Permalink
Browse files

Migration to the more static directory structure

Blessed patch from Hong Li
Removed (most of) the kludges to remove %{builddir} from installed files.
  • Loading branch information...
1 parent e5007b9 commit 65f42975aabdab89f396b5bc115656fe396eaf20 @erikogan erikogan committed Dec 1, 2010
Showing with 85 additions and 7 deletions.
  1. +25 −7 rpm/passenger.spec
  2. +60 −0 rpm/patches/passenger-force-native.patch
View
@@ -13,7 +13,7 @@
%define passenger_version 3.0.1
%endif
%if %{?passenger_release:0}%{?!passenger_release:1}
- %define passenger_release 1%{?dist}
+ %define passenger_release 2%{?dist}
%endif
%define passenger_epoch 1
@@ -90,6 +90,7 @@ Source200: rubygem-passenger.te
# # Ignore everything after the ?, it's meant to trick rpmbuild into
# # finding the correct file
# Source300: http://github.com/gnosek/nginx-upstream-fair/tarball/master?/nginx-upstream-fair.tar.gz
+Patch0: passenger-force-native.patch
BuildRoot: %{_tmppath}/%{name}-%{passenger_version}-%{passenger_release}-root-%(%{__id_u} -n)
Requires: rubygems
Requires: rubygem(rake) >= 0.8.1
@@ -261,6 +262,13 @@ This package includes an nginx server with Passenger compiled in.
# %setup -q -T -D -n nginx-%{nginx_version} -a 300
# # Fix the CWD
# %setup -q -T -D -n %{gemname}-%{passenger_version}
+%patch0 -p1
+
+# Rather than hard-coding the path into the patch, change it here so
+# that it's consistent with the %{ruby} macro, which might be defined on
+# the command-line (4 %'s = 2)
+perl -pi -e '%{perlfileck} s{%%%%GEM_INSTALL_DIR%%%%}{%{geminstdir}};s{%%%%APACHE_INSTALLED_MOD%%%%}{%{_libdir}/httpd/modules/mod_passenger.so}' lib/phusion_passenger.rb ext/common/ResourceLocator.h
+
%if %{gem_version_mismatch}
%{warn:
***
@@ -294,7 +302,7 @@ export LIBEV_LIBS='-lev'
%{rake} native_support
%else
%{rake} package
- ./bin/passenger-install-apache2-module --auto
+ %{rake} apache2
### SELINUX
rm -rf selinux
@@ -422,6 +430,7 @@ tar -zx -C $standalone_dir/support -f $standalone_dir/support.tar.gz
# Hong Li says the binaries are relocatable, so we don't have to jump
# through hoops to change directories. Just move it.
mv $standalone_dir $native_dir
+mv $native_dir/support/ext/ruby/*-linux $native_dir/support/ext/ruby/native
# Unhack
mv lib/phusion_passenger/standalone/runtime_installer.rb.nohack lib/phusion_passenger/standalone/runtime_installer.rb
@@ -438,8 +447,8 @@ cd -
%endif #!only_native_libs
##### NATIVE LIBS INSTALL
-mkdir -p %{buildroot}/%{geminstdir}/ext/ruby
-cp -ra ext/ruby/*-linux %{buildroot}/%{geminstdir}/ext/ruby
+mkdir -p %{buildroot}/%{geminstdir}/ext/ruby/native
+cp -ra ext/ruby/*-linux/* %{buildroot}/%{geminstdir}/ext/ruby/native
%if !%{only_native_libs}
#### Clean up everything we don't care about
@@ -461,12 +470,15 @@ perl -pe 's{%%ROOT}{%geminstdir}g;s{%%RUBY}{%ruby}g' %{SOURCE100} > %{buildroot}
perl -pe 's{%%ROOT}{%geminstdir}g;s{%%RUBY}{%ruby}g' %{SOURCE101} > %{buildroot}/%{nginx_confdir}/conf.d/passenger.conf
# CLEANUP
-rm -f $native_dir/support/ext/ruby/ruby*/mkmf.log
+rm -f $native_dir/support/ext/ruby/native/mkmf.log
# Reversed logic from most other tests
%if %{?fedora:0}%{?!fedora:1}
rm -f $native_dir/support/ext/libev/config.log
%endif
+# REMOVE THIS TO FORCE 'native-packaged' (it's still in doc)
+rm %{buildroot}/%{geminstdir}/DEVELOPERS.TXT
+
# This is still needed
%if %{?fedora:1}%{?!fedora:0}
%define libevmunge %nil
@@ -537,7 +549,8 @@ rm -rf %{buildroot}
%{_bindir}/passenger-make-enterprisey
%{gemdir}/gems/%{gemname}-%{gemversion}/
%doc %{gemdir}/doc/%{gemname}-%{gemversion}
-%doc %{geminstdir}/README
+%doc README
+%doc DEVELOPERS.TXT
%{gemdir}/cache/%{gemname}-%{gemversion}.gem
%{gemdir}/specifications/%{gemname}-%{gemversion}.gemspec
@@ -570,10 +583,15 @@ rm -rf %{buildroot}
%files native-libs
# %{geminstdir}/ext/ruby/%{gemnativedir}
-%{geminstdir}/ext/ruby/*-linux
+%{geminstdir}/ext/ruby/native
%changelog
+* Tue Nov 30 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-2
+- Remove (most of) the kludges to remove %%{builddir} from installed files.
+- Blessed natively-packaged patch from Hong Li
+- Migration to the more static directory structure
+
* Mon Nov 29 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-1
- Integration into passenger source
- Bump to 3.0.1
@@ -0,0 +1,60 @@
+diff --git a/lib/phusion_passenger.rb b/lib/phusion_passenger.rb
+index 6019499..2728455 100644
+--- a/lib/phusion_passenger.rb
++++ b/lib/phusion_passenger.rb
+@@ -88,10 +88,11 @@ module PhusionPassenger
+ # Not available when natively packaged.
+ NATIVE_SUPPORT_DIR = File.join(SOURCE_ROOT, "ext", "ruby")
+ else
+- SOURCE_ROOT = NATIVELY_PACKAGED_SOURCE_ROOT
+- DOCDIR = NATIVELY_PACKAGED_DOCDIR
+- RESOURCES_DIR = NATIVELY_PACKAGED_RESOURCES_DIR
+- APACHE2_MODULE = NATIVELY_PACKAGED_APACHE2_MODULE
++ SOURCE_ROOT = '%%GEM_INSTALL_DIR%%'
++ DOCDIR = "#{SOURCE_ROOT}/doc"
++ RESOURCES_DIR = "#{SOURCE_ROOT}/resources"
++ APACHE2_MODULE = '%%APACHE_INSTALLED_MOD%%'
++ NATIVE_SUPPORT_DIR = "#{SOURCE_ROOT}/ext/ruby"
+ end
+
+
+diff --git a/lib/phusion_passenger/native_support.rb b/lib/phusion_passenger/native_support.rb
+index f1edf1c..4312d01 100644
+--- a/lib/phusion_passenger/native_support.rb
++++ b/lib/phusion_passenger/native_support.rb
+@@ -38,10 +38,7 @@ class NativeSupportLoader
+
+ private
+ def archdir
+- @archdir ||= begin
+- require 'phusion_passenger/platform_info/binary_compatibility'
+- PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
+- end
++ @archdir ||= 'native'
+ end
+
+ def libext
+diff --git a/ext/common/ResourceLocator.h b/ext/common/ResourceLocator.h
+index 5f65804..e585d1a 100644
+--- a/ext/common/ResourceLocator.h
++++ b/ext/common/ResourceLocator.h
+@@ -64,13 +64,13 @@ public:
+ !fileExists(root + "/DEVELOPERS.TXT");
+
+ if (nativelyPackaged) {
+- agentsDir = "/usr/lib/phusion-passenger/agents";
+- helperScriptsDir = "/usr/share/phusion-passenger/helper-scripts";
+- resourcesDir = "/usr/share/phusion-passenger";
+- docDir = "/usr/share/doc/phusion-passenger";
++ agentsDir = "%%GEM_INSTALL_DIR%%/agents";
++ helperScriptsDir = "%%GEM_INSTALL_DIR%%/helper-scripts";
++ resourcesDir = "%%GEM_INSTALL_DIR%%";
++ docDir = "%%GEM_INSTALL_DIR%%/doc";
+ rubyLibDir = "";
+- compilableSourceDir = "/usr/share/phusion-passenger/compilable-source";
+- apache2Module = "/usr/lib/apache2/modules/mod_passenger.so";
++ compilableSourceDir = "%%GEM_INSTALL_DIR%%";
++ apache2Module = "%%APACHE_INSTALLED_MOD%%";
+ } else {
+ agentsDir = root + "/agents";
+ helperScriptsDir = root + "/helper-scripts";

0 comments on commit 65f4297

Please sign in to comment.