passenger 5.1.10 → 5.1.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +18 -0
  3. data/Rakefile +20 -17
  4. data/bin/passenger-install-apache2-module +14 -11
  5. data/build/agent.rb +45 -18
  6. data/build/apache2.rb +32 -16
  7. data/build/basics.rb +29 -40
  8. data/build/common_library.rb +70 -54
  9. data/build/cxx_tests.rb +34 -43
  10. data/build/integration_tests.rb +10 -10
  11. data/build/misc.rb +6 -6
  12. data/build/node_tests.rb +1 -2
  13. data/build/oxt_tests.rb +7 -5
  14. data/build/packaging.rb +11 -441
  15. data/build/ruby_extension.rb +1 -1
  16. data/build/ruby_tests.rb +1 -2
  17. data/build/support/cplusplus.rb +6 -5
  18. data/build/support/cxx_dependency_map.rb +357 -833
  19. data/build/support/general.rb +23 -1
  20. data/build/test_basics.rb +3 -28
  21. data/dev/ci/tests/rpm/Jenkinsfile +68 -0
  22. data/dev/ci/tests/rpm/run +63 -0
  23. data/dev/ci/tests/source-packaging/run +1 -1
  24. data/dev/ci/tests/source-packaging/setup +1 -1
  25. data/doc/{Packaging.txt.md → Packaging.md} +0 -0
  26. data/resources/templates/apache2/deployment_example.txt.erb +2 -2
  27. data/resources/templates/apache2/multiple_apache_installations_detected.txt.erb +2 -2
  28. data/resources/templates/nginx/deployment_example.txt.erb +1 -1
  29. data/resources/templates/standalone/mass_deployment_default_server.erb +2 -2
  30. data/resources/templates/standalone/server.erb +2 -2
  31. data/src/agent/AgentMain.cpp +0 -4
  32. data/src/agent/Core/CoreMain.cpp +88 -5
  33. data/src/agent/Core/SpawningKit/Spawner.h +2 -1
  34. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1109 -0
  35. data/src/agent/Shared/Fundamentals/AbortHandler.h +63 -0
  36. data/src/agent/Shared/Fundamentals/Implementation.cpp +7 -0
  37. data/src/agent/Shared/Fundamentals/Initialization.cpp +614 -0
  38. data/src/agent/Shared/{Base.h → Fundamentals/Initialization.h} +23 -14
  39. data/src/agent/Shared/Fundamentals/Utils.cpp +127 -0
  40. data/src/agent/Shared/Fundamentals/Utils.h +46 -0
  41. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
  42. data/src/agent/Watchdog/CoreWatcher.cpp +3 -1
  43. data/src/agent/Watchdog/InstanceDirToucher.cpp +90 -53
  44. data/src/agent/Watchdog/WatchdogMain.cpp +13 -29
  45. data/src/apache2_module/Hooks.cpp +4 -1
  46. data/src/cxx_supportlib/ConfigKit/Store.h +32 -5
  47. data/src/cxx_supportlib/Constants.h +1 -2
  48. data/src/cxx_supportlib/Crypto.cpp +2 -1
  49. data/src/cxx_supportlib/Hooks.h +16 -37
  50. data/src/cxx_supportlib/LoggingKit/Context.h +22 -0
  51. data/src/cxx_supportlib/LoggingKit/Forward.h +1 -0
  52. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +106 -22
  53. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +106 -0
  54. data/src/{agent/UstRouter/FileSink.h → cxx_supportlib/ProcessManagement/Ruby.h} +23 -47
  55. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +199 -0
  56. data/src/cxx_supportlib/ProcessManagement/Spawn.h +150 -0
  57. data/src/cxx_supportlib/ProcessManagement/Utils.cpp +459 -0
  58. data/src/cxx_supportlib/ProcessManagement/Utils.h +107 -0
  59. data/src/cxx_supportlib/Utils.cpp +41 -561
  60. data/src/cxx_supportlib/Utils.h +0 -68
  61. data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +187 -0
  62. data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +14 -2
  63. data/src/cxx_supportlib/WatchdogLauncher.h +2 -12
  64. data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +2 -2
  65. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +4 -0
  66. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +16 -1
  67. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +12 -9
  68. data/src/cxx_supportlib/vendor-modified/libev/ev++.h +4 -4
  69. data/src/cxx_supportlib/vendor-modified/libev/ev.h +3 -3
  70. data/src/nginx_module/CacheLocationConfig.c +0 -75
  71. data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +1 -0
  72. data/src/nginx_module/Configuration.c +0 -1
  73. data/src/nginx_module/Configuration.h +0 -1
  74. data/src/nginx_module/ConfigurationCommands.c +1 -1
  75. data/src/nginx_module/ContentHandler.c +0 -1
  76. data/src/nginx_module/ContentHandler.h +0 -1
  77. data/src/nginx_module/CreateLocationConfig.c +0 -5
  78. data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +1 -0
  79. data/src/nginx_module/LocationConfig.h +0 -4
  80. data/src/nginx_module/LocationConfig.h.cxxcodebuilder +2 -1
  81. data/src/nginx_module/MergeLocationConfig.c +0 -12
  82. data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +1 -0
  83. data/src/nginx_module/ngx_http_passenger_module.h +0 -1
  84. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  85. data/src/ruby_supportlib/phusion_passenger/common_library.rb +20 -11
  86. data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
  87. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +0 -1
  88. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +10 -3
  89. data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +3 -1
  90. data/src/ruby_supportlib/phusion_passenger/constants.rb +0 -1
  91. data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
  92. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +32 -6
  93. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +0 -1
  94. data/src/ruby_supportlib/phusion_passenger/packaging.rb +2 -4
  95. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +101 -20
  96. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +21 -9
  97. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +34 -31
  98. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +3 -1
  99. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +2 -14
  100. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +40 -3
  101. data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +15 -14
  102. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
  103. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
  104. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +8 -3
  105. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +19 -18
  106. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +6 -1
  107. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +17 -1
  108. metadata +19 -97
  109. data/build/documentation.rb +0 -70
  110. data/doc/CloudLicensingConfiguration.html +0 -172
  111. data/doc/CloudLicensingConfiguration.txt.md +0 -3
  112. data/doc/Packaging.html +0 -488
  113. data/doc/Security of user switching support.idmap.txt +0 -34
  114. data/doc/Security of user switching support.txt +0 -197
  115. data/doc/ServerOptimizationGuide.html +0 -172
  116. data/doc/ServerOptimizationGuide.txt.md +0 -3
  117. data/doc/images/by_sa.png +0 -0
  118. data/doc/images/cloud_licensing_batch_job.png +0 -0
  119. data/doc/images/code_walkthrough.jpg +0 -0
  120. data/doc/images/direct_spawning.png +0 -0
  121. data/doc/images/direct_spawning.svg +0 -251
  122. data/doc/images/glyphicons-halflings-white.png +0 -0
  123. data/doc/images/glyphicons-halflings.png +0 -0
  124. data/doc/images/icons/README +0 -5
  125. data/doc/images/icons/callouts/1.png +0 -0
  126. data/doc/images/icons/callouts/10.png +0 -0
  127. data/doc/images/icons/callouts/11.png +0 -0
  128. data/doc/images/icons/callouts/12.png +0 -0
  129. data/doc/images/icons/callouts/13.png +0 -0
  130. data/doc/images/icons/callouts/14.png +0 -0
  131. data/doc/images/icons/callouts/15.png +0 -0
  132. data/doc/images/icons/callouts/2.png +0 -0
  133. data/doc/images/icons/callouts/3.png +0 -0
  134. data/doc/images/icons/callouts/4.png +0 -0
  135. data/doc/images/icons/callouts/5.png +0 -0
  136. data/doc/images/icons/callouts/6.png +0 -0
  137. data/doc/images/icons/callouts/7.png +0 -0
  138. data/doc/images/icons/callouts/8.png +0 -0
  139. data/doc/images/icons/callouts/9.png +0 -0
  140. data/doc/images/icons/caution.png +0 -0
  141. data/doc/images/icons/example.png +0 -0
  142. data/doc/images/icons/home.png +0 -0
  143. data/doc/images/icons/important.png +0 -0
  144. data/doc/images/icons/next.png +0 -0
  145. data/doc/images/icons/note.png +0 -0
  146. data/doc/images/icons/prev.png +0 -0
  147. data/doc/images/icons/tip.png +0 -0
  148. data/doc/images/icons/up.png +0 -0
  149. data/doc/images/icons/warning.png +0 -0
  150. data/doc/images/many_web_framework_protocols.png +0 -0
  151. data/doc/images/passenger_architecture.png +0 -0
  152. data/doc/images/passenger_architecture.svg +0 -385
  153. data/doc/images/passenger_architecture_overview.png +0 -0
  154. data/doc/images/passenger_core_architecture.png +0 -0
  155. data/doc/images/passenger_nodejs_architecture.svg +0 -558
  156. data/doc/images/phusion_banner.png +0 -0
  157. data/doc/images/rack.png +0 -0
  158. data/doc/images/smart_spawning.png +0 -0
  159. data/doc/images/smart_spawning.svg +0 -323
  160. data/doc/images/spawn_server_architecture.png +0 -0
  161. data/doc/images/spawn_server_architecture.svg +0 -655
  162. data/doc/images/spawning_preparation_work.png +0 -0
  163. data/doc/images/startup_sequence.png +0 -0
  164. data/doc/images/typical_isolated_web_application.png +0 -0
  165. data/doc/images/typical_isolated_web_application.svg +0 -213
  166. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +0 -1
  167. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +0 -61
  168. data/doc/users_guide_snippets/appendix_a_about.txt +0 -13
  169. data/doc/users_guide_snippets/appendix_b_terminology.txt +0 -71
  170. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +0 -36
  171. data/doc/users_guide_snippets/deployment_basics.txt +0 -37
  172. data/doc/users_guide_snippets/enterprise_only.txt +0 -1
  173. data/doc/users_guide_snippets/environment_variables.txt +0 -44
  174. data/doc/users_guide_snippets/global_queueing_explained.txt +0 -74
  175. data/doc/users_guide_snippets/installation.txt +0 -228
  176. data/doc/users_guide_snippets/installation/run_installer.txt +0 -58
  177. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +0 -6
  178. data/doc/users_guide_snippets/passenger_spawn_method.txt +0 -37
  179. data/doc/users_guide_snippets/rackup_specifications.txt +0 -1
  180. data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -44
  181. data/doc/users_guide_snippets/since_version.txt +0 -1
  182. data/doc/users_guide_snippets/support_information.txt +0 -8
  183. data/doc/users_guide_snippets/tips.txt +0 -302
  184. data/doc/users_guide_snippets/troubleshooting/default.txt +0 -48
  185. data/doc/users_guide_snippets/troubleshooting/rails.txt +0 -59
  186. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +0 -24
  187. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +0 -10
  188. data/doc/users_guide_snippets/where_to_get_support.txt +0 -9
  189. data/src/agent/Shared/Base.cpp +0 -1678
  190. data/src/agent/UstRouter/ApiServer.h +0 -292
  191. data/src/agent/UstRouter/Client.h +0 -112
  192. data/src/agent/UstRouter/Controller.h +0 -1309
  193. data/src/agent/UstRouter/LogSink.h +0 -145
  194. data/src/agent/UstRouter/OptionParser.h +0 -180
  195. data/src/agent/UstRouter/RemoteSender.h +0 -853
  196. data/src/agent/UstRouter/RemoteSink.h +0 -145
  197. data/src/agent/UstRouter/Transaction.h +0 -278
  198. data/src/agent/UstRouter/UstRouterMain.cpp +0 -681
  199. data/src/agent/Watchdog/UstRouterWatcher.cpp +0 -80
  200. data/src/ruby_supportlib/phusion_passenger/platform_info/macos.rb +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e20b037aaef74394247443777fc16afe26f0691
4
- data.tar.gz: bddc866fe0e4e2d56805e70904bb3b7c3a50fb5e
3
+ metadata.gz: 1dcd88ceab959baa6975ea6d4305a925af272321
4
+ data.tar.gz: 44883c1837663f92487534c6069ba313a53062d8
5
5
  SHA512:
6
- metadata.gz: '0585c5cb8e3313c4d6c85a134f7f212dd32b0553c4a22ec806502af8baa0f83c77530dfbcc8d3ae25a42adafa8cea3f329c9444f9e7e6435f7063365b7587d66'
7
- data.tar.gz: 8d3054d1a05cd1fcff2ef2802e612dc72ba78d0529c5e7b027ce76480f4c8ed0360c8fa5961e8a17bbb799be40048cd17110eafa2fb4bd5c4fa755b6a7813123
6
+ metadata.gz: b7946c6e1585492f3f6e05e153893ef54b403e2850844ecafa228408d2f03168cd12e61cfdbe33735145d3d047b07375911e09b3c7b5bef52c5fd8978a0f80c1
7
+ data.tar.gz: 88bd249512da994cb367ec337be1e0ca9a986f017f1a911cbe5d4cd45f2880ff9fad63a68563b8d90fecdd3000f265b3048ef5d88155868f6c9aee20a3a74f06
data/CHANGELOG CHANGED
@@ -1,3 +1,21 @@
1
+ Release 5.1.11
2
+ --------------
3
+
4
+ * [Apache] Fixes a race condition (segfault) on startup, which primarily affected macOS hosts (regression in 5.1.8 due to the logging improvements). Closes GH-1973.
5
+ * [Apache] Fixes compilation on macOS 10.13 High Sierra.
6
+ * [Nginx] It is now allowed to specify `passenger_enabled` in the `http` context as well.
7
+ * [Nginx] Namespaced Jsoncpp under the Passenger namespace to avoid collisions with Google Pagespeed's copy when linked into Nginx.
8
+ * [Standalone] Enables HTTP/2 support in the Nginx template. Support is only active if SSL is used, to avoid potential issues with HTTP/2 on HTTP ports. Closes GH-1945.
9
+ * [Enterprise, Standalone] Adds a new feature that is especially useful on Heroku: deferred port binding. When `--defer-port-binding` is set, Passenger does not listen on the given port until the application has finished spawning. If the application starts slowly then this mechanism can prevent the Heroku request timeout from killing the dyno (the boot timeout still applies).
10
+ * [Enterprise, Standalone] Fixes duplicate warnings when Passengerfile.json contains errors.
11
+ * [Standalone] `passenger start` now accepts the `--start-timeout` configuration option.
12
+ * Adds support for Bundler 2.0's new `gems.rb` and `gems.locked`. Learn more about these in [Gemfile's new clothes](https://depfu.com/blog/2017/09/06/gemfiles-new-clothes). Closes GH-1982.
13
+ * Removes Debian packages for Ubuntu 12.04 Precise.
14
+ * Fixes compilation warnings on macOS + Clang 9.0.
15
+ * Introduces a new check that logs a vulnerability warning if Passenger is run with root permissions while the directory permissions of (parts of) its root dir allow modifications by non-root users.
16
+ * Fixes an arbitrary file read vulnerability (if Passenger is running as root and the attacker has access to a user account that hosts an application).
17
+
18
+
1
19
  Release 5.1.10
2
20
  --------------
3
21
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (C) 2008-2016 Phusion Holding B.V.
2
+ # Copyright (C) 2008-2017 Phusion Holding B.V.
3
3
  #
4
4
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
5
5
  # trademarks of Phusion Holding B.V.
@@ -38,25 +38,28 @@ if defined?(Bundler)
38
38
  end
39
39
  end
40
40
 
41
+ def require_build_system_file(name)
42
+ require "#{SOURCE_ROOT}/build/#{name}"
43
+ end
44
+
41
45
  require("#{SOURCE_ROOT}/config") if File.exist?("#{SOURCE_ROOT}/config.rb")
42
- require 'build/basics'
46
+ require_build_system_file 'basics'
43
47
  if boolean_option('ONLY_RUBY')
44
- require 'build/ruby_extension'
48
+ require_build_system_file 'ruby_extension'
45
49
  else
46
- require 'build/ruby_extension'
47
- require 'build/common_library'
48
- require 'build/agent'
49
- require 'build/apache2'
50
- require 'build/nginx'
51
- require 'build/documentation'
52
- require 'build/packaging'
53
- require 'build/test_basics'
54
- require 'build/oxt_tests'
55
- require 'build/cxx_tests'
56
- require 'build/ruby_tests'
57
- require 'build/node_tests'
58
- require 'build/integration_tests'
59
- require 'build/misc'
50
+ require_build_system_file 'ruby_extension'
51
+ require_build_system_file 'common_library'
52
+ require_build_system_file 'agent'
53
+ require_build_system_file 'apache2'
54
+ require_build_system_file 'nginx'
55
+ require_build_system_file 'packaging'
56
+ require_build_system_file 'test_basics'
57
+ require_build_system_file 'oxt_tests'
58
+ require_build_system_file 'cxx_tests'
59
+ require_build_system_file 'ruby_tests'
60
+ require_build_system_file 'node_tests'
61
+ require_build_system_file 'integration_tests'
62
+ require_build_system_file 'misc'
60
63
  end
61
64
 
62
65
  #### Default tasks
@@ -49,7 +49,6 @@ PhusionPassenger.require_passenger_lib 'constants'
49
49
  PhusionPassenger.require_passenger_lib 'platform_info/ruby'
50
50
  PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
51
51
  PhusionPassenger.require_passenger_lib 'platform_info/linux'
52
- PhusionPassenger.require_passenger_lib 'platform_info/macos'
53
52
  PhusionPassenger.require_passenger_lib 'platform_info/apache'
54
53
  PhusionPassenger.require_passenger_lib 'platform_info/apache_detector'
55
54
  PhusionPassenger.require_passenger_lib 'abstract_installer'
@@ -77,10 +76,8 @@ class Installer < PhusionPassenger::AbstractInstaller
77
76
  'cc',
78
77
  'c++',
79
78
  'libcurl-dev',
80
- 'openssl-dev',
81
79
  'zlib-dev',
82
80
  'apache2',
83
- 'apache2-dev',
84
81
  'rake',
85
82
  'ruby-openssl',
86
83
  'rubygems'
@@ -91,25 +88,29 @@ class Installer < PhusionPassenger::AbstractInstaller
91
88
  end
92
89
  ids << 'rack'
93
90
  end
91
+ # On macOS our Crypto.cpp uses TransportSecurity instead of OpenSSL.
92
+ if PlatformInfo.os_name_simple != 'macosx'
93
+ ids << 'openssl-dev'
94
+ end
95
+ if PlatformInfo.apxs2_needed_for_building_apache_modules?
96
+ ids << 'apache2-dev'
97
+ end
94
98
  # Some broken servers don't have apr-config or apu-config installed.
95
99
  # Nevertheless, it is possible to compile Apache modules if Apache
96
100
  # was configured with --included-apr. So here we check whether
97
101
  # apr-config and apu-config are available. If they're not available,
98
102
  # then we only register them as required dependency if no Apache
99
103
  # module can be compiled without their presence.
100
- if needs_apr_and_apu
104
+ if needs_apr_and_apu?
101
105
  ids << 'apr-dev'
102
106
  ids << 'apu-dev'
103
107
  end
104
108
  return [specs, ids]
105
109
  end
106
110
 
107
- def needs_apr_and_apu
108
- ((PlatformInfo.apr_config && PlatformInfo.apu_config) ||
109
- PlatformInfo.apr_config_needed_for_building_apache_modules?) &&
110
- (PlatformInfo.apxs2 == '/usr/sbin/apxs' &&
111
- (PlatformInfo.os_name_simple != "macosx" ||
112
- PlatformInfo.macos_version < 12))
111
+ def needs_apr_and_apu?
112
+ (PlatformInfo.apr_config && PlatformInfo.apu_config) ||
113
+ PlatformInfo.apr_config_needed_for_building_apache_modules?
113
114
  end
114
115
 
115
116
  def install_doc_url
@@ -260,8 +261,10 @@ private
260
261
  :other_installs => other_installs
261
262
  puts
262
263
  if interactive?
264
+ # @apache.apxs2 can be nil, which on macOS >= 10.13 High Sierra
265
+ # means that we're using the OS-provided Apache installation.
263
266
  result = prompt_confirmation "Are you sure you want to install " +
264
- "against Apache #{@apache2.version} (#{@apache2.apxs2})?"
267
+ "against Apache #{@apache2.version} (#{@apache2.apxs2 || 'OS-provided install'})?"
265
268
  if !result
266
269
  puts
267
270
  line
@@ -22,13 +22,13 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- AGENT_TARGET = "#{AGENT_OUTPUT_DIR}#{AGENT_EXE}"
25
+ AGENT_TARGET = "#{AGENT_OUTPUT_DIR}#{PhusionPassenger::AGENT_EXE}"
26
26
  AGENT_MAIN_OBJECT = "#{AGENT_OUTPUT_DIR}AgentMain.o"
27
27
  AGENT_OBJECTS = {
28
28
  AGENT_MAIN_OBJECT =>
29
29
  "src/agent/AgentMain.cpp",
30
- "#{AGENT_OUTPUT_DIR}AgentBase.o" =>
31
- "src/agent/Shared/Base.cpp",
30
+ "#{AGENT_OUTPUT_DIR}AgentFundamentals.o" =>
31
+ "src/agent/Shared/Fundamentals/Implementation.cpp",
32
32
  "#{AGENT_OUTPUT_DIR}WatchdogMain.o" =>
33
33
  "src/agent/Watchdog/WatchdogMain.cpp",
34
34
  "#{AGENT_OUTPUT_DIR}CoreMain.o" =>
@@ -37,8 +37,6 @@ AGENT_OBJECTS = {
37
37
  "src/agent/Core/ApplicationPool/Implementation.cpp",
38
38
  "#{AGENT_OUTPUT_DIR}CoreController.o" =>
39
39
  "src/agent/Core/Controller/Implementation.cpp",
40
- "#{AGENT_OUTPUT_DIR}UstRouterMain.o" =>
41
- "src/agent/UstRouter/UstRouterMain.cpp",
42
40
  "#{AGENT_OUTPUT_DIR}SystemMetricsMain.o" =>
43
41
  "src/agent/SystemMetrics/SystemMetricsMain.cpp",
44
42
  "#{AGENT_OUTPUT_DIR}TempDirToucherMain.o" =>
@@ -47,28 +45,54 @@ AGENT_OBJECTS = {
47
45
  "src/agent/SpawnPreparer/SpawnPreparerMain.cpp"
48
46
  }
49
47
 
48
+ # Agent-specific compiler flags.
49
+ let(:agent_cflags) do
50
+ result = []
51
+ result << '-O' if OPTIMIZE
52
+ result << '-DUSE_SELINUX' if USE_SELINUX
53
+ result << '-flto' if LTO
54
+ result << PlatformInfo.adress_sanitizer_flag if USE_ASAN
55
+ result.join(' ')
56
+ end
57
+
58
+ # Agent-specific linker flags.
59
+ let(:agent_ldflags) do
60
+ result = []
61
+ result << '-O' if OPTIMIZE
62
+ result << '-flto' if LTO
63
+ result << PlatformInfo.adress_sanitizer_flag if USE_ASAN
64
+ result << '-lselinux' if USE_SELINUX
65
+ # Extra linker flags for backtrace_symbols() to generate useful output (see agent/Base.cpp).
66
+ result << PlatformInfo.export_dynamic_flags
67
+ # Enable dead symbol elimination on OS X.
68
+ result << '-Wl,-dead_strip' if PlatformInfo.os_name_simple == 'macosx'
69
+ result.join(' ')
70
+ end
71
+
50
72
  # Define compilation tasks for object files.
51
73
  AGENT_OBJECTS.each_pair do |object, source|
52
74
  define_cxx_object_compilation_task(
53
75
  object,
54
76
  source,
55
- :include_paths => [
56
- "src/agent",
57
- *CXX_SUPPORTLIB_INCLUDE_PATHS
58
- ],
59
- :flags => [
60
- AGENT_CFLAGS,
61
- LIBEV_CFLAGS,
62
- LIBUV_CFLAGS,
63
- PlatformInfo.curl_flags,
64
- PlatformInfo.zlib_flags
65
- ]
77
+ lambda { {
78
+ :include_paths => [
79
+ "src/agent",
80
+ *CXX_SUPPORTLIB_INCLUDE_PATHS
81
+ ],
82
+ :flags => [
83
+ agent_cflags,
84
+ libev_cflags,
85
+ libuv_cflags,
86
+ PlatformInfo.curl_flags,
87
+ PlatformInfo.zlib_flags
88
+ ]
89
+ } }
66
90
  )
67
91
  end
68
92
 
69
93
  # Define compilation task for the agent executable.
70
94
  agent_libs = COMMON_LIBRARY.
71
- only(:base, :bas64, :union_station_filter, :other).
95
+ only(:base, :base64, :union_station_filter, :process_management_ruby, :other).
72
96
  exclude('WatchdogLauncher.o')
73
97
  dependencies = AGENT_OBJECTS.keys + [
74
98
  LIBBOOST_OXT,
@@ -91,11 +115,14 @@ file(AGENT_TARGET => dependencies) do
91
115
  PlatformInfo.zlib_libs,
92
116
  PlatformInfo.crypto_libs,
93
117
  PlatformInfo.portability_cxx_ldflags,
94
- AGENT_LDFLAGS
118
+ agent_ldflags
95
119
  ]
96
120
  )
97
121
  end
98
122
 
123
+ desc 'Build the agent'
124
+ task :agent => AGENT_TARGET
125
+
99
126
  task 'common:clean' do
100
127
  sh "rm -rf #{AGENT_OUTPUT_DIR}"
101
128
  end
@@ -50,27 +50,43 @@ APACHE2_AUTOGENERATED_SOURCES = %w(
50
50
  src/apache2_module/SetHeaders.cpp
51
51
  )
52
52
 
53
+ let(:apache2_cflags) do
54
+ result = [PlatformInfo.apache2_module_cflags]
55
+ result << '-O' if OPTIMIZE
56
+ result.join(' ')
57
+ end
58
+
59
+ let(:apache2_cxxflags) do
60
+ result = [PlatformInfo.apache2_module_cxxflags]
61
+ result << '-O' if OPTIMIZE
62
+ result.join(' ')
63
+ end
64
+
53
65
  # Define compilation tasks for object files.
54
66
  APACHE2_OBJECTS.each_pair do |object, source|
55
67
  if source =~ /\.c$/
56
68
  define_c_object_compilation_task(
57
69
  object,
58
70
  source,
59
- :include_paths => [
60
- "src/agent",
61
- *CXX_SUPPORTLIB_INCLUDE_PATHS
62
- ],
63
- :flags => PlatformInfo.apache2_module_cflags
71
+ lambda { {
72
+ :include_paths => [
73
+ "src/agent",
74
+ *CXX_SUPPORTLIB_INCLUDE_PATHS
75
+ ],
76
+ :flags => apache2_cflags
77
+ } }
64
78
  )
65
79
  else
66
80
  define_cxx_object_compilation_task(
67
81
  object,
68
82
  source,
69
- :include_paths => [
70
- "src/agent",
71
- *CXX_SUPPORTLIB_INCLUDE_PATHS
72
- ],
73
- :flags => PlatformInfo.apache2_module_cxxflags
83
+ lambda { {
84
+ :include_paths => [
85
+ "src/agent",
86
+ *CXX_SUPPORTLIB_INCLUDE_PATHS
87
+ ],
88
+ :flags => apache2_cxxflags
89
+ } }
74
90
  )
75
91
  end
76
92
  end
@@ -79,12 +95,12 @@ end
79
95
  APACHE2_MODULE_BOOST_OXT_LIBRARY, APACHE2_MODULE_BOOST_OXT_LINKARG =
80
96
  define_libboost_oxt_task("apache2",
81
97
  APACHE2_OUTPUT_DIR + "module_libboost_oxt",
82
- PlatformInfo.apache2_module_cflags)
98
+ lambda { PlatformInfo.apache2_module_cflags })
83
99
  APACHE2_MODULE_COMMON_LIBRARIES = COMMON_LIBRARY.
84
- only(:base, :bas64, 'AppTypes.o').
100
+ only(:base, :base64, 'AppTypes.o').
85
101
  set_namespace("apache2").
86
102
  set_output_dir(APACHE2_OUTPUT_DIR + "module_libpassenger_common").
87
- define_tasks(PlatformInfo.apache2_module_cflags).
103
+ define_tasks(lambda { PlatformInfo.apache2_module_cxxflags }).
88
104
  link_objects
89
105
  dependencies = [
90
106
  APACHE2_MODULE_COMMON_LIBRARIES,
@@ -92,7 +108,6 @@ dependencies = [
92
108
  APACHE2_OBJECTS.keys
93
109
  ].flatten
94
110
  file(APACHE2_TARGET => dependencies) do
95
- PlatformInfo.apxs2.nil? and raise "Could not find 'apxs' or 'apxs2'."
96
111
  PlatformInfo.apache2ctl.nil? and raise "Could not find 'apachectl' or 'apache2ctl'."
97
112
  PlatformInfo.httpd.nil? and raise "Could not find the Apache web server binary."
98
113
 
@@ -103,8 +118,9 @@ file(APACHE2_TARGET => dependencies) do
103
118
  APACHE2_MODULE_COMMON_LIBRARIES,
104
119
  APACHE2_MODULE_BOOST_OXT_LINKARG,
105
120
  PlatformInfo.apache2_module_cxx_ldflags,
106
- PlatformInfo.portability_cxx_ldflags
107
- ]
121
+ PlatformInfo.portability_cxx_ldflags,
122
+ OPTIMIZE ? '-O' : nil
123
+ ].compact
108
124
  )
109
125
  end
110
126
 
@@ -43,12 +43,19 @@ PhusionPassenger.require_passenger_lib 'platform_info/crypto'
43
43
  PhusionPassenger.require_passenger_lib 'platform_info/compiler'
44
44
  PhusionPassenger.require_passenger_lib 'platform_info/cxx_portability'
45
45
 
46
- include PhusionPassenger
47
- include PhusionPassenger::PlatformInfo
46
+ PlatformInfo = PhusionPassenger::PlatformInfo
47
+ SHORT_PROGRAM_NAME = PhusionPassenger::SHORT_PROGRAM_NAME
48
+ PhusionPassenger::SharedConstants.constants.each do |name|
49
+ Kernel.const_set(name, PhusionPassenger::SharedConstants.const_get(name))
50
+ end
48
51
 
49
- require 'build/support/cxx_dependency_map'
50
- require 'build/support/general'
51
- require 'build/support/cplusplus'
52
+ if File.exist?("#{SOURCE_ROOT}/build/support/cxx_dependency_map.rb")
53
+ require_build_system_file 'support/cxx_dependency_map'
54
+ else
55
+ CXX_DEPENDENCY_MAP = {}
56
+ end
57
+ require_build_system_file 'support/general'
58
+ require_build_system_file 'support/cplusplus'
52
59
 
53
60
  if string_option('OUTPUT_DIR')
54
61
  OUTPUT_DIR = string_option('OUTPUT_DIR') + "/"
@@ -56,7 +63,6 @@ else
56
63
  OUTPUT_DIR = "buildout/"
57
64
  end
58
65
 
59
- verbose true if !boolean_option('REALLY_QUIET')
60
66
  if boolean_option('STDERR_TO_STDOUT')
61
67
  # Just redirecting the file descriptor isn't enough because
62
68
  # data written to STDERR might arrive in an unexpected order
@@ -82,11 +88,10 @@ PACKAGE_VERSION = PhusionPassenger::VERSION_STRING
82
88
  MAINTAINER_NAME = "Phusion"
83
89
  MAINTAINER_EMAIL = "info@phusion.nl"
84
90
 
85
- CC = maybe_wrap_in_ccache(PhusionPassenger::PlatformInfo.cc)
86
- CXX = maybe_wrap_in_ccache(PhusionPassenger::PlatformInfo.cxx)
87
- LIBEXT = PlatformInfo.library_extension
88
- USE_DMALLOC = boolean_option('USE_DMALLOC')
89
- USE_EFENCE = boolean_option('USE_EFENCE')
91
+ let(:cc) { maybe_wrap_in_ccache(PhusionPassenger::PlatformInfo.cc) }
92
+ let(:cxx) { maybe_wrap_in_ccache(PhusionPassenger::PlatformInfo.cxx) }
93
+ let(:libext) { PlatformInfo.library_extension }
94
+
90
95
  USE_ASAN = boolean_option('USE_ASAN')
91
96
  USE_SELINUX = boolean_option('USE_SELINUX')
92
97
  OPTIMIZE = boolean_option('OPTIMIZE')
@@ -98,40 +103,24 @@ CXX_SUPPORTLIB_INCLUDE_PATHS = [
98
103
  "src/cxx_supportlib/vendor-modified"
99
104
  ]
100
105
 
101
- # Agent-specific compiler flags.
102
- AGENT_CFLAGS = ""
103
- AGENT_CFLAGS << " -O" if OPTIMIZE
104
- AGENT_CFLAGS << " -DUSE_SELINUX" if USE_SELINUX
105
- AGENT_CFLAGS << " -flto" if LTO
106
- AGENT_CFLAGS << " #{PlatformInfo.adress_sanitizer_flag}" if USE_ASAN
107
- AGENT_CFLAGS.strip!
108
-
109
- # Agent-specific linker flags.
110
- AGENT_LDFLAGS = ""
111
- AGENT_LDFLAGS << " -O" if OPTIMIZE
112
- AGENT_LDFLAGS << " -flto" if LTO
113
- AGENT_LDFLAGS << " #{PlatformInfo.dmalloc_ldflags}" if USE_DMALLOC
114
- AGENT_LDFLAGS << " #{PlatformInfo.electric_fence_ldflags}" if USE_EFENCE
115
- AGENT_LDFLAGS << " #{PlatformInfo.adress_sanitizer_flag}" if USE_ASAN
116
- AGENT_LDFLAGS << " -lselinux" if USE_SELINUX
117
- # Extra linker flags for backtrace_symbols() to generate useful output (see agent/Base.cpp).
118
- AGENT_LDFLAGS << " #{PlatformInfo.export_dynamic_flags}"
119
- # Enable dead symbol elimination on OS X.
120
- AGENT_LDFLAGS << " -Wl,-dead_strip" if PlatformInfo.os_name_simple == "macosx"
121
- AGENT_LDFLAGS.strip!
122
-
123
106
  # Extra compiler flags that should always be passed to the C/C++ compiler.
124
107
  # These should be included first in the command string, before anything else.
125
108
  EXTRA_PRE_CFLAGS = compiler_flag_option('EXTRA_PRE_CFLAGS')
126
109
  EXTRA_PRE_CXXFLAGS = compiler_flag_option('EXTRA_PRE_CXXFLAGS')
127
110
  # These should be included last in the command string.
128
- EXTRA_CFLAGS = PlatformInfo.default_extra_cflags.dup
129
- EXTRA_CFLAGS << " " << compiler_flag_option('EXTRA_CFLAGS') if !compiler_flag_option('EXTRA_CFLAGS').empty?
130
- EXTRA_CXXFLAGS = PlatformInfo.default_extra_cxxflags.dup
131
- EXTRA_CXXFLAGS << " " << compiler_flag_option('EXTRA_CXXFLAGS') if !compiler_flag_option('EXTRA_CXXFLAGS').empty?
132
- [EXTRA_CFLAGS, EXTRA_CXXFLAGS].each do |flags|
133
- flags << " -fno-omit-frame-pointers" if USE_ASAN
134
- flags << " -DPASSENGER_DISABLE_THREAD_LOCAL_STORAGE" if !boolean_option('PASSENGER_THREAD_LOCAL_STORAGE', true)
111
+ let(:extra_cflags) do
112
+ result = PlatformInfo.default_extra_cflags.dup
113
+ result << " " << compiler_flag_option('EXTRA_CFLAGS') if !compiler_flag_option('EXTRA_CFLAGS').empty?
114
+ result << " -fno-omit-frame-pointer" if USE_ASAN
115
+ result << " -DPASSENGER_DISABLE_THREAD_LOCAL_STORAGE" if !boolean_option('PASSENGER_THREAD_LOCAL_STORAGE', true)
116
+ result
117
+ end
118
+ let(:extra_cxxflags) do
119
+ result = PlatformInfo.default_extra_cxxflags.dup
120
+ result << " " << compiler_flag_option('EXTRA_CXXFLAGS') if !compiler_flag_option('EXTRA_CXXFLAGS').empty?
121
+ result << " -fno-omit-frame-pointer" if USE_ASAN
122
+ result << " -DPASSENGER_DISABLE_THREAD_LOCAL_STORAGE" if !boolean_option('PASSENGER_THREAD_LOCAL_STORAGE', true)
123
+ result
135
124
  end
136
125
 
137
126
  # Extra linker flags that should always be passed to the linker.