Permalink
Browse files

Support parallel execution with drake for cross compilation and packa…

…ging
  • Loading branch information...
larskanis committed Mar 8, 2012
1 parent 8fb2cba commit e8099572453a68a46b5be3c6bbfa9d1b7ad8c28f
Showing with 25 additions and 14 deletions.
  1. +12 −0 Rakefile
  2. +13 −14 Rakefile.cross
View
@@ -5,6 +5,18 @@ require 'rake/extensiontask'
require './lib/fox16/version.rb'
load 'Rakefile.cross'
+# Use forked process for chdir'ed environment, to allow parallel execution with drake
+module FileUtils
+ alias old_fileutils_cd cd
+ def cd(dir, options={}, &block)
+ raise "forked_chdir called without block" unless block_given?
+ Process.waitpid(fork{ old_fileutils_cd(dir, options, &block) })
+ end
+ module_function :cd
+ alias chdir cd
+ module_function :chdir
+end
+
# Some constants we'll need
PKG_VERSION = Fox.fxrubyversion
FXSCINTILLA_INSTALL_DIR = Pathname( "build/builds/fxscintilla-#{LIBFXSCINTILLA_VERSION}" ).expand_path
View
27 Rakefile.cross 100644 → 100755
@@ -93,7 +93,6 @@ CLEAN.include( STATIC_BUILDDIR.to_s )
### C R O S S - C O M P I L A T I O N - T A S K S
#####################################################################
-
directory STATIC_SOURCESDIR.to_s
#
@@ -123,7 +122,7 @@ LIBZ_ENV = [
# generate the makefile in a clean build location
file LIBZ_MAKEFILE => [STATIC_LIBZ_BUILDDIR] do |t|
- Dir.chdir( STATIC_LIBZ_BUILDDIR ) do
+ chdir( STATIC_LIBZ_BUILDDIR ) do
options = [
"--prefix=#{STATIC_INSTALLDIR}",
]
@@ -135,7 +134,7 @@ end
# generate the makefile in a clean build location
task LIBZ_A => LIBZ_MAKEFILE do |t|
- Dir.chdir( STATIC_LIBZ_BUILDDIR ) do
+ chdir( STATIC_LIBZ_BUILDDIR ) do
sh "make -j#{NUM_CPUS} install 'LDSHAREDLIBC=-lmsvcrt'"
end
end
@@ -164,7 +163,7 @@ LIBPNG_ENV = [
]
# generate the makefile in a clean build location
file LIBPNG_MAKEFILE => [STATIC_LIBPNG_BUILDDIR, LIBZ_A] do |t|
- Dir.chdir( STATIC_LIBPNG_BUILDDIR ) do
+ chdir( STATIC_LIBPNG_BUILDDIR ) do
options = [
"--target=#{CROSS_PREFIX}",
"--host=#{CROSS_PREFIX}",
@@ -180,7 +179,7 @@ end
# generate the makefile in a clean build location
task LIBPNG_A => [LIBPNG_MAKEFILE, LIBZ_A] do |t|
- Dir.chdir( STATIC_LIBPNG_BUILDDIR ) do
+ chdir( STATIC_LIBPNG_BUILDDIR ) do
sh "make -j#{NUM_CPUS} install"
end
end
@@ -205,7 +204,7 @@ end
# generate the makefile in a clean build location
file LIBJPEG_MAKEFILE => STATIC_LIBJPEG_BUILDDIR do |t|
- Dir.chdir( STATIC_LIBJPEG_BUILDDIR ) do
+ chdir( STATIC_LIBJPEG_BUILDDIR ) do
options = [
"--target=#{CROSS_PREFIX}",
"--host=#{CROSS_PREFIX}",
@@ -222,7 +221,7 @@ end
# build libjpeg.a
task LIBJPEG_A => [LIBJPEG_MAKEFILE] do |t|
- Dir.chdir( STATIC_LIBJPEG_BUILDDIR ) do
+ chdir( STATIC_LIBJPEG_BUILDDIR ) do
sh "make -j#{NUM_CPUS} install"
end
end
@@ -252,7 +251,7 @@ LIBTIFF_ENV = [
# generate the makefile in a clean build location
file LIBTIFF_MAKEFILE => [STATIC_LIBTIFF_BUILDDIR, LIBJPEG_A, LIBZ_A] do |t|
- Dir.chdir( STATIC_LIBTIFF_BUILDDIR ) do
+ chdir( STATIC_LIBTIFF_BUILDDIR ) do
options = [
"--target=#{CROSS_PREFIX}",
"--host=#{CROSS_PREFIX}",
@@ -272,7 +271,7 @@ end
# build libtiff.a
task LIBTIFF_A => [LIBTIFF_MAKEFILE] do |t|
- Dir.chdir( STATIC_LIBTIFF_BUILDDIR ) do
+ chdir( STATIC_LIBTIFF_BUILDDIR ) do
sh "make -j#{NUM_CPUS} install"
end
end
@@ -303,7 +302,7 @@ LIBFOX_ENV = [
# generate the makefile in a clean build location
file LIBFOX_MAKEFILE => [STATIC_LIBFOX_BUILDDIR, LIBJPEG_A, LIBZ_A] do |t|
- Dir.chdir( STATIC_LIBFOX_BUILDDIR ) do
+ chdir( STATIC_LIBFOX_BUILDDIR ) do
options = [
"--target=#{CROSS_PREFIX}",
"--host=#{CROSS_PREFIX}",
@@ -321,7 +320,7 @@ end
# build libfox.a
task LIBFOX_A => [LIBFOX_MAKEFILE] do |t|
- Dir.chdir( STATIC_LIBFOX_BUILDDIR ) do
+ chdir( STATIC_LIBFOX_BUILDDIR ) do
sh "make -j#{NUM_CPUS} #{FOX_ENV.join(" ")} install"
end
end
@@ -354,8 +353,8 @@ FOX_ENV = [
]
# generate the makefile in a clean build location
-file LIBFXSCINTILLA_MAKEFILE => [STATIC_LIBFXSCINTILLA_BUILDDIR, LIBJPEG_A, LIBZ_A] do |t|
- Dir.chdir( STATIC_LIBFXSCINTILLA_BUILDDIR ) do
+file LIBFXSCINTILLA_MAKEFILE => [STATIC_LIBFXSCINTILLA_BUILDDIR, LIBFOX_A] do |t|
+ chdir( STATIC_LIBFXSCINTILLA_BUILDDIR ) do
options = [
"--target=#{CROSS_PREFIX}",
"--host=#{CROSS_PREFIX}",
@@ -371,7 +370,7 @@ end
# build libfxscintilla.a
task LIBFXSCINTILLA_A => [LIBFXSCINTILLA_MAKEFILE] do |t|
- Dir.chdir( STATIC_LIBFXSCINTILLA_BUILDDIR ) do
+ chdir( STATIC_LIBFXSCINTILLA_BUILDDIR ) do
sh "make -j#{NUM_CPUS} #{FOX_ENV.join(" ")} install"
end
end

0 comments on commit e809957

Please sign in to comment.