dev-lang/perl: 5.28.9999: Update to 5.27.3
[gentoo.git] / dev-lang / perl / perl-5.24.2.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit eutils alternatives flag-o-matic toolchain-funcs multilib multiprocessing
7
8 PATCH_VER=1
9 CROSS_VER=1.1.4
10 PATCH_BASE="perl-5.24.2-patches-${PATCH_VER}"
11
12 PERL_OLDVERSEN="5.24.1 5.24.0"
13 DIST_AUTHOR=SHAY
14
15 SHORT_PV="${PV%.*}"
16 MY_P="perl-${PV/_rc/-RC}"
17 MY_PV="${PV%_rc*}"
18
19 DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
20
21 SRC_URI="
22         mirror://cpan/src/5.0/${MY_P}.tar.xz
23         mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
24         https://github.com/gentoo-perl/perl-patchset/releases/download/${PATCH_BASE}/${PATCH_BASE}.tar.xz
25         mirror://gentoo/${PATCH_BASE}.tar.xz
26         https://dev.gentoo.org/~kentnl/distfiles/${PATCH_BASE}.tar.xz
27         https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
28 "
29 HOMEPAGE="http://www.perl.org/"
30
31 LICENSE="|| ( Artistic GPL-1+ )"
32 SLOT="0/${SHORT_PV}"
33 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
34 IUSE="berkdb debug doc gdbm ithreads"
35
36 RDEPEND="
37         berkdb? ( sys-libs/db:= )
38         gdbm? ( >=sys-libs/gdbm-1.8.3 )
39         app-arch/bzip2
40         sys-libs/zlib
41 "
42 DEPEND="${RDEPEND}
43         !prefix? ( elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs ) )
44 "
45 PDEPEND="
46         >=app-admin/perl-cleaner-2.5
47         >=virtual/perl-File-Path-2.130.0
48         >=virtual/perl-File-Temp-0.230.400-r2
49         >=virtual/perl-Data-Dumper-2.154.0
50         virtual/perl-Test-Harness
51 "
52 # bug 390719, bug 523624, bug 620304
53 # virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
54
55 S="${WORKDIR}/${MY_P}"
56
57 dual_scripts() {
58         src_remove_dual      perl-core/Archive-Tar        2.40.100_rc   ptar ptardiff ptargrep
59         src_remove_dual      perl-core/CPAN               2.110.100_rc  cpan
60         src_remove_dual      perl-core/Digest-SHA         5.950.100_rc  shasum
61         src_remove_dual      perl-core/Encode             2.800.100_rc  enc2xs piconv
62         src_remove_dual      perl-core/ExtUtils-MakeMaker 7.100.200_rc  instmodsh
63         src_remove_dual      perl-core/ExtUtils-ParseXS   3.310.0       xsubpp
64         src_remove_dual      perl-core/IO-Compress        2.69.1_rc          zipdetails
65         src_remove_dual      perl-core/JSON-PP            2.273.0.100_rc     json_pp
66         src_remove_dual      perl-core/Module-CoreList    5.201.707.152.400_rc  corelist
67         src_remove_dual      perl-core/Pod-Parser         1.630.0       pod2usage podchecker podselect
68         src_remove_dual      perl-core/Pod-Perldoc        3.250.300_rc  perldoc
69         src_remove_dual      perl-core/Test-Harness       3.360.100_rc  prove
70         src_remove_dual      perl-core/podlators          4.70.0        pod2man pod2text
71         src_remove_dual_man  perl-core/podlators          4.70.0        /usr/share/man/man1/perlpodstyle.1
72 }
73
74 check_rebuild() {
75         # Fresh install
76         if [[ -z "${REPLACING_VERSIONS}" ]]; then
77                 return 0;
78         # Major Upgrade
79         # doesn't matter if there's multiple copies, it still needs a rebuild
80         # if the string is anything other than "5.CURRENTMAJOR"
81         elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
82                 echo ""
83                 ewarn "UPDATE THE PERL MODULES:"
84                 ewarn "After updating dev-lang/perl the installed Perl modules"
85                 ewarn "have to be re-installed. In most cases, this is done automatically"
86                 ewarn "by the package manager, but subsequent steps are still recommended"
87                 ewarn "to ensure system consistency."
88                 ewarn
89                 ewarn "You should start with a depclean to remove any unused perl dependencies"
90                 ewarn "that may confuse portage in future. Regular depcleans are also encouraged"
91                 ewarn "as part of your regular update cycle, as that will keep perl upgrades working."
92                 ewarn "Recommended: emerge --depclean -va"
93                 ewarn
94                 ewarn "You should then call perl-cleaner to clean up any old files and trigger any"
95                 ewarn "remaining rebuilds portage may have missed."
96                 ewarn "Use: perl-cleaner --all"
97                 return 0;
98
99         # Reinstall w/ USE Change
100         elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
101              ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
102              (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
103              ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
104                 echo ""
105                 ewarn "TOGGLED USE-FLAGS WARNING:"
106                 ewarn "You changed one of the use-flags ithreads or debug."
107                 ewarn "You must rebuild all perl-modules installed."
108                 ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
109         fi
110 }
111
112 pkg_setup() {
113         case ${CHOST} in
114                 *-freebsd*)   osname="freebsd" ;;
115                 *-dragonfly*) osname="dragonfly" ;;
116                 *-netbsd*)    osname="netbsd" ;;
117                 *-openbsd*)   osname="openbsd" ;;
118                 *-darwin*)    osname="darwin" ;;
119                 *-interix*)   osname="interix" ;;
120                 *-aix*)       osname="aix" ;;
121                 *-cygwin*)    osname="cygwin" ;;
122                 *)            osname="linux" ;;
123         esac
124
125         myarch="${CHOST%%-*}-${osname}"
126         if use debug ; then
127                 myarch+="-debug"
128         fi
129         if use ithreads ; then
130                 mythreading="-multi"
131                 myarch+="-thread"
132         fi
133
134         LIBPERL="libperl$(get_libname ${MY_PV} )"
135         PRIV_LIB="/usr/$(get_libdir)/perl5/${MY_PV}"
136         ARCH_LIB="/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}"
137         SITE_LIB="/usr/local/$(get_libdir)/perl5/${MY_PV}"
138         SITE_ARCH="/usr/local/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}"
139         VENDOR_LIB="/usr/$(get_libdir)/perl5/vendor_perl/${MY_PV}"
140         VENDOR_ARCH="/usr/$(get_libdir)/perl5/vendor_perl/${MY_PV}/${myarch}${mythreading}"
141
142         dual_scripts
143 }
144
145 src_remove_dual_file() {
146         local i pkg ver
147         pkg="$1"
148         ver="$2"
149         shift 2
150         case "${EBUILD_PHASE:-none}" in
151                 postinst|postrm)
152                         for i in "$@" ; do
153                                 alternatives_auto_makesym "${i}" "${i}-[0-9]*"
154                         done
155                         ;;
156                 setup)
157                         for i in "$@" ; do
158                                 if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
159                                         has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
160                                         break
161                                 fi
162                         done
163                         ;;
164                 install)
165                         for i in "$@" ; do
166                                 if ! [[ -f "${ED}"${i} ]] ; then
167                                         ewarn "${i} does not exist!"
168                                         continue
169                                 fi
170                                 mv "${ED}"${i}{,-${ver}-${P}} || die
171                         done
172                         ;;
173         esac
174 }
175
176 src_remove_dual_man() {
177         local i pkg ver ff
178         pkg="$1"
179         ver="$2"
180         shift 2
181         case "${EBUILD_PHASE:-none}" in
182                 postinst|postrm)
183                         for i in "$@" ; do
184                                 ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
185                                 ff=${ff##*${i#${i%.[0-9]}}}
186                                 alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
187                         done
188                         ;;
189                 install)
190                         for i in "$@" ; do
191                                 if ! [[ -f "${ED}"${i} ]] ; then
192                                         ewarn "${i} does not exist!"
193                                         continue
194                                 fi
195                                 mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
196                         done
197                         ;;
198         esac
199 }
200
201 src_remove_dual() {
202         local i pkg ver
203         pkg="$1"
204         ver="$2"
205         shift 2
206         for i in "$@" ; do
207                 src_remove_dual_file  "${pkg}" "${ver}" "/usr/bin/${i}"
208                 src_remove_dual_man   "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
209         done
210 }
211
212 src_prepare_update_patchlevel_h() {
213         # Copied and modified from debian:
214         # Copyright 2011 Niko Tyni
215         # This program is free software; you can redistribute it and/or modify
216         # it under the same terms as Perl itself.
217         local patchdir="${WORKDIR}/patches"
218         local prefix
219         local patchoutput="patchlevel-gentoo.h"
220
221         [[ -f ${patchdir}/series ]] || return 0
222
223 while read patch
224 do
225         patchname=$(echo $patch | sed 's/\.diff$//')
226         < $patchdir/$patch sed -e '/^Subject:/ { N; s/\n / / }' | sed -n -e '
227
228         # massage the patch headers
229         s|^Bug: .*https\?://rt\.perl\.org/.*id=\(.*\).*|[perl #\1]|; tprepend;
230         s|^Bug: .*https\?://rt\.cpan\.org/.*id=\(.*\).*|[rt.cpan.org #\1]|; tprepend;
231         s|^Bug-Gentoo: ||; tprepend;
232         s/^\(Subject\|Description\): //; tappend;
233         s|^Origin: .*http://perl5\.git\.perl\.org/perl\.git/commit\(diff\)\?/\(.......\).*|[\2]|; tprepend;
234
235         # post-process at the end of input
236         $ { x;
237                 # include the version number in the patchlevel.h description (if available)
238                 s/List packaged patches/&'" for ${PF}(#${PATCH_VER})"'/;
239
240                 # escape any backslashes and double quotes
241                 s|\\|\\\\|g; s|"|\\"|g;
242
243                 # add a prefix
244                 s|^|\t,"'"$prefix$patchname"' - |;
245                 # newlines away
246                 s/\n/ /g; s/  */ /g;
247                 # add a suffix
248                 s/ *$/"/; p
249         };
250         # stop all processing
251         d;
252         # label: append to the hold space
253         :append H; d;
254         # label: prepend to the hold space
255         :prepend x; H; d;
256         '
257 done < "${WORKDIR}"/patches/series > "${S}/${patchoutput}"
258 echo "${patchoutput}" >> "${S}/MANIFEST"
259 }
260
261 src_prepare() {
262         local patch
263         EPATCH_OPTS+=" -p1"
264         einfo "Applying patches from ${MY_P}-${PATCH_VER} ..."
265         while read patch ; do
266                 EPATCH_SINGLE_MSG="  ${patch} ..."
267                 epatch "${WORKDIR}"/patches/${patch}
268         done < "${WORKDIR}"/patches/series
269
270         src_prepare_update_patchlevel_h
271
272         if tc-is-cross-compiler; then
273                 cp -a ../perl-cross-${CROSS_VER}/* . || die
274
275                 sed -i \
276                         -e 's/(15 + $CLEANUP)/(13 + $CLEANUP)/' \
277                         cnf/diffs/perl5-${PV}/makemaker-test.patch || die
278
279                 sed -i \
280                         -e 's/MakeMaker\.pm .*/MakeMaker.pm bf9174c70a0e50ff2fee4552c7df89b37d292da1/' \
281                         -e 's/MM_Unix\.pm .*/MM_Unix.pm b0ec308fe2d7dcfcef5732880db0fae1f4ea80fa/' \
282                         cnf/diffs/perl5-${PV}/customized.patch || die
283
284                 sed -i \
285                         -e 's|^lib/unicore/CombiningClass.pl pod/perluniprops.pod:|lib/unicore/CombiningClass.pl pod/perluniprops.pod: $(CONFIGPM)|' \
286                         Makefile || die
287
288                 # bug 604072
289                 MAKEOPTS+=" -j1"
290                 export MAKEOPTS
291         fi
292
293         if ! tc-is-static-only ; then
294                 ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
295                 ln -s ${LIBPERL} libperl$(get_libname ) || die
296         fi
297
298         if use gdbm; then
299                 sed -i "s:INC => .*:INC => \"-I${EROOT}usr/include/gdbm\":g" \
300                         ext/NDBM_File/Makefile.PL || die
301         fi
302
303         default
304 }
305
306 myconf() {
307         # the myconf array is declared in src_configure
308         myconf=( "${myconf[@]}" "$@" )
309 }
310
311 src_configure() {
312         declare -a myconf
313
314         export LC_ALL="C"
315         [[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
316
317         # some arches and -O do not mix :)
318         use ppc && replace-flags -O? -O1
319
320         # Perl has problems compiling with -Os in your flags with glibc
321         use elibc_uclibc || replace-flags "-Os" "-O2"
322
323         # This flag makes compiling crash in interesting ways
324         filter-flags "-malign-double"
325
326         # Fixes bug #97645
327         use ppc && filter-flags "-mpowerpc-gpopt"
328
329         # Fixes bug #143895 on gcc-4.1.1
330         filter-flags "-fsched2-use-superblocks"
331
332         use sparc && myconf -Ud_longdbl
333
334         export BUILD_BZIP2=0
335         export BZIP2_INCLUDE=${EROOT}/usr/include
336         export BZIP2_LIB=${EROOT}/usr/$(get_libdir)
337
338         export BUILD_ZLIB=False
339         export ZLIB_INCLUDE=${EROOT}/usr/include
340         export ZLIB_LIB=${EROOT}/usr/$(get_libdir)
341
342         # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
343         myndbm='U'
344         mygdbm='U'
345         mydb='U'
346         if use gdbm ; then
347                 mygdbm='D'
348                 if use berkdb ; then
349                         myndbm='D'
350                 fi
351         fi
352         if use berkdb ; then
353                 mydb='D'
354                 has_version '=sys-libs/db-1*' && myndbm='D'
355         fi
356
357         myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
358
359         if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
360                 ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
361                 myconf -Ui_db -Ui_ndbm
362         fi
363
364         use ithreads && myconf -Dusethreads
365
366         if use debug ; then
367                 append-cflags "-g"
368                 myconf -DDEBUGGING
369         elif [[ ${CFLAGS} == *-g* ]] ; then
370                 myconf -DDEBUGGING=-g
371         else
372                 myconf -DDEBUGGING=none
373         fi
374
375         if [[ -n ${PERL_OLDVERSEN} ]] ; then
376                 local inclist=$(for v in ${PERL_OLDVERSEN}; do echo -n "${v}/${myarch}${mythreading} ${v} "; done )
377                 myconf -Dinc_version_list="${inclist}"
378         fi
379
380         [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
381
382         # Make sure we can do the final link #523730, need to set deployment
383         # target to override hardcoded 10.3 which breaks on modern OSX
384         [[ ${CHOST} == *-darwin* ]] && \
385                 myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
386
387         # Prefix: the host system needs not to follow Gentoo multilib stuff, and in
388         # Prefix itself we don't do multilib either, so make sure perl can find
389         # something compatible.
390         if use prefix ; then
391                 # Set a hook to check for each detected library whether it actually works.
392                 export libscheck="
393                         ( echo 'main(){}' > '${T}'/conftest.c &&
394                           $(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
395                         ) || xxx=/dev/null"
396
397                 # Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
398                 local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
399                 myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
400         elif [[ $(get_libdir) != "lib" ]] ; then
401                 # We need to use " and not ', as the written config.sh use ' ...
402                 myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
403         fi
404
405         # don't try building ODBM, bug #354453
406         disabled_extensions="ODBM_File"
407
408         if ! use gdbm ; then
409                 # workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
410                 disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
411         fi
412
413         myconf -Dnoextensions="${disabled_extensions}"
414
415         [[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
416         # allow fiddling via EXTRA_ECONF, bug 558070
417         eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
418
419         myconf \
420                 -Duseshrplib \
421                 -Darchname="${myarch}" \
422                 -Dcc="$(tc-getCC)" \
423                 -Doptimize="${CFLAGS}" \
424                 -Dldflags="${LDFLAGS}" \
425                 -Dprefix="${EPREFIX}"'/usr' \
426                 -Dsiteprefix="${EPREFIX}"'/usr/local' \
427                 -Dvendorprefix="${EPREFIX}"'/usr' \
428                 -Dscriptdir="${EPREFIX}"'/usr/bin' \
429                 -Dprivlib="${EPREFIX}${PRIV_LIB}" \
430                 -Darchlib="${EPREFIX}${ARCH_LIB}" \
431                 -Dsitelib="${EPREFIX}${SITE_LIB}" \
432                 -Dsitearch="${EPREFIX}${SITE_ARCH}" \
433                 -Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
434                 -Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
435                 -Dman1dir="${EPREFIX}"/usr/share/man/man1 \
436                 -Dman3dir="${EPREFIX}"/usr/share/man/man3 \
437                 -Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
438                 -Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
439                 -Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
440                 -Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
441                 -Dman1ext='1' \
442                 -Dman3ext='3pm' \
443                 -Dlibperl="${LIBPERL}" \
444                 -Dlocincpth="${EPREFIX}"'/usr/include ' \
445                 -Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
446                 -Duselargefiles \
447                 -Dd_semctl_semun \
448                 -Dcf_by='Gentoo' \
449                 -Dmyhostname='localhost' \
450                 -Dperladmin='root@localhost' \
451                 -Ud_csh \
452                 -Dsh="${EPREFIX}"/bin/sh \
453                 -Dtargetsh="${EPREFIX}"/bin/sh \
454                 -Uusenm \
455                 "${myconf[@]}" \
456                 "${EXTRA_ECONF[@]}"
457
458         if tc-is-cross-compiler; then
459                 ./configure \
460                         --target="${CHOST}" \
461                         --build="${CBUILD}" \
462                         -Dinstallprefix='' \
463                         -Dinstallusrbinperl='undef' \
464                         -Dusevendorprefix='define' \
465                         "${myconf[@]}" \
466                         || die "Unable to configure"
467         else
468                 sh Configure \
469                         -des \
470                         -Dinstallprefix="${EPREFIX}"'/usr' \
471                         -Dinstallusrbinperl='n' \
472                         "${myconf[@]}" \
473                         || die "Unable to configure"
474         fi
475 }
476
477 src_test() {
478         export NO_GENTOO_NETWORK_TESTS=1;
479         if [[ ${EUID} == 0 ]] ; then
480                 ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
481                 return 0
482         fi
483         use elibc_uclibc && export MAKEOPTS+=" -j1"
484         TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
485 }
486
487 src_install() {
488         local i
489         local coredir="${ARCH_LIB}/CORE"
490
491         emake DESTDIR="${D}" install
492
493         rm -f "${ED}/usr/bin/perl${MY_PV}"
494         ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
495
496         if ! tc-is-static-only ; then
497                 dolib.so "${ED}"${coredir}/${LIBPERL}
498                 rm -f "${ED}"${coredir}/${LIBPERL}
499                 ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
500                 ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
501                 ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
502                 ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
503                 ln -sf ../../../../../$(get_libdir)/${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
504         fi
505
506         rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
507
508         # This removes ${D} from Config.pm
509         for i in $(find "${D}" -iname "Config.pm" ) ; do
510                 einfo "Removing ${D} from ${i}..."
511                 sed -i -e "s:${D}::" "${i}" || die "Sed failed"
512         done
513
514         dodoc Changes* README AUTHORS
515
516         if use doc ; then
517                 # HTML Documentation
518                 # We expect errors, warnings, and such with the following.
519
520                 dodir /usr/share/doc/${PF}/html
521                 LD_LIBRARY_PATH=. ./perl installhtml \
522                         --podroot='.' \
523                         --podpath='lib:ext:pod:vms' \
524                         --recurse \
525                         --htmldir="${ED}/usr/share/doc/${PF}/html"
526         fi
527
528         [[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
529
530         dual_scripts
531 }
532
533 pkg_preinst() {
534         check_rebuild
535 }
536
537 pkg_postinst() {
538         dual_scripts
539
540         if [[ "${ROOT}" = "/" ]] ; then
541                 local INC DIR file
542                 INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
543                 einfo "Removing old .ph files"
544                 for DIR in ${INC} ; do
545                         if [[ -d "${DIR}" ]] ; then
546                                 for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
547                                         rm -f "${file}"
548                                         einfo "<< ${file}"
549                                 done
550                         fi
551                 done
552                 # Silently remove the now empty dirs
553                 for DIR in ${INC} ; do
554                         if [[ -d "${DIR}" ]] ; then
555                                 find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
556                         fi
557                 done
558
559         fi
560 }
561
562 pkg_postrm(){
563         dual_scripts
564 }