Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "Perl scripting language" |
| 2 | HOMEPAGE = "http://www.perl.org/" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | DESCRIPTION = "Perl is a highly capable, feature-rich programming language" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 4 | SECTION = "devel" |
| 5 | LICENSE = "Artistic-1.0 | GPL-1.0+" |
| 6 | LIC_FILES_CHKSUM = "file://Copying;md5=5b122a36d0f6dc55279a0ebc69f3c60b \ |
| 7 | file://Artistic;md5=71a4d5d9acc18c0952a6df2218bb68da \ |
| 8 | " |
| 9 | |
| 10 | |
| 11 | SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 12 | file://perl-rdepends.txt \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 13 | file://0001-Somehow-this-module-breaks-through-the-perl-wrapper-.patch \ |
| 14 | file://errno_ver.diff \ |
| 15 | file://native-perlinc.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | file://perl-dynloader.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 17 | file://0002-Constant-Fix-up-shebang.patch \ |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 18 | file://determinism.patch \ |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 19 | file://CVE-2021-36770.patch \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 20 | file://aacd2398e766500cb5d83c4d76b642fcf31d997a.patch \ |
| 21 | file://ea57297a58b8f10ab885c19eec48ea076116cc1f.patch \ |
| 22 | file://5bc1e5fdd87aa205011512cd1e6cc655bcf677fd.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 24 | SRC_URI:append:class-native = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 25 | file://perl-configpm-switch.patch \ |
| 26 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 27 | SRC_URI:append:class-target = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 28 | file://encodefix.patch \ |
| 29 | " |
| 30 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 31 | SRC_URI[perl.sha256sum] = "551efc818b968b05216024fb0b727ef2ad4c100f8cb6b43fab615fa78ae5be9a" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 32 | |
| 33 | S = "${WORKDIR}/perl-${PV}" |
| 34 | |
| 35 | inherit upstream-version-is-even update-alternatives |
| 36 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 37 | DEPENDS += "perlcross-native zlib virtual/crypt" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 38 | |
| 39 | PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0" |
| 40 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 41 | PACKAGECONFIG ??= "gdbm" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 42 | PACKAGECONFIG[bdb] = ",-Ui_db,db" |
| 43 | PACKAGECONFIG[gdbm] = ",-Ui_gdbm,gdbm" |
| 44 | |
| 45 | # Don't generate comments in enc2xs output files. They are not reproducible |
| 46 | export ENC2XS_NO_COMMENTS = "1" |
| 47 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 48 | do_configure:prepend() { |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 49 | cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${S} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 50 | } |
| 51 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 52 | do_configure:class-target() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 53 | ./configure --prefix=${prefix} --libdir=${libdir} \ |
| 54 | --target=${TARGET_SYS} \ |
| 55 | -Duseshrplib \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 56 | -Dusethreads \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 57 | -Dsoname=libperl.so.5 \ |
| 58 | -Dvendorprefix=${prefix} \ |
| 59 | -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 60 | -Dlibpth='${libdir} ${base_libdir}' \ |
| 61 | -Dglibpth='${libdir} ${base_libdir}' \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 62 | -Alddlflags=' ${LDFLAGS}' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 63 | ${PACKAGECONFIG_CONFARGS} |
| 64 | |
| 65 | #perl.c uses an ARCHLIB_EXP define to generate compile-time code that |
| 66 | #adds the archlibexp path to @INC during run-time initialization of a |
| 67 | #new perl interpreter. |
| 68 | |
| 69 | #Because we've changed this value in a temporary way to make it |
| 70 | #possible to use ExtUtils::Embed in the target build (the temporary |
| 71 | #value in config.sh gets re-stripped out during packaging), the |
| 72 | #ARCHLIB_EXP value that gets generated still uses the temporary version |
| 73 | #instead of the original expected version (i.e. becauses it's in the |
| 74 | #generated config.h, it doesn't get stripped out during packaging like |
| 75 | #the others in config.sh). |
| 76 | |
| 77 | sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h |
| 78 | } |
| 79 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 80 | do_configure:class-nativesdk() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 81 | ./configure --prefix=${prefix} \ |
| 82 | --target=${TARGET_SYS} \ |
| 83 | -Duseshrplib \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 84 | -Dusethreads \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 85 | -Dsoname=libperl.so.5 \ |
| 86 | -Dvendorprefix=${prefix} \ |
| 87 | -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 88 | -Alddlflags=' ${LDFLAGS}' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 89 | ${PACKAGECONFIG_CONFARGS} |
| 90 | |
| 91 | # See the comment above |
| 92 | sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h |
| 93 | } |
| 94 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 95 | do_configure:class-native() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 96 | ./configure --prefix=${prefix} \ |
| 97 | -Dbin=${bindir}/perl-native \ |
| 98 | -Duseshrplib \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 99 | -Dusethreads \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 100 | -Dsoname=libperl.so.5 \ |
| 101 | -Dvendorprefix=${prefix} \ |
| 102 | -Ui_xlocale \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 103 | -Alddlflags=' ${LDFLAGS}' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 104 | ${PACKAGECONFIG_CONFARGS} |
| 105 | } |
| 106 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 107 | do_configure:append() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 108 | if [ -n "$SOURCE_DATE_EPOCH" ]; then |
| 109 | PERL_BUILD_DATE="$(${PYTHON} -c "\ |
| 110 | from datetime import datetime, timezone; \ |
| 111 | print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %d %H:%M:%S %Y')) \ |
| 112 | ")" |
| 113 | echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h |
| 114 | fi |
| 115 | } |
| 116 | |
| 117 | do_compile() { |
| 118 | oe_runmake |
| 119 | # This isn't generated reliably so delete and re-generate. |
| 120 | # https://github.com/arsv/perl-cross/issues/86 |
| 121 | |
| 122 | if [ -e pod/perltoc.pod ]; then |
| 123 | bbnote Rebuilding perltoc.pod |
| 124 | rm -f pod/perltoc.pod |
| 125 | oe_runmake pod/perltoc.pod |
| 126 | fi |
| 127 | } |
| 128 | |
| 129 | do_install() { |
| 130 | oe_runmake 'DESTDIR=${D}' install |
| 131 | |
| 132 | install -d ${D}${libdir}/perl5 |
| 133 | install -d ${D}${libdir}/perl5/${PV}/ |
| 134 | install -d ${D}${libdir}/perl5/${PV}/ExtUtils/ |
| 135 | |
| 136 | # Save native config |
| 137 | install config.sh ${D}${libdir}/perl5 |
| 138 | install lib/Config.pm ${D}${libdir}/perl5/${PV}/ |
| 139 | install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/ |
| 140 | |
| 141 | # Fix up shared library |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 142 | dir=$(echo ${D}/${libdir}/perl5/${PV}/*/CORE) |
| 143 | rm $dir/libperl.so |
| 144 | ln -sf ../../../../libperl.so.${PERL_LIB_VER} $dir/libperl.so |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 145 | |
| 146 | # Try to catch Bug #13946 |
| 147 | if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then |
| 148 | bbfatal 'non-arch specific Storable.pm found! See https://bugzilla.yoctoproject.org/show_bug.cgi?id=13946' |
| 149 | fi |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 150 | } |
| 151 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 152 | do_install:append:class-target() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 153 | # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch |
| 154 | ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl |
| 155 | |
| 156 | # This contains host-specific information used for building miniperl (a helper executable built with host compiler) |
| 157 | # and therefore isn't reproducible. I believe the file isn't actually needed on target. |
| 158 | rm ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/xconfig.h |
| 159 | } |
| 160 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 161 | do_install:append:class-nativesdk() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 162 | # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch |
| 163 | ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl |
| 164 | |
| 165 | create_wrapper ${D}${bindir}/perl \ |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 166 | PERL5LIB='$PERL5LIB:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/site_perl/${PV}:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/vendor_perl/${PV}:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/${PV}' |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 167 | } |
| 168 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 169 | do_install:append:class-native () { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 170 | # Those wrappers mean that perl installed from sstate (which may change |
| 171 | # path location) works and that in the nativesdk case, the SDK can be |
| 172 | # installed to a different location from the one it was built for. |
| 173 | create_wrapper ${D}${bindir}/perl-native/perl PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl5/site_perl/${PV}:${STAGING_LIBDIR}/perl5/vendor_perl/${PV}:${STAGING_LIBDIR}/perl5/${PV}' |
| 174 | |
| 175 | # Use /usr/bin/env nativeperl for the perl script. |
| 176 | for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do |
| 177 | sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f |
| 178 | done |
| 179 | } |
| 180 | |
| 181 | PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess" |
| 182 | |
| 183 | perl_package_preprocess () { |
| 184 | # Fix up installed configuration |
| 185 | sed -i -e "s,${D},,g" \ |
| 186 | -e "s,${DEBUG_PREFIX_MAP},,g" \ |
| 187 | -e "s,--sysroot=${STAGING_DIR_HOST},,g" \ |
| 188 | -e "s,-isystem${STAGING_INCDIR} ,,g" \ |
| 189 | -e "s,${STAGING_LIBDIR},${libdir},g" \ |
| 190 | -e "s,${STAGING_BINDIR},${bindir},g" \ |
| 191 | -e "s,${STAGING_INCDIR},${includedir},g" \ |
| 192 | -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \ |
| 193 | -e "s,${STAGING_BINDIR_NATIVE}/,,g" \ |
| 194 | -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \ |
| 195 | -e 's:${RECIPE_SYSROOT}::g' \ |
| 196 | ${PKGD}${bindir}/h2xs.perl \ |
| 197 | ${PKGD}${bindir}/h2ph.perl \ |
| 198 | ${PKGD}${bindir}/pod2man.perl \ |
| 199 | ${PKGD}${bindir}/pod2text.perl \ |
| 200 | ${PKGD}${bindir}/pod2usage.perl \ |
| 201 | ${PKGD}${bindir}/podchecker.perl \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 202 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h \ |
| 203 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/perl.h \ |
| 204 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/pp.h \ |
| 205 | ${PKGD}${libdir}/perl5/${PV}/Config.pm \ |
| 206 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \ |
| 207 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pod \ |
| 208 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_git.pl \ |
| 209 | ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy.pl \ |
| 210 | ${PKGD}${libdir}/perl5/${PV}/ExtUtils/Liblist/Kid.pm \ |
| 211 | ${PKGD}${libdir}/perl5/${PV}/FileCache.pm \ |
| 212 | ${PKGD}${libdir}/perl5/${PV}/pod/*.pod \ |
| 213 | ${PKGD}${libdir}/perl5/config.sh |
| 214 | } |
| 215 | |
| 216 | inherit update-alternatives |
| 217 | |
| 218 | ALTERNATIVE_PRIORITY = "100" |
| 219 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 220 | ALTERNATIVE:${PN}-misc = "corelist cpan enc2xs encguess h2ph h2xs instmodsh json_pp libnetcfg \ |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 221 | piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 222 | prove ptar ptardiff ptargrep shasum splain xsubpp zipdetails" |
| 223 | ALTERNATIVE_LINK_NAME[corelist] = "${bindir}/corelist" |
| 224 | ALTERNATIVE_LINK_NAME[cpan] = "${bindir}/cpan" |
| 225 | ALTERNATIVE_LINK_NAME[enc2xs] = "${bindir}/enc2xs" |
| 226 | ALTERNATIVE_LINK_NAME[encguess] = "${bindir}/encguess" |
| 227 | ALTERNATIVE_LINK_NAME[h2ph] = "${bindir}/h2ph" |
| 228 | ALTERNATIVE_LINK_NAME[h2xs] = "${bindir}/h2xs" |
| 229 | ALTERNATIVE_LINK_NAME[instmodsh] = "${bindir}/instmodsh" |
| 230 | ALTERNATIVE_LINK_NAME[json_pp] = "${bindir}/json_pp" |
| 231 | ALTERNATIVE_LINK_NAME[libnetcfg] = "${bindir}/libnetcfg" |
| 232 | ALTERNATIVE_LINK_NAME[piconv] = "${bindir}/piconv" |
| 233 | ALTERNATIVE_LINK_NAME[pl2pm] = "${bindir}/pl2pm" |
| 234 | ALTERNATIVE_LINK_NAME[pod2html] = "${bindir}/pod2html" |
| 235 | ALTERNATIVE_LINK_NAME[pod2man] = "${bindir}/pod2man" |
| 236 | ALTERNATIVE_LINK_NAME[pod2text] = "${bindir}/pod2text" |
| 237 | ALTERNATIVE_LINK_NAME[pod2usage] = "${bindir}/pod2usage" |
| 238 | ALTERNATIVE_LINK_NAME[podchecker] = "${bindir}/podchecker" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 239 | ALTERNATIVE_LINK_NAME[prove] = "${bindir}/prove" |
| 240 | ALTERNATIVE_LINK_NAME[ptar] = "${bindir}/ptar" |
| 241 | ALTERNATIVE_LINK_NAME[ptardiff] = "${bindir}/ptardiff" |
| 242 | ALTERNATIVE_LINK_NAME[ptargrep] = "${bindir}/ptargrep" |
| 243 | ALTERNATIVE_LINK_NAME[shasum] = "${bindir}/shasum" |
| 244 | ALTERNATIVE_LINK_NAME[splain] = "${bindir}/splain" |
| 245 | ALTERNATIVE_LINK_NAME[xsubpp] = "${bindir}/xsubpp" |
| 246 | ALTERNATIVE_LINK_NAME[zipdetails] = "${bindir}/zipdetails" |
| 247 | |
| 248 | require perl-ptest.inc |
| 249 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 250 | FILES:${PN} = "${bindir}/perl ${bindir}/perl.real ${bindir}/perl${PV} ${libdir}/libperl.so* \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 251 | ${libdir}/perl5/site_perl \ |
| 252 | ${libdir}/perl5/${PV}/Config.pm \ |
| 253 | ${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \ |
| 254 | ${libdir}/perl5/${PV}/*/Config_git.pl \ |
| 255 | ${libdir}/perl5/${PV}/*/Config_heavy-target.pl \ |
| 256 | ${libdir}/perl5/config.sh \ |
| 257 | ${libdir}/perl5/${PV}/strict.pm \ |
| 258 | ${libdir}/perl5/${PV}/warnings.pm \ |
| 259 | ${libdir}/perl5/${PV}/warnings \ |
| 260 | ${libdir}/perl5/${PV}/vars.pm \ |
| 261 | ${libdir}/perl5/site_perl \ |
| 262 | ${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \ |
| 263 | ${libdir}/perl5/${PV}/ExtUtils/xsubpp \ |
| 264 | ${libdir}/perl5/${PV}/ExtUtils/typemap \ |
| 265 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 266 | RPROVIDES:${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 267 | perl-module-warnings-register" |
| 268 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 269 | FILES:${PN}-staticdev:append = " ${libdir}/perl5/${PV}/*/CORE/libperl.a" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 270 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 271 | FILES:${PN}-dev:append = " ${libdir}/perl5/${PV}/*/CORE" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 272 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 273 | FILES:${PN}-doc:append = " ${libdir}/perl5/${PV}/Unicode/Collate/*.txt \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 274 | ${libdir}/perl5/${PV}/*/.packlist \ |
| 275 | ${libdir}/perl5/${PV}/Encode/encode.h \ |
| 276 | " |
| 277 | PACKAGES += "${PN}-misc" |
| 278 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 279 | FILES:${PN}-misc = "${bindir}/*" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 280 | |
| 281 | PACKAGES += "${PN}-pod" |
| 282 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 283 | FILES:${PN}-pod = "${libdir}/perl5/${PV}/pod \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 284 | ${libdir}/perl5/${PV}/*.pod \ |
| 285 | ${libdir}/perl5/${PV}/*/*.pod \ |
| 286 | ${libdir}/perl5/${PV}/*/*/*.pod \ |
| 287 | ${libdir}/perl5/${PV}/*/*/*/*.pod \ |
| 288 | " |
| 289 | |
| 290 | PACKAGES += "${PN}-module-cpan ${PN}-module-unicore" |
| 291 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 292 | FILES:${PN}-module-cpan += "${libdir}/perl5/${PV}/CPAN \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 293 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 294 | FILES:${PN}-module-unicore += "${libdir}/perl5/${PV}/unicore" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 295 | |
| 296 | ALTERNATIVE_PRIORITY = "40" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 297 | ALTERNATIVE:${PN}-doc = "Thread.3" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 298 | ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3" |
| 299 | |
| 300 | # Create a perl-modules package recommending all the other perl |
| 301 | # packages (actually the non modules packages and not created too) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 302 | ALLOW_EMPTY:${PN}-modules = "1" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 303 | PACKAGES += "${PN}-modules " |
| 304 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 305 | PACKAGESPLITFUNCS:prepend = "split_perl_packages " |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 306 | |
| 307 | python split_perl_packages () { |
| 308 | libdir = d.expand('${libdir}/perl5/${PV}') |
| 309 | do_split_packages(d, libdir, r'.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False) |
| 310 | do_split_packages(d, libdir, r'.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) |
| 311 | do_split_packages(d, libdir, r'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) |
| 312 | do_split_packages(d, libdir, r'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) |
| 313 | do_split_packages(d, libdir, r'.*linux/([^\/].*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 314 | do_split_packages(d, libdir, r'(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/|.*linux\/)[^\/]).*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 315 | |
| 316 | # perl-modules should recommend every perl module, and only the |
| 317 | # modules. Don't attempt to use the result of do_split_packages() as some |
| 318 | # modules are manually split (eg. perl-module-unicore). |
| 319 | packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES').split()) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 320 | d.setVar(d.expand("RRECOMMENDS:${PN}-modules"), ' '.join(packages)) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 321 | |
| 322 | # Read the pre-generated dependency file, and use it to set module dependecies |
| 323 | for line in open(d.expand("${WORKDIR}") + '/perl-rdepends.txt').readlines(): |
| 324 | splitline = line.split() |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 325 | # Filter empty lines and comments |
| 326 | if len(splitline) == 0 or splitline[0].startswith("#"): |
| 327 | continue |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 328 | if bb.data.inherits_class('native', d): |
| 329 | module = splitline[0] + '-native' |
| 330 | depends = "perl-native" |
| 331 | else: |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 332 | module = splitline[0].replace("RDEPENDS:perl", "RDEPENDS:${PN}") |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 333 | depends = splitline[2].strip('"').replace("perl-module", "${PN}-module") |
| 334 | d.appendVar(d.expand(module), " " + depends) |
| 335 | } |
| 336 | |
| 337 | python() { |
| 338 | if d.getVar('CLASSOVERRIDE') == "class-target": |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 339 | d.setVar("PACKAGES_DYNAMIC", "^${MLPREFIX}perl-module-.*(?<!native)$") |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 340 | elif d.getVar('CLASSOVERRIDE') == "class-native": |
| 341 | d.setVar("PACKAGES_DYNAMIC", "^perl-module-.*-native$") |
| 342 | elif d.getVar('CLASSOVERRIDE') == "class-nativesdk": |
| 343 | d.setVar("PACKAGES_DYNAMIC", "^nativesdk-perl-module-.*") |
| 344 | } |
| 345 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 346 | RDEPENDS:${PN}-misc += "perl perl-modules" |
| 347 | RDEPENDS:${PN}-pod += "perl" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 348 | |
| 349 | BBCLASSEXTEND = "native nativesdk" |
| 350 | |
| 351 | SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh" |
| 352 | |
| 353 | do_create_rdepends_inc() { |
| 354 | cd ${WORKDIR} |
| 355 | cat <<'EOPREAMBLE' > ${WORKDIR}/perl-rdepends.inc |
| 356 | |
| 357 | # Some additional dependencies that the above doesn't manage to figure out |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 358 | RDEPENDS:${PN}-module-file-spec += "${PN}-module-file-spec-unix" |
| 359 | RDEPENDS:${PN}-module-math-bigint += "${PN}-module-math-bigint-calc" |
| 360 | RDEPENDS:${PN}-module-thread-queue += "${PN}-module-attributes" |
| 361 | RDEPENDS:${PN}-module-overload += "${PN}-module-overloading" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 362 | |
| 363 | # Generated depends list beyond this line |
| 364 | EOPREAMBLE |
| 365 | test -e packages-split.new && rm -rf packages-split.new |
| 366 | cp -r packages-split packages-split.new && cd packages-split.new |
| 367 | find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d' |
| 368 | egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \ |
| 369 | sed "s/\/.*\.pm: */ += /g;s/[\"\']//g;s/;.*/\"/g;s/+= .*\(require\|use\)\> */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;s/(//;" | tr [:upper:] [:lower:] | \ |
| 370 | awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \ |
| 371 | grep -v -e "\-vms\-" -e module-5 -e "^$" -e "\\$" -e your -e tk -e autoperl -e html -e http -e parse-cpan -e perl-ostype -e ndbm-file -e module-mac -e fcgi -e lwp -e dbd -e dbix | \ |
| 372 | sort -u | \ |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 373 | sed 's/^/RDEPENDS:/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 374 | egrep -wv '=>|module-a|module-apache.?|module-apr|module-authen-sasl|module-b-asmdata|module-convert-ebcdic|module-devel-size|module-digest-perl-md5|module-dumpvalue|module-extutils-constant-aaargh56hash|module-extutils-xssymset|module-file-bsdglob|module-for|module-it|module-io-socket-inet6|module-io-socket-ssl|module-io-string|module-ipc-system-simple|module-lexical|module-local-lib|metadata|module-modperl-util|module-pluggable-object|module-test-builder-io-scalar|module-test2|module-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \ |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 375 | egrep -wv '=>|module-algorithm-diff|module-carp|module-c<extutils-mm-unix>|module-l<extutils-mm-unix>|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-io-uncompress-unxz|module-locale-maketext-lexicon|module-log-agent|module-meta-notation|module-net-localcfg|module-net-ping-external|module-b-deparse|module-scalar-util|module-some-module|module-symbol|module-uri|module-win32api-file' > ${WORKDIR}/perl-rdepends.generated |
| 376 | cat ${WORKDIR}/perl-rdepends.inc ${WORKDIR}/perl-rdepends.generated > ${THISDIR}/files/perl-rdepends.txt |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | # bitbake perl -c create_rdepends_inc |
| 380 | addtask do_create_rdepends_inc |
| 381 | |
| 382 | SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper" |
| 383 | |
| 384 | perl_sysroot_create_wrapper () { |
| 385 | mkdir -p ${SYSROOT_DESTDIR}${bindir} |
| 386 | # Create a wrapper that /usr/bin/env perl will use to get perl-native. |
| 387 | # This MUST live in the normal bindir. |
| 388 | cat > ${SYSROOT_DESTDIR}${bindir}/nativeperl << EOF |
| 389 | #!/bin/sh |
| 390 | realpath=\`readlink -fn \$0\` |
| 391 | exec \`dirname \$realpath\`/perl-native/perl "\$@" |
| 392 | EOF |
| 393 | chmod 0755 ${SYSROOT_DESTDIR}${bindir}/nativeperl |
| 394 | cat ${SYSROOT_DESTDIR}${bindir}/nativeperl |
| 395 | } |
Patrick Williams | 93c203f | 2021-10-06 16:15:23 -0500 | [diff] [blame] | 396 | |
| 397 | SSTATE_HASHEQUIV_FILEMAP = " \ |
| 398 | populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${TMPDIR} \ |
| 399 | populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${COREBASE} \ |
| 400 | populate_sysroot:*/lib*/perl5/config.sh:${TMPDIR} \ |
| 401 | populate_sysroot:*/lib*/perl5/config.sh:${COREBASE} \ |
| 402 | " |