perl-5.26.9999.ebuild 17 KB

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