passenger 4.0.48 → 4.0.49

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 (218) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +36 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG +16 -0
  7. data/Rakefile +0 -1
  8. data/build/apache2.rb +4 -4
  9. data/build/common_library.rb +18 -18
  10. data/build/cplusplus_support.rb +2 -2
  11. data/build/documentation.rb +1 -1
  12. data/build/integration_tests.rb +12 -4
  13. data/build/misc.rb +12 -7
  14. data/build/packaging.rb +14 -14
  15. data/build/preprocessor.rb +10 -10
  16. data/build/rake_extensions.rb +11 -11
  17. data/build/ruby_extension.rb +2 -2
  18. data/dev/ci/inituidgid +24 -0
  19. data/dev/ci/run_jenkins.sh +57 -0
  20. data/dev/ci/run_rpm_tests.sh +77 -0
  21. data/dev/{run_travis.sh → ci/run_travis.sh} +60 -4
  22. data/doc/Users guide Nginx.txt +2 -2
  23. data/doc/users_guide_snippets/environment_variables.txt +0 -2
  24. data/doc/users_guide_snippets/tips.txt +20 -1
  25. data/ext/apache2/Bucket.cpp +18 -18
  26. data/ext/apache2/Bucket.h +4 -4
  27. data/ext/apache2/Configuration.cpp +7 -7
  28. data/ext/apache2/Configuration.hpp +43 -43
  29. data/ext/apache2/DirectoryMapper.h +5 -5
  30. data/ext/apache2/Hooks.cpp +142 -142
  31. data/ext/apache2/MergeDirConfig.cpp +40 -40
  32. data/ext/common/Account.h +17 -17
  33. data/ext/common/AccountsDatabase.h +9 -9
  34. data/ext/common/AgentsStarter.cpp +2 -2
  35. data/ext/common/AgentsStarter.h +40 -40
  36. data/ext/common/ApplicationPool2/Common.h +10 -6
  37. data/ext/common/ApplicationPool2/ComponentInfo.h +2 -2
  38. data/ext/common/ApplicationPool2/DirectSpawner.h +17 -17
  39. data/ext/common/ApplicationPool2/DummySpawner.h +5 -5
  40. data/ext/common/ApplicationPool2/Group.h +54 -38
  41. data/ext/common/ApplicationPool2/Implementation.cpp +76 -49
  42. data/ext/common/ApplicationPool2/Options.h +98 -91
  43. data/ext/common/ApplicationPool2/Pool.h +70 -69
  44. data/ext/common/ApplicationPool2/Process.h +21 -21
  45. data/ext/common/ApplicationPool2/Session.h +11 -11
  46. data/ext/common/ApplicationPool2/SmartSpawner.h +60 -60
  47. data/ext/common/ApplicationPool2/Socket.h +19 -19
  48. data/ext/common/ApplicationPool2/Spawner.h +64 -72
  49. data/ext/common/ApplicationPool2/SpawnerFactory.h +4 -4
  50. data/ext/common/ApplicationPool2/SuperGroup.h +41 -41
  51. data/ext/common/BackgroundEventLoop.cpp +1 -1
  52. data/ext/common/BackgroundEventLoop.h +2 -2
  53. data/ext/common/Constants.h +1 -1
  54. data/ext/common/EventedBufferedInput.h +5 -5
  55. data/ext/common/EventedClient.h +51 -51
  56. data/ext/common/EventedMessageServer.h +39 -39
  57. data/ext/common/EventedServer.h +32 -32
  58. data/ext/common/Exceptions.h +23 -23
  59. data/ext/common/FileDescriptor.h +18 -18
  60. data/ext/common/Logging.cpp +1 -1
  61. data/ext/common/MessageClient.h +27 -27
  62. data/ext/common/MessageReadersWriters.h +79 -79
  63. data/ext/common/MessageServer.h +59 -59
  64. data/ext/common/RandomGenerator.h +12 -12
  65. data/ext/common/ResourceLocator.h +8 -8
  66. data/ext/common/SafeLibev.h +54 -25
  67. data/ext/common/ServerInstanceDir.h +31 -31
  68. data/ext/common/StaticString.h +50 -48
  69. data/ext/common/Utils.cpp +73 -78
  70. data/ext/common/Utils.h +6 -6
  71. data/ext/common/Utils/Base64.cpp +3 -3
  72. data/ext/common/Utils/Base64.h +7 -7
  73. data/ext/common/Utils/BlockingQueue.h +9 -9
  74. data/ext/common/Utils/BufferedIO.h +17 -17
  75. data/ext/common/Utils/CachedFileStat.hpp +16 -16
  76. data/ext/common/Utils/Dechunker.h +25 -25
  77. data/ext/common/Utils/FileChangeChecker.h +10 -10
  78. data/ext/common/Utils/MemZeroGuard.h +5 -5
  79. data/ext/common/Utils/MemoryBarrier.h +1 -1
  80. data/ext/common/Utils/MessageIO.h +61 -61
  81. data/ext/common/Utils/ProcessMetricsCollector.h +40 -40
  82. data/ext/common/Utils/ScopeGuard.h +7 -7
  83. data/ext/common/Utils/SpeedMeter.h +1 -1
  84. data/ext/common/Utils/StrIntUtils.cpp +13 -13
  85. data/ext/common/Utils/StrIntUtils.h +3 -3
  86. data/ext/common/Utils/StringScanning.h +5 -5
  87. data/ext/common/Utils/SystemMetricsCollector.h +2 -2
  88. data/ext/common/Utils/SystemTime.h +10 -10
  89. data/ext/common/Utils/Template.h +2 -2
  90. data/ext/common/Utils/Timer.h +6 -6
  91. data/ext/common/Utils/VariantMap.h +29 -29
  92. data/ext/common/agents/Base.cpp +19 -19
  93. data/ext/common/agents/HelperAgent/AgentOptions.h +1 -1
  94. data/ext/common/agents/HelperAgent/FileBackedPipe.h +6 -6
  95. data/ext/common/agents/HelperAgent/Main.cpp +44 -43
  96. data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
  97. data/ext/common/agents/HelperAgent/RequestHandler.h +29 -28
  98. data/ext/common/agents/HelperAgent/ScgiRequestParser.h +56 -50
  99. data/ext/common/agents/LoggingAgent/AdminController.h +8 -8
  100. data/ext/common/agents/LoggingAgent/DataStoreId.h +17 -17
  101. data/ext/common/agents/LoggingAgent/FilterSupport.h +167 -167
  102. data/ext/common/agents/LoggingAgent/LoggingServer.h +122 -122
  103. data/ext/common/agents/LoggingAgent/Main.cpp +7 -7
  104. data/ext/common/agents/LoggingAgent/RemoteSender.h +54 -54
  105. data/ext/common/agents/SpawnPreparer.cpp +4 -4
  106. data/ext/common/agents/TempDirToucher.c +2 -2
  107. data/ext/common/agents/Watchdog/AgentWatcher.cpp +47 -47
  108. data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +7 -7
  109. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +7 -7
  110. data/ext/common/agents/Watchdog/Main.cpp +22 -22
  111. data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +9 -9
  112. data/ext/libeio/eio.c +1 -1
  113. data/ext/nginx/Configuration.c +30 -30
  114. data/ext/nginx/Configuration.h +1 -1
  115. data/ext/nginx/ContentHandler.c +54 -54
  116. data/ext/nginx/ContentHandler.h +3 -3
  117. data/ext/nginx/StaticContentHandler.c +2 -2
  118. data/ext/nginx/ngx_http_passenger_module.c +21 -21
  119. data/ext/oxt/detail/backtrace_enabled.hpp +1 -1
  120. data/ext/oxt/detail/context.hpp +1 -1
  121. data/ext/oxt/detail/spin_lock_darwin.hpp +4 -4
  122. data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -3
  123. data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
  124. data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
  125. data/ext/oxt/dynamic_thread_group.hpp +18 -18
  126. data/ext/oxt/implementation.cpp +9 -8
  127. data/ext/oxt/macros.hpp +2 -2
  128. data/ext/oxt/system_calls.cpp +11 -11
  129. data/ext/oxt/system_calls.hpp +13 -13
  130. data/ext/oxt/thread.hpp +22 -14
  131. data/ext/ruby/passenger_native_support.c +55 -55
  132. data/lib/phusion_passenger.rb +24 -24
  133. data/lib/phusion_passenger/common_library.rb +2 -0
  134. data/lib/phusion_passenger/loader_shared_helpers.rb +18 -18
  135. data/lib/phusion_passenger/packaging.rb +9 -4
  136. data/lib/phusion_passenger/platform_info/apache.rb +45 -31
  137. data/lib/phusion_passenger/platform_info/compiler.rb +11 -11
  138. data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  139. data/lib/phusion_passenger/request_handler/thread_handler.rb +8 -8
  140. data/lib/phusion_passenger/standalone/app_finder.rb +16 -16
  141. data/lib/phusion_passenger/standalone/command.rb +22 -22
  142. data/packaging/rpm/LICENSE.txt +19 -0
  143. data/packaging/rpm/Makefile +13 -0
  144. data/packaging/rpm/README.md +41 -0
  145. data/packaging/rpm/Vagrantfile +38 -0
  146. data/{rpm/Vagrantfile → packaging/rpm/Vagrantfile.centos} +0 -0
  147. data/packaging/rpm/build +170 -0
  148. data/packaging/rpm/create_project +41 -0
  149. data/packaging/rpm/git_update +88 -0
  150. data/packaging/rpm/image/Dockerfile +37 -0
  151. data/packaging/rpm/image/Gemfile +3 -0
  152. data/packaging/rpm/image/Gemfile.lock +12 -0
  153. data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +19 -0
  154. data/packaging/rpm/image/amazon2014-i386.cfg +96 -0
  155. data/packaging/rpm/image/amazon2014-x86_64.cfg +96 -0
  156. data/packaging/rpm/image/site-defaults.cfg +168 -0
  157. data/packaging/rpm/internal/build_tasks.rb +238 -0
  158. data/packaging/rpm/internal/dummygpg +11 -0
  159. data/packaging/rpm/internal/exec_build +42 -0
  160. data/packaging/rpm/internal/get_distro_arch +14 -0
  161. data/packaging/rpm/internal/get_distro_id +10 -0
  162. data/packaging/rpm/internal/git_update +27 -0
  163. data/packaging/rpm/internal/inituidgid +17 -0
  164. data/packaging/rpm/internal/my_init +344 -0
  165. data/packaging/rpm/internal/python27 +3 -0
  166. data/packaging/rpm/internal/repo_update +46 -0
  167. data/packaging/rpm/internal/setuser +26 -0
  168. data/packaging/rpm/internal/tracking_helper +40 -0
  169. data/packaging/rpm/jenkins_release +99 -0
  170. data/packaging/rpm/lib/build_tasks_support.rb +402 -0
  171. data/packaging/rpm/lib/preprocessor.rb +341 -0
  172. data/packaging/rpm/nginx_spec/404.html +119 -0
  173. data/packaging/rpm/nginx_spec/50x.html +119 -0
  174. data/packaging/rpm/nginx_spec/index.html +116 -0
  175. data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +13 -0
  176. data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
  177. data/packaging/rpm/nginx_spec/nginx-upgrade +13 -0
  178. data/packaging/rpm/nginx_spec/nginx-upgrade.8 +151 -0
  179. data/packaging/rpm/nginx_spec/nginx.conf +131 -0
  180. data/packaging/rpm/nginx_spec/nginx.init +144 -0
  181. data/packaging/rpm/nginx_spec/nginx.logrotate +13 -0
  182. data/packaging/rpm/nginx_spec/nginx.service +15 -0
  183. data/packaging/rpm/nginx_spec/nginx.spec.template +559 -0
  184. data/packaging/rpm/nginx_spec/nginx.sysconfig +4 -0
  185. data/packaging/rpm/nginx_spec/passenger.conf +9 -0
  186. data/packaging/rpm/nginx_spec/poweredby.png +0 -0
  187. data/{rpm → packaging/rpm/passenger_spec}/apache-passenger.conf.in +0 -0
  188. data/{rpm → packaging/rpm/passenger_spec}/config.json +0 -0
  189. data/{rpm → packaging/rpm/passenger_spec}/passenger.logrotate +0 -0
  190. data/{rpm → packaging/rpm/passenger_spec}/passenger.spec.template +58 -31
  191. data/{rpm → packaging/rpm/passenger_spec}/passenger_dynamic_thread_group.patch +0 -0
  192. data/{rpm → packaging/rpm/passenger_spec}/passenger_tests_default_config_example.patch +0 -0
  193. data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -0
  194. data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -0
  195. data/packaging/rpm/repo_update +114 -0
  196. data/packaging/rpm/setup-system +60 -0
  197. data/packaging/rpm/shell +10 -0
  198. data/resources/templates/standalone/config.erb +3 -1
  199. data/test/config.json.rpm-automation +1 -1
  200. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +11 -11
  201. data/test/cxx/ApplicationPool2/OptionsTest.cpp +5 -5
  202. data/test/cxx/ApplicationPool2/PoolTest.cpp +129 -89
  203. data/test/cxx/ApplicationPool2/ProcessTest.cpp +15 -15
  204. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +22 -22
  205. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +11 -11
  206. data/test/cxx/ScgiRequestParserTest.cpp +75 -61
  207. data/test/cxx/UtilsTest.cpp +86 -85
  208. data/test/gdbinit.example +3 -0
  209. data/test/integration_tests/nginx_tests.rb +3 -3
  210. data/test/integration_tests/source_packaging_test.rb +3 -1
  211. data/test/stub/nginx/nginx.conf.erb +8 -1
  212. data/test/support/nginx_controller.rb +7 -7
  213. metadata +62 -17
  214. metadata.gz.asc +7 -7
  215. data/build/rpm.rb +0 -128
  216. data/dev/rpmtool +0 -21
  217. data/dev/test_rpm_packaging.sh +0 -28
  218. data/rpm/get_distro_id.py +0 -4
@@ -24,38 +24,38 @@
24
24
 
25
25
  module PhusionPassenger
26
26
  FILE_LOCATION = File.expand_path(__FILE__)
27
-
28
-
27
+
28
+
29
29
  ###### Names and version numbers ######
30
-
30
+
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '4.0.48'
34
-
35
- PREFERRED_NGINX_VERSION = '1.6.0'
36
- NGINX_SHA256_CHECKSUM = '943ad757a1c3e8b3df2d5c4ddacc508861922e36fa10ea6f8e3a348fc9abfc1a'
33
+ VERSION_STRING = '4.0.49'
34
+
35
+ PREFERRED_NGINX_VERSION = '1.6.1'
36
+ NGINX_SHA256_CHECKSUM = 'f5cfe682a1aeef4602c2ca705402d5049b748f946563f41d8256c18674836067'
37
37
 
38
38
  PREFERRED_PCRE_VERSION = '8.34'
39
39
  PCRE_SHA256_CHECKSUM = '1dd78994c81e44ac41cf30b2a21d4b4cc6d76ccde7fc6e77713ed51d7bddca47'
40
40
 
41
41
  STANDALONE_INTERFACE_VERSION = 1
42
-
43
-
42
+
43
+
44
44
  ###### Directories ######
45
-
45
+
46
46
  GLOBAL_NAMESPACE_DIRNAME = "passenger"
47
47
  # Subdirectory under $HOME to use for storing stuff.
48
48
  USER_NAMESPACE_DIRNAME = ".passenger"
49
49
  # The name for the /etc/apache2/mods-available/*.{load,conf} file.
50
50
  APACHE2_MODULE_CONF_NAME = "passenger"
51
-
51
+
52
52
  # Directories in which to look for plugins.
53
53
  PLUGIN_DIRS = [
54
54
  "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins",
55
55
  "/usr/local/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins",
56
56
  "~/#{USER_NAMESPACE_DIRNAME}/plugins"
57
57
  ]
58
-
58
+
59
59
  REQUIRED_LOCATIONS_INI_FIELDS = [
60
60
  :bin_dir,
61
61
  :agents_dir,
@@ -93,16 +93,16 @@ module PhusionPassenger
93
93
  :build_system_dir,
94
94
  :buildout_dir
95
95
  ].freeze
96
-
96
+
97
97
  # Follows the logic of ext/common/ResourceLocator.h, so don't forget to modify that too.
98
98
  def self.locate_directories(source_root_or_location_configuration_file = nil)
99
99
  source_root_or_location_configuration_file ||= find_location_configuration_file
100
100
  root_or_file = @source_root = source_root_or_location_configuration_file
101
-
101
+
102
102
  if root_or_file && File.file?(root_or_file)
103
103
  filename = root_or_file
104
104
  options = parse_ini_file(filename)
105
-
105
+
106
106
  @natively_packaged = get_bool_option(filename, options, 'natively_packaged')
107
107
  REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
108
108
  value = get_option(filename, options, field.to_s)
@@ -146,7 +146,7 @@ module PhusionPassenger
146
146
  end
147
147
  end
148
148
  end
149
-
149
+
150
150
  # Returns whether this Phusion Passenger installation is in the 'originally packaged'
151
151
  # configuration (as opposed to the 'natively packaged' configuration.
152
152
  def self.originally_packaged?
@@ -203,10 +203,10 @@ module PhusionPassenger
203
203
  def self.standalone_doc_path
204
204
  return "#{doc_dir}/#{STANDALONE_DOC_NAME}"
205
205
  end
206
-
207
-
206
+
207
+
208
208
  ###### Other resource locations ######
209
-
209
+
210
210
  INDEX_DOC_NAME = "Users guide.html"
211
211
  APACHE2_DOC_NAME = "Users guide Apache.html"
212
212
  NGINX_DOC_NAME = "Users guide Nginx.html"
@@ -219,17 +219,17 @@ module PhusionPassenger
219
219
  { :url => "https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release" }
220
220
  ]
221
221
  end
222
-
223
-
222
+
223
+
224
224
  # Instead of calling `require 'phusion_passenger/foo'`, you should call
225
225
  # `PhusionPassenger.require_passenger_lib 'foo'`. This is because when Phusion
226
226
  # Passenger is natively packaged, it may still be run with arbitrary Ruby
227
227
  # interpreters. Adding ruby_libdir to $LOAD_PATH is then dangerous because ruby_libdir
228
228
  # may be the distribution's Ruby's vendor_ruby directory, which may be incompatible
229
229
  # with the active Ruby interpreter. This method looks up the exact filename directly.
230
- #
230
+ #
231
231
  # Using this method also has two more advantages:
232
- #
232
+ #
233
233
  # 1. It is immune to Bundler's load path mangling code.
234
234
  # 2. It is faster than plan require() because it doesn't need to
235
235
  # scan the entire load path.
@@ -293,7 +293,7 @@ private
293
293
  return nil
294
294
  end
295
295
  end
296
-
296
+
297
297
  def self.get_bool_option(filename, options, key)
298
298
  value = get_option(filename, options, key)
299
299
  return value == 'yes' || value == 'true' || value == 'on' || value == '1'
@@ -382,6 +382,8 @@ COMMON_LIBRARY = CommonLibraryBuilder.new do
382
382
  ApplicationPool2/Pool.h
383
383
  ApplicationPool2/SuperGroup.h
384
384
  ApplicationPool2/Group.h
385
+ ApplicationPool2/Process.h
386
+ ApplicationPool2/Socket.h
385
387
  ApplicationPool2/Session.h
386
388
  ApplicationPool2/Options.h
387
389
  ApplicationPool2/PipeWatcher.h
@@ -69,7 +69,7 @@ module LoaderSharedHelpers
69
69
  def to_boolean(value)
70
70
  return !(value.nil? || value == false || value == "false")
71
71
  end
72
-
72
+
73
73
  def sanitize_spawn_options(options)
74
74
  defaults = {
75
75
  "app_type" => "rack",
@@ -86,7 +86,7 @@ module LoaderSharedHelpers
86
86
  # in this case.
87
87
  options["debugger"] = to_boolean(options["debugger"])
88
88
  options["spawn_method"] = "direct" if options["debugger"]
89
-
89
+
90
90
  return options
91
91
  end
92
92
 
@@ -182,7 +182,7 @@ module LoaderSharedHelpers
182
182
  rescue SystemCallError
183
183
  # Don't care.
184
184
  end
185
-
185
+
186
186
  # Prepare an application process using rules for the given spawn options.
187
187
  # This method is to be called before loading the application code.
188
188
  #
@@ -199,7 +199,7 @@ module LoaderSharedHelpers
199
199
  PhusionPassenger.require_passenger_lib 'union_station/core'
200
200
  options["union_station_core"] = UnionStation::Core.new_from_options(options)
201
201
  end
202
-
202
+
203
203
  def run_load_path_setup_code(options)
204
204
  # rack-preloader.rb depends on the 'rack' library, but the app
205
205
  # might want us to use a bundled version instead of a
@@ -220,17 +220,17 @@ module LoaderSharedHelpers
220
220
  # These apps call Bundler.setup in their preinitializer.rb.
221
221
  #
222
222
  # So the strategy is as follows:
223
-
223
+
224
224
  # Our strategy might be completely unsuitable for the app or the
225
225
  # developer is using something other than Bundler, so we let the user
226
226
  # manually specify a load path setup file.
227
227
  if options["load_path_setup_file"]
228
228
  require File.expand_path(options["load_path_setup_file"])
229
-
229
+
230
230
  # The app developer may also override our strategy with this magic file.
231
231
  elsif File.exist?('config/setup_load_paths.rb')
232
232
  require File.expand_path('config/setup_load_paths')
233
-
233
+
234
234
  # Older versions of Bundler use .bundle/environment.rb as the Bundler
235
235
  # environment lock file. This has been replaced by Gemfile.lock in later
236
236
  # versions, but we still support the older mechanism.
@@ -241,7 +241,7 @@ module LoaderSharedHelpers
241
241
  running_bundler(options) do
242
242
  require File.expand_path('.bundle/environment')
243
243
  end
244
-
244
+
245
245
  # If the legacy Bundler environment file doesn't exist then there are two
246
246
  # possibilities:
247
247
  # 1. Bundler is not used, in which case we don't have to do anything.
@@ -263,17 +263,17 @@ module LoaderSharedHelpers
263
263
  require 'bundler/setup'
264
264
  end
265
265
  end
266
-
267
-
266
+
267
+
268
268
  # !!! NOTE !!!
269
269
  # If the app is using Bundler then any dependencies required past this
270
270
  # point must be specified in the Gemfile. Like ruby-debug if debugging is on...
271
271
  end
272
-
272
+
273
273
  def before_loading_app_code_step2(options)
274
274
  # Do nothing.
275
275
  end
276
-
276
+
277
277
  # This method is to be called after loading the application code but
278
278
  # before forking a worker process.
279
279
  def after_loading_app_code(options)
@@ -283,7 +283,7 @@ module LoaderSharedHelpers
283
283
  require 'rails/version'
284
284
  end
285
285
  end
286
-
286
+
287
287
  def create_socket_address(protocol, address)
288
288
  if protocol == 'unix'
289
289
  return "unix:#{address}"
@@ -293,7 +293,7 @@ module LoaderSharedHelpers
293
293
  raise ArgumentError, "Unknown protocol '#{protocol}'"
294
294
  end
295
295
  end
296
-
296
+
297
297
  def advertise_readiness
298
298
  # https://code.google.com/p/phusion-passenger/issues/detail?id=1039
299
299
  puts
@@ -307,7 +307,7 @@ module LoaderSharedHelpers
307
307
  output.puts "!> socket: #{name};#{options[:address]};#{options[:protocol]};#{concurrency}"
308
308
  end
309
309
  end
310
-
310
+
311
311
  # To be called before the request handler main loop is entered, but after the app
312
312
  # startup file has been loaded. This function will fire off necessary events
313
313
  # and perform necessary preparation tasks.
@@ -328,7 +328,7 @@ module LoaderSharedHelpers
328
328
  if forked && options["union_station_core"]
329
329
  options["union_station_core"].clear_connection
330
330
  end
331
-
331
+
332
332
  # If we were forked from a preloader process then clear or
333
333
  # re-establish ActiveRecord database connections. This prevents
334
334
  # child processes from concurrently accessing the same
@@ -343,7 +343,7 @@ module LoaderSharedHelpers
343
343
  ActiveRecord::Base.establish_connection
344
344
  end
345
345
  end
346
-
346
+
347
347
  # Fire off events.
348
348
  PhusionPassenger.call_event(:starting_worker_process, forked)
349
349
  if options["pool_account_username"] && options["pool_account_password_base64"]
@@ -354,7 +354,7 @@ module LoaderSharedHelpers
354
354
  PhusionPassenger.call_event(:credentials, nil, nil)
355
355
  end
356
356
  end
357
-
357
+
358
358
  # To be called after the request handler main loop is exited. This function
359
359
  # will fire off necessary events perform necessary cleanup tasks.
360
360
  def after_handling_requests
@@ -91,7 +91,7 @@ module Packaging
91
91
  'doc/**/*',
92
92
  'man/*',
93
93
  'debian.template/**/*',
94
- 'rpm/**/*',
94
+ 'packaging/**/*',
95
95
  'helper-scripts/**/*',
96
96
  'ext/common/**/*.{cpp,c,h,hpp,md,erb}',
97
97
  'ext/apache2/*.{cpp,h,hpp,c,erb}',
@@ -131,6 +131,8 @@ module Packaging
131
131
  ]
132
132
 
133
133
  EXCLUDE_GLOB = [
134
+ '**/.DS_Store',
135
+ 'packaging/*/.git',
134
136
  'test/stub/rails_apps/3.0/empty/help/**/*',
135
137
  'test/stub/*.dSYM'
136
138
  ]
@@ -138,16 +140,19 @@ module Packaging
138
140
  # Files that should be excluded from the Debian tarball.
139
141
  DEBIAN_EXCLUDE_GLOB = [
140
142
  "debian.template/**/*",
143
+ "packaging/**/*",
141
144
  ]
142
145
 
143
146
  # Files and directories that should be excluded from the Homebrew installation.
144
147
  HOMEBREW_EXCLUDE = [
145
- "dev", "test", ".gitignore", ".travis.yml", "debian.template", "rpm",
146
- "Vagrantfile", "package.json", "npm-shrinkwrap.json"
148
+ ".gitignore", ".gitmodules", ".travis.yml", "package.json", "Vagrantfile",
149
+ "npm-shrinkwrap.json", "debian.template", "packaging", "dev", "test"
147
150
  ]
148
151
 
149
152
  def self.files
150
- return Dir[*GLOB] - Dir[*EXCLUDE_GLOB]
153
+ result = Dir[*GLOB] - Dir[*EXCLUDE_GLOB]
154
+ result.reject! { |path| path =~ %r{/\.\.?$} }
155
+ return result
151
156
  end
152
157
 
153
158
  def self.debian_orig_tarball_files
@@ -42,7 +42,7 @@ module PhusionPassenger
42
42
 
43
43
  module PlatformInfo
44
44
  ################ Programs ################
45
-
45
+
46
46
  # The absolute path to the 'apxs' or 'apxs2' executable, or nil if not found.
47
47
  def self.apxs2
48
48
  if env_defined?("APXS2")
@@ -57,14 +57,14 @@ module PlatformInfo
57
57
  return nil
58
58
  end
59
59
  memoize :apxs2
60
-
60
+
61
61
  # The absolute path to the 'apachectl' or 'apache2ctl' binary, or nil if
62
62
  # not found.
63
63
  def self.apache2ctl(options = {})
64
64
  return find_apache2_executable('apache2ctl', 'apachectl2', 'apachectl', options)
65
65
  end
66
66
  memoize :apache2ctl
67
-
67
+
68
68
  # The absolute path to the Apache binary (that is, 'httpd', 'httpd2', 'apache'
69
69
  # or 'apache2'), or nil if not found.
70
70
  def self.httpd(options = {})
@@ -190,7 +190,7 @@ module PlatformInfo
190
190
  memoize :httpd_default_config_file
191
191
 
192
192
  # Given an Apache config file, returns the a hash with the following elements:
193
- #
193
+ #
194
194
  # * `:files` - An array containing `config_file`, as well as all config files
195
195
  # included from that config file, including recursively included
196
196
  # ones. Only filenames that actually exist are put here.
@@ -212,7 +212,7 @@ module PlatformInfo
212
212
  # The default Apache error log's filename, as it is compiled into the Apache
213
213
  # main executable. This may not be the actual error log that is used. The actual
214
214
  # error log depends on the configuration file.
215
- #
215
+ #
216
216
  # Returns nil if Apache is not detected, or if the default error log filename
217
217
  # cannot be detected.
218
218
  def self.httpd_default_error_log(options = nil)
@@ -285,7 +285,7 @@ module PlatformInfo
285
285
  else
286
286
  httpd = self.httpd
287
287
  end
288
-
288
+
289
289
  httpd_dir = File.dirname(httpd)
290
290
  if httpd_dir == "/usr/bin" || httpd_dir == "/usr/sbin"
291
291
  if File.exist?("/etc/apache2/envvars")
@@ -294,7 +294,7 @@ module PlatformInfo
294
294
  return "/etc/httpd/envvars"
295
295
  end
296
296
  end
297
-
297
+
298
298
  conf_dir = File.expand_path(File.dirname(httpd) + "/../conf")
299
299
  if File.exist?("#{conf_dir}/envvars")
300
300
  return "#{conf_dir}/envvars"
@@ -397,7 +397,7 @@ module PlatformInfo
397
397
  end
398
398
  end
399
399
  memoize :a2dismod
400
-
400
+
401
401
  # The absolute path to the 'apr-config' or 'apr-1-config' executable,
402
402
  # or nil if not found.
403
403
  def self.apr_config
@@ -423,7 +423,7 @@ module PlatformInfo
423
423
  end
424
424
  end
425
425
  memoize :apr_config
426
-
426
+
427
427
  # The absolute path to the 'apu-config' or 'apu-1-config' executable, or nil
428
428
  # if not found.
429
429
  def self.apu_config
@@ -484,10 +484,10 @@ module PlatformInfo
484
484
  end
485
485
  return nil
486
486
  end
487
-
488
-
487
+
488
+
489
489
  ################ Directories ################
490
-
490
+
491
491
  # The absolute path to the Apache 2 'bin' directory, or nil if unknown.
492
492
  def self.apache2_bindir(options = {})
493
493
  apxs2 = options[:apxs2] || self.apxs2
@@ -498,7 +498,7 @@ module PlatformInfo
498
498
  end
499
499
  end
500
500
  memoize :apache2_bindir
501
-
501
+
502
502
  # The absolute path to the Apache 2 'sbin' directory, or nil if unknown.
503
503
  def self.apache2_sbindir(options = {})
504
504
  apxs2 = options[:apxs2] || self.apxs2
@@ -509,15 +509,25 @@ module PlatformInfo
509
509
  end
510
510
  end
511
511
  memoize :apache2_sbindir
512
-
513
-
512
+
513
+
514
514
  ################ Compiler and linker flags ################
515
-
515
+
516
+ def self.apache2_module_cflags(with_apr_flags = true)
517
+ return apache2_module_c_or_cxxflags(:c, with_apr_flags)
518
+ end
519
+ memoize :apache2_module_cflags, true
520
+
521
+ def self.apache2_module_cxxflags(with_apr_flags = true)
522
+ return apache2_module_c_or_cxxflags(:cxx, with_apr_flags)
523
+ end
524
+ memoize :apache2_module_cxxflags, true
525
+
516
526
  # The C compiler flags that are necessary to compile an Apache module.
517
527
  # Also includes APR and APU compiler flags if with_apr_flags is true.
518
- def self.apache2_module_cflags(with_apr_flags = true)
528
+ def self.apache2_module_c_or_cxxflags(language, with_apr_flags = true)
519
529
  flags = [""]
520
- if cc_is_sun_studio?
530
+ if (language == :c && cc_is_sun_studio?) || (language == :cxx && cxx_is_sun_studio?)
521
531
  flags << "-KPIC"
522
532
  else
523
533
  flags << "-fPIC"
@@ -551,7 +561,7 @@ module PlatformInfo
551
561
  # is 64-bit. Fix this.
552
562
  apxs2_flags.gsub!('-m32 -march=i386 -mtune=generic', '')
553
563
  end
554
-
564
+
555
565
  apxs2_flags.strip!
556
566
  flags << apxs2_flags
557
567
  end
@@ -598,40 +608,44 @@ module PlatformInfo
598
608
  end
599
609
  return flags.compact.join(' ').strip
600
610
  end
601
- memoize :apache2_module_cflags, true
602
-
611
+
603
612
  # Linker flags that are necessary for linking an Apache module.
604
613
  # Already includes APR and APU linker flags.
605
- def self.apache2_module_ldflags
606
- flags = "-fPIC #{apr_libs} #{apu_libs}"
614
+ def self.apache2_module_cxx_ldflags
615
+ if cxx_is_sun_studio?
616
+ flags = "-KPIC"
617
+ else
618
+ flags = "-fPIC"
619
+ end
620
+ flags << " #{apr_libs} #{apu_libs}"
607
621
  flags.strip!
608
622
  return flags
609
623
  end
610
- memoize :apache2_module_ldflags
611
-
624
+ memoize :apache2_module_cxx_ldflags
625
+
612
626
  # The C compiler flags that are necessary for programs that use APR.
613
627
  def self.apr_flags
614
628
  return determine_apr_info[0]
615
629
  end
616
-
630
+
617
631
  # The linker flags that are necessary for linking programs that use APR.
618
632
  def self.apr_libs
619
633
  return determine_apr_info[1]
620
634
  end
621
-
635
+
622
636
  # The C compiler flags that are necessary for programs that use APR-Util.
623
637
  def self.apu_flags
624
638
  return determine_apu_info[0]
625
639
  end
626
-
640
+
627
641
  # The linker flags that are necessary for linking programs that use APR-Util.
628
642
  def self.apu_libs
629
643
  return determine_apu_info[1]
630
644
  end
631
-
645
+
632
646
  ################ Miscellaneous information ################
633
-
634
-
647
+
648
+
635
649
  # Returns whether it is necessary to use information outputted by
636
650
  # 'apr-config' and 'apu-config' in order to compile an Apache module.
637
651
  # When Apache is installed with --with-included-apr, the APR/APU