lib/extensions/digest-md5/ext/Rakefile in rhodes-3.5.1.12 vs lib/extensions/digest-md5/ext/Rakefile in rhodes-5.5.0
- old
+ new
@@ -1,8 +1,20 @@
require 'fileutils'
+require File.join(pwd, '../../../build/jake.rb')
def build_extension(name, arch)
+ if (ENV['RHO_PLATFORM'] == 'osx') or (ENV['RHO_PLATFORM'] == 'win32')
+ args = ['-o', 'Makefile', '-r', '-spec', $qmake_spec, "#{name}.pro", 'CONFIG-=debug', 'CONFIG+=release', $qmakevars]
+ puts Jake.run($qmake,args)
+ fail "[qmake #{name}.pro]" unless $? == 0
+ #puts Jake.run($make, ['clean'])
+ fail "[make clean]" unless $? == 0
+ puts Jake.run($make, ['all'])
+ fail "[make all]" unless $? == 0
+ return
+ end
+
objects = []
mkdir_p $tempdir unless File.exists? $tempdir
Dir.glob("*.c").each do |f|
objname = File.join( $tempdir, File.basename( f.gsub(/\.c$/, '.o') ) )
@@ -18,11 +30,11 @@
if ENV['RHO_PLATFORM'] == 'android'
args << "-I\"#{$rhoroot}/platform/shared/ruby/android\""
args << "-I\"#{$rhoroot}/platform/shared/ruby/generated\""
cc_compile f, $tempdir, args or exit 1
- elsif (ENV['RHO_PLATFORM'] == 'iphone') or (ENV['RHO_PLATFORM'] == 'osx')
+ elsif ENV['RHO_PLATFORM'] == 'iphone'
args << "-I\"#{$rhoroot}/platform/shared/ruby/iphone\""
args << "-D_XOPEN_SOURCE"
args << "-D_DARWIN_C_SOURCE"
args << "-isysroot \"#{$sdkroot}\""
args << "-fno-common"
@@ -32,54 +44,41 @@
args << "-c"
args << f
cmdline = $gccbin + ' ' + args.join(' ')
puts cmdline
puts `#{cmdline}`
- exit unless $? == 0
+ fail "[#{cmdline}]" unless $? == 0
-
end
end
mkdir_p $targetdir unless File.exist? $targetdir
if ENV['RHO_PLATFORM'] == 'android'
cc_ar ('"'+File.join( $targetdir, 'lib' + name + '.a' )+'"'), Dir.glob($tempdir + "/**/*.o").collect{|x| '"'+x+'"'} or exit 1
- elsif (ENV['RHO_PLATFORM'] == 'iphone') or (ENV['RHO_PLATFORM'] == 'osx')
+ elsif ENV['RHO_PLATFORM'] == 'iphone'
args = []
args << 'rcs'
args << File.join( $targetdir, 'lib' + name + '.a' )
args += objects
cmdline = $arbin + ' ' + args.join(' ')
puts cmdline
puts `#{cmdline}`
- exit unless $? == 0
+ fail "[#{cmdline}]" unless $? == 0
elsif ENV['RHO_PLATFORM'] == 'wm'
args = []
args << "/M4"
args << name + ".sln"
args << "\"Release|#{$sdk}\""
cmdline = "\"" + $vcbuild + "\"" + ' ' + args.join(' ')
puts cmdline
puts `#{cmdline}`
- exit unless $? == 0
+ fail "[#{cmdline}]" unless $? == 0
cp_r File.join($tempdir, "Release", name + ".lib"), $targetdir
-
- elsif ENV['RHO_PLATFORM'] == 'win32'
- args = []
- args << "/M4"
- args << name + ".sln"
- args << "\"#{ENV['RHO_BUILD_CONFIG']}|Win32\""
- cmdline = "\"" + $vcbuild + "\"" + ' ' + args.join(' ')
- puts cmdline
- puts `#{cmdline}`
- exit unless $? == 0
-
- cp_r File.join($tempdir, ENV['RHO_BUILD_CONFIG'], name + ".lib"), $targetdir
end
end
namespace "build" do
task :config do
@@ -87,26 +86,34 @@
$targetdir = ENV['TARGET_TEMP_DIR']
raise "TARGET_TEMP_DIR is not set" if $targetdir.nil?
$tempdir = ENV['TEMP_FILES_DIR']
raise "TEMP_FILES_DIR is not set" if $tempdir.nil?
+ $qmakevars = ENV['RHO_QMAKE_VARS']
if ENV['RHO_PLATFORM'] == 'android'
require File.dirname(__FILE__) + '/../../../../platform/android/build/androidcommon.rb'
setup_ndk(ENV['ANDROID_NDK'],ENV['ANDROID_API_LEVEL'])
- elsif (ENV['RHO_PLATFORM'] == 'iphone') or (ENV['RHO_PLATFORM'] == 'osx')
- $bindir = ENV['PLATFORM_DEVELOPER_BIN_DIR']
- raise "PLATFORM_DEVELOPER_BIN_DIR is not set" if $bindir.nil?
+ elsif ENV['RHO_PLATFORM'] == 'iphone'
$sdkroot = ENV['SDKROOT']
raise "SDKROOT is not set" if $sdkroot.nil?
+ $bindir = ENV['PLATFORM_DEVELOPER_BIN_DIR']
+ raise "PLATFORM_DEVELOPER_BIN_DIR is not set" if $bindir.nil?
$arch = ENV['ARCHS']
raise "ARCHS is not set" if $arch.nil?
$gccbin = $bindir + '/gcc'
$arbin = $bindir + '/ar'
+ elsif ENV['RHO_PLATFORM'] == 'osx'
+ $qmake = ENV['RHO_QMAKE']
+ raise "RHO_QMAKE is not set" if $qmake.nil?
+ $qmake_spec = ENV['RHO_QMAKE_SPEC']
+ raise "RHO_QMAKE_SPEC is not set" if $qmake_spec.nil?
+ $make = 'make'
+
elsif ENV['RHO_PLATFORM'] == 'wm'
$vcbuild = ENV['VCBUILD']
raise "VCBUILD is not set" if $vcbuild.nil?
$sdk = ENV['SDK']
raise "SDK is not set" if $sdk.nil?
@@ -114,9 +121,15 @@
elsif ENV['RHO_PLATFORM'] == 'win32'
$vcbuild = ENV['VCBUILD']
raise "VCBUILD is not set" if $vcbuild.nil?
$sdk = ENV['SDK']
raise "SDK is not set" if $sdk.nil?
+
+ $qmake = ENV['RHO_QMAKE']
+ raise "RHO_QMAKE is not set" if $qmake.nil?
+ $qmake_spec = ENV['RHO_QMAKE_SPEC']
+ raise "RHO_QMAKE_SPEC is not set" if $qmake_spec.nil?
+ $make = 'nmake'
end
end
task :all => :config do