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