Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved build scripts

  • Loading branch information...
commit 6461c28e191ffe8300f0f2db92c0779ba9233597 1 parent b4cbeeb
@wedesoft authored
Showing with 13 additions and 11 deletions.
  1. +13 −11 Rakefile
View
24 Rakefile
@@ -8,13 +8,14 @@ require 'rbconfig'
PKG_NAME = 'hornetseye-alsa'
PKG_VERSION = '0.1.2'
+CFG = RbConfig::CONFIG
CXX = ENV[ 'CXX' ] || 'g++'
RB_FILES = FileList[ 'lib/**/*.rb' ]
CC_FILES = FileList[ 'ext/*.cc' ]
HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
TC_FILES = FileList[ 'test/tc_*.rb' ]
TS_FILES = FileList[ 'test/ts_*.rb' ]
-SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.so"
+SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.#{CFG[ 'DLEXT' ]}"
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
@@ -26,17 +27,18 @@ EMAIL = %q{jan@wedesoft.de}
HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-alsa/}
OBJ = CC_FILES.ext 'o'
-$CXXFLAGS = ENV[ 'CXXFLAGS' ] || ''
-$CXXFLAGS = "#{$CXXFLAGS} -fPIC -DNDEBUG"
-if RbConfig::CONFIG[ 'rubyhdrdir' ]
- $CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'rubyhdrdir' ]} " +
- "-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
+$CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
+if CFG[ 'rubyhdrdir' ]
+ $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
+ "-I#{CFG[ 'rubyhdrdir' ]}/#{CFG[ 'arch' ]}"
else
- $CXXFLAGS += "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'archdir' ]}"
+ $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'archdir' ]}"
end
-$LIBRUBYARG = RbConfig::CONFIG[ 'LIBRUBYARG' ]
-$SITELIBDIR = RbConfig::CONFIG[ 'sitelibdir' ]
-$SITEARCHDIR = RbConfig::CONFIG[ 'sitearchdir' ]
+$LIBRUBYARG = "-L#{CFG[ 'libdir' ]} #{CFG[ 'LIBRUBYARG' ]} #{CFG[ 'LDFLAGS' ]} " +
+ "#{CFG[ 'SOLIBS' ]} #{CFG[ 'DLDLIBS' ]}"
+$SITELIBDIR = CFG[ 'sitelibdir' ]
+$SITEARCHDIR = CFG[ 'sitearchdir' ]
+$LDSHARED = CFG[ 'LDSHARED' ][ CFG[ 'LDSHARED' ].index( ' ' ) .. -1 ]
task :default => :all
@@ -167,7 +169,7 @@ rule '.o' => '.cc' do |t|
end
file ".depends.mf" do |t|
- sh "g++ -MM #{$CXXFLAGS} #{CC_FILES.join ' '} | " +
+ sh "g++ -MM #{CC_FILES.join ' '} | " +
"sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
"sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.