<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -73,22 +73,21 @@ task :clobber
 
 ##### Ruby C extension
 
-task :native_support =&gt; &quot;ext/phusion_passenger/native_support.#{LIBEXT}&quot;
-
-file 'ext/phusion_passenger/Makefile' =&gt; 'ext/phusion_passenger/extconf.rb' do
-	sh &quot;cd ext/phusion_passenger &amp;&amp; #{RUBY} extconf.rb&quot;
-end
-
-file &quot;ext/phusion_passenger/native_support.#{LIBEXT}&quot; =&gt; [
-	'ext/phusion_passenger/Makefile',
-	'ext/phusion_passenger/native_support.c'
-] do
-	sh &quot;cd ext/phusion_passenger &amp;&amp; make&quot;
-end
-
-task :clean do
-	sh &quot;cd ext/phusion_passenger &amp;&amp; make clean&quot; if File.exist?('ext/phusion_passenger/Makefile')
-	sh &quot;rm -f ext/phusion_passenger/Makefile&quot;
+subdir 'ext/phusion_passenger' do
+	task :native_support =&gt; [&quot;native_support.#{LIBEXT}&quot;]
+	
+	file 'Makefile' =&gt; 'extconf.rb' do
+		sh &quot;#{RUBY} extconf.rb&quot;
+	end
+	
+	file &quot;native_support.#{LIBEXT}&quot; =&gt; ['Makefile', 'native_support.c'] do
+		sh &quot;make&quot;
+	end
+	
+	task :clean do
+		sh &quot;make clean&quot; if File.exist?('Makefile')
+		sh &quot;rm -f Makefile&quot;
+	end
 end
 
 
@@ -97,46 +96,43 @@ end
 def define_libboost_oxt_task(output_dir, extra_compiler_flags = nil)
 	output_file = &quot;#{output_dir}/libboost_oxt.a&quot;
 	objects_output_dir = &quot;#{output_dir}/libboost_oxt&quot;
-	
-	file &quot;#{objects_output_dir}/boost&quot; do
-		sh &quot;mkdir -p #{objects_output_dir}/boost&quot;
-	end
-	
-	file &quot;#{objects_output_dir}/oxt&quot; do
-		sh &quot;mkdir -p #{objects_output_dir}/oxt&quot;
-	end
-	
-	# Define compilation targets for .cpp files in ext/boost/src/pthread.
-	boost_object_files = []
-	flags = &quot;-Iext #{extra_compiler_flags} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
-	Dir['ext/boost/src/pthread/*.cpp'].each do |source_file|
-		object_name = File.basename(source_file.sub(/\.cpp$/, '.o'))
-		output_dir  = &quot;#{objects_output_dir}/boost&quot;
-		object_file = &quot;#{output_dir}/#{object_name}&quot;
-		boost_object_files &lt;&lt; object_file
+	objects_output_path = Pathname.new(objects_output_dir).expand_path
+	ext_path = Pathname.new(&quot;ext&quot;).expand_path
+	
+	file(output_file =&gt;
+		Dir['ext/boost/src/*.cpp'] +
+		Dir['ext/boost/src/pthread/*.cpp'] +
+		Dir['ext/oxt/*.cpp'] +
+		Dir['ext/oxt/*.hpp'] +
+		Dir['ext/oxt/detail/*.hpp']
+	) do
+		sh &quot;mkdir -p #{objects_output_dir}/boost #{objects_output_dir}/oxt&quot;
 		
-		file object_file =&gt; [output_dir, source_file] do
-			compile_cxx(source_file, &quot;#{flags} -o #{object_file}&quot;)
+		Dir.chdir(&quot;#{objects_output_dir}/boost&quot;) do
+			puts &quot;### In #{objects_output_dir}/boost:&quot;
+			current_dir = Pathname.new(&quot;.&quot;).expand_path
+			ext_dir = ext_path.relative_path_from(current_dir)
+			flags = &quot;-I#{ext_dir} #{extra_compiler_flags} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
+			
+			# Compling &quot;pthread/*.cpp&quot; doesn't work on some systems,
+			# so we compile each cpp file invidually instead.
+			Dir[&quot;#{ext_dir}/boost/src/pthread/*.cpp&quot;].each do |file|
+				compile_cxx(file, flags)
+			end
+			puts
 		end
-	end
-	
-	# Define compilation targets for .cpp files in ext/oxt.
-	oxt_object_files = []
-	oxt_dependency_files = Dir[&quot;ext/oxt/*.hpp&quot;] + Dir[&quot;ext/oxt/detail/*.hpp&quot;]
-	flags = &quot;-Iext #{extra_compiler_flags} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
-	Dir['ext/oxt/*.cpp'].each do |source_file|
-		object_name = File.basename(source_file.sub(/\.cpp$/, '.o'))
-		output_dir  = &quot;#{objects_output_dir}/oxt&quot;
-		object_file = &quot;#{output_dir}/#{object_name}&quot;
-		oxt_object_files &lt;&lt; object_file
 		
-		file object_file =&gt; [output_dir, source_file, *oxt_dependency_files] do
-			compile_cxx(source_file, &quot;#{flags} -o #{object_file}&quot;)
+		Dir.chdir(&quot;#{objects_output_dir}/oxt&quot;) do
+			puts &quot;### In #{objects_output_dir}/oxt:&quot;
+			current_dir = Pathname.new(&quot;.&quot;).expand_path
+			ext_dir = ext_path.relative_path_from(current_dir)
+			flags = &quot;-I#{ext_dir} #{extra_compiler_flags} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
+			Dir[&quot;#{ext_dir}/oxt/*.cpp&quot;].each do |file|
+				compile_cxx(file, flags)
+			end
+			puts
 		end
-	end
-	
-	file(output_file =&gt; boost_object_files + oxt_object_files) do
-		sh &quot;mkdir -p #{objects_output_dir}/boost #{objects_output_dir}/oxt&quot;
+		
 		create_static_library(output_file,
 			&quot;#{objects_output_dir}/boost/*.o &quot; &lt;&lt;
 			&quot;#{objects_output_dir}/oxt/*.o&quot;)
@@ -160,29 +156,37 @@ def define_common_library_task(output_dir, extra_compiler_flags = nil,
                                extra_linker_flags = nil)
 	static_library = &quot;#{output_dir}/libpassenger_common.a&quot;
 	objects_output_dir = &quot;#{output_dir}/libpassenger_common&quot;
+	objects_output_path = Pathname.new(objects_output_dir).expand_path
+	ext_path = Pathname.new(&quot;ext&quot;).expand_path
 	targets = [static_library]
 	
-	file objects_output_dir do
+	file(static_library =&gt; [
+		'ext/common/Utils.h',
+		'ext/common/Utils.cpp',
+		'ext/common/Logging.h',
+		'ext/common/Logging.cpp',
+		'ext/common/SystemTime.h',
+		'ext/common/SystemTime.cpp',
+		'ext/common/CachedFileStat.h',
+		'ext/common/CachedFileStat.cpp'
+	]) do
 		sh &quot;mkdir -p #{objects_output_dir}&quot;
-	end
-	
-	# Define compilation targets for the object files in libpassenger_common.
-	flags =  &quot;-Iext -Iext/common #{extra_compiler_flags} &quot;
-	flags &lt;&lt; &quot;#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
-	common_object_files = []
-	['Utils.cpp', 'Logging.cpp', 'SystemTime.cpp', 'CachedFileStat.cpp'].each do |source_file|
-		object_name = source_file.sub(/\.cpp$/, '.o')
-		object_file = &quot;#{objects_output_dir}/#{object_name}&quot;
-		header_file = source_file.sub(/\.cpp$/, '.h')
-		common_object_files &lt;&lt; object_file
 		
-		file object_file =&gt; [objects_output_dir, &quot;ext/common/#{source_file}&quot;, &quot;ext/common/#{header_file}&quot;] do
-			compile_cxx(&quot;ext/common/#{source_file}&quot;, &quot;#{flags} -o #{object_file}&quot;)
+		Dir.chdir(objects_output_dir) do
+			puts &quot;### In #{objects_output_dir}:&quot;
+			current_dir = Pathname.new(&quot;.&quot;).expand_path
+			ext_dir = ext_path.relative_path_from(current_dir)
+			flags =  &quot;-I#{ext_dir} -I#{ext_dir}/common #{extra_compiler_flags} &quot;
+			flags &lt;&lt; &quot;#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}&quot;
+			
+			compile_cxx(&quot;#{ext_dir}/common/Utils.cpp&quot;, flags)
+			compile_cxx(&quot;#{ext_dir}/common/Logging.cpp&quot;, flags)
+			compile_cxx(&quot;#{ext_dir}/common/SystemTime.cpp&quot;, flags)
+			compile_cxx(&quot;#{ext_dir}/common/CachedFileStat.cpp&quot;, flags)
+			
+			puts
 		end
-	end
-	
-	file(static_library =&gt; common_object_files) do
-		sh &quot;mkdir -p #{objects_output_dir}&quot;
+		
 		create_static_library(static_library, &quot;#{objects_output_dir}/*.o&quot;)
 	end
 	</diff>
      <filename>Rakefile</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>845d32edacbb4dc543c0bee8d3a6ea4eb7a5b376</id>
    </parent>
  </parents>
  <author>
    <name>Hongli Lai (Phusion)</name>
    <login></login>
    <email>hongli@phusion.nl</email>
  </author>
  <url>http://github.com/FooBarWidget/passenger/commit/7a9092a560de4f2096a73fc39375260f827f6153</url>
  <id>7a9092a560de4f2096a73fc39375260f827f6153</id>
  <committed-date>2009-04-16T16:12:16-07:00</committed-date>
  <authored-date>2009-04-16T16:12:16-07:00</authored-date>
  <message>Revert &quot;Make the build system Rakefile thread-safe so that it can be parallelized by rake.&quot;

This reverts commit b5b2c59568653638285a21accb4e798d6d24b3e3.

There are some bugs in this commit. Reverting it and fixing it later.</message>
  <tree>62dc6029da86719e898baa967bd25b52a06e1837</tree>
  <committer>
    <name>Hongli Lai (Phusion)</name>
    <login></login>
    <email>hongli@phusion.nl</email>
  </committer>
</commit>
