passenger 3.0.0.pre2 → 3.0.0.pre3

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 (182) hide show
  1. data/bin/passenger-status +1 -1
  2. data/build/packaging.rb +4 -7
  3. data/build/ruby_extension.rb +5 -5
  4. data/ext/common/Constants.h +1 -1
  5. data/ext/common/LoggingAgent/RemoteSender.h +3 -1
  6. data/ext/nginx/ngx_http_passenger_module.c +1 -1
  7. data/ext/{phusion_passenger → ruby}/extconf.rb +1 -1
  8. data/ext/{phusion_passenger/native_support.c → ruby/passenger_native_support.c} +1 -1
  9. data/lib/phusion_passenger.rb +5 -6
  10. data/lib/phusion_passenger/dependencies.rb +23 -0
  11. data/lib/phusion_passenger/native_support.rb +123 -65
  12. data/lib/phusion_passenger/packaging.rb +1 -1
  13. data/lib/phusion_passenger/platform_info/apache.rb +1 -1
  14. data/lib/phusion_passenger/platform_info/compiler.rb +25 -1
  15. data/lib/phusion_passenger/platform_info/ruby.rb +36 -5
  16. data/lib/phusion_passenger/standalone/runtime_installer.rb +5 -4
  17. data/lib/phusion_passenger/utils.rb +62 -1
  18. data/test/ruby/utils_spec.rb +62 -0
  19. data/test/support/test_helper.rb +2 -0
  20. metadata +6 -168
  21. data/doc/rdoc/classes/ConditionVariable.html +0 -215
  22. data/doc/rdoc/classes/Exception.html +0 -120
  23. data/doc/rdoc/classes/GC.html +0 -113
  24. data/doc/rdoc/classes/IO.html +0 -221
  25. data/doc/rdoc/classes/PhusionPassenger.html +0 -368
  26. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +0 -180
  27. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +0 -647
  28. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +0 -654
  29. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/InvalidPassword.html +0 -92
  30. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +0 -97
  31. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +0 -96
  32. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +0 -97
  33. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +0 -96
  34. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +0 -619
  35. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +0 -142
  36. data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats.html +0 -368
  37. data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats/Process.html +0 -231
  38. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance.html +0 -588
  39. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/CorruptedDirectoryError.html +0 -92
  40. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/GenerationsAbsentError.html +0 -92
  41. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Group.html +0 -147
  42. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Process.html +0 -279
  43. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/RoleDeniedError.html +0 -92
  44. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/StaleDirectoryError.html +0 -92
  45. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Stats.html +0 -123
  46. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/UnsupportedGenerationStructureVersionError.html +0 -92
  47. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger.html +0 -341
  48. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/Log.html +0 -294
  49. data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/SharedData.html +0 -199
  50. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +0 -155
  51. data/doc/rdoc/classes/PhusionPassenger/AppProcess.html +0 -367
  52. data/doc/rdoc/classes/PhusionPassenger/ClassicRails.html +0 -95
  53. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner.html +0 -351
  54. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner/Error.html +0 -98
  55. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/CGIFixed.html +0 -200
  56. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner.html +0 -410
  57. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner/Error.html +0 -98
  58. data/doc/rdoc/classes/PhusionPassenger/ClassicRails/RequestHandler.html +0 -156
  59. data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions.html +0 -115
  60. data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions/AnalyticsLogging.html +0 -202
  61. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +0 -172
  62. data/doc/rdoc/classes/PhusionPassenger/DebugLogging.html +0 -273
  63. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +0 -145
  64. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +0 -162
  65. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +0 -141
  66. data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +0 -92
  67. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +0 -673
  68. data/doc/rdoc/classes/PhusionPassenger/MessageChannel/InvalidHashError.html +0 -92
  69. data/doc/rdoc/classes/PhusionPassenger/MessageClient.html +0 -415
  70. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +0 -494
  71. data/doc/rdoc/classes/PhusionPassenger/NativeSupport/FileSystemWatcher.html +0 -96
  72. data/doc/rdoc/classes/PhusionPassenger/Packaging.html +0 -129
  73. data/doc/rdoc/classes/PhusionPassenger/PlatformInfo.html +0 -1758
  74. data/doc/rdoc/classes/PhusionPassenger/Plugin.html +0 -237
  75. data/doc/rdoc/classes/PhusionPassenger/Rack.html +0 -91
  76. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +0 -312
  77. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner/Error.html +0 -98
  78. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +0 -218
  79. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions.html +0 -114
  80. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging.html +0 -256
  81. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ACExtension.html +0 -139
  82. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ASBenchmarkableExtension.html +0 -118
  83. data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ExceptionLogger.html +0 -135
  84. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +0 -378
  85. data/doc/rdoc/classes/PhusionPassenger/Standalone.html +0 -111
  86. data/doc/rdoc/classes/PhusionPassenger/Standalone/AppFinder.html +0 -252
  87. data/doc/rdoc/classes/PhusionPassenger/Standalone/Command.html +0 -161
  88. data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile.html +0 -368
  89. data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile/DisallowedContextError.html +0 -132
  90. data/doc/rdoc/classes/PhusionPassenger/Standalone/HelpCommand.html +0 -151
  91. data/doc/rdoc/classes/PhusionPassenger/Standalone/Main.html +0 -189
  92. data/doc/rdoc/classes/PhusionPassenger/Standalone/PackageRuntimeCommand.html +0 -177
  93. data/doc/rdoc/classes/PhusionPassenger/Standalone/RuntimeInstaller.html +0 -341
  94. data/doc/rdoc/classes/PhusionPassenger/Standalone/StartCommand.html +0 -203
  95. data/doc/rdoc/classes/PhusionPassenger/Standalone/StatusCommand.html +0 -156
  96. data/doc/rdoc/classes/PhusionPassenger/Standalone/StopCommand.html +0 -168
  97. data/doc/rdoc/classes/PhusionPassenger/Standalone/Utils.html +0 -86
  98. data/doc/rdoc/classes/PhusionPassenger/Standalone/VersionCommand.html +0 -135
  99. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +0 -125
  100. data/doc/rdoc/classes/PhusionPassenger/Utils.html +0 -1468
  101. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher.html +0 -204
  102. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/DirInfo.html +0 -171
  103. data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/FileInfo.html +0 -140
  104. data/doc/rdoc/classes/PhusionPassenger/Utils/HostsFileParser.html +0 -260
  105. data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +0 -169
  106. data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput.html +0 -265
  107. data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput/Tempfile.html +0 -120
  108. data/doc/rdoc/classes/PhusionPassenger/Utils/UnseekableSocket.html +0 -561
  109. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +0 -140
  110. data/doc/rdoc/classes/PhusionPassenger/WSGI.html +0 -89
  111. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +0 -182
  112. data/doc/rdoc/classes/Process.html +0 -115
  113. data/doc/rdoc/classes/Signal.html +0 -139
  114. data/doc/rdoc/created.rid +0 -1
  115. data/doc/rdoc/files/DEVELOPERS_TXT.html +0 -276
  116. data/doc/rdoc/files/README.html +0 -157
  117. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +0 -92
  118. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +0 -130
  119. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +0 -135
  120. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +0 -126
  121. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +0 -128
  122. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/memory_stats_rb.html +0 -126
  123. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/server_instance_rb.html +0 -132
  124. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +0 -122
  125. data/doc/rdoc/files/lib/phusion_passenger/analytics_logger_rb.html +0 -129
  126. data/doc/rdoc/files/lib/phusion_passenger/app_process_rb.html +0 -127
  127. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/application_spawner_rb.html +0 -141
  128. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/cgi_fixed_rb.html +0 -126
  129. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/framework_spawner_rb.html +0 -146
  130. data/doc/rdoc/files/lib/phusion_passenger/classic_rails/request_handler_rb.html +0 -125
  131. data/doc/rdoc/files/lib/phusion_passenger/classic_rails_extensions/init_rb.html +0 -132
  132. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +0 -126
  133. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +0 -122
  134. data/doc/rdoc/files/lib/phusion_passenger/debug_logging_rb.html +0 -122
  135. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +0 -147
  136. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +0 -122
  137. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +0 -127
  138. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +0 -120
  139. data/doc/rdoc/files/lib/phusion_passenger/message_client_rb.html +0 -127
  140. data/doc/rdoc/files/lib/phusion_passenger/native_support_rb.html +0 -131
  141. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +0 -122
  142. data/doc/rdoc/files/lib/phusion_passenger/platform_info/apache_rb.html +0 -127
  143. data/doc/rdoc/files/lib/phusion_passenger/platform_info/binary_compatibility_rb.html +0 -129
  144. data/doc/rdoc/files/lib/phusion_passenger/platform_info/compiler_rb.html +0 -126
  145. data/doc/rdoc/files/lib/phusion_passenger/platform_info/curl_rb.html +0 -126
  146. data/doc/rdoc/files/lib/phusion_passenger/platform_info/documentation_tools_rb.html +0 -126
  147. data/doc/rdoc/files/lib/phusion_passenger/platform_info/linux_rb.html +0 -126
  148. data/doc/rdoc/files/lib/phusion_passenger/platform_info/operating_system_rb.html +0 -127
  149. data/doc/rdoc/files/lib/phusion_passenger/platform_info/ruby_rb.html +0 -128
  150. data/doc/rdoc/files/lib/phusion_passenger/platform_info/zlib_rb.html +0 -126
  151. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +0 -122
  152. data/doc/rdoc/files/lib/phusion_passenger/plugin_rb.html +0 -127
  153. data/doc/rdoc/files/lib/phusion_passenger/public_api_rb.html +0 -127
  154. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +0 -137
  155. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +0 -125
  156. data/doc/rdoc/files/lib/phusion_passenger/rails3_extensions/init_rb.html +0 -127
  157. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +0 -122
  158. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +0 -160
  159. data/doc/rdoc/files/lib/phusion_passenger/standalone/app_finder_rb.html +0 -127
  160. data/doc/rdoc/files/lib/phusion_passenger/standalone/command_rb.html +0 -135
  161. data/doc/rdoc/files/lib/phusion_passenger/standalone/config_file_rb.html +0 -126
  162. data/doc/rdoc/files/lib/phusion_passenger/standalone/help_command_rb.html +0 -126
  163. data/doc/rdoc/files/lib/phusion_passenger/standalone/main_rb.html +0 -126
  164. data/doc/rdoc/files/lib/phusion_passenger/standalone/package_runtime_command_rb.html +0 -127
  165. data/doc/rdoc/files/lib/phusion_passenger/standalone/runtime_installer_rb.html +0 -132
  166. data/doc/rdoc/files/lib/phusion_passenger/standalone/start_command_rb.html +0 -136
  167. data/doc/rdoc/files/lib/phusion_passenger/standalone/status_command_rb.html +0 -126
  168. data/doc/rdoc/files/lib/phusion_passenger/standalone/stop_command_rb.html +0 -126
  169. data/doc/rdoc/files/lib/phusion_passenger/standalone/utils_rb.html +0 -126
  170. data/doc/rdoc/files/lib/phusion_passenger/standalone/version_command_rb.html +0 -127
  171. data/doc/rdoc/files/lib/phusion_passenger/utils/file_system_watcher_rb.html +0 -126
  172. data/doc/rdoc/files/lib/phusion_passenger/utils/hosts_file_parser_rb.html +0 -120
  173. data/doc/rdoc/files/lib/phusion_passenger/utils/rewindable_input_rb.html +0 -100
  174. data/doc/rdoc/files/lib/phusion_passenger/utils/tmpdir_rb.html +0 -122
  175. data/doc/rdoc/files/lib/phusion_passenger/utils/unseekable_socket_rb.html +0 -126
  176. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +0 -179
  177. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +0 -132
  178. data/doc/rdoc/fr_class_index.html +0 -139
  179. data/doc/rdoc/fr_file_index.html +0 -109
  180. data/doc/rdoc/fr_method_index.html +0 -435
  181. data/doc/rdoc/index.html +0 -26
  182. data/doc/rdoc/rdoc-style.css +0 -187
@@ -111,7 +111,7 @@ def show_status(server_instance, options = {})
111
111
  rescue ServerInstance::RoleDeniedError
112
112
  require 'phusion_passenger/platform_info/ruby'
113
113
  STDERR.puts "*** ERROR: You are not authorized to query the status for this Phusion " <<
114
- "Passenger instance. Please try again with '#{PlatformInfo.ruby_sudo_command}'."
114
+ "Passenger instance. Please try again with '#{PhusionPassenger::PlatformInfo.ruby_sudo_command}'."
115
115
  exit 2
116
116
  end
117
117
 
@@ -93,7 +93,7 @@ task :fakeroot => [:apache2, :nginx] + Packaging::ASCII_DOCS do
93
93
  # the files to be installed to /usr, and the Ruby interpreter
94
94
  # on the packaging machine might be in /usr/local.
95
95
  fake_libdir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}"
96
- fake_native_support_dir = "#{fakeroot}#{NATIVELY_PACKAGED_NATIVE_SUPPORT_DIR}"
96
+ fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
97
97
  fake_agents_dir = "#{fakeroot}#{NATIVELY_PACKAGED_AGENTS_DIR}"
98
98
  fake_helper_scripts_dir = "#{fakeroot}#{NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR}"
99
99
  fake_docdir = "#{fakeroot}#{NATIVELY_PACKAGED_DOCDIR}"
@@ -112,12 +112,9 @@ task :fakeroot => [:apache2, :nginx] + Packaging::ASCII_DOCS do
112
112
  sh "cp -R #{LIBDIR}/phusion_passenger #{fake_libdir}/"
113
113
 
114
114
  sh "mkdir -p #{fake_native_support_dir}"
115
- Dir["#{NATIVE_SUPPORT_DIR}/*"].each do |subdir|
116
- next unless File.directory?(subdir)
117
- subdirname = File.basename(subdir)
118
- sh "mkdir -p #{fake_native_support_dir}/#{subdirname}"
119
- sh "cp -R #{subdir}/*.#{LIBEXT} #{fake_native_support_dir}/#{subdirname}/"
120
- end
115
+ native_support_archdir = PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
116
+ sh "mkdir -p #{fake_native_support_dir}"
117
+ sh "cp -R ext/ruby/#{native_support_archdir}/*.#{LIBEXT} #{fake_native_support_dir}/"
121
118
 
122
119
  sh "mkdir -p #{fake_agents_dir}"
123
120
  sh "cp -R #{AGENTS_DIR}/* #{fake_agents_dir}/"
@@ -15,16 +15,16 @@
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
17
  native_support_archdir = PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
18
- output_dir = "ext/phusion_passenger/#{native_support_archdir}"
19
- output_name = "native_support.#{LIBEXT}"
20
- source_dir = "ext/phusion_passenger"
18
+ output_dir = "ext/ruby/#{native_support_archdir}"
19
+ output_name = "passenger_native_support.#{LIBEXT}"
20
+ source_dir = "ext/ruby"
21
21
 
22
22
  task :native_support => "#{output_dir}/#{output_name}"
23
23
  task :clean => 'native_support:clean'
24
24
 
25
25
  dependencies = [
26
26
  "#{output_dir}/Makefile",
27
- "#{source_dir}/native_support.c"
27
+ "#{source_dir}/passenger_native_support.c"
28
28
  ]
29
29
  file("#{output_dir}/#{output_name}" => dependencies) do
30
30
  sh "mkdir -p '#{output_dir}'" if !File.exist?(output_dir)
@@ -38,7 +38,7 @@ file "#{output_dir}/Makefile" => "#{source_dir}/extconf.rb" do
38
38
  end
39
39
 
40
40
  task 'native_support:clean' do
41
- Dir["ext/phusion_passenger/*"].each do |entry|
41
+ Dir["ext/ruby/*"].each do |entry|
42
42
  if File.exist?("#{entry}/Makefile")
43
43
  sh "rm -rf #{entry}"
44
44
  end
@@ -26,7 +26,7 @@
26
26
  #define _PASSENGER_CONSTANTS_H_
27
27
 
28
28
  /* Don't forget to update lib/phusion_passenger.rb too. */
29
- #define PASSENGER_VERSION "3.0.0.pre2"
29
+ #define PASSENGER_VERSION "3.0.0.pre3"
30
30
 
31
31
  #define FEEDBACK_FD 3
32
32
 
@@ -285,6 +285,7 @@ private:
285
285
  someServersAreDown = true;
286
286
  }
287
287
  }
288
+ P_DEBUG(servers.size() << " Union Station gateway servers are up");
288
289
 
289
290
  if (servers.empty()) {
290
291
  scheduleNextCheckup(5 * 60);
@@ -306,8 +307,9 @@ private:
306
307
  */
307
308
  void scheduleNextCheckup(unsigned int seconds) {
308
309
  time_t now = SystemTime::get();
309
- if (now > nextCheckupTime || (time_t) (now + seconds) < nextCheckupTime) {
310
+ if (now >= nextCheckupTime || (time_t) (now + seconds) < nextCheckupTime) {
310
311
  nextCheckupTime = now + seconds;
312
+ P_DEBUG("Next checkup time in about " << seconds << " seconds");
311
313
  }
312
314
  }
313
315
 
@@ -464,7 +464,7 @@ init_worker_process(ngx_cycle_t *cycle) {
464
464
  */
465
465
  static void
466
466
  exit_master(ngx_cycle_t *cycle) {
467
- shutdown_helper_server(cycle);
467
+ shutdown_helper_server();
468
468
  }
469
469
 
470
470
 
@@ -37,5 +37,5 @@ have_header('alloca.h')
37
37
  have_header('ruby/io.h')
38
38
 
39
39
  with_cflags($CFLAGS) do
40
- create_makefile('native_support')
40
+ create_makefile('passenger_native_support')
41
41
  end
@@ -994,7 +994,7 @@ fs_watcher_close(VALUE self) {
994
994
  /***************************/
995
995
 
996
996
  void
997
- Init_native_support() {
997
+ Init_passenger_native_support() {
998
998
  struct sockaddr_un addr;
999
999
 
1000
1000
  /* */
@@ -25,7 +25,7 @@ module PhusionPassenger
25
25
  ###### Version numbers ######
26
26
 
27
27
  # Phusion Passenger version number. Don't forget to edit ext/common/Constants.h too.
28
- VERSION_STRING = '3.0.0.pre2'
28
+ VERSION_STRING = '3.0.0.pre3'
29
29
 
30
30
  PREFERRED_NGINX_VERSION = '0.7.67'
31
31
  PREFERRED_PCRE_VERSION = '8.02'
@@ -47,7 +47,6 @@ module PhusionPassenger
47
47
  end
48
48
 
49
49
  NATIVELY_PACKAGED_SOURCE_ROOT = "/usr/share/phusion-passenger/source"
50
- NATIVELY_PACKAGED_NATIVE_SUPPORT_DIR = "/usr/lib/phusion-passenger/native_support/#{VERSION_STRING}"
51
50
  NATIVELY_PACKAGED_DOCDIR = "/usr/share/doc/phusion-passenger"
52
51
  NATIVELY_PACKAGED_AGENTS_DIR = "/usr/lib/phusion-passenger/agents"
53
52
  NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR = "/usr/share/phusion-passenger/helper-scripts"
@@ -77,9 +76,6 @@ module PhusionPassenger
77
76
  # Top directory of the Phusion Passenger source code.
78
77
  SOURCE_ROOT = File.expand_path(File.join(LIBDIR, ".."))
79
78
 
80
- # Directory containing #{archdir}/native_support.so.
81
- NATIVE_SUPPORT_DIR = File.join(SOURCE_ROOT, "ext", "phusion_passenger")
82
-
83
79
  # Documentation directory.
84
80
  DOCDIR = File.join(SOURCE_ROOT, "doc")
85
81
 
@@ -91,9 +87,12 @@ module PhusionPassenger
91
87
 
92
88
  # Location of the Apache 2 module.
93
89
  APACHE2_MODULE = File.join(SOURCE_ROOT, "ext", "apache2", "mod_passenger.so")
90
+
91
+ # Directory possibly containing #{archdir}/passenger_native_support.so.
92
+ # Not available when natively packaged.
93
+ NATIVE_SUPPORT_DIR = File.join(SOURCE_ROOT, "ext", "ruby")
94
94
  else
95
95
  SOURCE_ROOT = NATIVELY_PACKAGED_SOURCE_ROOT
96
- NATIVE_SUPPORT_DIR = NATIVELY_PACKAGED_NATIVE_SUPPORT_DIR
97
96
  DOCDIR = NATIVELY_PACKAGED_DOCDIR
98
97
  AGENTS_DIR = NATIVELY_PACKAGED_AGENTS_DIR
99
98
  HELPER_SCRIPTS_DIR = NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR
@@ -168,6 +168,29 @@ module Dependencies # :nodoc: all
168
168
  dep.website = "http://www.gnu.org/software/make/"
169
169
  end
170
170
 
171
+ GnuMake = Dependency.new do |dep|
172
+ dep.name = "GNU make"
173
+ dep.define_checker do |result|
174
+ make = PlatformInfo.gnu_make
175
+ if make
176
+ result.found(make)
177
+ else
178
+ result.not_found
179
+ end
180
+ end
181
+ if RUBY_PLATFORM =~ /linux/
182
+ case PlatformInfo.linux_distro
183
+ when :ubuntu, :debian
184
+ dep.install_command = "apt-get install build-essential"
185
+ when :rhel, :fedora, :centos
186
+ dep.install_command = "yum install make"
187
+ end
188
+ elsif RUBY_PLATFORM =~ /darwin/
189
+ dep.install_instructions = "Please install the Apple Development Tools: http://developer.apple.com/tools/"
190
+ end
191
+ dep.website = "http://www.gnu.org/software/make/"
192
+ end
193
+
171
194
  DownloadTool = Dependency.new do |dep|
172
195
  dep.name = "A download tool like 'wget' or 'curl'"
173
196
  dep.define_checker do |result|
@@ -22,87 +22,145 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  module PhusionPassenger
25
- require 'phusion_passenger'
26
- require 'phusion_passenger/platform_info/operating_system'
27
- require 'phusion_passenger/platform_info/binary_compatibility'
25
+
26
+ class NativeSupportLoader
27
+ def supported?
28
+ return !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx"
29
+ end
30
+
31
+ def start
32
+ require 'phusion_passenger'
33
+ load_from_source_dir ||
34
+ load_from_load_path ||
35
+ load_from_home ||
36
+ compile_and_load
37
+ end
38
+
39
+ private
40
+ def archdir
41
+ @archdir ||= begin
42
+ require 'phusion_passenger/platform_info/binary_compatibility'
43
+ PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
44
+ end
45
+ end
46
+
47
+ def libext
48
+ @libext ||= begin
49
+ require 'phusion_passenger/platform_info/operating_system'
50
+ PlatformInfo.library_extension
51
+ end
52
+ end
53
+
54
+ def home
55
+ @home ||= begin
56
+ require 'etc' if !defined?(Etc)
57
+ home = Etc.getpwuid(Process.uid).dir
58
+ end
59
+ end
60
+
61
+ def library_name
62
+ return "passenger_native_support.#{libext}"
63
+ end
64
+
65
+ def extconf_rb
66
+ File.join(SOURCE_ROOT, "ext", "ruby", "extconf.rb")
67
+ end
68
+
69
+ def load_from_source_dir
70
+ if defined?(NATIVE_SUPPORT_DIR)
71
+ begin
72
+ require "#{NATIVE_SUPPORT_DIR}/#{archdir}/#{library_name}"
73
+ return true
74
+ rescue LoadError
75
+ return false
76
+ end
77
+ else
78
+ return false
79
+ end
80
+ end
28
81
 
29
- libext = PlatformInfo.library_extension
30
- archdir = PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
31
- loaded = false
32
- begin
33
- require "#{NATIVE_SUPPORT_DIR}/#{archdir}/native_support.#{libext}"
34
- loaded = true
82
+ def load_from_load_path
83
+ require 'passenger_native_support'
84
+ return true
35
85
  rescue LoadError
36
- require 'etc'
37
-
38
- home = Etc.getpwuid(Process.uid).dir
86
+ return false
87
+ end
88
+
89
+ def load_from_home
39
90
  begin
40
- require "#{home}/#{LOCAL_DIR}/native_support/#{VERSION_STRING}/#{archdir}/native_support.#{libext}"
41
- loaded = true
91
+ require "#{home}/#{LOCAL_DIR}/native_support/#{VERSION_STRING}/#{archdir}/#{library_name}"
92
+ return true
42
93
  rescue LoadError
94
+ return false
43
95
  end
44
96
  end
45
97
 
46
- if !loaded
47
- STDERR.puts "*** Phusion Passenger: no native_support.#{libext} found for " +
98
+ def compile_and_load
99
+ STDERR.puts "*** Phusion Passenger: no #{library_name} found for " +
48
100
  "the current Ruby interpreter. Compiling one..."
49
101
 
50
102
  require 'fileutils'
51
103
  require 'phusion_passenger/platform_info/ruby'
52
104
 
53
- mkdir = proc do |dir|
54
- begin
55
- STDERR.puts "# mkdir -p #{dir}"
56
- FileUtils.mkdir_p(dir)
57
- rescue Errno::EEXIST
58
- end
105
+ target_dirs = []
106
+ if defined?(NATIVE_SUPPORT_DIR)
107
+ target_dirs << "#{NATIVE_SUPPORT_DIR}/#{archdir}"
59
108
  end
109
+ target_dirs << "#{home}/#{LOCAL_DIR}/native_support/#{VERSION_STRING}/#{archdir}"
60
110
 
61
- sh = proc do |*args|
62
- command_string = args.join(' ')
63
- STDERR.puts "# #{command_string}"
64
- if !system(*args)
65
- raise "Could not compile native_support.#{libext} ('#{command_string}' failed)"
66
- end
111
+ target_dir = compile(target_dirs)
112
+ require "#{target_dir}/#{library_name}"
113
+ end
114
+
115
+ def mkdir(dir)
116
+ begin
117
+ STDERR.puts "# mkdir -p #{dir}"
118
+ FileUtils.mkdir_p(dir)
119
+ rescue Errno::EEXIST
67
120
  end
68
-
69
- compile = proc do |target_dirs|
70
- result = nil
71
- target_dirs.each_with_index do |target_dir, i|
72
- begin
73
- mkdir.call(target_dir)
74
- File.open("#{target_dir}/.permission_test", "w").close
75
- File.unlink("#{target_dir}/.permission_test")
76
- STDERR.puts "# cd #{target_dir}"
77
- Dir.chdir(target_dir) do
78
- extconf_rb = File.join(SOURCE_ROOT, "ext",
79
- "phusion_passenger", "extconf.rb")
80
- sh.call(PlatformInfo.ruby_command, extconf_rb)
81
- sh.call("make")
82
- end
83
- result = target_dir
84
- break
85
- rescue Errno::EACCES
86
- # If we encountered a permission error, then try
87
- # the next target directory. If we get a permission
88
- # error on the last one too then propagate the
89
- # exception.
90
- if i == target_dirs.size - 1
91
- raise
92
- else
93
- STDERR.puts "Encountered permission error, " +
94
- "trying a different directory..."
95
- STDERR.puts "-------------------------------"
96
- end
121
+ end
122
+
123
+ def sh(*args)
124
+ command_string = args.join(' ')
125
+ STDERR.puts "# #{command_string}"
126
+ if !system(*args)
127
+ raise "Could not compile #{library_name} ('#{command_string}' failed)"
128
+ end
129
+ end
130
+
131
+ def compile(target_dirs)
132
+ result = nil
133
+ target_dirs.each_with_index do |target_dir, i|
134
+ begin
135
+ mkdir(target_dir)
136
+ File.open("#{target_dir}/.permission_test", "w").close
137
+ File.unlink("#{target_dir}/.permission_test")
138
+ STDERR.puts "# cd #{target_dir}"
139
+ Dir.chdir(target_dir) do
140
+ sh("#{PlatformInfo.ruby_command} '#{extconf_rb}'")
141
+ sh("make")
142
+ end
143
+ result = target_dir
144
+ break
145
+ rescue Errno::EACCES
146
+ # If we encountered a permission error, then try
147
+ # the next target directory. If we get a permission
148
+ # error on the last one too then propagate the
149
+ # exception.
150
+ if i == target_dirs.size - 1
151
+ raise
152
+ else
153
+ STDERR.puts "Encountered permission error, " +
154
+ "trying a different directory..."
155
+ STDERR.puts "-------------------------------"
97
156
  end
98
157
  end
99
- result
100
158
  end
101
-
102
- target_dir = compile.call([
103
- "#{NATIVE_SUPPORT_DIR}/#{archdir}",
104
- "#{home}/#{LOCAL_DIR}/native_support/#{VERSION_STRING}/#{archdir}"
105
- ])
106
- require "#{target_dir}/native_support.#{libext}"
159
+ return result
107
160
  end
108
- end if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx"
161
+ end
162
+
163
+ end
164
+
165
+ loader = PhusionPassenger::NativeSupportLoader.new
166
+ loader.start if loader.supported?
@@ -84,7 +84,7 @@ module Packaging
84
84
  'ext/oxt/*.hpp',
85
85
  'ext/oxt/*.cpp',
86
86
  'ext/oxt/detail/*.hpp',
87
- 'ext/phusion_passenger/*.{c,rb}',
87
+ 'ext/ruby/*.{c,rb}',
88
88
  'misc/*',
89
89
  'test/*.example',
90
90
  'test/support/*.{cpp,h,rb}',
@@ -165,7 +165,7 @@ module PlatformInfo
165
165
  flags = ["-fPIC"]
166
166
  if compiler_supports_visibility_flag?
167
167
  flags << "-fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED"
168
- if compiler_visibility_flag_generates_warnings?
168
+ if compiler_visibility_flag_generates_warnings? && compiler_supports_wno_attributes_flag?
169
169
  flags << "-Wno-attributes"
170
170
  end
171
171
  end
@@ -34,11 +34,35 @@ module PlatformInfo
34
34
  return ENV['CXX'] || "g++"
35
35
  end
36
36
 
37
+ def self.gnu_make
38
+ gmake = find_command('gmake')
39
+ if !gmake
40
+ gmake = find_command('make')
41
+ if gmake
42
+ if `#{gmake} --version 2>&1` =~ /GNU/
43
+ return gmake
44
+ else
45
+ return nil
46
+ end
47
+ else
48
+ return nil
49
+ end
50
+ else
51
+ return gmake
52
+ end
53
+ end
54
+ memoize :gnu_make, true
55
+
37
56
  def self.compiler_supports_visibility_flag?
38
57
  return try_compile(:c, '', '-fvisibility=hidden')
39
58
  end
40
59
  memoize :compiler_supports_visibility_flag?, true
41
60
 
61
+ def self.compiler_supports_wno_attributes_flag?
62
+ return try_compile(:c, '', '-Wno-attributes')
63
+ end
64
+ memoize :compiler_supports_wno_attributes_flag?, true
65
+
42
66
  # Returns whether compiling C++ with -fvisibility=hidden might result
43
67
  # in tons of useless warnings, like this:
44
68
  # http://code.google.com/p/phusion-passenger/issues/detail?id=526
@@ -46,7 +70,7 @@ module PlatformInfo
46
70
  # http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00861.html
47
71
  # Warnings should be suppressed with -Wno-attributes.
48
72
  def self.compiler_visibility_flag_generates_warnings?
49
- if `#{cxx} -v 2>&1` =~ /gcc version (.*?)/
73
+ if RUBY_PLATFORM =~ /linux/ && `#{cxx} -v 2>&1` =~ /gcc version (.*?)/
50
74
  return $1 <= "4.1.2"
51
75
  else
52
76
  return false