[perl] Define SONAME for libperl.so and move the libary into standard path

Petr Pisar ppisar at fedoraproject.org
Fri Jul 12 07:37:08 UTC 2013


commit bd3c2bdecb30a5fd1f66e7b22f3665f8c7e67326
Author: Petr Písař <ppisar at redhat.com>
Date:   Wed Jun 19 17:37:52 2013 +0200

    Define SONAME for libperl.so and move the libary into standard path

 perl-5.16.3-create_libperl_soname.patch |   52 +++++++++++++++++++++++++++++++
 perl.spec                               |   26 ++++++++++++++-
 2 files changed, 76 insertions(+), 2 deletions(-)
---
diff --git a/perl-5.16.3-create_libperl_soname.patch b/perl-5.16.3-create_libperl_soname.patch
new file mode 100644
index 0000000..1f26c71
--- /dev/null
+++ b/perl-5.16.3-create_libperl_soname.patch
@@ -0,0 +1,52 @@
+From fa2f0dd5a7767223df10149d3f16d7ed7013e16f Mon Sep 17 00:00:00 2001
+From: Torsten Veller <tove at gentoo.org>
+Date: Sat, 14 Apr 2012 13:49:18 +0200
+Subject: Set libperl soname
+
+Bug-Gentoo: https://bugs.gentoo.org/286840
+
+Patch-Name: gentoo/create_libperl_soname.diff
+---
+ Makefile.SH | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.SH b/Makefile.SH
+index d1da0a0..7733a32 100755
+--- a/Makefile.SH
++++ b/Makefile.SH
+@@ -58,7 +58,7 @@ true)
+ 				${api_revision}.${api_version}.${api_subversion} \
+ 			     -current_version \
+ 				${revision}.${patchlevel}.${subversion} \
+-			     -install_name \$(shrpdir)/\$@"
++			     -install_name \$(shrpdir)/libperl.${revision}.${patchlevel}.dylib"
+ 		;;
+ 	cygwin*)
+ 		shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000"
+@@ -66,13 +66,15 @@ true)
+ 		;;
+ 	sunos*)
+ 		linklibperl="-lperl"
++		shrpldflags="$shrpldflags -Wl,-soname -Wl,libperl.so.${revision}.${patchlevel}"
+ 		;;
+ 	netbsd*|freebsd[234]*|openbsd*|dragonfly*)
+ 		linklibperl="-L. -lperl"
++		shrpldflags="$shrpldflags -Wl,-soname -Wl,libperl.so.${revision}.${patchlevel}"
+ 		;;
+ 	interix*)
+ 		linklibperl="-L. -lperl"
+-		shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
++		shrpldflags="$shrpldflags -Wl,--image-base,0x57000000 -Wl,-soname -Wl,libperl.so.${revision}.${patchlevel}"
+ 		;;
+ 	aix*)
+ 		case "$cc" in
+@@ -110,6 +112,9 @@ true)
+ 	    linklibperl='libperl.x'
+ 	    DPERL_EXTERNAL_GLOB=''
+ 	    ;;
++	linux*)
++		shrpldflags="$shrpldflags -Wl,-soname -Wl,libperl.so.${revision}.${patchlevel}"
++	    ;;
+ 	esac
+ 	case "$ldlibpthname" in
+ 	'') ;;
diff --git a/perl.spec b/perl.spec
index 6babcc7..a7b5711 100644
--- a/perl.spec
+++ b/perl.spec
@@ -31,7 +31,7 @@
 Name:           perl
 Version:        %{perl_version}
 # release number must be even higher, because dual-lived modules will be broken otherwise
-Release:        282%{?dist}
+Release:        283%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -96,6 +96,9 @@ Patch13:        perl-5.18.0-Fix-regmatch-pointer-32-bit-wraparound-regression.pa
 # RT#118821
 Patch14:        perl-5.18.0-Suppress-system-Term-ReadLine-Gnu.patch
 
+# Define SONAME for libperl.so
+Patch15:        perl-5.16.3-create_libperl_soname.patch
+
 # Update some of the bundled modules
 # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
 
@@ -1876,6 +1879,7 @@ tarball from perl.org.
 %patch12 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1
 
 %if !%{defined perl_bootstrap}
 # Local patch tracking
@@ -1894,6 +1898,7 @@ perl -x patchlevel.h \
     'Fedora Patch12: Disable ornaments on perl5db AutoTrace tests (RT#118817)' \
     'Fedora Patch13: Fix regmatch pointer 32-bit wraparound regression (RT#118175)' \
     'Fedora Patch14: Do not use system Term::ReadLine::Gnu in tests (RT#118821)' \
+    'Fedora Patch15: Define SONAME for libperl.so' \
     %{nil}
 %endif
 
@@ -2032,6 +2037,16 @@ make install DESTDIR=$RPM_BUILD_ROOT
     PERL5LIB="%{build_archlib}:%{build_privlib}" \\\
     %{build_bindir}/perl
 
+# Make proper DSO names, move libperl to standard path.
+%global soname libperl.so.%(echo '%{version}' | sed 's/^\\([^.]*\\.[^.]*\\).*/\\1/')
+mv "%{build_archlib}/CORE/libperl.so" \
+    "$RPM_BUILD_ROOT%{_libdir}/libperl.so.%{version}"
+ln -s "libperl.so.%{version}" "$RPM_BUILD_ROOT%{_libdir}/%{soname}"
+ln -s "libperl.so.%{version}" "$RPM_BUILD_ROOT%{_libdir}/libperl.so"
+# XXX: Keep symlink from original location because various code glues
+# $archlib/CORE/$libperl to get the DSO.
+ln -s "../../libperl.so.%{version}" "%{build_archlib}/CORE/libperl.so"
+
 install -p -m 755 utils/pl2pm %{build_bindir}/pl2pm
 
 for i in asm/termios.h syscall.h syslimits.h syslog.h \
@@ -2122,7 +2137,7 @@ mkdir -p %{buildroot}%{tapsetdir}
 %endif
 
 sed \
-  -e "s|LIBRARY_PATH|%{archlib}/CORE/libperl.so|" \
+  -e "s|LIBRARY_PATH|%{_libdir}/%{soname}|" \
   %{SOURCE4} \
   > %{buildroot}%{tapsetdir}/%{libperl_stp}
 
@@ -2162,6 +2177,7 @@ sed \
 
 # libs
 %exclude %{archlib}/CORE/libperl.so
+%exclude %{_libdir}/libperl.so.*
 %exclude %{perl_vendorarch}
 
 # devel
@@ -2172,6 +2188,7 @@ sed \
 %exclude %{_bindir}/perlivp
 %exclude %{_mandir}/man1/perlivp*
 %exclude %{archlib}/CORE/*.h
+%exclude %{_libdir}/libperl.so
 %exclude %{_mandir}/man1/perlxs*
 
 # Archive-Extract
@@ -2770,6 +2787,7 @@ sed \
 %files libs
 %defattr(-,root,root)
 %{archlib}/CORE/libperl.so
+%{_libdir}/libperl.so.*
 %dir %{archlib}
 %dir %{perl_vendorarch}
 %dir %{perl_vendorarch}/auto
@@ -2782,6 +2800,7 @@ sed \
 %{_bindir}/perlivp
 %{_mandir}/man1/perlivp*
 %{archlib}/CORE/*.h
+%{_libdir}/libperl.so
 %{_mandir}/man1/perlxs*
 %{tapsetdir}/%{libperl_stp}
 %doc perl-example.stp
@@ -3563,6 +3582,9 @@ sed \
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Tue Jul 09 2013 Petr Pisar <ppisar at redhat.com> - 4:5.18.0-283
+- Define SONAME for libperl.so and move the libary into standard path
+
 * Mon Jul 08 2013 Petr Pisar <ppisar at redhat.com> - 4:5.18.0-282
 - Do not load system Term::ReadLine::Gnu while running tests
 - Disable ornaments on perl5db AutoTrace tests


More information about the scm-commits mailing list