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