Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 919 lines (793 sloc) 28.06 kB
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
1 # kate: syntax ruby
bd6e3b4 @FooBarWidget Insert GPL headers to source files.
FooBarWidget authored
2
3 # Phusion Passenger - http://www.modrails.com/
aca72e8 @FooBarWidget Bump version number to 2.1.2.
FooBarWidget authored
4 # Copyright (C) 2008, 2009 Phusion
bd6e3b4 @FooBarWidget Insert GPL headers to source files.
FooBarWidget authored
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; version 2 of the License.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
19 $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
4906d6a @FooBarWidget Move 'lib/rake' to 'misc/rake' in order to prevent Ruby from treating…
FooBarWidget authored
20 $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/misc")
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
21 require 'rubygems'
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
22 require 'pathname'
7f3904d @FooBarWidget Add RDoc Rake task. Modify some files for improve RDoc output.
FooBarWidget authored
23 require 'rake/rdoctask'
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
24 require 'rake/gempackagetask'
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
25 require 'rake/extensions'
797952c @FooBarWidget Split most platform-specific autodetection code to a seperate module.
FooBarWidget authored
26 require 'rake/cplusplus'
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
27 require 'phusion_passenger/platform_info'
67d9166 @FooBarWidget Move version number from version.rb to constants.rb. Introduce packag…
FooBarWidget authored
28 require 'phusion_passenger/constants'
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
29
e640f43 @FooBarWidget Set Rake verbosity to true so that compilation commands are still sho…
FooBarWidget authored
30 verbose true
31
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
32 ##### Configuration
33
db845bb @FooBarWidget Fix problems introduced by the recent renames.
FooBarWidget authored
34 PACKAGE_VERSION = PhusionPassenger::VERSION_STRING
0b25079 @FooBarWidget Add Rakefile flag for enabling compiler optimizations.
FooBarWidget authored
35 OPTIMIZE = ["yes", "on", "true"].include?(ENV['OPTIMIZE'])
d6ef3dd @FooBarWidget Add X-Powered-By header to HTTP requests.
FooBarWidget authored
36
797952c @FooBarWidget Split most platform-specific autodetection code to a seperate module.
FooBarWidget authored
37 include PlatformInfo
38
0135af9 @FooBarWidget Fix some build system problems.
FooBarWidget authored
39 CC = "gcc"
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
40 CXX = "g++"
33e7c59 @FooBarWidget Revamp PlatformInfo.
FooBarWidget authored
41 LIBEXT = PlatformInfo.library_extension
0b25079 @FooBarWidget Add Rakefile flag for enabling compiler optimizations.
FooBarWidget authored
42 if OPTIMIZE
66f219d @FooBarWidget Fix some compilation issues on OpenBSD. This doesn't fix the segfault…
FooBarWidget authored
43 OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -O2 -DBOOST_DISABLE_ASSERTS"
0b25079 @FooBarWidget Add Rakefile flag for enabling compiler optimizations.
FooBarWidget authored
44 else
66f219d @FooBarWidget Fix some compilation issues on OpenBSD. This doesn't fix the segfault…
FooBarWidget authored
45 OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS"
0b25079 @FooBarWidget Add Rakefile flag for enabling compiler optimizations.
FooBarWidget authored
46 end
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
47
48 # Extra compiler flags that should always be passed to the C/C++ compiler.
0135af9 @FooBarWidget Fix some build system problems.
FooBarWidget authored
49 # Should be included last in the command string, even after PlatformInfo.portability_cflags.
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
50 EXTRA_CXXFLAGS = "-Wall #{OPTIMIZATION_FLAGS}"
51
52 # Extra linker flags that should always be passed to the linker.
0135af9 @FooBarWidget Fix some build system problems.
FooBarWidget authored
53 # Should be included last in the command string, even after PlatformInfo.portability_ldflags.
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
54 EXTRA_LDFLAGS = ""
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
55
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
56
33b0064 @FooBarWidget Fix build problems
FooBarWidget authored
57 #### Default tasks
58
59 desc "Build everything"
60 task :default => [
d92d3e5 @FooBarWidget Seperate integration tests from unit tests.
FooBarWidget authored
61 :native_support,
33b0064 @FooBarWidget Fix build problems
FooBarWidget authored
62 :apache2,
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
63 :nginx,
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
64 'test/oxt/oxt_test_main',
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
65 'test/CxxTests'
33b0064 @FooBarWidget Fix build problems
FooBarWidget authored
66 ]
67
079ccdc @FooBarWidget Remove generated API docs with 'clobber' instead of 'clean'.
FooBarWidget authored
68 desc "Remove compiled files"
33b0064 @FooBarWidget Fix build problems
FooBarWidget authored
69 task :clean
70
079ccdc @FooBarWidget Remove generated API docs with 'clobber' instead of 'clean'.
FooBarWidget authored
71 desc "Remove all generated files"
72 task :clobber
73
33b0064 @FooBarWidget Fix build problems
FooBarWidget authored
74
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
75 ##### Ruby C extension
76
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
77 task :native_support => "ext/phusion_passenger/native_support.#{LIBEXT}"
78
79 file 'ext/phusion_passenger/Makefile' => 'ext/phusion_passenger/extconf.rb' do
80 sh "cd ext/phusion_passenger && #{RUBY} extconf.rb"
81 end
82
83 file "ext/phusion_passenger/native_support.#{LIBEXT}" => [
84 'ext/phusion_passenger/Makefile',
85 'ext/phusion_passenger/native_support.c'
86 ] do
87 sh "cd ext/phusion_passenger && make"
88 end
89
90 task :clean do
91 sh "cd ext/phusion_passenger && make clean" if File.exist?('ext/phusion_passenger/Makefile')
92 sh "rm -f ext/phusion_passenger/Makefile"
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
93 end
94
95
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
96 ##### Boost and OXT static library
97
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
98 def define_libboost_oxt_task(namespace, output_dir, extra_compiler_flags = nil)
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
99 output_file = "#{output_dir}/libboost_oxt.a"
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
100 output_dir_base = "#{output_dir}/libboost_oxt"
101 flags = "-Iext #{extra_compiler_flags} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
102
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
103 # Define compilation targets for .cpp files in ext/boost/src/pthread.
104 boost_object_files = []
105 Dir['ext/boost/src/pthread/*.cpp'].each do |source_file|
106 object_name = File.basename(source_file.sub(/\.cpp$/, '.o'))
107 boost_output_dir = "#{output_dir_base}/boost"
108 object_file = "#{boost_output_dir}/#{object_name}"
109 boost_object_files << object_file
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
110
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
111 file object_file => source_file do
112 sh "mkdir -p #{boost_output_dir}" if !File.directory?(boost_output_dir)
113 compile_cxx(source_file, "#{flags} -o #{object_file}")
15d3293 @FooBarWidget Compile ext/boost/src/pthread/*.cpp individually instead of in bulk. …
FooBarWidget authored
114 end
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
115 end
116
117 # Define compilation targets for .cpp files in ext/oxt.
118 oxt_object_files = []
119 oxt_dependency_files = Dir["ext/oxt/*.hpp"] + Dir["ext/oxt/detail/*.hpp"]
120 Dir['ext/oxt/*.cpp'].each do |source_file|
121 object_name = File.basename(source_file.sub(/\.cpp$/, '.o'))
122 oxt_output_dir = "#{output_dir_base}/oxt"
123 object_file = "#{oxt_output_dir}/#{object_name}"
124 oxt_object_files << object_file
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
125
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
126 file object_file => [source_file, *oxt_dependency_files] do
127 sh "mkdir -p #{oxt_output_dir}" if !File.directory?(oxt_output_dir)
128 compile_cxx(source_file, "#{flags} -o #{object_file}")
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
129 end
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
130 end
131
132 file(output_file => boost_object_files + oxt_object_files) do
133 sh "mkdir -p #{output_dir_base}/boost #{output_dir_base}/oxt"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
134 create_static_library(output_file,
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
135 "#{output_dir_base}/boost/*.o " <<
136 "#{output_dir_base}/oxt/*.o")
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
137 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
138
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
139 task "#{namespace}:clean" do
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
140 sh "rm -rf #{output_file} #{output_dir_base}"
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
141 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
142
143 return output_file
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
144 end
145
146
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
147 ##### Static library for Passenger source files that are shared between
148 ##### the Apache module and the Nginx helper server.
149
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
150 def define_common_library_task(namespace, output_dir, extra_compiler_flags = nil,
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
151 with_application_pool_server_exe = false,
152 boost_oxt_library = nil,
153 extra_compiler_flags_for_server_exe = nil,
167b8be @FooBarWidget When compiling the Apache version, do not link ApplicationPoolServerE…
FooBarWidget authored
154 extra_linker_flags_for_server_exe = nil)
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
155 static_library = "#{output_dir}/libpassenger_common.a"
156 objects_output_dir = "#{output_dir}/libpassenger_common"
157 targets = [static_library]
158
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
159 # Define compilation targets for the object files in libpassenger_common.
160 flags = "-Iext -Iext/common #{extra_compiler_flags} "
161 flags << "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}"
162 common_object_files = []
0d1371f @FooBarWidget Include a base64 library.
FooBarWidget authored
163 ['Utils.cpp', 'Logging.cpp', 'SystemTime.cpp', 'CachedFileStat.cpp',
164 'Base64.cpp'].each do |source_file|
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
165 object_name = source_file.sub(/\.cpp$/, '.o')
166 object_file = "#{objects_output_dir}/#{object_name}"
167 header_file = source_file.sub(/\.cpp$/, '.h')
168 common_object_files << object_file
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
169
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
170 file object_file => ["ext/common/#{source_file}", "ext/common/#{header_file}"] do
171 sh "mkdir -p #{objects_output_dir}" if !File.directory?(objects_output_dir)
172 compile_cxx("ext/common/#{source_file}", "#{flags} -o #{object_file}")
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
173 end
3dd54ec @FooBarWidget Revert "Revert "Make the Rakefile properly parallelizable.""
FooBarWidget authored
174 end
175
176 file(static_library => common_object_files) do
177 sh "mkdir -p #{objects_output_dir}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
178 create_static_library(static_library, "#{objects_output_dir}/*.o")
179 end
180
181 if with_application_pool_server_exe
182 exe_file = "#{output_dir}/ApplicationPoolServerExecutable"
183 targets << exe_file
184
185 file(exe_file => [
186 'ext/common/ApplicationPoolServerExecutable.cpp',
187 'ext/common/ApplicationPool.h',
188 'ext/common/Application.h',
189 'ext/common/StandardApplicationPool.h',
746b1e6 @FooBarWidget Do not show backtraces in passenger-status by default. Instead, make …
FooBarWidget authored
190 'ext/common/ApplicationPoolStatusReporter.h',
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
191 'ext/common/MessageChannel.h',
192 'ext/common/SpawnManager.h',
193 'ext/common/PoolOptions.h',
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
194 'ext/common/StringListCreator.h',
0bc257a @FooBarWidget Fix a bug which prevents ApplicationSpawner/FrameworkSpawner from bei…
FooBarWidget authored
195 'ext/common/FileChangeChecker.h',
754dfcd @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
196 'ext/common/SystemTime.h',
0bc257a @FooBarWidget Fix a bug which prevents ApplicationSpawner/FrameworkSpawner from bei…
FooBarWidget authored
197 'ext/common/CachedFileStat.hpp',
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
198 boost_oxt_library,
199 static_library
200 ]) do
201 create_executable(exe_file,
202 "ext/common/ApplicationPoolServerExecutable.cpp",
b50ff76 @FooBarWidget Merge branch 'revamp_platform_autodetection' into nginx_revamp_platfo…
FooBarWidget authored
203 "-Iext -Iext/common " <<
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
204 "#{extra_compiler_flags_for_server_exe} " <<
205 "#{extra_compiler_flags} " <<
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
206 "#{PlatformInfo.portability_cflags} " <<
207 "#{EXTRA_CXXFLAGS} " <<
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
208 "#{static_library} " <<
209 "#{boost_oxt_library} " <<
167b8be @FooBarWidget When compiling the Apache version, do not link ApplicationPoolServerE…
FooBarWidget authored
210 "#{extra_linker_flags_for_server_exe} " <<
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
211 "#{PlatformInfo.portability_ldflags} " <<
212 EXTRA_LDFLAGS
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
213 )
214 end
215 end
216
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
217 task "#{namespace}:clean" do
679d988 @FooBarWidget Correctly remove libpassenger_common output directory upon cleaning.
FooBarWidget authored
218 sh "rm -rf #{targets.join(' ')} #{objects_output_dir}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
219 end
220
221 return targets
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
222 end
223
4e96c5f @FooBarWidget Fix some build problems.
FooBarWidget authored
224
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
225 ##### Apache 2 module
226
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
227 APACHE2_CXXFLAGS = "-Iext -Iext/common #{PlatformInfo.apache2_module_cflags} " <<
228 "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
229 APACHE2_INPUT_FILES = {
230 'ext/apache2/Configuration.o' => %w(
231 ext/apache2/Configuration.cpp
232 ext/apache2/Configuration.h),
233 'ext/apache2/Bucket.o' => %w(
234 ext/apache2/Bucket.cpp
235 ext/apache2/Bucket.h),
236 'ext/apache2/Hooks.o' => %w(
237 ext/apache2/Hooks.cpp
238 ext/apache2/Hooks.h
239 ext/apache2/Configuration.h
240 ext/apache2/Bucket.h
241 ext/apache2/DirectoryMapper.h
242 ext/common/ApplicationPool.h
243 ext/common/ApplicationPoolServer.h
244 ext/common/SpawnManager.h
245 ext/common/Exceptions.h
246 ext/common/Application.h
247 ext/common/MessageChannel.h
248 ext/common/PoolOptions.h
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
249 ext/common/StringListCreator.h
fe4fd9b @FooBarWidget Bump version number to 2.2.2.
FooBarWidget authored
250 ext/common/Version.h
bb3c3f5 @FooBarWidget Apache: improve the error messages that are shown when the backend pr…
FooBarWidget authored
251 ext/common/Timer.h
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
252 ext/common/Utils.h)
253 }
254 APACHE2_OBJECTS = APACHE2_INPUT_FILES.keys
255
256 # NOTE: APACHE2_BOOST_OXT_LIBRARY is a task name, while APACHE2_COMMON_LIBRARY
257 # is an array of task names.
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
258 APACHE2_BOOST_OXT_LIBRARY = define_libboost_oxt_task("apache2", "ext/apache2",
b50ff76 @FooBarWidget Merge branch 'revamp_platform_autodetection' into nginx_revamp_platfo…
FooBarWidget authored
259 PlatformInfo.apache2_module_cflags)
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
260 APACHE2_COMMON_LIBRARY = define_common_library_task("apache2", "ext/apache2",
b50ff76 @FooBarWidget Merge branch 'revamp_platform_autodetection' into nginx_revamp_platfo…
FooBarWidget authored
261 PlatformInfo.apache2_module_cflags,
167b8be @FooBarWidget When compiling the Apache version, do not link ApplicationPoolServerE…
FooBarWidget authored
262 true, APACHE2_BOOST_OXT_LIBRARY)
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
263
264
265 desc "Build Apache 2 module"
266 task :apache2 => ['ext/apache2/mod_passenger.so', :native_support]
267
268 mod_passenger_dependencies = [APACHE2_COMMON_LIBRARY,
269 APACHE2_BOOST_OXT_LIBRARY,
270 'ext/apache2/mod_passenger.o',
271 APACHE2_OBJECTS].flatten
272 file 'ext/apache2/mod_passenger.so' => mod_passenger_dependencies do
b50ff76 @FooBarWidget Merge branch 'revamp_platform_autodetection' into nginx_revamp_platfo…
FooBarWidget authored
273 PlatformInfo.apxs2.nil? and raise "Could not find 'apxs' or 'apxs2'."
274 PlatformInfo.apache2ctl.nil? and raise "Could not find 'apachectl' or 'apache2ctl'."
275 PlatformInfo.httpd.nil? and raise "Could not find the Apache web server binary."
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
276
7d7ac08 @FooBarWidget Attempt to fix compilation on OS X. *Still* not done. :(
FooBarWidget authored
277 # apxs totally sucks. We couldn't get it working correctly
278 # on MacOS X (it had various problems with building universal
279 # binaries), so we decided to ditch it and build/install the
280 # Apache module ourselves.
281 #
282 # Oh, and libtool sucks too. Do we even need it anymore in 2008?
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
283
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
284 sources = APACHE2_OBJECTS.join(' ')
285 sources << ' ext/apache2/mod_passenger.o'
286
287 linkflags =
288 "#{PlatformInfo.apache2_module_cflags} " <<
289 "#{PlatformInfo.portability_cflags} " <<
290 "#{EXTRA_CXXFLAGS} " <<
291 "#{APACHE2_COMMON_LIBRARY[0]} " <<
292 "#{APACHE2_BOOST_OXT_LIBRARY} " <<
293 "#{PlatformInfo.apache2_module_ldflags} " <<
294 "#{PlatformInfo.portability_ldflags} " <<
295 "#{EXTRA_LDFLAGS} "
296
297 create_shared_library('ext/apache2/mod_passenger.so',
298 sources, linkflags)
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
299 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
300
301 file 'ext/apache2/mod_passenger.o' => ['ext/apache2/mod_passenger.c'] do
302 compile_c('ext/apache2/mod_passenger.c',
303 APACHE2_CXXFLAGS +
304 " -o ext/apache2/mod_passenger.o")
9b9f71b @FooBarWidget Begin working on seperating ApplicationPool server into a seperate ex…
FooBarWidget authored
305 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
306
307 APACHE2_INPUT_FILES.each_pair do |target, sources|
308 file(target => sources) do
309 object_basename = File.basename(target)
310 compile_cxx(sources[0],
311 APACHE2_CXXFLAGS +
312 " -o ext/apache2/#{object_basename}")
313 end
7d7ac08 @FooBarWidget Attempt to fix compilation on OS X. *Still* not done. :(
FooBarWidget authored
314 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
315
316 task :clean => 'apache2:clean'
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
317 desc "Clean all compiled Apache 2 files"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
318 task 'apache2:clean' do
319 files = [APACHE2_OBJECTS, %w(ext/apache2/mod_passenger.o
320 ext/apache2/mod_passenger.so)]
321 sh("rm", "-rf", *files.flatten)
322 end
323
324
325 ##### Nginx helper server
326
327 # NOTE: NGINX_BOOST_OXT_LIBRARY is a task name, while NGINX_COMMON_LIBRARY
328 # is an array of task names.
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
329 NGINX_BOOST_OXT_LIBRARY = define_libboost_oxt_task("nginx", "ext/nginx")
330 NGINX_COMMON_LIBRARY = define_common_library_task("nginx", "ext/nginx")
7d7ac08 @FooBarWidget Attempt to fix compilation on OS X. *Still* not done. :(
FooBarWidget authored
331
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
332 desc "Build Nginx helper server"
333 task :nginx => ['ext/nginx/HelperServer', :native_support]
334
335 helper_server_dependencies = [
336 NGINX_BOOST_OXT_LIBRARY,
337 NGINX_COMMON_LIBRARY[0],
338 'ext/nginx/HelperServer.cpp',
339 'ext/nginx/ScgiRequestParser.h',
6de2c83 @FooBarWidget Optimize ScgiRequestParser.
FooBarWidget authored
340 'ext/nginx/HttpStatusExtractor.h',
59ed797 @FooBarWidget Add StandardApplicationPool to HelperServer's dependencies list.
FooBarWidget authored
341 'ext/common/StaticString.h',
342 'ext/common/StandardApplicationPool.h'
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
343 ]
344 file 'ext/nginx/HelperServer' => helper_server_dependencies do
345 create_executable "ext/nginx/HelperServer",
346 'ext/nginx/HelperServer.cpp',
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
347 "-Iext -Iext/common " <<
348 "#{PlatformInfo.portability_cflags} " <<
349 "#{EXTRA_CXXFLAGS} " <<
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
350 "#{NGINX_COMMON_LIBRARY[0]} " <<
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
351 "#{NGINX_BOOST_OXT_LIBRARY} " <<
352 "#{PlatformInfo.portability_ldflags} " <<
353 "#{EXTRA_LDFLAGS}"
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
354 end
355
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
356 task :clean => 'nginx:clean'
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
357 desc "Clean all compiled Nginx files"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
358 task 'nginx:clean' do
359 sh("rm", "-rf", "ext/nginx/HelperServer")
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
360 end
361
362
363 ##### Unit tests
364
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
365 TEST_BOOST_OXT_LIBRARY = define_libboost_oxt_task("test", "test")
366 TEST_COMMON_LIBRARY = define_common_library_task("test", "test",
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
367 nil, true, TEST_BOOST_OXT_LIBRARY)
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
368
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
369 TEST_COMMON_CFLAGS = "-DTESTING_SPAWN_MANAGER -DTESTING_APPLICATION_POOL " <<
370 "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}"
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
371
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
372 TEST_OXT_CFLAGS = "-I../../ext -I../support #{TEST_COMMON_CFLAGS}"
373 TEST_OXT_LDFLAGS = "#{TEST_BOOST_OXT_LIBRARY} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
374 TEST_OXT_OBJECTS = {
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
375 'oxt_test_main.o' => %w(oxt_test_main.cpp),
fdfffe7 @FooBarWidget OXT: use sigaction() instead of signal() for better portability. Add …
FooBarWidget authored
376 'backtrace_test.o' => %w(backtrace_test.cpp),
377 'syscall_interruption_test.o' => %w(syscall_interruption_test.cpp)
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
378 }
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
379
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
380 TEST_CXX_CFLAGS = "-Iext -Iext/common -Iext/nginx -Itest/support " <<
381 "#{PlatformInfo.apr_flags} #{PlatformInfo.apu_flags} #{TEST_COMMON_CFLAGS}"
382 TEST_CXX_LDFLAGS = "#{PlatformInfo.apr_libs} #{PlatformInfo.apu_libs} " <<
383 "#{TEST_COMMON_LIBRARY[0]} #{TEST_BOOST_OXT_LIBRARY} " <<
384 "#{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
385 TEST_CXX_OBJECTS = {
386 'test/CxxTestMain.o' => %w(
387 test/CxxTestMain.cpp),
644121c @FooBarWidget Fix some unit test problems.
FooBarWidget authored
388 'test/support/Support.o' => %w(
389 test/support/Support.cpp
390 test/support/Support.h),
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
391 'test/MessageChannelTest.o' => %w(
392 test/MessageChannelTest.cpp
393 ext/common/MessageChannel.h),
394 'test/SpawnManagerTest.o' => %w(
395 test/SpawnManagerTest.cpp
396 ext/common/SpawnManager.h
397 ext/common/PoolOptions.h
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
398 ext/common/StringListCreator.h
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
399 ext/common/Application.h
400 ext/common/MessageChannel.h),
401 'test/ApplicationPoolServerTest.o' => %w(
402 test/ApplicationPoolServerTest.cpp
403 ext/common/ApplicationPoolServer.h
404 ext/common/PoolOptions.h
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
405 ext/common/StringListCreator.h
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
406 ext/common/MessageChannel.h),
407 'test/ApplicationPoolServer_ApplicationPoolTest.o' => %w(
408 test/ApplicationPoolServer_ApplicationPoolTest.cpp
409 test/ApplicationPoolTest.cpp
410 ext/common/ApplicationPoolServer.h
411 ext/common/ApplicationPool.h
412 ext/common/SpawnManager.h
413 ext/common/PoolOptions.h
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
414 ext/common/StringListCreator.h
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
415 ext/common/Application.h
416 ext/common/MessageChannel.h),
417 'test/StandardApplicationPoolTest.o' => %w(
418 test/StandardApplicationPoolTest.cpp
419 test/ApplicationPoolTest.cpp
420 ext/common/ApplicationPool.h
421 ext/common/StandardApplicationPool.h
422 ext/common/SpawnManager.h
423 ext/common/PoolOptions.h
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
424 ext/common/StringListCreator.h
0bc257a @FooBarWidget Fix a bug which prevents ApplicationSpawner/FrameworkSpawner from bei…
FooBarWidget authored
425 ext/common/FileChangeChecker.h
426 ext/common/CachedFileStat.hpp
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
427 ext/common/Application.h),
428 'test/PoolOptionsTest.o' => %w(
429 test/PoolOptionsTest.cpp
f085919 @FooBarWidget Make it possible to pass mod_env environment variables to the backend…
FooBarWidget authored
430 ext/common/PoolOptions.h
431 ext/common/StringListCreator.h),
0d1371f @FooBarWidget Include a base64 library.
FooBarWidget authored
432 'test/StaticStringTest.o' => %w(
6de2c83 @FooBarWidget Optimize ScgiRequestParser.
FooBarWidget authored
433 test/StaticStringTest.cpp
434 ext/common/StaticString.h),
0d1371f @FooBarWidget Include a base64 library.
FooBarWidget authored
435 'test/Base64Test.o' => %w(
436 test/Base64Test.cpp
437 ext/common/Base64.h
438 ext/common/Base64.cpp),
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
439 'test/ScgiRequestParserTest.o' => %w(
440 test/ScgiRequestParserTest.cpp
6de2c83 @FooBarWidget Optimize ScgiRequestParser.
FooBarWidget authored
441 ext/nginx/ScgiRequestParser.h
442 ext/common/StaticString.h),
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
443 'test/HttpStatusExtractorTest.o' => %w(
444 test/HttpStatusExtractorTest.cpp
445 ext/nginx/HttpStatusExtractor.h),
0bc257a @FooBarWidget Fix a bug which prevents ApplicationSpawner/FrameworkSpawner from bei…
FooBarWidget authored
446 'test/FileChangeCheckerTest.o' => %w(
447 test/FileChangeCheckerTest.cpp
448 ext/common/FileChangeChecker.h
449 ext/common/CachedFileStat.hpp),
3ff694e @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
450 'test/SystemTimeTest.o' => %w(
451 test/SystemTimeTest.cpp
452 ext/common/SystemTime.h
9a48394 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
453 ext/common/SystemTime.cpp),
754dfcd @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
454 'test/CachedFileStatTest.o' => %w(
455 test/CachedFileStatTest.cpp
0bc257a @FooBarWidget Fix a bug which prevents ApplicationSpawner/FrameworkSpawner from bei…
FooBarWidget authored
456 ext/common/CachedFileStat.hpp
d37d357 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
457 ext/common/CachedFileStat.cpp),
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
458 'test/UtilsTest.o' => %w(
459 test/UtilsTest.cpp
460 ext/common/Utils.h)
461 }
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
462
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
463 desc "Run all unit tests and integration tests"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
464 task :test => ['test:oxt', 'test:cxx', 'test:ruby', 'test:integration']
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
465
466 desc "Run unit tests for the OXT library"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
467 task 'test:oxt' => 'test/oxt/oxt_test_main' do
468 sh "cd test && ./oxt/oxt_test_main"
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
469 end
02ce854 @FooBarWidget - Add rules for running the unit tests.
FooBarWidget authored
470
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
471 desc "Run unit tests for the Apache 2 and Nginx C++ components"
472 task 'test:cxx' => ['test/CxxTests', :native_support] do
473 sh "cd test && ./CxxTests"
634b9bd @FooBarWidget - Attempt to improve error handling.
FooBarWidget authored
474 end
475
02ce854 @FooBarWidget - Add rules for running the unit tests.
FooBarWidget authored
476 desc "Run unit tests for the Ruby libraries"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
477 task 'test:ruby' => :native_support do
2b958c3 @FooBarWidget Also look in Gem.bindir for Ruby executables, because Gem.bindir may …
FooBarWidget authored
478 if PlatformInfo.rspec.nil?
66cbcc2 @FooBarWidget Make sure that the test Rake tasks runs tools that belong to the curr…
FooBarWidget authored
479 abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
480 else
119f839 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
481 Dir.chdir("test") do
482 ruby "#{PlatformInfo.rspec} -c -f s ruby/*.rb ruby/*/*.rb"
483 end
66cbcc2 @FooBarWidget Make sure that the test Rake tasks runs tools that belong to the curr…
FooBarWidget authored
484 end
a72b5b5 @FooBarWidget Add RCov support.
FooBarWidget authored
485 end
486
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
487 desc "Run coverage tests for the Ruby libraries"
488 task 'test:rcov' => :native_support do
2b958c3 @FooBarWidget Also look in Gem.bindir for Ruby executables, because Gem.bindir may …
FooBarWidget authored
489 if PlatformInfo.rspec.nil?
66cbcc2 @FooBarWidget Make sure that the test Rake tasks runs tools that belong to the curr…
FooBarWidget authored
490 abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
491 else
119f839 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
492 Dir.chdir("test") do
493 sh "rcov", "--exclude",
494 "lib\/spec,\/spec$,_spec\.rb$,support\/,platform_info,integration_tests",
495 PlatformInfo.rspec, "--", "-c", "-f", "s",
496 *Dir["ruby/*.rb", "ruby/*/*.rb", "integration_tests.rb"]
497 end
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
498 end
02ce854 @FooBarWidget - Add rules for running the unit tests.
FooBarWidget authored
499 end
d92d3e5 @FooBarWidget Seperate integration tests from unit tests.
FooBarWidget authored
500
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
501 desc "Run all integration tests"
502 task 'test:integration' => ['test:integration:apache2', 'test:integration:nginx'] do
503 end
504
505 desc "Run Apache 2 integration tests"
506 task 'test:integration:apache2' => [:apache2, :native_support] do
2b958c3 @FooBarWidget Also look in Gem.bindir for Ruby executables, because Gem.bindir may …
FooBarWidget authored
507 if PlatformInfo.rspec.nil?
66cbcc2 @FooBarWidget Make sure that the test Rake tasks runs tools that belong to the curr…
FooBarWidget authored
508 abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
509 else
119f839 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
510 Dir.chdir("test") do
511 ruby "#{PlatformInfo.rspec} -c -f s integration_tests/apache2_tests.rb"
512 end
66cbcc2 @FooBarWidget Make sure that the test Rake tasks runs tools that belong to the curr…
FooBarWidget authored
513 end
d92d3e5 @FooBarWidget Seperate integration tests from unit tests.
FooBarWidget authored
514 end
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
515
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
516 desc "Run Nginx integration tests"
517 task 'test:integration:nginx' => :nginx do
119f839 @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
518 if PlatformInfo.rspec.nil?
519 abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
520 else
521 Dir.chdir("test") do
522 ruby "#{PlatformInfo.rspec} -c -f s integration_tests/nginx_tests.rb"
523 end
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
524 end
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
525 end
526
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
527 oxt_test_main_dependencies = TEST_OXT_OBJECTS.keys.map do |object|
528 "test/oxt/#{object}"
529 end
530 oxt_test_main_dependencies << TEST_BOOST_OXT_LIBRARY
531 file 'test/oxt/oxt_test_main' => oxt_test_main_dependencies do
3424bfa @FooBarWidget Fix test:oxt Rake tasks.
FooBarWidget authored
532 objects = TEST_OXT_OBJECTS.keys.map{ |x| "test/oxt/#{x}" }.join(' ')
533 create_executable("test/oxt/oxt_test_main", objects, TEST_OXT_LDFLAGS)
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
534 end
535
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
536 TEST_OXT_OBJECTS.each_pair do |target, sources|
644121c @FooBarWidget Fix some unit test problems.
FooBarWidget authored
537 file "test/oxt/#{target}" => sources.map{ |x| "test/oxt/#{x}" } + ['test/support/Support.h'] do
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
538 Dir.chdir('test/oxt') do
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
539 puts "### In test/oxt:"
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
540 compile_cxx sources[0], TEST_OXT_CFLAGS
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
541 end
542 end
543 end
02ce854 @FooBarWidget - Add rules for running the unit tests.
FooBarWidget authored
544
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
545 cxx_tests_dependencies = [TEST_CXX_OBJECTS.keys,
546 TEST_BOOST_OXT_LIBRARY, TEST_COMMON_LIBRARY]
547 file 'test/CxxTests' => cxx_tests_dependencies.flatten do
548 objects = TEST_CXX_OBJECTS.keys.join(' ')
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
549 create_executable("test/CxxTests", objects, TEST_CXX_LDFLAGS)
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
550 end
551
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
552 TEST_CXX_OBJECTS.each_pair do |target, sources|
553 file(target => sources) do
08c845a @FooBarWidget Merge branch 'master' into nginx
FooBarWidget authored
554 compile_cxx sources[0], "-o #{target} #{TEST_CXX_CFLAGS}"
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
555 end
556 end
557
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
558 desc "Run the 'restart' integration test infinitely, and abort if/when it fails"
fe97ccf @FooBarWidget Fix a potential racing condition.
FooBarWidget authored
559 task 'test:restart' => [:apache2, :native_support] do
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
560 Dir.chdir("test") do
561 color_code_start = "\e[33m\e[44m\e[1m"
562 color_code_end = "\e[0m"
563 i = 1
564 while true do
565 puts "#{color_code_start}Test run #{i} (press Ctrl-C multiple times to abort)#{color_code_end}"
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
566 sh "spec -c -f s integration_tests/apache2.rb -e 'mod_passenger running in Apache 2 : MyCook(tm) beta running on root URI should support restarting via restart.txt'"
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
567 i += 1
568 end
fe97ccf @FooBarWidget Fix a potential racing condition.
FooBarWidget authored
569 end
570 end
571
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
572 task :clean => 'test:clean'
573 desc "Clean all compiled test files"
574 task 'test:clean' do
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
575 sh("rm -rf test/oxt/oxt_test_main test/oxt/*.o test/CxxTests test/*.o")
46e3283 @FooBarWidget Swtich to Rake as build system. Remove some unnecessary files that we…
FooBarWidget authored
576 end
577
578
5fe3d4e @FooBarWidget Improve documentation and fix some spelling mistakes. Rename C++ Doxy…
FooBarWidget authored
579 ##### Documentation
7f3904d @FooBarWidget Add RDoc Rake task. Modify some files for improve RDoc output.
FooBarWidget authored
580
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
581 subdir 'doc' do
70359f3 @FooBarWidget Add ext/common to package file list.
FooBarWidget authored
582 ASCIIDOC = 'asciidoc'
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
583 ASCIIDOC_FLAGS = "-a toc -a numbered -a toclevels=3 -a icons"
8b6f8b1 @FooBarWidget Oops, wrong rename.
FooBarWidget authored
584 ASCII_DOCS = ['Security of user switching support',
585 'Users guide Apache', 'Users guide Nginx',
586 'Architectural overview']
8ec6d80 @FooBarWidget More work on the architectural overview
FooBarWidget authored
587
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
588 DOXYGEN = 'doxygen'
589
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
590 desc "Generate all documentation"
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
591 task :doc => [:rdoc]
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
592
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
593 if PlatformInfo.find_command(DOXYGEN)
594 task :doc => :doxygen
595 end
596
597 task :doc => ASCII_DOCS.map{ |x| "#{x}.html" }
598
1c9a41e @FooBarWidget Make Rakefile DRYer
FooBarWidget authored
599 ASCII_DOCS.each do |name|
8ec6d80 @FooBarWidget More work on the architectural overview
FooBarWidget authored
600 file "#{name}.html" => ["#{name}.txt"] do
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
601 if PlatformInfo.find_command(ASCIIDOC)
f065c12 @FooBarWidget Fix indentation.
FooBarWidget authored
602 sh "#{ASCIIDOC} #{ASCIIDOC_FLAGS} '#{name}.txt'"
ea6bcf8 Some hacks to proceed with docs even if asciidoc and/or doxygen are m…
Jacob Harris authored
603 else
604 sh "echo 'asciidoc required to build docs' > '#{name}.html'"
605 end
f065c12 @FooBarWidget Fix indentation.
FooBarWidget authored
606 end
466c9bc @FooBarWidget Add users guide
FooBarWidget authored
607 end
608
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
609 task :clobber => [:'doxygen:clobber'] do
610 sh "rm -f *.html"
611 end
612
613 desc "Generate Doxygen C++ API documentation if necessary"
614 task :doxygen => ['cxxapi']
615 file 'cxxapi' => Dir['../ext/apache2/*.{h,c,cpp}'] do
d73f7e2 @FooBarWidget Improve documentation and documentation-related Rake tasks.
FooBarWidget authored
616 sh "doxygen"
617 end
618
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
619 desc "Force generation of Doxygen C++ API documentation"
620 task :'doxygen:force' do
5fe3d4e @FooBarWidget Improve documentation and fix some spelling mistakes. Rename C++ Doxy…
FooBarWidget authored
621 sh "doxygen"
622 end
623
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
624 desc "Remove generated Doxygen C++ API documentation"
625 task :'doxygen:clobber' do
5fe3d4e @FooBarWidget Improve documentation and fix some spelling mistakes. Rename C++ Doxy…
FooBarWidget authored
626 sh "rm -rf cxxapi"
627 end
628 end
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
629
9e013fd @FooBarWidget Modify rake/rdoctask to allow arbitrary customization of task names.
FooBarWidget authored
630 Rake::RDocTask.new(:clobber_rdoc => "rdoc:clobber", :rerdoc => "rdoc:force") do |rd|
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
631 rd.main = "README"
632 rd.rdoc_dir = "doc/rdoc"
58632cb @FooBarWidget Split developer documentation to seperate file
FooBarWidget authored
633 rd.rdoc_files.include("README", "DEVELOPERS.TXT",
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
634 "lib/phusion_passenger/*.rb",
635 "lib/phusion_passenger/*/*.rb",
40a98ef @FooBarWidget Fix some distribution problems.
FooBarWidget authored
636 "misc/rake/extensions.rb",
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
637 "ext/phusion_passenger/*.c")
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
638 rd.template = "./doc/template/horo"
639 rd.title = "Passenger Ruby API"
382f8d5 @FooBarWidget Improve API documentation. Do not generate diagrams: it becomes too big.
FooBarWidget authored
640 rd.options << "-S" << "-N" << "-p" << "-H"
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
641 end
5fe3d4e @FooBarWidget Improve documentation and fix some spelling mistakes. Rename C++ Doxy…
FooBarWidget authored
642
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
643
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
644 ##### Packaging
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
645
646 spec = Gem::Specification.new do |s|
647 s.platform = Gem::Platform::RUBY
3ae8f88 @FooBarWidget Fix website URL in gem specification. Remove dependency on Rails and …
FooBarWidget authored
648 s.homepage = "http://www.modrails.com/"
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
649 s.summary = "Apache module for Ruby on Rails support."
650 s.name = "passenger"
d6ef3dd @FooBarWidget Add X-Powered-By header to HTTP requests.
FooBarWidget authored
651 s.version = PACKAGE_VERSION
01242f4 @FooBarWidget Gem specification: specify RubyForge project, author and email.
FooBarWidget authored
652 s.rubyforge_project = "passenger"
653 s.author = "Phusion - http://www.phusion.nl/"
654 s.email = "info@phusion.nl"
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
655 s.requirements << "fastthread" << "Apache 2 with development headers"
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
656 s.require_paths = ["lib", "ext"]
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
657 s.add_dependency 'rake', '>= 0.8.1'
658 s.add_dependency 'fastthread', '>= 1.0.1'
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
659 s.extensions << 'ext/phusion_passenger/extconf.rb'
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
660 s.files = FileList[
661 'Rakefile',
b599d22 @FooBarWidget Installer: warn against OS X's default Apache installation. Prepare P…
FooBarWidget authored
662 'README',
58632cb @FooBarWidget Split developer documentation to seperate file
FooBarWidget authored
663 'DEVELOPERS.TXT',
79c6223 @FooBarWidget Add licensing terms.
FooBarWidget authored
664 'LICENSE',
0924ccf @FooBarWidget Add more references to Users Guide. For some reason too many people o…
FooBarWidget authored
665 'INSTALL',
f2cea7b @FooBarWidget Add a rough NEWS file.
FooBarWidget authored
666 'NEWS',
0812844 @FooBarWidget Add 'sloccount' task and fix the package file list.
FooBarWidget authored
667 'lib/**/*.rb',
ecef494 @FooBarWidget Add WSGI files to distribution.
FooBarWidget authored
668 'lib/**/*.py',
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
669 'lib/phusion_passenger/templates/*',
9e19941 @FooBarWidget Merge branch 'change_namespace' into nginx_change_namespace
FooBarWidget authored
670 'lib/phusion_passenger/templates/apache2/*',
671 'lib/phusion_passenger/templates/nginx/*',
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
672 'bin/*',
d73f7e2 @FooBarWidget Improve documentation and documentation-related Rake tasks.
FooBarWidget authored
673 'doc/*',
b0a1a10 @FooBarWidget Bump version to 1.9.1. Fix some packaging issues.
FooBarWidget authored
674
675 # If you're running 'rake package' for the first time, then these
676 # files don't exist yet, and so won't be matched by the above glob.
677 # So we add these filenames manually.
85846cc @FooBarWidget Begin writing Nginx documentation.
FooBarWidget authored
678 'doc/Users guide Apache.html',
679 'doc/Users guide Nginx.html',
b0a1a10 @FooBarWidget Bump version to 1.9.1. Fix some packaging issues.
FooBarWidget authored
680 'doc/Security of user switching support.html',
681
557fcb4 @FooBarWidget Rename the Jamis template to Horo, we modified it after all. Move it …
FooBarWidget authored
682 'doc/*/*',
683 'doc/*/*/*',
684 'doc/*/*/*/*',
685 'doc/*/*/*/*/*',
686 'doc/*/*/*/*/*/*',
0f1f7f8 @FooBarWidget Add manual pages to distribution.
FooBarWidget authored
687 'man/*',
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
688 'debian/*',
5f0deaa @FooBarWidget Add ext/common/*.hpp to the tarball/gem file list. Fixes issue #312.
FooBarWidget authored
689 'ext/common/*.{cpp,c,h,hpp}',
79c6223 @FooBarWidget Add licensing terms.
FooBarWidget authored
690 'ext/apache2/*.{cpp,h,c,TXT}',
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
691 'ext/nginx/*.{c,cpp,h}',
0b3a68d @FooBarWidget Add nginx config file to package file list.
FooBarWidget authored
692 'ext/nginx/config',
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
693 'ext/boost/*.{hpp,TXT}',
8469c8c @FooBarWidget Package .ipp files in the boost directory.
FooBarWidget authored
694 'ext/boost/**/*.{hpp,cpp,pl,inl,ipp}',
f0a507f @FooBarWidget Integrate OXT into the build system.
FooBarWidget authored
695 'ext/oxt/*.hpp',
696 'ext/oxt/*.cpp',
697 'ext/oxt/detail/*.hpp',
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
698 'ext/phusion_passenger/*.{c,rb}',
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
699 'benchmark/*.{cpp,rb}',
3ea518f @FooBarWidget Add a tool for rendering the error pages
FooBarWidget authored
700 'misc/*',
851dfe2 @FooBarWidget Package misc/rake.
FooBarWidget authored
701 'misc/*/*',
ea7fb0a @FooBarWidget Vendor Rack in order to work around broken applications that depend o…
FooBarWidget authored
702 'vendor/**/*',
7cec9ba @FooBarWidget Add config.yml.example to package.
FooBarWidget authored
703 'test/*.{rb,cpp,example}',
644121c @FooBarWidget Fix some unit test problems.
FooBarWidget authored
704 'test/support/*.{cpp,h,rb}',
2b185c6 @FooBarWidget Add beginning of unit test suite for OXT.
FooBarWidget authored
705 'test/oxt/*.cpp',
b5093c2 @FooBarWidget Refactor ApplicationPoolTest: split some functionality to functions, …
FooBarWidget authored
706 'test/ruby/**/*',
707 'test/integration_tests/**/*',
708 'test/stub/**/*'
709 ]
56598a6 @FooBarWidget - Move misc/memory_stats.rb into bin/ and turn it into a first-class …
FooBarWidget authored
710 s.executables = [
711 'passenger-spawn-server',
712 'passenger-install-apache2-module',
6eb60e9 @FooBarWidget Add passenger-install-nginx-module to the executables list.
FooBarWidget authored
713 'passenger-install-nginx-module',
56598a6 @FooBarWidget - Move misc/memory_stats.rb into bin/ and turn it into a first-class …
FooBarWidget authored
714 'passenger-config',
bb20616 @FooBarWidget Add enterprisey aspects.
FooBarWidget authored
715 'passenger-memory-stats',
ea5e36c @FooBarWidget Add 'passenger-status' and 'passenger-stress-test' to the gem specifi…
FooBarWidget authored
716 'passenger-make-enterprisey',
717 'passenger-status',
718 'passenger-stress-test'
56598a6 @FooBarWidget - Move misc/memory_stats.rb into bin/ and turn it into a first-class …
FooBarWidget authored
719 ]
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
720 s.has_rdoc = true
0f1f0b1 @FooBarWidget Improve documentation.
FooBarWidget authored
721 s.extra_rdoc_files = ['README']
722 s.rdoc_options <<
382f8d5 @FooBarWidget Improve API documentation. Do not generate diagrams: it becomes too big.
FooBarWidget authored
723 "-S" << "-N" << "-p" << "-H" <<
0f1f0b1 @FooBarWidget Improve documentation.
FooBarWidget authored
724 '--main' << 'README' <<
725 '--title' << 'Passenger Ruby API'
4c0583f @FooBarWidget Add Rake task to generate source tarball and gem. Add executable whic…
FooBarWidget authored
726 s.description = "Passenger is an Apache module for Ruby on Rails support."
727 end
728
729 Rake::GemPackageTask.new(spec) do |pkg|
730 pkg.need_tar_gz = true
731 end
0812844 @FooBarWidget Add 'sloccount' task and fix the package file list.
FooBarWidget authored
732
7a348c4 @FooBarWidget Fix dependencies order
FooBarWidget authored
733 Rake::Task['package'].prerequisites.unshift(:doc)
734 Rake::Task['package:gem'].prerequisites.unshift(:doc)
735 Rake::Task['package:force'].prerequisites.unshift(:doc)
13896a1 @FooBarWidget Use AsciiDoc to generate pretty HTML documentation from .txt.
FooBarWidget authored
736 task :clobber => :'package:clean'
d73f7e2 @FooBarWidget Improve documentation and documentation-related Rake tasks.
FooBarWidget authored
737
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
738 desc "Create a fakeroot, useful for building native packages"
739 task :fakeroot => [:apache2, :native_support, :doc] do
740 require 'rbconfig'
9618fae @FooBarWidget Fix packaging process for Debian Sarge.
FooBarWidget authored
741 include Config
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
742 fakeroot = "pkg/fakeroot"
9618fae @FooBarWidget Fix packaging process for Debian Sarge.
FooBarWidget authored
743
744 # We don't use CONFIG['archdir'] and the like because we want
745 # the files to be installed to /usr, and the Ruby interpreter
746 # on the packaging machine might be in /usr/local.
747 libdir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}"
748 extdir = "#{libdir}/#{CONFIG['arch']}"
749 bindir = "#{fakeroot}/usr/bin"
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
750 docdir = "#{fakeroot}/usr/share/doc/phusion_passenger"
751 libexecdir = "#{fakeroot}/usr/lib/phusion_passenger"
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
752
7a3a4a0 @FooBarWidget Require 'fakeroot' and 'package:debian' tasks to be run as root (with…
FooBarWidget authored
753 sh "rm -rf #{fakeroot}"
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
754 sh "mkdir -p #{fakeroot}"
755
756 sh "mkdir -p #{libdir}"
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
757 sh "cp -R lib/phusion_passenger #{libdir}/"
9618fae @FooBarWidget Fix packaging process for Debian Sarge.
FooBarWidget authored
758
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
759 sh "mkdir -p #{extdir}/phusion_passenger"
760 sh "cp -R ext/phusion_passenger/*.#{LIBEXT} #{extdir}/phusion_passenger/"
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
761
762 sh "mkdir -p #{bindir}"
763 sh "cp bin/* #{bindir}/"
764
9c75736 @FooBarWidget Fix some Debian packaging issues.
FooBarWidget authored
765 sh "mkdir -p #{libexecdir}"
0c888b8 @FooBarWidget Move passenger-spawn-server from /usr/bin to /usr/lib/passenger.
FooBarWidget authored
766 sh "cp ext/apache2/mod_passenger.so #{libexecdir}/"
767 sh "mv #{fakeroot}/usr/bin/passenger-spawn-server #{libexecdir}/"
9c75736 @FooBarWidget Fix some Debian packaging issues.
FooBarWidget authored
768 sh "cp ext/apache2/ApplicationPoolServerExecutable #{libexecdir}/"
769
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
770 sh "mkdir -p #{docdir}"
771 sh "cp -R doc/* #{docdir}/"
0c888b8 @FooBarWidget Move passenger-spawn-server from /usr/bin to /usr/lib/passenger.
FooBarWidget authored
772 sh "rm", "-rf", *Dir["#{docdir}/{definitions.h,Doxyfile,template}"]
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
773 end
774
775 desc "Create a Debian package"
776 task 'package:debian' => :fakeroot do
7a3a4a0 @FooBarWidget Require 'fakeroot' and 'package:debian' tasks to be run as root (with…
FooBarWidget authored
777 if Process.euid != 0
778 STDERR.puts
779 STDERR.puts "*** ERROR: the 'package:debian' task must be run as root."
780 STDERR.puts
781 exit 1
782 end
783
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
784 fakeroot = "pkg/fakeroot"
6a16fe1 @FooBarWidget Set Debian package architecture to 'amd64' when on x86_64.
FooBarWidget authored
785 raw_arch = `uname -m`.strip
786 arch = case raw_arch
e19ac44 @jberkel Fix x86 regexp when building a Debian package. Patch by jan.berkel, f…
jberkel authored
787 when /^i.86$/
6a16fe1 @FooBarWidget Set Debian package architecture to 'amd64' when on x86_64.
FooBarWidget authored
788 "i386"
789 when /^x86_64/
790 "amd64"
791 else
792 raw_arch
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
793 end
794
795 sh "sed -i 's/Version: .*/Version: #{PACKAGE_VERSION}/' debian/control"
796 sh "cp -R debian #{fakeroot}/DEBIAN"
797 sh "sed -i 's/: any/: #{arch}/' #{fakeroot}/DEBIAN/control"
7a3a4a0 @FooBarWidget Require 'fakeroot' and 'package:debian' tasks to be run as root (with…
FooBarWidget authored
798 sh "chown -R root:root #{fakeroot}"
799 sh "dpkg -b #{fakeroot} pkg/passenger_#{PACKAGE_VERSION}-#{arch}.deb"
f51378b @FooBarWidget Add support for native Linux packages. Add Rake task for building a D…
FooBarWidget authored
800 end
801
0285eaf @FooBarWidget Seperate the Apache and Nginx clean tasks.
FooBarWidget authored
802
803 ##### Misc
804
0812844 @FooBarWidget Add 'sloccount' task and fix the package file list.
FooBarWidget authored
805 desc "Run 'sloccount' to see how much code Passenger has"
806 task :sloccount do
807 ENV['LC_ALL'] = 'C'
ff9a5b1 @FooBarWidget Correctly sloccount Ruby scripts in bin/
FooBarWidget authored
808 begin
809 # sloccount doesn't recognize the scripts in
810 # bin/ as Ruby, so we make symlinks with proper
811 # extensions.
812 tmpdir = ".sloccount"
813 system "rm -rf #{tmpdir}"
814 mkdir tmpdir
815 Dir['bin/*'].each do |file|
816 safe_ln file, "#{tmpdir}/#{File.basename(file)}.rb"
817 end
818 sh "sloccount", *Dir[
819 "#{tmpdir}/*",
cf8ceca @FooBarWidget Clean up the Rakefile and add a task for running the Nginx integratio…
FooBarWidget authored
820 "lib/phusion_passenger",
ff9a5b1 @FooBarWidget Correctly sloccount Ruby scripts in bin/
FooBarWidget authored
821 "lib/rake/{cplusplus,extensions}.rb",
822 "ext/apache2",
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
823 "ext/nginx",
45c4244 @FooBarWidget Fix sloccount
FooBarWidget authored
824 "ext/common",
f0a507f @FooBarWidget Integrate OXT into the build system.
FooBarWidget authored
825 "ext/oxt",
71d1513 @FooBarWidget Remove 'passenger' directory to 'phusion_passenger'.
FooBarWidget authored
826 "ext/phusion_passenger/*.c",
04263ed @FooBarWidget Integrate the Nginx code into the build system.
FooBarWidget authored
827 "test/**/*.{cpp,rb}",
ff9a5b1 @FooBarWidget Correctly sloccount Ruby scripts in bin/
FooBarWidget authored
828 "benchmark/*.{cpp,rb}"
829 ]
830 ensure
831 system "rm -rf #{tmpdir}"
832 end
0812844 @FooBarWidget Add 'sloccount' task and fix the package file list.
FooBarWidget authored
833 end
7215630 @FooBarWidget Write some release notes.
FooBarWidget authored
834
835 desc "Convert the NEWS items for the latest release to HTML"
836 task :news_as_html do
837 # The text is in the following format:
838 #
839 # Release x.x.x
840 # -------------
841 #
842 # * Text.
843 # * More text.
844 # * A header.
845 # With yet more text.
846 #
847 # Release y.y.y
848 # -------------
849 # .....
850 require 'cgi'
851 contents = File.read("NEWS")
852
853 # We're only interested in the latest release, so extract the text for that.
854 contents =~ /\A(Release.*?)^(Release|Older releases)/m
855
856 # Now split the text into individual items.
857 items = $1.split(/^ \*/)
858 items.shift # Delete the 'Release x.x.x' header.
859
860 puts "<dl>"
861 items.each do |item|
862 item.strip!
863
864 # Does this item have a header? It does if it consists of multiple lines, and
865 # the next line is capitalized.
866 lines = item.split("\n")
867 if lines.size > 1 && lines[1].strip[0..0] == lines[1].strip[0..0].upcase
868 puts "<dt>#{lines[0]}</dt>"
869 lines.shift
870 item = lines.join("\n")
871 item.strip!
872 end
873
874 # Split into paragraphs. Empty lines are paragraph dividers.
875 paragraphs = item.split(/^ *$/m)
876
877 def format_paragraph(text)
878 # Get rid of newlines: convert them into spaces.
879 text.gsub!("\n", ' ')
880 while text.index(' ')
881 text.gsub!(' ', ' ')
882 end
883
884 # Auto-link to issue tracker.
24cc3fa @FooBarWidget Continue writing release notes
FooBarWidget authored
885 text.gsub!(/(bug|issue) #(\d+)/i) do
7215630 @FooBarWidget Write some release notes.
FooBarWidget authored
886 url = "http://code.google.com/p/phusion-passenger/issues/detail?id=#{$2}"
24cc3fa @FooBarWidget Continue writing release notes
FooBarWidget authored
887 %Q(<{a href="#{url}"}>#{$1} ##{$2}<{/a}>)
7215630 @FooBarWidget Write some release notes.
FooBarWidget authored
888 end
889
890 text.strip!
24cc3fa @FooBarWidget Continue writing release notes
FooBarWidget authored
891 text = CGI.escapeHTML(text)
892 text.gsub!(%r(&lt;\{(.*?)\}&gt;(.*?)&lt;\{/(.*?)\}&gt;)) do
893 "<#{CGI.unescapeHTML $1}>#{$2}</#{CGI.unescapeHTML $3}>"
894 end
7215630 @FooBarWidget Write some release notes.
FooBarWidget authored
895 text
896 end
897
898 if paragraphs.size > 1
899 STDOUT.write("<dd>")
900 paragraphs.each do |paragraph|
901 paragraph.gsub!(/\A\n+/, '')
902 paragraph.gsub!(/\n+\Z/, '')
903
904 if (paragraph =~ /\A /)
905 # Looks like a code block.
906 paragraph.gsub!(/^ /m, '')
907 puts "<pre lang=\"ruby\">#{CGI.escapeHTML(paragraph)}</pre>"
908 else
909 puts "<p>#{format_paragraph(paragraph)}</p>"
910 end
911 end
912 STDOUT.write("</dd>\n")
913 else
914 puts "<dd>#{format_paragraph(item)}</dd>"
915 end
916 end
917 puts "</dl>"
918 end
Something went wrong with that request. Please try again.