Permalink
Browse files

fixing compilation on linux and RbConfig

  • Loading branch information...
1 parent 2cedfbc commit 42499b352647a508b7edfcc87a56970bebf1f297 @mpapis mpapis committed Mar 8, 2012
Showing with 51 additions and 37 deletions.
  1. +6 −6 Rakefile
  2. +3 −3 lib/shoes/cache.rb
  3. +1 −1 lib/shoes/setup.rb
  4. +9 −6 make/darwin/env.rb
  5. +8 −5 make/linux/env.rb
  6. +9 −4 make/linux/tasks.rb
  7. +1 −1 make/make.rb
  8. +7 −4 make/mingw/env.rb
  9. +2 −2 make/mingw/tasks.rb
  10. +5 −5 platform/nix/Makefile
View
@@ -60,10 +60,10 @@ FLAGS = %w[DEBUG]
BIN = "*.{bundle,jar,o,so,obj,pdb,pch,res,lib,def,exp,exe,ilk}"
CLEAN.include ["{bin,shoes}/#{BIN}", "req/**/#{BIN}", "dist", "*.app"]
-RUBY_SO = Config::CONFIG['RUBY_SO_NAME']
-RUBY_V = Config::CONFIG['ruby_version']
-RUBY_PROGRAM_VERSION = Config::CONFIG['RUBY_PROGRAM_VERSION']
-SHOES_RUBY_ARCH = Config::CONFIG['arch']
+RUBY_SO = RbConfig::CONFIG['RUBY_SO_NAME']
+RUBY_V = RbConfig::CONFIG['ruby_version']
+RUBY_PROGRAM_VERSION = RbConfig::CONFIG['RUBY_PROGRAM_VERSION']
+SHOES_RUBY_ARCH = RbConfig::CONFIG['arch']
if ENV['APP']
%w[dmg icons].each do |subk|
@@ -265,7 +265,7 @@ namespace :osx do
# Make sure the installed ruby is capable of this build
task :check_ruby_arch do
- build_arch, ruby_arch = [OSX_ARCH, Config::CONFIG['ARCH_FLAG']].map {|s| s.split.reject {|w| w.include?("arch")}}
+ build_arch, ruby_arch = [OSX_ARCH, RbConfig::CONFIG['ARCH_FLAG']].map {|s| s.split.reject {|w| w.include?("arch")}}
if build_arch.length > 1 and build_arch.sort != ruby_arch.sort
abort("To build universal shoes, you must first install a universal ruby")
end
@@ -282,7 +282,7 @@ namespace :osx do
task :common_build do
mkdir_p "dist/ruby"
- cp_r "#{EXT_RUBY}/lib/ruby/#{RUBY_V}", "dist/ruby/lib"
+ cp_r "#{EXT_RUBY_LIBRUBY}", "dist/ruby/lib"
unless ENV['STANDARD']
%w[soap wsdl xsd].each do |libn|
rm_rf "dist/ruby/lib/#{libn}"
View
@@ -27,7 +27,7 @@
ENV['GEM_HOME'] = GEM_DIR
require 'rbconfig'
-SHOES_RUBY_ARCH = Config::CONFIG['arch']
+SHOES_RUBY_ARCH = RbConfig::CONFIG['arch']
config = {
'ruby_install_name' => "shoes --ruby",
'RUBY_INSTALL_NAME' => "shoes --ruby",
@@ -47,9 +47,9 @@
'libdir' => "#{DIR}",
'LDFLAGS' => "-L. -L#{DIR}"
}
-Config::CONFIG.merge! config
+RbConfig::CONFIG.merge! config
Config::MAKEFILE_CONFIG.merge! config
-GEM_CENTRAL_DIR = File.join(DIR, 'ruby/gems/' + Config::CONFIG['ruby_version'])
+GEM_CENTRAL_DIR = File.join(DIR, 'ruby/gems/' + RbConfig::CONFIG['ruby_version'])
Dir[GEM_CENTRAL_DIR + "/gems/*"].each do |gdir|
$: << "#{gdir}/lib"
end
View
@@ -1,7 +1,7 @@
require 'rubygems'
require 'rubygems/dependency_installer'
module Gem
- @ruby = (File.join(Config::CONFIG['bindir'], 'shoes') + Config::CONFIG['EXEEXT']).
+ @ruby = (File.join(RbConfig::CONFIG['bindir'], 'shoes') + RbConfig::CONFIG['EXEEXT']).
sub(/.*\s.*/m, '"\&"') + " --ruby"
end
class << Gem::Ext::ExtConfBuilder
View
@@ -1,4 +1,7 @@
-EXT_RUBY = File.exists?("deps/ruby") ? "deps/ruby" : Config::CONFIG['prefix']
+EXT_RUBY = File.exists?("deps/ruby") ? "deps/ruby" : RbConfig::CONFIG['prefix']
+EXT_RUBY_BIN = File.exists?("deps/ruby/bin") ? "deps/ruby/bin" : RbConfig::CONFIG['bindir']
+EXT_RUBY_LIB = File.exists?("deps/ruby/lib") ? "deps/ruby/lib" : RbConfig::CONFIG['libdir']
+EXT_RUBY_LIBRUBY = File.exists?("deps/ruby/lib/ruby/#{RUBY_V}") ? "deps/ruby/lib/ruby/#{RUBY_V}" : RbConfig::CONFIG['rubylibdir']
# use the platform Ruby claims
require 'rbconfig'
@@ -27,9 +30,9 @@
end
png_lib = 'png'
-LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{Config::CONFIG['archdir']}]
-if Config::CONFIG['rubyhdrdir']
- LINUX_CFLAGS << " -I#{Config::CONFIG['rubyhdrdir']} -I#{Config::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
+LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{RbConfig::CONFIG['archdir']}]
+if RbConfig::CONFIG['rubyhdrdir']
+ LINUX_CFLAGS << " -I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
end
LINUX_LIB_NAMES = %W[#{RUBY_SO} cairo pangocairo-1.0 gif]
@@ -46,7 +49,7 @@
LINUX_CFLAGS << " -DRUBY_1_9"
DLEXT = "dylib"
-LINUX_CFLAGS << " -DSHOES_QUARTZ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fpascal-strings #{Config::CONFIG["CFLAGS"]} -x objective-c -fobjc-exceptions"
+LINUX_CFLAGS << " -DSHOES_QUARTZ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fpascal-strings #{RbConfig::CONFIG["CFLAGS"]} -x objective-c -fobjc-exceptions"
LINUX_LDFLAGS = "-framework Cocoa -framework Carbon -dynamiclib -Wl,-single_module INSTALL_NAME"
LINUX_LIB_NAMES << 'pixman-1' << 'jpeg.8'
@@ -67,5 +70,5 @@
LINUX_LIBS = LINUX_LIB_NAMES.map { |x| "-l#{x}" }.join(' ')
-LINUX_LIBS << " -L#{Config::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
+LINUX_LIBS << " -L#{RbConfig::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
View
@@ -1,4 +1,7 @@
-EXT_RUBY = File.exists?("deps/ruby") ? "deps/ruby" : Config::CONFIG['prefix']
+EXT_RUBY = File.exists?("deps/ruby") ? "deps/ruby" : RbConfig::CONFIG['prefix']
+EXT_RUBY_BIN = File.exists?("deps/ruby/bin") ? "deps/ruby/bin" : RbConfig::CONFIG['bindir']
+EXT_RUBY_LIB = File.exists?("deps/ruby/lib") ? "deps/ruby/lib" : RbConfig::CONFIG['libdir']
+EXT_RUBY_LIBRUBY = File.exists?("deps/ruby/lib/ruby/#{RUBY_V}") ? "deps/ruby/lib/ruby/#{RUBY_V}" : RbConfig::CONFIG['rubylibdir']
# use the platform Ruby claims
require 'rbconfig'
@@ -20,9 +23,9 @@
PANGO_LIB = ENV['PANGO_LIB'] ? "-L#{ENV['PANGO_LIB']}" : `pkg-config --libs pango`.strip
png_lib = 'png'
-LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{Config::CONFIG['archdir']}]
-if Config::CONFIG['rubyhdrdir']
- LINUX_CFLAGS << " -I#{Config::CONFIG['rubyhdrdir']} -I#{Config::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
+LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{RbConfig::CONFIG['archdir']}]
+if RbConfig::CONFIG['rubyhdrdir']
+ LINUX_CFLAGS << " -I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
end
LINUX_LIB_NAMES = %W[#{RUBY_SO} cairo pangocairo-1.0 ungif]
@@ -46,4 +49,4 @@
LINUX_LIBS = LINUX_LIB_NAMES.map { |x| "-l#{x}" }.join(' ')
-LINUX_LIBS << " -L#{Config::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
+LINUX_LIBS << " -L#{RbConfig::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
View
@@ -16,8 +16,13 @@ def copy_ext xdir, libdir
end
def find_and_copy thelib,newplace
- testpath = ["/usr/lib/#{thelib}", "/usr/lib/x86_64-linux-gnu/#{thelib}",
- "/usr/lib/i386-linux-gnu/#{thelib}"]
+ testpath = ENV['LD_LIBRARY_PATH'].nil? ? [] : ENV['LD_LIBRARY_PATH'].split(/:/).map(&:strip)
+ testpath += [
+ "/usr/lib/#{thelib}",
+ "/usr/lib64/#{thelib}",
+ "/usr/lib/x86_64-linux-gnu/#{thelib}",
+ "/usr/lib/i386-linux-gnu/#{thelib}"
+ ]
testpath.each do |tp|
if File.exists? tp
cp tp, newplace
@@ -27,7 +32,7 @@ def find_and_copy thelib,newplace
end
def copy_deps_to_dist
- cp "#{::EXT_RUBY}/lib/lib#{::RUBY_SO}.so", "dist/lib#{::RUBY_SO}.so"
+ cp "#{::EXT_RUBY_LIB}/lib#{::RUBY_SO}.so", "dist/lib#{::RUBY_SO}.so"
ln_s "lib#{::RUBY_SO}.so", "dist/lib#{::RUBY_SO}.so.#{::RUBY_V[/^\d+\.\d+/]}"
find_and_copy "libgif.so", "dist/libgif.so.4"
ln_s "libgif.so.4", "dist/libungif.so.4"
@@ -47,7 +52,7 @@ def make_app(name)
bin = "#{name}-bin"
rm_f name
rm_f bin
- sh "#{CC} -Ldist -o #{bin} bin/main.o #{LINUX_LIBS} -lshoes #{Config::CONFIG['LDFLAGS']}"
+ sh "#{CC} -Ldist -o #{bin} bin/main.o #{LINUX_LIBS} -lshoes #{RbConfig::CONFIG['LDFLAGS']}"
rewrite "platform/nix/shoes.launch", name, %r!/shoes-bin!, "/#{NAME}-bin"
sh %{echo 'cd "$OLDPWD"\nLD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{name}}
chmod 0755, name
View
@@ -51,7 +51,7 @@ def copy_files glob, dir
def common_build
mkdir_p "dist/ruby"
- cp_r "#{EXT_RUBY}/lib/ruby/#{RUBY_V}", "dist/ruby/lib"
+ cp_r "#{EXT_RUBY_LIBRUBY}", "dist/ruby/lib"
unless ENV['STANDARD']
%w[soap wsdl xsd].each do |libn|
rm_rf "dist/ruby/lib/#{libn}"
View
@@ -2,6 +2,9 @@
extend Make
EXT_RUBY = "../mingw"
+EXT_RUBY_BIN = "#{EXT_RUBY}/bin"
+EXT_RUBY_LIB = "#{EXT_RUBY}/lib"
+EXT_RUBY_LIBRUBY = "#{EXT_RUBY}/lib/ruby/#{RUBY_V}"
# use the platform Ruby claims
require 'rbconfig'
@@ -21,9 +24,9 @@
CAIRO_LIB = '-lcairo'
PANGO_CFLAGS = '-I/mingw/include/pango-1.0'
PANGO_LIB = '-lpangocairo-1.0 -lpango-1.0 -lpangoft2-1.0 -lpangowin32-1.0'
-LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{Config::CONFIG['archdir']}]
-if Config::CONFIG['rubyhdrdir']
- LINUX_CFLAGS << " -I#{Config::CONFIG['rubyhdrdir']} -I#{Config::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
+LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} -I#{RbConfig::CONFIG['archdir']}]
+if RbConfig::CONFIG['rubyhdrdir']
+ LINUX_CFLAGS << " -I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyhdrdir']}/#{SHOES_RUBY_ARCH}"
end
LINUX_LIB_NAMES = %W[#{RUBY_SO} cairo pangocairo-1.0 ungif]
@@ -48,4 +51,4 @@
LINUX_LIBS = LINUX_LIB_NAMES.map { |x| "-l#{x}" }.join(' ')
-LINUX_LIBS << " -L#{Config::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
+LINUX_LIBS << " -L#{RbConfig::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB}"
View
@@ -23,7 +23,7 @@ def copy_ext xdir, libdir
def copy_deps_to_dist
dlls = [RUBY_SO]
dlls += IO.readlines("make/mingw/dlls").map{|dll| dll.chomp}
- dlls.each{|dll| cp "#{EXT_RUBY}/bin/#{dll}.dll", "dist/"}
+ dlls.each{|dll| cp "#{EXT_RUBY_BIN}/#{dll}.dll", "dist/"}
cp "dist/zlib1.dll", "dist/zlib.dll"
Dir.glob("../deps_cairo*/*"){|file| cp file, "dist/"}
sh "strip -x dist/*.dll" unless ENV['DEBUG']
@@ -40,7 +40,7 @@ def make_resource(t)
def make_app(name)
bin = name
rm_f bin
- sh "#{CC} -Ldist -o #{bin} bin/main.o shoes/appwin32.o #{LINUX_LIBS} -lshoes #{Config::CONFIG['LDFLAGS']} -mwindows"
+ sh "#{CC} -Ldist -o #{bin} bin/main.o shoes/appwin32.o #{LINUX_LIBS} -lshoes #{RbConfig::CONFIG['LDFLAGS']} -mwindows"
rewrite "platform/nix/shoes.launch", name, %r!/shoes!, "/#{NAME}"
sh %{echo 'cd "$OLDPWD"'}
sh %{echo 'LD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{name}}
View
@@ -9,12 +9,12 @@ INCS = -I. -I/usr/include -I/usr/local/include
LIBS = -L/usr/lib -L/usr/local/lib -lcairo -lpangocairo-1.0 -lgif -ljpeg -lrt
REVISION = `git rev-list HEAD | wc -l`
-RUBY_INCS = `ruby -rrbconfig -e 'puts Config::CONFIG["archdir"]'`
-RUBY_SO = `ruby -rrbconfig -e 'puts Config::CONFIG["RUBY_SO_NAME"]'`
-RUBY_LIBS = `ruby -rrbconfig -e 'puts Config::CONFIG["LIBRUBYARG_SHARED"]'` -l${RUBY_SO}
-RUBY_PREFIX = `ruby -rrbconfig -e 'puts Config::CONFIG["prefix"]'`
+RUBY_INCS = `ruby -rrbconfig -e 'puts RbConfig::CONFIG["archdir"]'`
+RUBY_SO = `ruby -rrbconfig -e 'puts RbConfig::CONFIG["RUBY_SO_NAME"]'`
+RUBY_LIBS = `ruby -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBYARG_SHARED"]'` -l${RUBY_SO}
+RUBY_PREFIX = `ruby -rrbconfig -e 'puts RbConfig::CONFIG["prefix"]'`
RUBY_PLATFORM = `ruby -rrbconfig -e 'puts RUBY_PLATFORM'`
-RUBY_VERSION = `ruby -rrbconfig -e 'puts Config::CONFIG["ruby_version"]'`
+RUBY_VERSION = `ruby -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]'`
CAIRO_CFLAGS = `pkg-config --cflags cairo`
CAIRO_LIB = `pkg-config --libs cairo`
PANGO_CFLAGS = `pkg-config --cflags pango`

0 comments on commit 42499b3

Please sign in to comment.