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