Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

generalize the perl install dir to work across distro

  • Loading branch information...
commit 0b33a6e264fb0d9b6bb66f3fb8d7b8f0513f6829 1 parent 010f6c4
@erikogan erikogan authored
Showing with 29 additions and 22 deletions.
  1. +12 −9 rpm/nginx-alternatives.spec
  2. +17 −13 rpm/passenger.spec
View
21 rpm/nginx-alternatives.spec
@@ -4,6 +4,9 @@
#
# This package is meant to be obsoleted by a future nginx package that
# will provide the same feature
+
+%define perldir %(perl -MConfig -e 'print $Config{installarchlib}')
+
Summary: Alternatives aware nginx
Name: nginx-alternatives
Version: 0.0.1
@@ -39,15 +42,15 @@ rm -rf $RPM_BUILD_ROOT
%triggerin -- nginx
if [ ! -L /usr/sbin/nginx ] ; then
mv /usr/sbin/nginx /usr/sbin/nginx.base
- mv %{_libdir}/perl5/auto/nginx/nginx.so %{_libdir}/perl5/auto/nginx/nginx_base.so
- mv %{_libdir}/perl5/nginx.pm %{_libdir}/perl5/nginx_base.pm
+ mv %{perldir}/auto/nginx/nginx.so %{perldir}/auto/nginx/nginx_base.so
+ mv %{perldir}/nginx.pm %{perldir}/nginx_base.pm
mv %{_mandir}/man3/nginx.3pm.gz %{_mandir}/man3/nginx_base.3pm.gz
/usr/sbin/alternatives --install /usr/sbin/nginx nginx \
/usr/sbin/nginx.base 30 \
- --slave %{_libdir}/perl5/auto/nginx/nginx.so nginx.so \
- %{_libdir}/perl5/auto/nginx/nginx_base.so \
- --slave %{_libdir}/perl5/nginx.pm nginx.pm %{_libdir}/perl5/nginx_base.pm \
+ --slave %{perldir}/auto/nginx/nginx.so nginx.so \
+ %{perldir}/auto/nginx/nginx_base.so \
+ --slave %{perldir}/nginx.pm nginx.pm %{perldir}/nginx_base.pm \
--slave %{_mandir}/man3/nginx.3pm.gz nginx.man \
%{_mandir}/man3/nginx_base.3pm.gz
fi
@@ -57,14 +60,14 @@ fi
# put the expected binary back in place.
%define undo_link \
bin=`readlink -f /usr/sbin/nginx` \
- so=`readlink -f %{_libdir}/perl5/auto/nginx/nginx.so` \
- pm=`readlink -f %{_libdir}/perl5/nginx.pm` \
+ so=`readlink -f %{perldir}/auto/nginx/nginx.so` \
+ pm=`readlink -f %{perldir}/nginx.pm` \
man=`readlink -f %{_mandir}/man3/nginx.3pm.gz` \
/usr/sbin/alternatives --remove nginx /usr/sbin/nginx.base \
/usr/sbin/alternatives --remove nginx $bin \
mv -f $bin /usr/sbin/nginx \
- mv -f $so %{_libdir}/perl5/auto/nginx/nginx.so \
- mv -f $pm %{_libdir}/perl5/nginx.pm \
+ mv -f $so %{perldir}/auto/nginx/nginx.so \
+ mv -f $pm %{perldir}/nginx.pm \
mv -f $man %{_mandir}/man3/nginx.3pm.gz
View
30 rpm/passenger.spec
@@ -45,6 +45,8 @@
%define gemdir %(%{ruby} -rubygems -e 'puts Gem::dir' 2>/dev/null)
%define geminstdir %{gemdir}/gems/%{gemname}-%{gemversion}
+%define perldir %(perl -MConfig -e 'print $Config{installvendorarch}')
+
# This will cause a chicken/egg problem where the dir isn't present yet
#% define gemnativedir % (%{ruby} -I%{_builddir}/%{gemname}-%{passenger_version}/lib -rphusion_passenger/platform_info/binary_compatibility -e 'puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")')
# %define native_libs_release %{passenger_release}_% (%{ruby} -I%{_builddir}/%{gemname}-%{passenger_version}/lib -rphusion_passenger/platform_info/binary_compatibility -e 'puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_ids[0,2].join("_")')
@@ -347,12 +349,14 @@ cp -ra ext/ruby/*-linux %{buildroot}/%{geminstdir}/ext/ruby
%if !%{only_native_libs}
#### Clean up everything we don't care about
rm -rf %{buildroot}/usr/share/nginx %{buildroot}/%{nginx_confdir}
-# Assume the old version is good enough. Probably not wise.
-#rm -rf %{buildroot}%{_libdir}/perl5 %{buildroot}%{_mandir}/man3/nginx.3pm*
-rm -f %{buildroot}%{_libdir}/perl5/{auto/nginx/.packlist,perllocal.pod}
-mv %{buildroot}%{_libdir}/perl5/auto/nginx/nginx{,_passenger}.bs
-mv %{buildroot}%{_libdir}/perl5/auto/nginx/nginx{,_passenger}.so
-mv %{buildroot}%{_libdir}/perl5/nginx{,_passenger}.pm
+# # Assume the old version is good enough. Probably not wise.
+# rm -rf %{buildroot}%{perldir} %{buildroot}%{_mandir}/man3/nginx.3pm*
+rm -f %{buildroot}%{perldir}/{auto/nginx/.packlist,perllocal.pod}
+# RHEL distinguishes these dirs
+rm -f %{buildroot}%(perl -MConfig -e 'print $Config{installarchlib}')/perllocal.pod
+mv %{buildroot}%{perldir}/auto/nginx/nginx{,_passenger}.bs
+mv %{buildroot}%{perldir}/auto/nginx/nginx{,_passenger}.so
+mv %{buildroot}%{perldir}/nginx{,_passenger}.pm
mv %{buildroot}%{_mandir}/man3/nginx.3pm{,_passenger}
install -p -d -m 0755 %{buildroot}/%{nginx_confdir}/conf.d
@@ -365,11 +369,11 @@ perl -pe 's{%%ROOT}{%geminstdir}g;s{%%RUBY}{%ruby}g' %{SOURCE101} > %{buildroot}
if [ $1 == 1 ]; then
/usr/sbin/alternatives --install /usr/sbin/nginx nginx \
/usr/sbin/nginx.passenger 50 \
- --slave %{_libdir}/perl5/auto/nginx/nginx.so nginx.so \
- %{_libdir}/perl5/auto/nginx/nginx_passenger.so \
- --slave %{_libdir}/perl5/auto/nginx/nginx.bs nginx.bs \
- %{_libdir}/perl5/auto/nginx/nginx_passenger.bs \
- --slave %{_libdir}/perl5/nginx.pm nginx.pm %{_libdir}/perl5/nginx_passenger.pm \
+ --slave %{perldir}/auto/nginx/nginx.so nginx.so \
+ %{perldir}/auto/nginx/nginx_passenger.so \
+ --slave %{perldir}/auto/nginx/nginx.bs nginx.bs \
+ %{perldir}/auto/nginx/nginx_passenger.bs \
+ --slave %{perldir}/nginx.pm nginx.pm %{perldir}/nginx_passenger.pm \
--slave %{_mandir}/man3/nginx.3pm.gz nginx.man \
%{_mandir}/man3/nginx_passenger.3pm.gz
fi
@@ -437,8 +441,8 @@ rm -rf %{buildroot}
%doc doc/Users\ guide\ Nginx.txt
%{nginx_confdir}/conf.d/passenger.conf
/usr/sbin/nginx.passenger
-%{_libdir}/perl5/auto/nginx/nginx*
-%{_libdir}/perl5/nginx*
+%{perldir}/auto/nginx/nginx*
+%{perldir}/nginx*
%{_mandir}/man3/nginx*
%endif # !only_native_libs
Please sign in to comment.
Something went wrong with that request. Please try again.