build/apache2.rb in passenger-5.1.10 vs build/apache2.rb in passenger-5.1.11
- old
+ new
@@ -48,64 +48,80 @@
src/apache2_module/MergeDirConfig.cpp
src/apache2_module/ConfigurationSetters.cpp
src/apache2_module/SetHeaders.cpp
)
+let(:apache2_cflags) do
+ result = [PlatformInfo.apache2_module_cflags]
+ result << '-O' if OPTIMIZE
+ result.join(' ')
+end
+
+let(:apache2_cxxflags) do
+ result = [PlatformInfo.apache2_module_cxxflags]
+ result << '-O' if OPTIMIZE
+ result.join(' ')
+end
+
# Define compilation tasks for object files.
APACHE2_OBJECTS.each_pair do |object, source|
if source =~ /\.c$/
define_c_object_compilation_task(
object,
source,
- :include_paths => [
- "src/agent",
- *CXX_SUPPORTLIB_INCLUDE_PATHS
- ],
- :flags => PlatformInfo.apache2_module_cflags
+ lambda { {
+ :include_paths => [
+ "src/agent",
+ *CXX_SUPPORTLIB_INCLUDE_PATHS
+ ],
+ :flags => apache2_cflags
+ } }
)
else
define_cxx_object_compilation_task(
object,
source,
- :include_paths => [
- "src/agent",
- *CXX_SUPPORTLIB_INCLUDE_PATHS
- ],
- :flags => PlatformInfo.apache2_module_cxxflags
+ lambda { {
+ :include_paths => [
+ "src/agent",
+ *CXX_SUPPORTLIB_INCLUDE_PATHS
+ ],
+ :flags => apache2_cxxflags
+ } }
)
end
end
# Define compilation task for the Apache 2 module.
APACHE2_MODULE_BOOST_OXT_LIBRARY, APACHE2_MODULE_BOOST_OXT_LINKARG =
define_libboost_oxt_task("apache2",
APACHE2_OUTPUT_DIR + "module_libboost_oxt",
- PlatformInfo.apache2_module_cflags)
+ lambda { PlatformInfo.apache2_module_cflags })
APACHE2_MODULE_COMMON_LIBRARIES = COMMON_LIBRARY.
- only(:base, :bas64, 'AppTypes.o').
+ only(:base, :base64, 'AppTypes.o').
set_namespace("apache2").
set_output_dir(APACHE2_OUTPUT_DIR + "module_libpassenger_common").
- define_tasks(PlatformInfo.apache2_module_cflags).
+ define_tasks(lambda { PlatformInfo.apache2_module_cxxflags }).
link_objects
dependencies = [
APACHE2_MODULE_COMMON_LIBRARIES,
APACHE2_MODULE_BOOST_OXT_LIBRARY,
APACHE2_OBJECTS.keys
].flatten
file(APACHE2_TARGET => dependencies) do
- PlatformInfo.apxs2.nil? and raise "Could not find 'apxs' or 'apxs2'."
PlatformInfo.apache2ctl.nil? and raise "Could not find 'apachectl' or 'apache2ctl'."
PlatformInfo.httpd.nil? and raise "Could not find the Apache web server binary."
sh "mkdir -p #{APACHE2_OUTPUT_DIR}" if !File.directory?(APACHE2_OUTPUT_DIR)
create_shared_library(APACHE2_TARGET,
APACHE2_OBJECTS.keys,
:flags => [
APACHE2_MODULE_COMMON_LIBRARIES,
APACHE2_MODULE_BOOST_OXT_LINKARG,
PlatformInfo.apache2_module_cxx_ldflags,
- PlatformInfo.portability_cxx_ldflags
- ]
+ PlatformInfo.portability_cxx_ldflags,
+ OPTIMIZE ? '-O' : nil
+ ].compact
)
end
desc "Build Apache 2 module"
task :apache2 => [