aboutsummaryrefslogtreecommitdiffstats
path: root/lang/perl5.14
diff options
context:
space:
mode:
authorak <ak@FreeBSD.org>2013-10-15 00:22:34 +0800
committerak <ak@FreeBSD.org>2013-10-15 00:22:34 +0800
commitd55681e8f907a9c1fb3a21b42995ef6adda169c9 (patch)
tree878d03be93e81a4a23e9899645c5ff5217f64913 /lang/perl5.14
parent522af6315654b236c8b71585c832422426c5c0f9 (diff)
downloadfreebsd-ports-gnome-d55681e8f907a9c1fb3a21b42995ef6adda169c9.tar.gz
freebsd-ports-gnome-d55681e8f907a9c1fb3a21b42995ef6adda169c9.tar.zst
freebsd-ports-gnome-d55681e8f907a9c1fb3a21b42995ef6adda169c9.zip
- Simplify and modernize use.perl
Approved by: perl (az, mat)
Diffstat (limited to 'lang/perl5.14')
-rw-r--r--lang/perl5.14/files/use.perl132
1 files changed, 53 insertions, 79 deletions
diff --git a/lang/perl5.14/files/use.perl b/lang/perl5.14/files/use.perl
index 338832f597a3..185814c44984 100644
--- a/lang/perl5.14/files/use.perl
+++ b/lang/perl5.14/files/use.perl
@@ -2,64 +2,31 @@
# $FreeBSD$
-this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'`
+LINK_USRBIN="%%LINK_USRBIN%%"
+: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`};
+PERL_ARCH="%%PERL_ARCH%%"
PERL_VERSION="%%PERL_VERSION%%"
PERL_VER="%%PERL_VER%%"
-PERL5_SIGNATURE=%%PERL5_SIGNATURE%%
-banner=`date +"%F %T"`
-banner="# added by use.perl $banner"
-if [ -z "${OSVERSION}" ]; then
- if [ -f /sbin/sysctl -a -x /sbin/sysctl ] ; then
- osreldate=`/sbin/sysctl -n kern.osreldate`
- else
- osreldate=`/usr/sbin/sysctl -n kern.osreldate`
- fi
-else
- osreldate=${OSVERSION}
-fi
-
-if [ "$2" = "POST-INSTALL" ] ; then
- need_remove_links=%%LINK_USRBIN%%
- need_create_links=%%LINK_USRBIN%%
- need_remove_perl5_signature=yes
- need_create_perl5_signature=yes
- need_post_install=yes
- if [ "${osreldate}" -lt 900022 ]; then
- need_cleanup_manpath=yes
- need_spam_manpath=yes
- fi
-elif [ "$2" = "POST-DEINSTALL" ] ; then
- need_remove_links=%%LINK_USRBIN%%
- need_remove_perl5_signature=yes
- if [ "${osreldate}" -lt 900022 ]; then
- need_cleanup_manpath=yes
- fi
-else
- exit 0;
-fi
-
-special_link_list="
- perl
- perl5"
+PERL5_SIGNATURE="%%PERL5_SIGNATURE%%"
+banner="# added by use.perl $(/bin/date +'%F %T')"
+special_link_list="perl perl5"
do_remove_links()
{
echo "Removing stale symlinks from /usr/bin..."
- for binary in $special_link_list
- do
- if [ -L "/usr/bin/$binary" ] ; then
- echo " Removing /usr/bin/$binary"
- /bin/rm -f "/usr/bin/$binary"
+ for binary in ${special_link_list} ; do
+ if [ -L "/usr/bin/${binary}" ] ; then
+ echo " Removing /usr/bin/${binary}"
+ /bin/rm -f "/usr/bin/${binary}"
else
- echo " Skipping /usr/bin/$binary"
+ echo " Skipping /usr/bin/${binary}"
fi
done
bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null`
- for binary in $bins
- do
- if [ -L "$binary" ] ; then
- echo " Removing $binary installed by an older perl port"
- /bin/rm -f "$binary"
+ for binary in ${bins} ; do
+ if [ -L "${binary}" ] ; then
+ echo " Removing ${binary} installed by an older perl port"
+ /bin/rm -f "${binary}"
fi
done
echo "Done."
@@ -68,20 +35,18 @@ do_remove_links()
do_create_links()
{
echo "Creating various symlinks in /usr/bin..."
- for binary in $special_link_list
- do
- if [ -f "/usr/bin/$binary" ] ; then
- echo " Backing up /usr/bin/$binary as /usr/bin/$binary.freebsd"
- /bin/mv -f "/usr/bin/$binary" "/usr/bin/$binary.freebsd"
+ for binary in ${special_link_list} ; do
+ if [ -f "/usr/bin/${binary}" ] ; then
+ echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd"
+ /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd"
fi
- bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'`
- if [ -e "/usr/bin/$binary" ] ; then
- echo " *** /usr/bin/$binary is still there, which should not happen"
- elif [ -e "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" ] ; then
- echo " Symlinking $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% to /usr/bin/$binary"
- /bin/ln -sf "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" "/usr/bin/$binary"
+ if [ -e "/usr/bin/${binary}" ] ; then
+ echo " *** /usr/bin/${binary} is still there, which should not happen"
+ elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then
+ echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}"
+ /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}"
else
- echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good"
+ echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good"
fi
done
echo "Done."
@@ -90,18 +55,16 @@ do_create_links()
do_post_install()
{
INCLUDEDIR=/usr/include
- install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto
- install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/auto
- install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man/man3
+ install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto
+ install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto
+ install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3
cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null
}
do_remove_perl5_signature()
{
echo -n "Removing ${PERL5_SIGNATURE}..."
- if [ -f ${PERL5_SIGNATURE} ] ; then
- /bin/rm ${PERL5_SIGNATURE}
- fi
+ [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}"
echo " Done."
}
@@ -125,9 +88,9 @@ do_cleanup_manpath()
do_create_perl5_signature()
{
echo -n "Creating ${PERL5_SIGNATURE}..."
- echo "$banner" >>${PERL5_SIGNATURE}
- echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>${PERL5_SIGNATURE}
- echo "PERL_VERSION=%%PERL_VERSION%%" >>${PERL5_SIGNATURE}
+ echo "${banner}" >>"${PERL5_SIGNATURE}"
+ echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}"
+ echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}"
echo " Done."
}
@@ -135,19 +98,30 @@ do_spam_manpath()
{
if [ -f /etc/manpath.config ] ; then
echo -n "Spamming /etc/manpath.config..."
- echo "$banner" >>/etc/manpath.config
- echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man" >>/etc/manpath.config
- echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/perl/man" >>/etc/manpath.config
+ echo "${banner}" >>/etc/manpath.config
+ echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config
+ echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config
echo " Done."
fi
}
-[ "$need_remove_links" = "yes" ] && do_remove_links
-[ "$need_create_links" = "yes" ] && do_create_links
-[ "$need_post_install" = "yes" ] && do_post_install
-[ "$need_remove_perl5_signature" = "yes" ] && do_remove_perl5_signature
-[ "$need_create_perl5_signature" = "yes" ] && do_create_perl5_signature
-[ "$need_cleanup_manpath" = "yes" ] && do_cleanup_manpath
-[ "$need_spam_manpath" = "yes" ] && do_spam_manpath
+
+if [ "$2" = "POST-INSTALL" ] ; then
+ do_remove_perl5_signature
+ do_create_perl5_signature
+ do_post_install
+ if [ ${LINK_USRBIN} = yes ] ; then
+ do_remove_links
+ do_create_links
+ fi
+ if [ "${OSVERSION}" -lt 900022 ] ; then
+ do_cleanup_manpath
+ do_spam_manpath
+ fi
+elif [ "$2" = "POST-DEINSTALL" ] ; then
+ do_remove_perl5_signature
+ [ ${LINK_USRBIN} = yes ] && do_remove_links
+ [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath
+fi
exit 0