passenger: remove wrapper scripts because they cause problems.

Instead, create a locations.ini so that Passenger can always find its own libraries.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Hongli Lai (Phusion) 2014-01-04 00:50:42 +01:00 committed by Mike McQuaid
parent 374635227d
commit cd295b6f1d

View file

@ -20,24 +20,30 @@ class Passenger < Formula
libexec.mkpath
cp_r necessary_files, libexec, :preserve => true
# The various scripts in bin cannot correctly locate their root directory
# when invoked as symlinks in /usr/local/bin. We create wrapper scripts
# to solve this problem.
# Allow Homebrew to create symlinks for the Phusion Passenger commands.
bin.mkpath
Dir[libexec/"bin/*"].each do |orig_script|
name = File.basename(orig_script)
(bin/name).write <<-EOS.undent
#!/bin/sh
exec #{orig_script} "$@"
EOS
ln_s orig_script, bin/name
end
# Ensure that the Phusion Passenger commands can always find their library
# files.
locations_ini = `/usr/bin/ruby ./bin/passenger-config --make-locations-ini`
locations_ini.gsub!(/=#{Regexp.compile Dir.pwd}\//, "=#{libexec}/")
(libexec/"lib/phusion_passenger/locations.ini").write(locations_ini)
system "/usr/bin/ruby", "./dev/install_scripts_bootstrap_code.rb",
"--ruby", libexec/"lib", *Dir[libexec/"bin/*"]
system "/usr/bin/ruby", "./dev/install_scripts_bootstrap_code.rb",
"--nginx-module-config", libexec/"bin", libexec/"ext/nginx/config"
mv libexec/'man', share
end
def caveats; <<-EOS.undent
To activate Phusion Passenger for Apache, create /etc/apache2/other/passenger.conf:
LoadModule passenger_module #{opt_prefix}/libexec/buildout/apache2/mod_passenger.so
PassengerRoot #{opt_prefix}/libexec
PassengerRoot #{opt_prefix}/libexec/lib/phusion_passenger/locations.ini
PassengerDefaultRuby /usr/bin/ruby
To activate Phusion Passenger for Nginx, run:
@ -46,8 +52,9 @@ class Passenger < Formula
end
test do
if `#{HOMEBREW_PREFIX}/bin/passenger-config --root`.strip != libexec.to_s
raise "Invalid root path"
ruby_libdir = `#{HOMEBREW_PREFIX}/bin/passenger-config --ruby-libdir`.strip
if ruby_libdir != (libexec/"lib").to_s
raise "Invalid installation"
end
end
end