3 # $FreeBSD: head/lang/perl5.12/files/use.perl 330335 2013-10-14 16:22:34Z ak $
5 LINK_USRBIN="%%LINK_USRBIN%%"
6 : ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`};
7 PERL_ARCH="%%PERL_ARCH%%"
8 PERL_VERSION="%%PERL_VERSION%%"
9 PERL_VER="%%PERL_VER%%"
10 PERL5_SIGNATURE="%%PERL5_SIGNATURE%%"
11 banner="# added by use.perl $(/bin/date +'%F %T')"
12 special_link_list="perl perl5"
16 echo "Removing stale symlinks from /usr/bin..."
17 for binary in ${special_link_list} ; do
18 if [ -L "/usr/bin/${binary}" ] ; then
19 echo " Removing /usr/bin/${binary}"
20 /bin/rm -f "/usr/bin/${binary}"
22 echo " Skipping /usr/bin/${binary}"
25 bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null`
26 for binary in ${bins} ; do
27 if [ -L "${binary}" ] ; then
28 echo " Removing ${binary} installed by an older perl port"
29 /bin/rm -f "${binary}"
37 echo "Creating various symlinks in /usr/bin..."
38 for binary in ${special_link_list} ; do
39 if [ -f "/usr/bin/${binary}" ] ; then
40 echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd"
41 /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd"
43 if [ -e "/usr/bin/${binary}" ] ; then
44 echo " *** /usr/bin/${binary} is still there, which should not happen"
45 elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then
46 echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}"
47 /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}"
49 echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good"
57 INCLUDEDIR=/usr/include
58 install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto
59 install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto
60 install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3
61 cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null
64 do_remove_perl5_signature()
66 echo -n "Removing ${PERL5_SIGNATURE}..."
67 [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}"
73 if [ -f /etc/manpath.config ] ; then
74 echo -n "Cleaning up /etc/manpath.config..."
75 /bin/cp -p /etc/manpath.config /etc/manpath.config.new
77 /^#.*use.perl/ { s=1; mode=1 }
78 /^#/ { s=1; if (mode != 1) { mode=0 } }
79 /^OPTIONAL_MANPATH.*perl5/ { s=1; if (mode == 1) { mode=2 } }
80 /^$/ { s=1; if (mode != 2) { mode = 0 } }
81 { if (s != 1) { mode = 0 } if (mode == 0) print }' /etc/manpath.config >/etc/manpath.config.new
82 /bin/mv /etc/manpath.config /etc/manpath.config.bak
83 /bin/mv /etc/manpath.config.new /etc/manpath.config
88 do_create_perl5_signature()
90 echo -n "Creating ${PERL5_SIGNATURE}..."
91 echo "${banner}" >>"${PERL5_SIGNATURE}"
92 echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}"
93 echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}"
99 if [ -f /etc/manpath.config ] ; then
100 echo -n "Spamming /etc/manpath.config..."
101 echo "${banner}" >>/etc/manpath.config
102 echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config
103 echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config
109 if [ "$2" = "POST-INSTALL" ] ; then
110 do_remove_perl5_signature
111 do_create_perl5_signature
113 if [ ${LINK_USRBIN} = yes ] ; then
117 if [ "${OSVERSION}" -lt 900022 ] ; then
121 elif [ "$2" = "POST-DEINSTALL" ] ; then
122 do_remove_perl5_signature
123 [ ${LINK_USRBIN} = yes ] && do_remove_links
124 [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath