aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2014-12-17 21:21:56 +0800
committermat <mat@FreeBSD.org>2014-12-17 21:21:56 +0800
commit4510900ec843d68a14effaa0b595e4a85d883311 (patch)
tree4202a3b2243a0e4544eabc8d5f6b2ecccb217330 /Mk
parentb3c0bb2471d46f5bb4d5670d749c84496d53f77a (diff)
downloadfreebsd-ports-gnome-4510900ec843d68a14effaa0b595e4a85d883311.tar.gz
freebsd-ports-gnome-4510900ec843d68a14effaa0b595e4a85d883311.tar.zst
freebsd-ports-gnome-4510900ec843d68a14effaa0b595e4a85d883311.zip
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
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/qa.sh51
-rw-r--r--Mk/Uses/perl5.mk12
2 files changed, 57 insertions, 6 deletions
diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh
index 32eda0b051f7..7a82dcaa6394 100644
--- a/Mk/Scripts/qa.sh
+++ b/Mk/Scripts/qa.sh
@@ -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}
diff --git a/Mk/Uses/perl5.mk b/Mk/Uses/perl5.mk
index 01b8e1512ddc..921dbc2fafba 100644
--- a/Mk/Uses/perl5.mk
+++ b/Mk/Uses/perl5.mk
@@ -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