Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not look for apr-1-config in PATH if we're building against OS X's…

… default Apache.
  • Loading branch information...
commit e58be5382e07e29c9a12c19fa69dd22ca0e2c611 1 parent 08760b6
Hongli Lai FooBarWidget authored
10 Rakefile
View
@@ -33,7 +33,7 @@ include PlatformInfo
APXS2.nil? and raise "Could not find 'apxs' or 'apxs2'."
APACHE2CTL.nil? and raise "Could not find 'apachectl' or 'apache2ctl'."
HTTPD.nil? and raise "Could not find the Apache web server binary."
-APR1_FLAGS.nil? and raise "Could not find Apache Portable Runtime (APR)."
+APR_FLAGS.nil? and raise "Could not find Apache Portable Runtime (APR)."
CXX = "g++"
THREADING_FLAGS = "-D_REENTRANT"
@@ -101,7 +101,7 @@ end
##### Apache module
class APACHE2
- CXXFLAGS = "-I.. -fPIC -g -DPASSENGER_DEBUG #{APR1_FLAGS} #{APXS2_FLAGS} #{CXXFLAGS}"
+ CXXFLAGS = "-I.. -fPIC -g -DPASSENGER_DEBUG #{APR_FLAGS} #{APXS2_FLAGS} #{CXXFLAGS}"
OBJECTS = {
'Configuration.o' => %w(Configuration.cpp Configuration.h),
'Hooks.o' => %w(Hooks.cpp Hooks.h
@@ -128,7 +128,7 @@ subdir 'ext/apache2' do
#
# Oh, and libtool sucks too. Do we even need it anymore in 2008?
linkflags = "#{LDFLAGS} #{MULTI_ARCH_FLAGS}"
- linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR1_LIBS}"
+ linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR_LIBS}"
create_shared_library 'mod_passenger.so',
APACHE2::OBJECTS.keys.join(' ') << ' mod_passenger.o',
linkflags
@@ -179,7 +179,7 @@ end
class TEST
CXXFLAGS = ::CXXFLAGS + " -Isupport -DTESTING_SPAWN_MANAGER -DTESTING_APPLICATION_POOL "
- AP2_FLAGS = "-I../ext/apache2 -I../ext #{APR1_FLAGS}"
+ AP2_FLAGS = "-I../ext/apache2 -I../ext #{APR_FLAGS}"
AP2_OBJECTS = {
'CxxTestMain.o' => %w(CxxTestMain.cpp),
@@ -239,7 +239,7 @@ subdir 'test' do
" ../ext/apache2/Utils.o" <<
" ../ext/apache2/Logging.o"
create_executable "Apache2ModuleTests", objects,
- "#{LDFLAGS} #{APR1_LIBS} #{MULTI_ARCH_FLAGS} " <<
+ "#{LDFLAGS} #{APR_LIBS} #{MULTI_ARCH_FLAGS} " <<
"../ext/boost/src/libboost_thread.a -lpthread"
end
2  lib/passenger/dependencies.rb
View
@@ -248,7 +248,7 @@ module Dependencies # :nodoc: all
APR_DevHeaders = Dependency.new do |dep|
dep.name = "Apache Portable Runtime (APR) development headers"
dep.define_checker do |result|
- result.found(!APR1_FLAGS.nil?)
+ result.found(APR_CONFIG)
end
if RUBY_PLATFORM =~ /linux/
case LINUX_DISTRO
34 lib/passenger/platform_info.rb
View
@@ -120,33 +120,35 @@ def self.determine_apxs2_flags
end
end
- def self.determine_apr1_info
+ def self.find_apr_config
# If we're on MacOS X, and we're compiling against the
# default provided Apache, then we'll want to query the
# correct 'apr-1-config' command. However, that command
# is not in $PATH by default. Instead, it lives in
# /Developer/SDKs/MacOSX*sdk/usr/bin.
- # So we forcefully add this path to $PATH, if we notice
- # that we're compiling against the default Apache.
if RUBY_PLATFORM =~ /darwin/ && HTTPD == "/usr/sbin/httpd"
sdk_dir = Dir["/Developer/SDKs/MacOSX*sdk"].sort.last
if sdk_dir
- sdk_bindir = "#{sdk_dir}/usr/bin"
- if !ENV['PATH'].split(':').include?(sdk_bindir)
- ENV['PATH'] = "#{sdk_bindir}:#{ENV['PATH']}"
+ apr_config = "#{sdk_dir}/usr/bin/apr-1-config"
+ if !File.executable?(apr_config)
+ apr_config = nil
end
end
+ else
+ apr_config = find_command('apr-1-config')
+ if apr_config.nil?
+ apr_config = find_command('apr-config')
+ end
end
-
- apr_config = find_command('apr-1-config')
- if apr_config.nil?
- apr_config = find_command('apr-config')
- end
- if apr_config.nil?
+ return apr_config
+ end
+
+ def self.determine_apr_info
+ if APR_CONFIG.nil?
return nil
else
- flags = `#{apr_config} --cppflags --includes`.strip
- libs = `#{apr_config} --link-ld`.strip
+ flags = `#{APR_CONFIG} --cppflags --includes`.strip
+ libs = `#{APR_CONFIG} --link-ld`.strip
flags.gsub!(/-O\d? /, '')
return [flags, libs]
end
@@ -240,11 +242,13 @@ def self.find_command(name)
APACHE2CTL = find_apache2ctl
# The absolute path to the Apache binary (that is, 'httpd', 'httpd2', 'apache' or 'apache2').
HTTPD = find_httpd
+ # The absolute path to the 'apr-config' or 'apr-1-config' executable.
+ APR_CONFIG = find_apr_config
# The C compiler flags that are necessary to compile an Apache module.
APXS2_FLAGS = determine_apxs2_flags
# The C compiler flags that are necessary for programs that use APR.
- APR1_FLAGS, APR1_LIBS = determine_apr1_info
+ APR_FLAGS, APR_LIBS = determine_apr_info
# The C compiler flags that are necessary for building binaries in the same architecture(s) as Apache.
MULTI_ARCH_FLAGS = determine_multi_arch_flags
Please sign in to comment.
Something went wrong with that request. Please try again.