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.
- data/bin/passenger-status +1 -1
- data/build/packaging.rb +4 -7
- data/build/ruby_extension.rb +5 -5
- data/ext/common/Constants.h +1 -1
- data/ext/common/LoggingAgent/RemoteSender.h +3 -1
- data/ext/nginx/ngx_http_passenger_module.c +1 -1
- data/ext/{phusion_passenger → ruby}/extconf.rb +1 -1
- data/ext/{phusion_passenger/native_support.c → ruby/passenger_native_support.c} +1 -1
- data/lib/phusion_passenger.rb +5 -6
- data/lib/phusion_passenger/dependencies.rb +23 -0
- data/lib/phusion_passenger/native_support.rb +123 -65
- data/lib/phusion_passenger/packaging.rb +1 -1
- data/lib/phusion_passenger/platform_info/apache.rb +1 -1
- data/lib/phusion_passenger/platform_info/compiler.rb +25 -1
- data/lib/phusion_passenger/platform_info/ruby.rb +36 -5
- data/lib/phusion_passenger/standalone/runtime_installer.rb +5 -4
- data/lib/phusion_passenger/utils.rb +62 -1
- data/test/ruby/utils_spec.rb +62 -0
- data/test/support/test_helper.rb +2 -0
- metadata +6 -168
- data/doc/rdoc/classes/ConditionVariable.html +0 -215
- data/doc/rdoc/classes/Exception.html +0 -120
- data/doc/rdoc/classes/GC.html +0 -113
- data/doc/rdoc/classes/IO.html +0 -221
- data/doc/rdoc/classes/PhusionPassenger.html +0 -368
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +0 -180
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +0 -647
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +0 -654
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/InvalidPassword.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +0 -619
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +0 -142
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats.html +0 -368
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/MemoryStats/Process.html +0 -231
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance.html +0 -588
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/CorruptedDirectoryError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/GenerationsAbsentError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Group.html +0 -147
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Process.html +0 -279
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/RoleDeniedError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/StaleDirectoryError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/Stats.html +0 -123
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ServerInstance/UnsupportedGenerationStructureVersionError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger.html +0 -341
- data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/Log.html +0 -294
- data/doc/rdoc/classes/PhusionPassenger/AnalyticsLogger/SharedData.html +0 -199
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +0 -155
- data/doc/rdoc/classes/PhusionPassenger/AppProcess.html +0 -367
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails.html +0 -95
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner.html +0 -351
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/ApplicationSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/CGIFixed.html +0 -200
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner.html +0 -410
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/FrameworkSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/ClassicRails/RequestHandler.html +0 -156
- data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions.html +0 -115
- data/doc/rdoc/classes/PhusionPassenger/ClassicRailsExtensions/AnalyticsLogging.html +0 -202
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +0 -172
- data/doc/rdoc/classes/PhusionPassenger/DebugLogging.html +0 -273
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +0 -145
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +0 -162
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +0 -141
- data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +0 -673
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel/InvalidHashError.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/MessageClient.html +0 -415
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +0 -494
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport/FileSystemWatcher.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/Packaging.html +0 -129
- data/doc/rdoc/classes/PhusionPassenger/PlatformInfo.html +0 -1758
- data/doc/rdoc/classes/PhusionPassenger/Plugin.html +0 -237
- data/doc/rdoc/classes/PhusionPassenger/Rack.html +0 -91
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +0 -312
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +0 -218
- data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions.html +0 -114
- data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging.html +0 -256
- data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ACExtension.html +0 -139
- data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ASBenchmarkableExtension.html +0 -118
- data/doc/rdoc/classes/PhusionPassenger/Rails3Extensions/AnalyticsLogging/ExceptionLogger.html +0 -135
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +0 -378
- data/doc/rdoc/classes/PhusionPassenger/Standalone.html +0 -111
- data/doc/rdoc/classes/PhusionPassenger/Standalone/AppFinder.html +0 -252
- data/doc/rdoc/classes/PhusionPassenger/Standalone/Command.html +0 -161
- data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile.html +0 -368
- data/doc/rdoc/classes/PhusionPassenger/Standalone/ConfigFile/DisallowedContextError.html +0 -132
- data/doc/rdoc/classes/PhusionPassenger/Standalone/HelpCommand.html +0 -151
- data/doc/rdoc/classes/PhusionPassenger/Standalone/Main.html +0 -189
- data/doc/rdoc/classes/PhusionPassenger/Standalone/PackageRuntimeCommand.html +0 -177
- data/doc/rdoc/classes/PhusionPassenger/Standalone/RuntimeInstaller.html +0 -341
- data/doc/rdoc/classes/PhusionPassenger/Standalone/StartCommand.html +0 -203
- data/doc/rdoc/classes/PhusionPassenger/Standalone/StatusCommand.html +0 -156
- data/doc/rdoc/classes/PhusionPassenger/Standalone/StopCommand.html +0 -168
- data/doc/rdoc/classes/PhusionPassenger/Standalone/Utils.html +0 -86
- data/doc/rdoc/classes/PhusionPassenger/Standalone/VersionCommand.html +0 -135
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +0 -125
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +0 -1468
- data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher.html +0 -204
- data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/DirInfo.html +0 -171
- data/doc/rdoc/classes/PhusionPassenger/Utils/FileSystemWatcher/FileInfo.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/Utils/HostsFileParser.html +0 -260
- data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +0 -169
- data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput.html +0 -265
- data/doc/rdoc/classes/PhusionPassenger/Utils/RewindableInput/Tempfile.html +0 -120
- data/doc/rdoc/classes/PhusionPassenger/Utils/UnseekableSocket.html +0 -561
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/WSGI.html +0 -89
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +0 -182
- data/doc/rdoc/classes/Process.html +0 -115
- data/doc/rdoc/classes/Signal.html +0 -139
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +0 -276
- data/doc/rdoc/files/README.html +0 -157
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +0 -92
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +0 -130
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +0 -135
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +0 -128
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/memory_stats_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/server_instance_rb.html +0 -132
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/analytics_logger_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/app_process_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/classic_rails/application_spawner_rb.html +0 -141
- data/doc/rdoc/files/lib/phusion_passenger/classic_rails/cgi_fixed_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/classic_rails/framework_spawner_rb.html +0 -146
- data/doc/rdoc/files/lib/phusion_passenger/classic_rails/request_handler_rb.html +0 -125
- data/doc/rdoc/files/lib/phusion_passenger/classic_rails_extensions/init_rb.html +0 -132
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/debug_logging_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +0 -147
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +0 -120
- data/doc/rdoc/files/lib/phusion_passenger/message_client_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/native_support_rb.html +0 -131
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/apache_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/binary_compatibility_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/compiler_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/curl_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/documentation_tools_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/linux_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/operating_system_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/ruby_rb.html +0 -128
- data/doc/rdoc/files/lib/phusion_passenger/platform_info/zlib_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/plugin_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/public_api_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +0 -137
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +0 -125
- data/doc/rdoc/files/lib/phusion_passenger/rails3_extensions/init_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +0 -160
- data/doc/rdoc/files/lib/phusion_passenger/standalone/app_finder_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/standalone/command_rb.html +0 -135
- data/doc/rdoc/files/lib/phusion_passenger/standalone/config_file_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/help_command_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/main_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/package_runtime_command_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/standalone/runtime_installer_rb.html +0 -132
- data/doc/rdoc/files/lib/phusion_passenger/standalone/start_command_rb.html +0 -136
- data/doc/rdoc/files/lib/phusion_passenger/standalone/status_command_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/stop_command_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/utils_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/standalone/version_command_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/utils/file_system_watcher_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/utils/hosts_file_parser_rb.html +0 -120
- data/doc/rdoc/files/lib/phusion_passenger/utils/rewindable_input_rb.html +0 -100
- data/doc/rdoc/files/lib/phusion_passenger/utils/tmpdir_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/utils/unseekable_socket_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +0 -179
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +0 -132
- data/doc/rdoc/fr_class_index.html +0 -139
- data/doc/rdoc/fr_file_index.html +0 -109
- data/doc/rdoc/fr_method_index.html +0 -435
- data/doc/rdoc/index.html +0 -26
- data/doc/rdoc/rdoc-style.css +0 -187
data/bin/passenger-status
CHANGED
@@ -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
|
|
data/build/packaging.rb
CHANGED
@@ -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}
|
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
|
-
|
116
|
-
|
117
|
-
|
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}/"
|
data/build/ruby_extension.rb
CHANGED
@@ -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/
|
19
|
-
output_name = "
|
20
|
-
source_dir = "ext/
|
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}/
|
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/
|
41
|
+
Dir["ext/ruby/*"].each do |entry|
|
42
42
|
if File.exist?("#{entry}/Makefile")
|
43
43
|
sh "rm -rf #{entry}"
|
44
44
|
end
|
data/ext/common/Constants.h
CHANGED
@@ -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
|
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
|
|
data/lib/phusion_passenger.rb
CHANGED
@@ -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.
|
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
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
|
89
|
+
def load_from_home
|
39
90
|
begin
|
40
|
-
require "#{home}/#{LOCAL_DIR}/native_support/#{VERSION_STRING}/#{archdir}
|
41
|
-
|
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
|
-
|
47
|
-
STDERR.puts "*** Phusion Passenger: no
|
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
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
loader = PhusionPassenger::NativeSupportLoader.new
|
166
|
+
loader.start if loader.supported?
|
@@ -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
|