Make Perl link all .so it builds with libperl.so.

It makes upgrading from one Perl major version to another way easier.  For
binary package users, it means pkg upgrade will detect the libperl.so.x.yy
change, and reinstall the affected packages.  For users using ports, it will
save rebuild time as it's easier to detect what ports really need to be
rebuilt.

PR:		195821
Differential Revision: https://reviews.freebsd.org/D1241
Submitted by:	mat
Reviewed by:	antoine, bdrewery
Exp-run by:	antoine
With hat:	perl
Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2014-12-17 13:21:56 +00:00
parent 6bc4665885
commit 64835f0cdc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=374847
12 changed files with 148 additions and 27 deletions

View File

@ -10,6 +10,15 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
20141217:
AFFECTS: users of lang/perl5.*
AUTHOR: mat@FreeBSD.org
Perl now links libperl.so with all .so it builds. The stage-qa checks have
been extended to check that libperl.so is in fact linked with .so in
SITE_ARCH and errors out if none of the .so build by a port are linked with
it. It also checks that the rpath and runpath elf attributes are present.
20141130:
AUTHOR: tijl@FreeBSD.org

View File

@ -206,7 +206,56 @@ libtool() {
fi
}
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool"
libperl() {
local has_some_libperl_so files found
if [ -n "${SITE_ARCH_REL}" ]; then
has_some_libperl_so=0
files=0
while read f; do
# No results presents a blank line from heredoc.
[ -z "${f}" ] && continue
files=$((files+1))
found=`readelf -d $f | awk "BEGIN {libperl=1; rpath=10; runpath=100}
/NEEDED.*${LIBPERL}/ { libperl = 0 }
/RPATH.*perl.*CORE/ { rpath = 0 }
/RUNPATH.*perl.*CORE/ { runpath = 0 }
END {print libperl+rpath+runpath}
"`
# FIXME When 8.4 goes out of commission, replace the ;;
# with ;& in the case below. Also, change the logic on
# detecting if there was a file with libperl.so
if [ "$found" -ne "0" ]; then
case "$found" in
*1)
warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"
;; #;&
*1?)
has_some_libperl_so=1
warn "${f} does not have a rpath to ${LIBPERL}, not respecting lddlflags?"
;; #;&
1??)
has_some_libperl_so=1
warn "${f} does not have a runpath to ${LIBPERL}, not respecting lddlflags?"
;; #;&
esac
else
has_some_libperl_so=1
fi
# Use heredoc to avoid losing rc from find|while subshell
done <<-EOT
$(find ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} -name '*.so')
EOT
if [ $files -gt 0 -a $has_some_libperl_so -eq 0 ]; then
err "None of the .so in ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} are linked with ${LIBPERL}, see above for the full list."
return 1
else
return 0
fi
fi
}
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles libtool libperl"
ret=0
cd ${STAGEDIR}

View File

@ -105,6 +105,8 @@ PERL5= ${LOCALBASE}/bin/perl${PERL_VERSION}
PERL= ${LOCALBASE}/bin/perl
CONFIGURE_ENV+= ac_cv_path_PERL=${PERL} ac_cv_path_PERL_PATH=${PERL}
QA_ENV+= SITE_ARCH_REL=${SITE_ARCH_REL} LIBPERL=libperl.so.${PERL_VER}
# Define the want perl first if defined
.if ${USE_PERL5:M5*}
want_perl_sign= ${USE_PERL5:M5*:C|^[0-9.]+||}
@ -236,15 +238,15 @@ MAN3PREFIX?= ${SITE_PERL}
.if !target(do-configure)
do-configure:
@if [ -f ${SCRIPTDIR}/configure ]; then \
cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
${SCRIPTDIR}/configure; \
cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
${SCRIPTDIR}/configure; \
fi
@cd ${CONFIGURE_WRKSRC} && \
${SETENV} ${CONFIGURE_ENV} \
${PERL5} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
${SETENV} ${CONFIGURE_ENV} \
${PERL5} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
.if !${_USE_PERL5:Mmodbuild*}
@cd ${CONFIGURE_WRKSRC} && \
${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
.endif # ! modbuild
.endif # !target(do-configure)
.endif # configure

View File

@ -5,6 +5,27 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20141217:
AFFECTS: users of lang/perl5.*
AUTHOR: mat@FreeBSD.org
Perl now links all .so it builds with libperl.so, it makes upgrading from one
Perl major version to another way easier. For binary package users, it means
pkg upgrade will detect the libperl.so.x.yy change, and reinstall the
affected packages. For users using ports, it will save rebuild time as it's
easier to detect what ports really need to be rebuilt.
Ports users are encouraged to rebuild ports that install files in SITE_ARCH.
If using Perl 5.18, run:
With portupgrade:
portupgrade `find /usr/local/lib/perl5/site_perl/mach/5.18 -name '*.so'|xargs pkg which -qo|sort -u`
With portmaster:
portupgrade `find /usr/local/lib/perl5/site_perl/mach/5.18 -name '*.so'|xargs pkg which -qo|sort -u`
20141216:
AFFECTS: users of security/openssh-portable
AUTHOR: bdrewery@FreeBSD.org

View File

@ -3,7 +3,7 @@
PORTNAME= perl
PORTVERSION= ${PERL_VERSION}
PORTREVISION= 13
PORTREVISION= 14
CATEGORIES= lang devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= ../../src
@ -56,7 +56,7 @@ USES= tar:bzip2 cpe
HAS_CONFIGURE= yes
CONFIGURE_SCRIPT=Configure
CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \
-Dlibperl=libperl.so.${PERL_VER} \
-Dlibperl=libperl.so.${PERL_VERSION} \
-Darchlib=${PREFIX}/${_ARCH_LIB} \
-Dprivlib=${PREFIX}/${_PRIV_LIB} \
-Dman3dir=${PREFIX}/${MAN3PREFIX_REL}/man/man3 \
@ -195,9 +195,19 @@ LINK_USRBIN= no
.endif
SUB_LIST+= LINK_USRBIN=${LINK_USRBIN}
# Put a symlink to the future libperl.so.x.yy so that -lperl works.
post-extract:
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so.${PERL_VER}
post-patch:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
# Keep the following two sync'ed
${REINPLACE_CMD} -e 's|lddlflags="-shared "|lddlflags="-shared -L${WRKSRC} -L${PREFIX}/${_ARCH_LIB}/CORE -Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE -lperl "|' \
${WRKSRC}/hints/freebsd.sh
${REINPLACE_CMD} -e 's|%%HOLDER%%|:N-L${WRKSRC}:N-L${PREFIX}/${_ARCH_LIB}/CORE:N-Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE:N-lperl|' \
${WRKSRC}/Makefile.SH
.if ${PORT_OPTIONS:MPTHREAD}
${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g;' \
-e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|g;' \
@ -213,8 +223,8 @@ post-install:
${MKDIR} ${STAGEDIR}${SITE_ARCH}/auto
${MKDIR} ${STAGEDIR}${SITE_PERL}/auto
${LN} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION} ${STAGEDIR}${PREFIX}/bin/perl5
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VERSION}
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VER}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION}
${INSTALL_DATA} ${WRKDIR}/perl5_version ${STAGEDIR}${PREFIX}/etc
${FIND} ${STAGEDIR} -name '*.bs' -size 0 -delete

View File

@ -5,7 +5,7 @@
$spitshell >>$Makefile <<'!NO!SUBS!'
rm -f $@
- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS) -Wl,-soname,$(LIBPERL) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS%%HOLDER%%) -Wl,-soname,$(LIBPERL:R) $(obj) $(DYNALOADER) $(libs)
!NO!SUBS!
case "$osname" in
aix)

View File

@ -3,7 +3,7 @@
PORTNAME= perl
PORTVERSION= ${PERL_VERSION}
PORTREVISION= 17
PORTREVISION= 18
CATEGORIES= lang devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= ../../src
@ -56,7 +56,7 @@ USES= tar:bzip2 cpe
HAS_CONFIGURE= yes
CONFIGURE_SCRIPT=Configure
CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \
-Dlibperl=libperl.so.${PERL_VER} \
-Dlibperl=libperl.so.${PERL_VERSION} \
-Darchlib=${PREFIX}/${_ARCH_LIB} \
-Dprivlib=${PREFIX}/${_PRIV_LIB} \
-Dman3dir=${PREFIX}/${MAN3PREFIX_REL}/man/man3 \
@ -195,9 +195,19 @@ LINK_USRBIN= no
.endif
SUB_LIST+= LINK_USRBIN=${LINK_USRBIN}
# Put a symlink to the future libperl.so.x.yy so that -lperl works.
post-extract:
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so.${PERL_VER}
post-patch:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
# Keep the following two sync'ed
${REINPLACE_CMD} -e 's|lddlflags="-shared "|lddlflags="-shared -L${WRKSRC} -L${PREFIX}/${_ARCH_LIB}/CORE -Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE -lperl "|' \
${WRKSRC}/hints/freebsd.sh
${REINPLACE_CMD} -e 's|%%HOLDER%%|:N-L${WRKSRC}:N-L${PREFIX}/${_ARCH_LIB}/CORE:N-Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE:N-lperl|' \
${WRKSRC}/Makefile.SH
.if ${PORT_OPTIONS:MPTHREAD}
${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g;' \
-e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|g;' \
@ -213,8 +223,8 @@ post-install:
${MKDIR} ${STAGEDIR}${SITE_ARCH}/auto
${MKDIR} ${STAGEDIR}${SITE_PERL}/auto
${LN} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION} ${STAGEDIR}${PREFIX}/bin/perl5
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VERSION}
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VER}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION}
${INSTALL_DATA} ${WRKDIR}/perl5_version ${STAGEDIR}${PREFIX}/etc
${FIND} ${STAGEDIR} -name '*.bs' -size 0 -delete

View File

@ -5,7 +5,7 @@
$spitshell >>$Makefile <<'!NO!SUBS!'
rm -f $@
- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS) -Wl,-soname,$(LIBPERL) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS%%HOLDER%%) -Wl,-soname,$(LIBPERL:R) $(obj) $(DYNALOADER) $(libs)
!NO!SUBS!
case "$osname" in
aix)

View File

@ -3,7 +3,7 @@
PORTNAME= perl
PORTVERSION= ${PERL_VERSION}
PORTREVISION= 10
PORTREVISION= 11
CATEGORIES= lang devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= ../../src
@ -73,7 +73,7 @@ USES= tar:bzip2 cpe
HAS_CONFIGURE= yes
CONFIGURE_SCRIPT=Configure
CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \
-Dlibperl=libperl.so.${PERL_VER} \
-Dlibperl=libperl.so.${PERL_VERSION} \
-Darchlib=${PREFIX}/${_ARCH_LIB} \
-Dprivlib=${PREFIX}/${_PRIV_LIB} \
-Dman3dir=${PREFIX}/${MAN3PREFIX_REL}/man/man3 \
@ -173,9 +173,19 @@ LINK_USRBIN= no
.endif
SUB_LIST+= LINK_USRBIN=${LINK_USRBIN}
# Put a symlink to the future libperl.so.x.yy so that -lperl works.
post-extract:
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so.${PERL_VER}
post-patch:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
# Keep the following two sync'ed
${REINPLACE_CMD} -e 's|lddlflags="-shared "|lddlflags="-shared -L${WRKSRC} -L${PREFIX}/${_ARCH_LIB}/CORE -Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE -lperl "|' \
${WRKSRC}/hints/freebsd.sh
${REINPLACE_CMD} -e 's|%%HOLDER%%|:N-L${WRKSRC}:N-L${PREFIX}/${_ARCH_LIB}/CORE:N-Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE:N-lperl|' \
${WRKSRC}/Makefile.SH
.if ${PORT_OPTIONS:MPTHREAD}
${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g;' \
-e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|g;' \
@ -191,8 +201,8 @@ post-install:
${MKDIR} ${STAGEDIR}${SITE_ARCH}/auto
${MKDIR} ${STAGEDIR}${SITE_PERL}/auto
${LN} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION} ${STAGEDIR}${PREFIX}/bin/perl5
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VERSION}
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VER}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION}
${INSTALL_DATA} ${WRKDIR}/perl5_version ${STAGEDIR}${PREFIX}/etc
${FIND} ${STAGEDIR} -name '*.bs' -size 0 -delete

View File

@ -1,11 +1,11 @@
--- Makefile.SH.orig 2014-10-01 15:23:34 UTC
+++ Makefile.SH
@@ -805,7 +808,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LI
@@ -805,7 +805,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LI
true)
$spitshell >>$Makefile <<'!NO!SUBS!'
rm -f $@
- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS) -Wl,-soname,$(LIBPERL) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS%%HOLDER%%) -Wl,-soname,$(LIBPERL:R) $(obj) $(DYNALOADER) $(libs)
!NO!SUBS!
case "$osname" in
aix)

View File

@ -3,7 +3,7 @@
PORTNAME= perl
PORTVERSION= ${PERL_VERSION}
PORTREVISION= 9
PORTREVISION= 10
CATEGORIES= lang devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= ../../src
@ -74,7 +74,7 @@ USES= tar:bzip2 cpe
HAS_CONFIGURE= yes
CONFIGURE_SCRIPT=Configure
CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \
-Dlibperl=libperl.so.${PERL_VER} \
-Dlibperl=libperl.so.${PERL_VERSION} \
-Darchlib=${PREFIX}/${_ARCH_LIB} \
-Dprivlib=${PREFIX}/${_PRIV_LIB} \
-Dman3dir=${PREFIX}/${MAN3PREFIX_REL}/man/man3 \
@ -170,9 +170,19 @@ PLIST_SUB+= MANCONF="@comment "
WITH_PTHREAD= yes
.endif
# Put a symlink to the future libperl.so.x.yy so that -lperl works.
post-extract:
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so
${LN} -s libperl.so.${PERL_VERSION} ${WRKSRC}/libperl.so.${PERL_VER}
post-patch:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/Configure ${WRKSRC}/hints/freebsd.sh
# Keep the following two sync'ed
${REINPLACE_CMD} -e 's|lddlflags="-shared "|lddlflags="-shared -L${WRKSRC} -L${PREFIX}/${_ARCH_LIB}/CORE -Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE -lperl "|' \
${WRKSRC}/hints/freebsd.sh
${REINPLACE_CMD} -e 's|%%HOLDER%%|:N-L${WRKSRC}:N-L${PREFIX}/${_ARCH_LIB}/CORE:N-Wl,-rpath=${PREFIX}/${_ARCH_LIB}/CORE:N-lperl|' \
${WRKSRC}/Makefile.SH
.if ${PORT_OPTIONS:MPTHREAD}
${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g;' \
-e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|g;' \
@ -188,8 +198,8 @@ post-install:
${MKDIR} ${STAGEDIR}${SITE_ARCH}/auto
${MKDIR} ${STAGEDIR}${SITE_PERL}/auto
${LN} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION} ${STAGEDIR}${PREFIX}/bin/perl5
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -s libperl.so.${PERL_VER} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VERSION}
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so
${LN} -sf libperl.so.${PERL_VERSION} ${STAGEDIR}${PREFIX}/${_ARCH_LIB}/CORE/libperl.so.${PERL_VER}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/perl${PERL_VERSION}
${INSTALL_DATA} ${WRKDIR}/perl5_version ${STAGEDIR}${PREFIX}/etc
${MKDIR} ${STAGEDIR}${SITE_ARCH}/machine

View File

@ -5,7 +5,7 @@
$spitshell >>$Makefile <<'!NO!SUBS!'
rm -f $@
- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS) -Wl,-soname,$(LIBPERL) $(obj) $(DYNALOADER) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS%%HOLDER%%) -Wl,-soname,$(LIBPERL:R) $(obj) $(DYNALOADER) $(libs)
!NO!SUBS!
case "$osname" in
aix)