diff options
author | tobez <tobez@FreeBSD.org> | 2005-02-01 21:36:21 +0800 |
---|---|---|
committer | tobez <tobez@FreeBSD.org> | 2005-02-01 21:36:21 +0800 |
commit | a4e9ddb1705665666c117bfc30c9b9ba2d906f15 (patch) | |
tree | 7eb3053e4b7bd19cda6f9a9b36433fe3793f5472 /lang/perl5.12/files | |
parent | 0930f44c166a4c6ba6f3732ff94d50e7d7a49a3c (diff) | |
download | freebsd-ports-gnome-a4e9ddb1705665666c117bfc30c9b9ba2d906f15.tar.gz freebsd-ports-gnome-a4e9ddb1705665666c117bfc30c9b9ba2d906f15.tar.zst freebsd-ports-gnome-a4e9ddb1705665666c117bfc30c9b9ba2d906f15.zip |
Update to 5.8.6. Also:
- redirect output from h2ph to /dev/null [1];
- fix File::Path insecure file/directory permissions [2];
this resolves CAN-2004-0452
(http://vuxml.freebsd.org/c418d472-6bd1-11d9-93ca-000a95bc6fae.html);
- for OSVERSION < 500036, create symlinks in /usr/bin not only for
perl and suidperl, but also for a2p, c2ph, find2perl, h2ph, h2xs,
perlbug, perlcc, perldoc, pl2pm, pod2html, pod2latex, pod2man,
pod2text, s2p, and splain; perl and suidperl are still enough for
more recent FreeBSD versions [3];
- clean up created symlinks upon deinstallation [4];
- try to cleanup symlinks created by older versions of lang/perl5 and
lang/perl5.8, during both installation and deinstallation [5];
- added support for DISABLE_BSDPAN environment variable [6];
- be explicit about use.perl usage after installation of 4.X systems
[7];
- respect __MAKE_CONF partially (the build-time value is used) [8];
- fix threaded build - respect PTHREAD_CFLAGS and PTHREAD_LIBS [9].
- use.perl is now the same as pkg-install is now the same as
pkg-deinstall; apart from the changes already mentioned above, this
is a shell script now;
- use.perl's logic is also simplified in several ways [10];
- fix a BSDPAN bug [11].
Outstanding issues: Module::Build support for BSDPAN, SU_CMD support (PR
70831), PR 64963 (partially), and anything else that I forgot.
[1] Nudged by: krion
[2] Reported by: nectar
Patch from: Chris Turner @ RedHat
[3] PR: 55760, 57151, 58406
[4] Requested by: kris
PR: 54262
[5] PR: 51281, 51539
[6] PR: 57134
[7] PR: 60736
[8] PR: 74431
[9] PR: 73233
[10] Perl version submitted by des, implemented in sh
[11] Reported by: Alexander Nagilum <freebsd %at% nagilum de>
Diffstat (limited to 'lang/perl5.12/files')
-rw-r--r-- | lang/perl5.12/files/patch-Path.pm | 30 | ||||
-rw-r--r-- | lang/perl5.12/files/patch-freebsd.sh | 39 | ||||
-rw-r--r-- | lang/perl5.12/files/use.perl | 362 |
3 files changed, 311 insertions, 120 deletions
diff --git a/lang/perl5.12/files/patch-Path.pm b/lang/perl5.12/files/patch-Path.pm new file mode 100644 index 000000000000..2735b0f6a648 --- /dev/null +++ b/lang/perl5.12/files/patch-Path.pm @@ -0,0 +1,30 @@ +$FreeBSD$ +--- lib/File/Path.pm.orig Sat Jan 29 20:23:40 2005 ++++ lib/File/Path.pm Sat Jan 29 20:24:56 2005 +@@ -196,7 +196,7 @@ sub rmtree { + # it's also intended to change it to writable in case we have + # to recurse in which case we are better than rm -rf for + # subtrees with strange permissions +- chmod(0777, ($Is_VMS ? VMS::Filespec::fileify($root) : $root)) ++ chmod(0700, ($Is_VMS ? VMS::Filespec::fileify($root) : $root)) + or carp "Can't make directory $root read+writeable: $!" + unless $safe; + +@@ -230,7 +230,7 @@ sub rmtree { + print "skipped $root\n" if $verbose; + next; + } +- chmod 0777, $root ++ chmod 0700, $root + or carp "Can't make directory $root writeable: $!" + if $force_writeable; + print "rmdir $root\n" if $verbose; +@@ -252,7 +252,7 @@ sub rmtree { + print "skipped $root\n" if $verbose; + next; + } +- chmod 0666, $root ++ chmod 0600, $root + or carp "Can't make file $root writeable: $!" + if $force_writeable; + print "unlink $root\n" if $verbose; diff --git a/lang/perl5.12/files/patch-freebsd.sh b/lang/perl5.12/files/patch-freebsd.sh index 68ec6d4cd8a1..6c5e9d7b0118 100644 --- a/lang/perl5.12/files/patch-freebsd.sh +++ b/lang/perl5.12/files/patch-freebsd.sh @@ -1,20 +1,51 @@ ---- hints/freebsd.sh.orig Sun May 30 17:55:47 2004 -+++ hints/freebsd.sh Sun May 30 17:57:16 2004 -@@ -88,6 +88,7 @@ case "$osvers" in +--- hints/freebsd.sh.orig Wed Mar 24 22:47:33 2004 ++++ hints/freebsd.sh Sun Jan 30 23:39:33 2005 +@@ -88,6 +88,8 @@ case "$osvers" in esac libswanted=`echo $libswanted | sed 's/ malloc / /'` libswanted=`echo $libswanted | sed 's/ bind / /'` + libswanted=`echo $libswanted | sed 's/ dl / /'` ++ libswanted=`echo $libswanted | sed 's/ c / /'` # iconv gone in Perl 5.8.1, but if someone compiles 5.8.0 or earlier. libswanted=`echo $libswanted | sed 's/ iconv / /'` d_setregid='define' -@@ -102,6 +103,9 @@ case "$osvers" in +@@ -102,6 +103,10 @@ case "$osvers" in ;; esac libswanted=`echo $libswanted | sed 's/ malloc / /'` + libswanted=`echo $libswanted | sed 's/ bind / /'` + libswanted=`echo $libswanted | sed 's/ dl / /'` + libswanted=`echo $libswanted | sed 's/ iconv / /'` ++ libswanted=`echo $libswanted | sed 's/ c / /'` ;; esac +@@ -119,7 +123,7 @@ case "$osvers" in + if [ x$objformat = xelf ]; then + libpth="/usr/lib /usr/local/lib" + glibpth="/usr/lib /usr/local/lib" +- ldflags="-Wl,-E " ++ ldflags="%%PTHREAD_LIBS%% -Wl,-E" + lddlflags="-shared " + else + if [ -e /usr/lib/aout ]; then +@@ -136,7 +140,7 @@ case "$osvers" in + 0*|1*|2*|3*) ;; + + *) +- ccflags="${ccflags} -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H" ++ ccflags="${ccflags} %%PTHREAD_CFLAGS%% -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H" + if /usr/bin/file -L /usr/lib/libc.so | /usr/bin/grep -vq "not stripped" ; then + usenm=false + fi +@@ -183,7 +187,9 @@ esac + + # This script UU/usethreads.cbu will get 'called-back' by Configure + # after it has prompted the user for whether to use threads. +-cat > UU/usethreads.cbu <<'EOCBU' ++## not quite - modern FreeBSD perl port is supposed to take care of that ++## we just add extra libraries and cflags nowadays ++cat > /dev/null <<'EOCBU' + case "$usethreads" in + $define|true|[yY]*) + lc_r=`/sbin/ldconfig -r|grep ':-lc_r'|awk '{print $NF}'|sed -n '$p'` diff --git a/lang/perl5.12/files/use.perl b/lang/perl5.12/files/use.perl index ba6057f1c5db..c20a441b65da 100644 --- a/lang/perl5.12/files/use.perl +++ b/lang/perl5.12/files/use.perl @@ -1,134 +1,264 @@ -#! %%PREFIX%%/bin/perl -w -# $FreeBSD$ -use strict; +#!/bin/sh -# XXX what to do with perldoc, pelbug, perlcc ?? +# $FreeBSD$ -sub usage -{ - print STDERR <<EOF; -Usage: - $0 port -> /usr/bin/perl is the perl5 port - $0 system -> /usr/bin/perl is the system perl -EOF - exit 2; -} +this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'` +PERL_VERSION="%%PERL_VERSION%%" +MAKE_CONF=%%MAKE_CONF%% +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 -my $port_perl = '%%PREFIX%%/bin/perl'; -$port_perl =~ tr|/|/|s; +if [ "x$this" = "xuse.perl" ]; then + PKG_PREFIX="%%PREFIX%%" + if [ "$1" = "port" ] ; then + need_remove_links=yes + need_create_links=yes + need_cleanup_make_conf=yes + need_cleanup_manpath=yes + need_spam_make_conf=yes + need_spam_manpath=yes + elif [ "$1" = "system" ] ; then + need_remove_links=yes + if [ $osreldate -lt 500036 ] ; then + need_base_system_perl=yes + fi + need_cleanup_make_conf=yes + need_cleanup_manpath=yes + else + echo 'Usage: + $0 port -> /usr/bin/perl is the perl5 port + $0 system -> /usr/bin/perl is the system perl' + exit 2; + fi +else + if [ "$2" = "POST-INSTALL" ] ; then + need_remove_links=yes + if [ $osreldate -ge 502100 ] ; then + need_create_links=yes + need_cleanup_make_conf=yes + need_cleanup_manpath=yes + need_spam_make_conf=yes + need_spam_manpath=yes + fi + need_post_install=yes + elif [ "$2" = "POST-DEINSTALL" ] ; then + need_remove_links=yes + if [ $osreldate -lt 500036 ] ; then + need_base_system_perl=yes + fi + need_cleanup_make_conf=yes + need_cleanup_manpath=yes + else + exit 0; + fi +fi -my $ident = `[ -r /usr/bin/perl5 ] && /usr/bin/ident -q /usr/bin/perl5`; +link_list=" + a2p + c2ph + find2perl + h2ph + h2xs + perlbug + perlcc + perldoc + pl2pm + pod2html + pod2latex + pod2man + pod2text + s2p + splain" +if [ $osreldate -ge 500036 ] ; then + link_list="" +fi +special_link_list=" + perl + perl5 + suidperl" -@ARGV == 1 or usage(); -if ($ARGV[0] eq 'port') { - switch_to_port(); -} elsif ($ARGV[0] eq 'system') { - switch_to_system(); -} else { - usage(); +do_remove_links() +{ + echo "Removing stale symlinks from /usr/bin..." + for binary in $link_list $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" + 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" + fi + done + echo "Done." } -exit 0; - -# Both functions depend on the idea that switch_to_port leaves -# perl5 alone. If the wrapper is installed on a -current system, -# /usr/bin/perl5 will also be the wrapper. -sub switch_to_system +do_create_links() { - # protect against cases where people use PREFIX=/usr - if ($port_perl ne '/usr/bin/perl') { - unlink '/usr/bin/perl', '/usr/bin/suidperl', - '/usr/bin/perl%%PERL_VERSION%%'; - - link '/usr/bin/perl5', '/usr/bin/perl'; - link '/usr/bin/perl5', '/usr/bin/perl%%PERL_VERSION%%'; - - if ($ident =~ m#src/usr.bin/perl/perl.c#) { - link '/usr/bin/perl5', '/usr/bin/suidperl'; - } else { - link '/usr/bin/sperl5', '/usr/bin/suidperl'; - } - } - - open MK, ">> /etc/make.conf" or die "/etc/make.conf: $!"; - print MK <<EOF; -# -- use.perl generated deltas -- # -# Created: @{[scalar localtime]} -# Setting to use base system perl: -.undef PERL_VER -.undef PERL_VERSION -.undef PERL_ARCH -.undef NOPERL -.undef NO_PERL - -EOF - close MK; + echo "Creating various symlinks in /usr/bin..." + for binary in $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 + if [ -e "/usr/bin/$binary" ] ; then + echo " *** /usr/bin/$binary is still there, which should not happen" + elif [ -e "$PKG_PREFIX/bin/$binary" ] ; then + echo " Symlinking $PKG_PREFIX/bin/$binary to /usr/bin/$binary" + /bin/ln -sf "$PKG_PREFIX/bin/$binary" "/usr/bin/$binary" + else + echo " *** $PKG_PREFIX/bin/$binary is not there, a symlink won't do any good" + fi + done + for binary in $special_link_list + do + if [ -f "/usr/bin/$binary" ] ; then + echo " Removing /usr/bin/$binary" + fi + bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` + bin=`echo $bin | /usr/bin/sed -e 's!suidperl!sperl!'` + if [ -e "/usr/bin/$binary.XXX" ] ; 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" + else + echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good" + fi + done + echo "Done." +} - open MPOLD, "< /etc/manpath.config" or die "/etc/manpath.config: $!"; - open MPNEW, "> /etc/manpath.config.new" or die "/etc/manpath.config.new: $!"; - while (<MPOLD>) { - next if m|use.perl generated line|; - next if m|^\s*OPTIONAL_MANPATH\s+\S+/lib/perl5/%%PERL_VERSION%%/man\s*$|; - next if m|^\s*OPTIONAL_MANPATH\s+\S+/lib/perl5/%%PERL_VERSION%%/perl/man\s*$|; - print MPNEW; - } - close MPNEW; - close MPOLD; - rename '/etc/manpath.config', '/etc/manpath.config.bak'; - rename '/etc/manpath.config.new', '/etc/manpath.config'; +do_base_system_perl() +{ + echo "Restoring base system perl binaries..." + for binary in $link_list + do + if [ -e "/usr/bin/$binary" ] ; then + echo " *** /usr/bin/$binary is there, which should not happen" + else + if [ -f "/usr/bin/$binary.freebsd" ] ; then + echo " Moving /usr/bin/$binary.freebsd to /usr/bin/$binary" + /bin/mv -f "/usr/bin/$binary.freebsd" "/usr/bin/$binary" + else + echo " *** /usr/bin/$binary.freebsd is NOT there, nothing to restore" + fi + fi + done + for binary in $special_link_list + do + if [ -e "/usr/bin/$binary" ] ; then + echo " *** /usr/bin/$binary is there, which should not happen" + else + bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` + bin=`echo $bin | /usr/bin/sed -e 's!suidperl!sperl!'` + bins=`/bin/ls /usr/bin/${bin}5.* 2>/dev/null | /usr/bin/sort` + bin="" + for b in $bins + do + if [ -f $b -a ! -L $b ] ; then + bin=$b + fi + done + if [ -z $bin ] ; then + echo " *** cannot find what /usr/bin/$binary shall be restored FROM" + elif [ -f $bin ] ; then + echo " Hardlinking $bin to /usr/bin/$binary" + ln -f "$bin" "/usr/bin/$binary" + else + echo " *** $bin is NOT there, nothing to restore" + fi + fi + done + echo "Done." } -sub switch_to_port +do_post_install() { - # protect against cases where people use PREFIX=/usr - if ($port_perl ne '/usr/bin/perl') { - if ($ident =~ m#src/usr.bin/perl/perl.c#) { - rename '/usr/bin/perl', '/usr/bin/perl-wrapper'; - } else { - unlink '/usr/bin/perl'; - } + INCLUDEDIR=/usr/include + install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VERSION%%/%%PERL_ARCH%%/auto + install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VERSION%%/auto + install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VERSION%%/man/man3 + cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null +} - unlink '/usr/bin/suidperl', '/usr/bin/perl%%PERL_VERSION%%'; +do_cleanup_make_conf() +{ + echo -n "Cleaning up ${MAKE_CONF}..." + if [ -f ${MAKE_CONF} ] ; then + /usr/bin/awk 's=0; + /^#.*use.perl/ { s=1; mode=1 } + /^#/ { s=1; if (mode != 1) { mode=0 } } + /.*PERL.*=/ { s=1; if (mode == 1) { mode=2 } } + /^$/ { s=1; if (mode != 2) { mode = 0 } } + { if (s != 1) { mode = 0 } if (mode == 0) print }' ${MAKE_CONF} >${MAKE_CONF}.new + /bin/mv ${MAKE_CONF} ${MAKE_CONF}.bak + /bin/mv ${MAKE_CONF}.new ${MAKE_CONF} + fi + echo " Done." +} - symlink '%%PREFIX%%/bin/perl', '/usr/bin/perl'; - symlink '%%PREFIX%%/bin/suidperl', '/usr/bin/suidperl'; - symlink '%%PREFIX%%/bin/perl', '/usr/bin/perl%%PERL_VERSION%%'; - } +do_cleanup_manpath() +{ + echo -n "Cleaning up /etc/manpath.config..." + if [ -f /etc/manpath.config ] ; then + /usr/bin/awk 's=0; + /^#.*use.perl/ { s=1; mode=1 } + /^#/ { s=1; if (mode != 1) { mode=0 } } + /^OPTIONAL_MANPATH.*perl5/ { s=1; if (mode == 1) { mode=2 } } + /^$/ { s=1; if (mode != 2) { mode = 0 } } + { if (s != 1) { mode = 0 } if (mode == 0) print }' /etc/manpath.config >/etc/manpath.config.new + /bin/mv /etc/manpath.config /etc/manpath.config.bak + /bin/mv /etc/manpath.config.new /etc/manpath.config + fi + echo " Done." +} - open MK, ">> /etc/make.conf" or die "/etc/make.conf: $!"; - print MK <<EOF; -# -- use.perl generated deltas -- # -# Created: @{[scalar localtime]} -# Setting to use base perl from ports: -PERL_VER=%%PERL_VER%% -PERL_VERSION=%%PERL_VERSION%% -PERL_ARCH=%%PERL_ARCH%% -NOPERL=yo -NO_PERL=yo -NO_PERL_WRAPPER=yo +do_spam_make_conf() +{ + echo -n "Spamming ${MAKE_CONF}..." + echo "$banner" >>${MAKE_CONF} + echo "PERL_VER=%%PERL_VER%%" >>${MAKE_CONF} + echo "PERL_VERSION=%%PERL_VERSION%%" >>${MAKE_CONF} + if [ $osreldate -lt 500036 ] ; then + echo "NOPERL=yes" >>${MAKE_CONF} + fi + echo " Done." +} -EOF - close MK; +do_spam_manpath() +{ + echo -n "Spamming /etc/manpath.config..." + echo "$banner" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VERSION%%/man" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VERSION%%/perl/man" >>/etc/manpath.config + echo " Done." +} - my $perl_port_manpath = <<EOF; -# -- use.perl generated line -- # -OPTIONAL_MANPATH %%PREFIX%%/lib/perl5/%%PERL_VERSION%%/man -OPTIONAL_MANPATH %%PREFIX%%/lib/perl5/%%PERL_VERSION%%/perl/man -EOF +[ $need_remove_links ] && do_remove_links +[ $need_create_links ] && do_create_links +[ $need_base_system_perl ] && do_base_system_perl +[ $need_post_install ] && do_post_install +[ $need_cleanup_make_conf ] && do_cleanup_make_conf +[ $need_spam_make_conf ] && do_spam_make_conf +[ $need_cleanup_manpath ] && do_cleanup_manpath +[ $need_spam_manpath ] && do_spam_manpath - open MPOLD, "< /etc/manpath.config" or die "/etc/manpath.config: $!"; - open MPNEW, "> /etc/manpath.config.new" or die "/etc/manpath.config.new: $!"; - my $modified = 0; - while (<MPOLD>) { - if (!$modified && m|^\s*OPTIONAL_MANPATH\s+\S+/lib/perl5/\S+/man\s*$|) { - print MPNEW $perl_port_manpath; - $modified = 1; - } - print MPNEW; - } - print MPNEW $perl_port_manpath unless $modified; - close MPNEW; - close MPOLD; - rename '/etc/manpath.config', '/etc/manpath.config.bak'; - rename '/etc/manpath.config.new', '/etc/manpath.config'; -} +exit 0 |