public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Autodetect and use the APR provided by OS X's Developer SDK, whenever 
appropriate.
Hongli Lai (Phusion (author)
Sat Apr 19 09:42:35 -0700 2008
commit  94f3e2afe4985aedb9d3174d82abdcc3a83aca36
tree    ead44782f564e04ae582c59c328411e24ab7cfac
parent  d7908621e1785d6032c466a84181b7f7931dd83a
...
259
260
261
 
 
 
 
262
263
264
...
259
260
261
262
263
264
265
266
267
268
0
@@ -259,6 +259,10 @@ module Dependencies # :nodoc: all
0
       when :gentoo
0
         dep.install_command = "emerge -av apr"
0
       end
0
+ elsif RUBY_PLATFORM =~ /darwin/
0
+ dep.install_instructions = "Please install Apache from MacPorts, which will " <<
0
+ "provide APR automatically. <b>Or</b>, if you're installing against MacOS X's " <<
0
+ "default provided Apache, then please install the OS X Developer SDK."
0
     end
0
     dep.website = "http://httpd.apache.org/"
0
     dep.website_comments = "APR is an integrated part of Apache."
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
141
142
143
 
 
 
 
 
 
 
 
 
 
 
 
 
144
145
146
...
121
122
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
 
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
0
@@ -121,26 +121,35 @@ private
0
   end
0
   
0
   def self.determine_apr1_info
0
- flags = nil
0
- libs = nil
0
- if find_command('pkg-config')
0
- flags = `pkg-config --cflags apr-1 apr-util-1 2>/dev/null`.strip
0
- libs = `pkg-config --libs apr-1 apr-util-1 2>/dev/null`.strip
0
- end
0
- if (flags.nil? || flags.empty?) && (libs.nil? || libs.empty?)
0
- apr_config = find_command('apr-1-config')
0
- if apr_config.nil?
0
- apr_config = find_command('apr-config')
0
- end
0
- if apr_config.nil?
0
- return nil
0
- else
0
- flags = `#{apr_config} --cppflags --includes`.strip
0
- libs = `#{apr_config} --link-ld`.strip
0
+ # If we're on MacOS X, and we're compiling against the
0
+ # default provided Apache, then we'll want to query the
0
+ # correct 'apr-1-config' command. However, that command
0
+ # is not in $PATH by default. Instead, it lives in
0
+ # /Developer/SDKs/MacOSX*sdk/usr/bin.
0
+ # So we forcefully add this path to $PATH, if we notice
0
+ # that we're compiling against the default Apache.
0
+ if RUBY_PLATFORM =~ /darwin/ && HTTPD == "/usr/sbin/httpd"
0
+ sdk_dir = Dir["/Developer/SDKs/MacOSX*sdk"].sort.last
0
+ if sdk_dir
0
+ sdk_bindir = "#{sdk_dir}/usr/bin"
0
+ if !ENV['PATH'].split(':').include?(sdk_bindir)
0
+ ENV['PATH'] = "#{sdk_bindir}:#{ENV['PATH']}"
0
+ end
0
       end
0
     end
0
- flags.gsub!(/-O\d? /, '')
0
- return [flags, libs]
0
+
0
+ apr_config = find_command('apr-1-config')
0
+ if apr_config.nil?
0
+ apr_config = find_command('apr-config')
0
+ end
0
+ if apr_config.nil?
0
+ return nil
0
+ else
0
+ flags = `#{apr_config} --cppflags --includes`.strip
0
+ libs = `#{apr_config} --link-ld`.strip
0
+ flags.gsub!(/-O\d? /, '')
0
+ return [flags, libs]
0
+ end
0
   end
0
   
0
   def self.determine_multi_arch_flags

Comments

    No one has commented yet.