Sha256: 73921ccc15aa7c6db608dd35630e4fe9a21d63327663b4760d244298444d3d91

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

require 'rbconfig'

conf = Config::CONFIG

File.unlink('Makefile.old') rescue nil
File.rename('Makefile', 'Makefile.old') rescue nil
File.open('Makefile', 'w') do |mkf|

  cppflags = if conf['rubyhdrdir'].to_s == ''
    "-I#{conf['archdir']}"
  else
    "-I#{conf['rubyhdrdir']} -I#{conf['rubyhdrdir']}/#{conf['arch']}"
  end
  mkf.puts <<EOF
# auto-generated by extsetup.rb
target_prefix = 
CC:=gcc
CXX:=g++
CPPFLAGS=#{cppflags}
CFLAGS=#{conf['CFLAGS']} #{conf['CCDLFLAGS']}
LDFLAGS=-L#{conf['archdir']} -L#{conf['libdir']} #{conf['LDFLAGS']}
LIBS=#{conf['LIBS']} #{conf['DLDLIBS']}
LIBRUBYARG=#{conf['LIBRUBYARG']}
DLLIB = qrscanner.so
TARGET_SO = $(DLLIB)
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755

all: qrscanner.so

install: install-so

install-so: #{conf['sitearchdir']}/$(DLLIB)

#{conf['sitearchdir']}/$(DLLIB): qrscanner.so
	$(INSTALL_PROG) $(DLLIB) #{conf['sitearchdir']}

zxing/build/libzxing.a:
	pwd ; cd zxing ; python scons/scons.py lib DEBUG=0 PIC=1

zxing/build/libqrscanner.a:
	pwd ; cd zxing ; python scons/scons.py qrscanner DEBUG=0 PIC=1

qrscanner.o: zxing/build/libzxing.a zxing/build/libqrscanner.a
	$(CC) -c qrscanner.c $(CPPFLAGS) $(CFLAGS) $(LIBS) -lstdc++  -o qrscanner.o
	
qrscanner.so: qrscanner.o
	$(CC) qrscanner.o -shared $(LIBS) $(LDFLAGS) -lstdc++ -lMagick++ -lMagickWand -lMagickCore -Wl,-whole-archive -Lzxing/build -lzxing -lqrscanner -Wl,-no-whole-archive -o qrscanner.so
	
clean:
	cd zxing ; python scons/scons.py -c all
	rm qrscanner.o
	rm qrscanner.so
	


EOF

  
end

=begin
# We also need to link with the ruby library, so we append
# ${ruby_config_LIBRUBYARG}.  The above variables are for compiling and
# linking; you may also need to install.  Ruby library files should be
# installed to ${ruby_config_sitelibdir}.  Ruby extensions should be
# installed to ${ruby_config_sitearchdir}.
=end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qrscanner-0.4.1 ext/qrscanner/extconf.rb
qrscanner-0.4 ext/qrscanner/extconf.rb
qrscanner-0.3.1 ext/qrscanner/extconf.rb
qrscanner-0.2 ext/qrscanner/extconf.rb
qrscanner-0.1 ext/qrscanner/extconf.rb