diff --git a/make/darwin/minosx/env.rb b/make/darwin/minosx/env.rb index 1fdc315e..1deafb88 100644 --- a/make/darwin/minosx/env.rb +++ b/make/darwin/minosx/env.rb @@ -46,7 +46,7 @@ elsif EXT_RUBY.include? '/usr/local/Cellar/' # brew install ruby@2.3 APP['RVMGEM'] = ENV['GEM_HOME'] - APP['ABSBUNDLE'] = true # ie. bundles use ABS patchs + APP['ABSBUNDLE'] = true # ie. bundles use ABS paths else $stderr.puts "Your ruby is Suspicious. Create a minosx-custom.yaml" abort @@ -114,13 +114,14 @@ CAIRO_LDFLAGS = "-L#{ShoesDeps}/lib -lcairo" PANGO_CFLAGS = "-I#{ShoesDeps}/include/pango-1.0" PANGO_LDFLAGS = "-L#{ShoesDeps}/lib -lpango-1.0" -#RUBY_CFLAGS = "-I#{EXT_RUBY}/include/ruby-2.3.0/x86_64-darwin14 -I#{EXT_RUBY}/include/ruby-2.3.0 " -RUBY_CFLAGS =`pkg-config --cflags "#{pkgruby}"`.strip+" " -RUBY_LDFLAGS = "-L#{EXT_RUBY}lib/ -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -lruby.2.3.0 -lpthread -ldl -lobjc " +RUBY_CFLAGS = `pkg-config --cflags "#{pkgruby}"`.strip+" " +#RUBY_LDFLAGS = `pkg-config --libs "#{pkgruby}"`.strip+" " +#RUBY_LDFLAGS = "-L#{EXT_RUBY}lib/ -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -lruby.2.4.5 -lpthread -ldl -lobjc " LINUX_CFLAGS << " -I#{ShoesDeps}/include #{GLIB_CFLAGS} #{RUBY_CFLAGS} #{CAIRO_CFLAGS} #{PANGO_CFLAGS}" LINUX_LIB_NAMES = %W[#{RUBY_SO} cairo pangocairo-1.0 gif] +#LINUX_LIB_NAMES = %W[#{RUBY_LDFLAGS} cairo pangocairo-1.0 gif] LINUX_CFLAGS << " -DRUBY_1_9 " @@ -130,7 +131,6 @@ LINUX_LDFLAGS = "-framework Cocoa -framework QuartzCore -framework Carbon -dynamiclib -Wl,-single_module INSTALL_NAME" LINUX_LIB_NAMES << 'pixman-1' << 'jpeg.8' -#OSX_SDK = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk' OSX_SDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/#{osxsdk}" ENV['MACOSX_DEPLOYMENT_TARGET'] = osxminv LINUX_CFLAGS << " -mmacosx-version-min=#{osxminv}" @@ -151,7 +151,7 @@ LINUX_CFLAGS << " -isysroot #{OSX_SDK} #{OSX_ARCH}" LINUX_LDFLAGS << " -isysroot #{OSX_SDK} #{OSX_ARCH} -L#{ShoesDeps}/lib/ #{GLIB_LDFLAGS}" -LINUX_LIBS = " -l#{RUBY_SO} -L#{ShoesDeps}/lib -l cairo -L#{ShoesDeps}/lib -lpangocairo-1.0 -L#{ShoesDeps}/lib -lgif -ljpeg" +LINUX_LIBS = " -L #{EXT_RUBY}/lib -l#{RUBY_SO} -L#{ShoesDeps}/lib -l cairo -L#{ShoesDeps}/lib -lpangocairo-1.0 -L#{ShoesDeps}/lib -lgif -ljpeg" LINUX_LIBS << " -L#{TGT_DIR} #{CAIRO_LDFLAGS} #{PANGO_LDFLAGS} #{GLIB_LDFLAGS}" # Sigh - shoesdeps and homebrew versions can be out of sync. diff --git a/make/darwin/minosx/setup.rb b/make/darwin/minosx/setup.rb index c86e5c12..568a202a 100644 --- a/make/darwin/minosx/setup.rb +++ b/make/darwin/minosx/setup.rb @@ -5,39 +5,50 @@ module Make def static_setup (so_list) $stderr.puts "setup: dir=#{`pwd`} for #{TGT_DIR}" - #rm_rf "#{TGT_DIR} " - mkdir_p "#{TGT_DIR}" - # copy Ruby, dylib, includes - have them in place before - # we build things - puts "Ruby at #{EXT_RUBY} : #{SHOES_GEM_ARCH}" - rbvt = RUBY_V - rbvm = RUBY_V[/^\d+\.\d+/] - rm_rf "#{TGT_DIR}/lib" - mkdir_p "#{TGT_DIR}/lib" - # clean out leftovers from last build - #rm_f "#{TGT_DIR}/libruby.dylib" if File.exist? "#{TGT_DIR}/libruby.dylib" - #rm_f "#{TGT_DIR}/libruby.#{rbvm}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvm}.dylib" - #rm_f "#{TGT_DIR}/libruby.#{rbvt}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvt}.dylib" - #mkdir_p "#{TGT_DIR}/lib/ruby/#{rbvm}.0/#{RUBY_PLATFORM}" - cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib" - # copy and link libruby.dylib - cp "#{EXT_RUBY}/lib/libruby.#{rbvt}.dylib", "#{TGT_DIR}" - # copy include files - it might help build gems - mkdir_p "#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}" - cp_r "#{EXT_RUBY}/include/ruby-#{rbvt}/", "#{TGT_DIR}/lib/ruby/include" - - if APP['LIBPATHS'] - dep_find_and_copy( APP['LIBPATHS'], SOLOCS) - else - SOLOCS.each do |k, v| - cp v, TGT_DIR - end - end - # copy ssl engines - if File.exist?("#{ShoesDeps}/lib/engines") - cp_r "#{ShoesDeps}/lib/engines", "#{TGT_DIR}" - end - +=begin + #rm_rf "#{TGT_DIR} " + mkdir_p "#{TGT_DIR}" + # copy Ruby, dylib, includes - have them in place before + # we build things + puts "Ruby at #{EXT_RUBY} : #{SHOES_GEM_ARCH}" + rbvt = RUBY_V + rbvm = RUBY_V[/^\d+\.\d+/] + rm_rf "#{TGT_DIR}/lib" + mkdir_p "#{TGT_DIR}/lib" + # clean out leftovers from last build + #rm_f "#{TGT_DIR}/libruby.dylib" if File.exist? "#{TGT_DIR}/libruby.dylib" + #rm_f "#{TGT_DIR}/libruby.#{rbvm}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvm}.dylib" + #rm_f "#{TGT_DIR}/libruby.#{rbvt}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvt}.dylib" + #mkdir_p "#{TGT_DIR}/lib/ruby/#{rbvm}.0/#{RUBY_PLATFORM}" + cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib" + # copy and link libruby.dylib + cp "#{EXT_RUBY}/lib/libruby.#{rbvt}.dylib", "#{TGT_DIR}" + # copy include files - it might help build gems + mkdir_p "#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}" + cp_r "#{EXT_RUBY}/include/ruby-#{rbvt}/", "#{TGT_DIR}/lib/ruby/include" + + if APP['LIBPATHS'] + dep_find_and_copy( APP['LIBPATHS'], SOLOCS) + else + SOLOCS.each do |k, v| + cp v, TGT_DIR + end + end + # copy ssl engines + if File.exist?("#{ShoesDeps}/lib/engines") + cp_r "#{ShoesDeps}/lib/engines", "#{TGT_DIR}" + end +=end + srcloc= `pwd`.strip + ln_s "#{srcloc}/lib", TGT_DIR + ln_s "#{srcloc}/samples", TGT_DIR + ln_s "#{srcloc}/static", TGT_DIR + ln_s "#{srcloc}/fonts", TGT_DIR + ln_s "#{srcloc}/themes", TGT_DIR + cp "README.md", TGT_DIR + cp "CHANGELOG", TGT_DIR + cp "COPYING", TGT_DIR +=begin # copy some static stuff cp_r "fonts", "#{TGT_DIR}/fonts" cp_r "lib", "#{TGT_DIR}" @@ -46,6 +57,7 @@ def static_setup (so_list) cp "README.md", "#{TGT_DIR}/README.txt" cp "CHANGELOG", "#{TGT_DIR}/CHANGELOG.txt" cp "COPYING", "#{TGT_DIR}/COPYING.txt" +=end end end diff --git a/make/darwin/minosx/tasks.rb b/make/darwin/minosx/tasks.rb index fd882749..c1b18e56 100644 --- a/make/darwin/minosx/tasks.rb +++ b/make/darwin/minosx/tasks.rb @@ -40,6 +40,11 @@ def rewrite_ary before, after, reg = /\#\{(\w+\[\'\w+\'\])\}/, reg2 = '\1' end end end + + # a stub, loose osx doesn't copy gems but the Builder will call it + def copy_gems + end + end class MakeDarwin @@ -93,7 +98,9 @@ def dylibs_to_change lib end def copy_deps_to_dist - puts "Entering copy_deps_to_dist #{TGT_DIR}" + $stderr.puts "Entering copy_deps_to_dist #{TGT_DIR}" + # for loose shoes (minosx) , see postbuild_fix + return # Generate a list of dependencies straight from the generated files. # Start with dependencies of shoes-bin, and then add the dependencies # of those dependencies. Finally, add any oddballs that must be @@ -164,6 +171,7 @@ def copy_deps_to_dist end def setup_system_resources + return # called after the gems are copied into the above setup. # build a hash of x.dylib > ShoesDeps/**/*.dylib @brew_hsh = {} @@ -219,8 +227,15 @@ def setup_system_resources def postbuild_fix # if this is called, the only thing that has changed is libshoes.dylib - # and shoes-bin. This hasn't needed but might involve - #$stderr.puts "called postbuild_fix" + # and shoes-bin. minosx needs this. + $stderr.puts "called postbuild_fix" + Dir.chdir TGT_DIR do + #sh "#{INTOOL} -id @executable_path/shoes-bin shoes-bin" + sh "#{INTOOL} -change @executable_path/librsvg-2.2.dylib /usr/local/lib/librsvg-2.2.dylib shoes-bin" + sh "#{INTOOL} -change @executable_path/librsvg-2.2.dylib /usr/local/lib/librsvg-2.2.dylib libshoes.dylib" + #sh "#{INTOOL} -change @executable_path/../lib/libruby.2.4.5.dylib #{EXT_RUBY}/lib/libruby.2.4.5.dylib shoes-bin" + #sh "#{INTOOL} -change @executable_path/../lib/libruby.2.4.5.dylib #{EXT_RUBY}/lib/libruby.2.4.5.dylib libshoes.dylibq" + end =begin install_name_tool -id @executable_path/shoes-bin shoes-bin install_name_tool -change /usr/local/lib/libcairo.2.dylib @executable_path/libcairo.2.dylib shoes-bin diff --git a/make/darwin/yosemite/env.rb b/make/darwin/yosemite/env.rb index a5ff385f..23634f14 100644 --- a/make/darwin/yosemite/env.rb +++ b/make/darwin/yosemite/env.rb @@ -122,7 +122,7 @@ LINUX_CFLAGS << " -isysroot #{OSX_SDK} #{OSX_ARCH}" LINUX_LDFLAGS << " -isysroot #{OSX_SDK} #{OSX_ARCH} -L#{ShoesDeps}/lib/ #{GLIB_LDFLAGS}" -RUBY_SO = RbConfig::CONFIG['RUBY_SO_NAME'] +#RUBY_SO = RbConfig::CONFIG['RUBY_SO_NAME'] LINUX_LIBS = " -l#{RUBY_SO} -L#{ShoesDeps}/lib -l cairo -L#{ShoesDeps}/lib -lpangocairo-1.0 -L#{ShoesDeps}/lib -lgif -ljpeg" LINUX_LIBS << " -L#{TGT_DIR} #{CAIRO_LDFLAGS} #{PANGO_LDFLAGS} #{GLIB_LDFLAGS}" diff --git a/make/darwin/yosemite/setup.rb b/make/darwin/yosemite/setup.rb index 8f3b17cd..bbd348bc 100644 --- a/make/darwin/yosemite/setup.rb +++ b/make/darwin/yosemite/setup.rb @@ -5,47 +5,49 @@ module Make def static_setup (so_list) $stderr.puts "setup: dir=#{`pwd`} for #{TGT_DIR}" - #rm_rf "#{TGT_DIR} " - mkdir_p "#{TGT_DIR}" - # copy Ruby, dylib, includes - have them in place before - # we build things - puts "Ruby at #{EXT_RUBY} : #{SHOES_GEM_ARCH} RUBY_V : #{RUBY_V}" - rbvt = rbinc = RUBY_V - rbvm = RUBY_V[/^\d+\.\d+/] - rm_rf "#{TGT_DIR}/lib" - mkdir_p "#{TGT_DIR}/lib" - if rbvm != '2.3' - # because ruby changes from version to version, os to os. Curses! - rbvt = RUBY_VERSION[/(\d+\.\d+\.\d+)/] - rbinc = rbvt[/\d+\.\d+/] + '.0' - end - # clean out leftovers from last build - #rm_f "#{TGT_DIR}/libruby.dylib" if File.exist? "#{TGT_DIR}/libruby.dylib" - #rm_f "#{TGT_DIR}/libruby.#{rbvm}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvm}.dylib" - #rm_f "#{TGT_DIR}/libruby.#{rbvt}.dylib" if File.exist? "#{TGT_DIR}/libruby.#{rbvt}.dylib" - #mkdir_p "#{TGT_DIR}/lib/ruby/#{rbvm}.0/#{RUBY_PLATFORM}" - cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib" - # copy and link libruby.dylib - cp "#{EXT_RUBY}/lib/libruby.#{rbvt}.dylib", "#{TGT_DIR}" - Dir.chdir(TGT_DIR) do - ln_s "libruby.#{rbvt}.dylib", "libruby.#{rbvm}.dylib" - ln_s "libruby.#{rbvt}.dylib", "libruby.dylib" - end - # copy include files - it might help build gems - mkdir_p "#{TGT_DIR}/lib/ruby/include/ruby-#{rbinc}" - cp_r "#{EXT_RUBY}/include/ruby-#{rbinc}/", "#{TGT_DIR}/lib/ruby/include" - - if APP['LIBPATHS'] - dep_find_and_copy( APP['LIBPATHS'], SOLOCS) - else - SOLOCS.each do |k, v| - cp v, TGT_DIR - end - end - # copy ssl engines - if File.exist?("#{ShoesDeps}/lib/engines") - cp_r "#{ShoesDeps}/lib/engines", "#{TGT_DIR}" - end + #rm_rf "#{TGT_DIR} " + mkdir_p "#{TGT_DIR}" + # copy Ruby, dylib, includes - have them in place before + # we build things + puts "Ruby at #{EXT_RUBY} : #{SHOES_GEM_ARCH} RUBY_V : #{RUBY_V}" + rbvt = rbinc = APP['RUBY_V'] + rbvm = APP['RUBY_V'][/^\d+\.\d+/] + rm_rf "#{TGT_DIR}/lib" + mkdir_p "#{TGT_DIR}/lib" + if rbvm == '2.3' + cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib" + # copy and link libruby.dylib + cp "#{EXT_RUBY}/lib/libruby.#{rbvm}.0.dylib", "#{TGT_DIR}" + Dir.chdir(TGT_DIR) do + ln_s "libruby.#{rbvm}.0.dylib", "libruby.dylib" + end + else + # because ruby changes from version to version, os to os. Curses! + rbvt = RUBY_VERSION[/(\d+\.\d+\.\d+)/] + rbinc = rbvt[/\d+\.\d+/] + '.0' + cp_r "#{EXT_RUBY}/lib/ruby", "#{TGT_DIR}/lib" + # copy and link libruby.dylib + cp "#{EXT_RUBY}/lib/libruby.#{rbvt}.dylib", "#{TGT_DIR}" + Dir.chdir(TGT_DIR) do + ln_s "libruby.#{rbvt}.dylib", "libruby.#{rbvm}.dylib" + ln_s "libruby.#{rbvt}.dylib", "libruby.dylib" + end + end + # copy include files - it might help build gems + mkdir_p "#{TGT_DIR}/lib/ruby/include/ruby-#{rbinc}" + cp_r "#{EXT_RUBY}/include/ruby-#{rbinc}/", "#{TGT_DIR}/lib/ruby/include" + + if APP['LIBPATHS'] + dep_find_and_copy( APP['LIBPATHS'], SOLOCS) + else + SOLOCS.each do |k, v| + cp v, TGT_DIR + end + end + # copy ssl engines + if File.exist?("#{ShoesDeps}/lib/engines") + cp_r "#{ShoesDeps}/lib/engines", "#{TGT_DIR}" + end # copy some static stuff cp_r "fonts", "#{TGT_DIR}/fonts" diff --git a/make/darwin/yosemite/tasks.rb b/make/darwin/yosemite/tasks.rb index 3731283c..70b0c81e 100644 --- a/make/darwin/yosemite/tasks.rb +++ b/make/darwin/yosemite/tasks.rb @@ -100,7 +100,7 @@ def copy_deps_to_dist # included. dylibs = get_dylibs("#{TGT_DIR}/#{NAME}-bin") # add the gem's bundles. - rbvm = RUBY_V[/^\d+\.\d+/] + rbvm = APP['RUBY_V'][/^\d+\.\d+/] Dir["#{TGT_DIR}/lib/ruby/gems/#{rbvm}.0/gems/**/*.bundle"].each do |gb| puts "Bundle: #{gb}" dylibs.concat get_dylibs(gb) @@ -178,7 +178,7 @@ def setup_system_resources @brew_hsh[key] = path end end - rbvm = RUBY_V[/^\d+\.\d+/] + rbvm = APP['RUBY_V'][/^\d+\.\d+/] #tgtd = File.join(Dir.getwd, TGT_DIR) tgtd = File.absolute_path(TGT_DIR) puts "tgtd: #{tgtd}" diff --git a/make/setup.rb b/make/setup.rb new file mode 100644 index 00000000..f99cb4c9 --- /dev/null +++ b/make/setup.rb @@ -0,0 +1,156 @@ +# two functions in this module are used +# env_create_and_save(build_os,target_os) - when `rake setup:xxxx` +# Builder.load_env('build_target.yaml') - when not above +# +module Make + include FileUtils + APP = {} + + # get the app.yaml, git's idea of revision number, + def self.basic_env(target_os) + app = YAML.load_file(File.join(ENV['APP'] || ".", "app.yaml")) + # APP['version'] = APP['major'] # for historical reasons + # populate APP[] with uppercase names and string values + APP['VERSION'] = "\"#{app['major']}.#{app['minor']}.#{app['tiny']}\"" + APP['MAJOR'] = app['major'].to_s + APP['MINOR'] = app['minor'].to_s + APP['TINY'] = app['tiny'].to_s + APP['NAME'] = app['name'] + APP['release'] = app['release'] + APP['icons'] = app['icons'] + APP['DATE'] = Time.now.to_s + APP['PLATFORM'] = RbConfig::CONFIG['arch'] # not correct for cross compile + case app['revision'] + when 'git' + gitp = ENV['GIT'] || "git" + APP['REVISION'] = (`#{gitp} rev-list HEAD`.split.length).to_s + when 'file' + File.open('VERSION.txt', 'r') do |f| + ln = f.read + rev = ln[/r\(\d+\)/] + APP['REVISION'] = "#{rev[/\d+/].to_i + 1}" + end + else + if APP['revision'].kind_of? Fixnum + APP['REVISION'] = APP['revision'].to_s + else + APP['REVISION'] = '9' # make it up + end + end + + + APP['NAME'] = app['shortname'] || app['name'].downcase.gsub(/\W+/, '') + APP['APPNAME'] = app['name'] # TODO: OSX needs this + APP['SONAME'] = 'shoes' + APP['APPARGS'] = APP['run'] # left over from HH build? + + # TODO: Shadow these until replaced with APP[] in env/setup/tasks files + #RUBY_SO = RbConfig::CONFIG['RUBY_SO_NAME'] + APP['RUBY_SO'] = RbConfig::CONFIG['RUBY_SO_NAME'] + #RUBY_V = RbConfig::CONFIG['ruby_version'] + APP['RUBY_V'] = RbConfig::CONFIG['ruby_version'] + #SHOES_RUBY_ARCH = RbConfig::CONFIG['arch'] + APP['SHOES_RUBY_ARCH'] = RbConfig::CONFIG['arch'] + + # default exts, gems & locations to build and include - replace with custom.yaml + APP['GEMLOC'] = "" + APP['EXTLOC'] = "" + APP['EXTLIST'] = [] + APP['GEMLIST'] = [] + APP['Bld_Tmp'] = 'tmp' + APP['Bld_Pre'] = ENV['NFS_ALTP'] if ENV['NFS_ALTP'] + APP['CROSS'] = true # TODO constant escape from file. grrr + if target_os =~ /yosemite|mavericks|minosx|darwin14/ + # osx is just different. It needs build performance optimizations + # is the build output directory outside the shoes3 dir? + if APP['Bld_Pre'] + APP['top_dir'] = APP['Bld_Pre']+target_os # likely to be abs path! + APP['TGT_DIR'] = APP['top_dir']+"/#{APPNAME}.app/Contents/MacOS" + else + APP['TGT_DIR'] = target_os+"/#{APPNAME}.app/Contents/MacOS" + APP['top_dir'] = APP['TGT_DIR'] + end + else + # is the build output directory outside the shoes3 dir? + if APP['Bld_Pre'] + APP['TGT_DIR'] = APP['Bld_Pre']+target_os + else + APP['TGT_DIR'] = target_os + end + end +=begin + mkdir_p "#{TGT_DIR}" + BLD_ARGS = {} + # This allows short circuiting the need to load setup and env (and pkg-config overhead) + # Exprimental - no visible performance gain. see make/linux/minlin/env.rb + if File.exists? "#{TGT_DIR}/build.yaml" + $stderr.puts "loading building args" + thsh = YAML.load_file("#{TGT_DIR}/build.yaml") + thsh.each {|k,v| BLD_ARGS[k] = v} + HAVE_BLD = true + else + HAVE_BLD = false + end +=end + end + + # Load -custom.yaml unless native + def self.load_custom(target_os, native=false) + if native + APP['CC'] = RbConfig::CONFIG['CC'] + APP['STRIP'] =RbConfig::CONFIG['STRIP'] + APP['RANBLIB'] = RbConfig::CONFIG['RANLIB'] + APP['ruby_pc'] = RbConfig::CONFIG['ruby_pc'] + APP['arch'] = RbConfig::CONFIG['arch'] + APP['RUBY_VERSION'] = RbConfig::CONFIG['ruby_version'] + APP['TGT_ARCH'] = target_os.to_s + require File.expand_path("make/env/#{target_os}") + else + # nothing here YET - parse the custom.yaml and make/flags + end + end + + def self.env_create_and_save(build_os,target_os) + # get the base stuff + basic_env(target_os.to_s) + # do specific setups + case target_os + when :minlin, :minbsd, :minosx + #sh "echo 'TGT_ARCH=#{target_os}' >build_target" + load_custom(target_os, true) + else + sh "echo 'TGT_ARCH=#{target_os}' >build_target" + #load_custom(target_os, false) + end + # call Builder.static_setup - + require File.expand_path("make/#{build_os}/#{target_os}/setup") + mkdir_p APP['TGT_DIR'] + Make.static_setup(APP) + # Save APP hash to build_target.yaml + File.open("build_target.yaml", 'w') { |f| YAML.dump(APP, f) } + end + + def self.load_env(filename) + # Load yaml into APP and create those CONSTANTS that + # make us look like Makefiles. + app = YAML.load_file(filename) + # Copy Make::APP to toplevel - better way? + hsh = Object.const_set('APP', app) + app.each do |k, v| + hsh[k] = v + end + Object.const_set('NAME', app['APPNAME'].downcase.gsub(/\W+/, '')) + Object.const_set('TGT_DIR', app['TGT_DIR']) + Object.const_set('TGT_ARCH' ,app['TGT_ARCH']) + Object.const_set('DLEXT', app['DLEXT']) + Object.const_set('SOLOCS', app['SOLOCS']) + Object.const_set('SHOES_RUBY_ARCH', app['SHOES_RUBY_ARCH']) + Object.const_set('CC', app['CC']) + Object.const_set('LINUX_CFLAGS', app['LINUX_CFLAGS']) + Object.const_set('LINUX_LIBS', app['LINUX_LIBS']) + Object.const_set('LINUX_LDFLAGS', app['LINUX_LDFLAGS']) + Object.const_set('EXT_RUBY', app['EXT_RUBY']) + Object.const_set('CROSS', true) # TODO - not needed in future. misnamed too! + # Should set zzsetup.done here? + end +end # Module diff --git a/make/utils.rb b/make/utils.rb new file mode 100644 index 00000000..caa77f9e --- /dev/null +++ b/make/utils.rb @@ -0,0 +1,20 @@ +# Call this to switch RUBY_VERSION constant to what's inside the +# rbconfig.rb give in the argument. +def switch_ruby(rbpath) + cnt = 0 + rbv = "" + IO.foreach(rbpath) do |ln| + cnt += 1 + if ln[/(\(\d.\d.\d\))/] + rbv = "#{$1[1..-2]}" + break + end + if cnt > 15 + puts "Could not find version (d.d.d) in first 15 lines" + abort + end + end + Object.instance_eval{ remove_const :RUBY_VERSION } + Object.const_set("RUBY_VERSION", rbv) + puts "Using Ruby version #{RUBY_VERSION}" +end