lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

perlPackages: use makeScopeWithSplicing

Artturin af0fc321 c0eaef73

+337 -261
+65 -245
pkgs/development/interpreters/perl/default.nix
··· 1 - { config, lib, stdenv, fetchurl, fetchFromGitHub, pkgs, buildPackages 2 - , callPackage 3 - , enableThreading ? true, coreutils, makeWrapper 4 - , enableCrypt ? true, libxcrypt ? null 5 - , zlib 6 - }: 7 - 8 - assert (enableCrypt -> (libxcrypt != null)); 9 - 10 - # Note: this package is used for bootstrapping fetchurl, and thus 11 - # cannot use fetchpatch! All mutable patches (generated by GitHub or 12 - # cgit) that are needed here should be included directly in Nixpkgs as 13 - # files. 1 + { callPackage }: 14 2 15 3 let 16 - 17 - libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr"; 18 - libcInc = lib.getDev libc; 19 - libcLib = lib.getLib libc; 20 - crossCompiling = stdenv.buildPlatform != stdenv.hostPlatform; 21 - 22 - common = { perl, buildPerl, version, sha256 }: stdenv.mkDerivation (rec { 23 - inherit version; 24 - pname = "perl"; 25 - 26 - src = fetchurl { 27 - url = "mirror://cpan/src/5.0/perl-${version}.tar.gz"; 28 - inherit sha256; 29 - }; 30 - 31 - strictDeps = true; 32 - # TODO: Add a "dev" output containing the header files. 33 - outputs = [ "out" "man" "devdoc" ] ++ 34 - lib.optional crossCompiling "mini"; 35 - setOutputFlags = false; 36 - 37 - # On FreeBSD, if Perl is built with threads support, having 38 - # libxcrypt available will result in a build failure, because 39 - # perl.h will get conflicting definitions of struct crypt_data 40 - # from libc's unistd.h and libxcrypt's crypt.h. 41 - # 42 - # FreeBSD Ports has the same issue building the perl port if 43 - # the libxcrypt port has been installed. 44 - # 45 - # Without libxcrypt, Perl will still find FreeBSD's crypt functions. 46 - propagatedBuildInputs = lib.optional (enableCrypt && !stdenv.isFreeBSD) libxcrypt; 47 - 48 - disallowedReferences = [ stdenv.cc ]; 49 - 50 - patches = 51 - [ 52 - # Do not look in /usr etc. for dependencies. 53 - ./no-sys-dirs-5.31.patch 54 - 55 - # Enable TLS/SSL verification in HTTP::Tiny by default 56 - ./http-tiny-verify-ssl-by-default.patch 57 - ] 58 - ++ lib.optional stdenv.isSunOS ./ld-shared.patch 59 - ++ lib.optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ] 60 - ++ lib.optional crossCompiling ./MakeMaker-cross.patch; 61 - 62 - # This is not done for native builds because pwd may need to come from 63 - # bootstrap tools when building bootstrap perl. 64 - postPatch = (if crossCompiling then '' 65 - substituteInPlace dist/PathTools/Cwd.pm \ 66 - --replace "/bin/pwd" '${coreutils}/bin/pwd' 67 - substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E" 68 - '' else '' 69 - substituteInPlace dist/PathTools/Cwd.pm \ 70 - --replace "/bin/pwd" "$(type -P pwd)" 71 - '') + 72 - # Perl's build system uses the src variable, and its value may end up in 73 - # the output in some cases (when cross-compiling) 74 - '' 75 - unset src 76 - ''; 77 - 78 - # Build a thread-safe Perl with a dynamic libperl.so. We need the 79 - # "installstyle" option to ensure that modules are put under 80 - # $out/lib/perl5 - this is the general default, but because $out 81 - # contains the string "perl", Configure would select $out/lib. 82 - # Miniperl needs -lm. perl needs -lrt. 83 - configureFlags = 84 - (if crossCompiling 85 - then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" "-Ddefault_inc_excludes_dot" ] 86 - else [ "-de" "-Dcc=cc" ]) 87 - ++ [ 88 - "-Uinstallusrbinperl" 89 - "-Dinstallstyle=lib/perl5" 90 - ] ++ lib.optional (!crossCompiling) "-Duseshrplib" ++ [ 91 - "-Dlocincpth=${libcInc}/include" 92 - "-Dloclibpth=${libcLib}/lib" 93 - ] 94 - ++ lib.optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [ "-Dusedevel" "-Uversiononly" ] 95 - ++ lib.optional stdenv.isSunOS "-Dcc=gcc" 96 - ++ lib.optional enableThreading "-Dusethreads" 97 - ++ lib.optional (!enableCrypt) "-A clear:d_crypt_r" 98 - ++ lib.optional stdenv.hostPlatform.isStatic "--all-static" 99 - ++ lib.optionals (!crossCompiling) [ 100 - "-Dprefix=${placeholder "out"}" 101 - "-Dman1dir=${placeholder "out"}/share/man/man1" 102 - "-Dman3dir=${placeholder "out"}/share/man/man3" 103 - ]; 104 - 105 - configureScript = lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure"; 106 - 107 - dontAddStaticConfigureFlags = true; 108 - 109 - dontAddPrefix = !crossCompiling; 110 - 111 - enableParallelBuilding = !crossCompiling; 112 - 113 - # perl includes the build date, the uname of the build system and the 114 - # username of the build user in some files. 115 - # We override these to make it build deterministically. 116 - # other distro solutions 117 - # https://github.com/bmwiedemann/openSUSE/blob/master/packages/p/perl/perl-reproducible.patch 118 - # https://github.com/archlinux/svntogit-packages/blob/packages/perl/trunk/config.over 119 - # https://salsa.debian.org/perl-team/interpreter/perl/blob/debian-5.26/debian/config.over 120 - # A ticket has been opened upstream to possibly clean some of this up: https://rt.perl.org/Public/Bug/Display.html?id=133452 121 - preConfigure = '' 122 - cat > config.over <<EOF 123 - ${lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu) ''osvers="gnulinux"''} 124 - myuname="nixpkgs" 125 - myhostname="nixpkgs" 126 - cf_by="nixpkgs" 127 - cf_time="$(date -d "@$SOURCE_DATE_EPOCH")" 128 - EOF 129 - 130 - # Compress::Raw::Zlib should use our zlib package instead of the one 131 - # included with the distribution 132 - cat > ./cpan/Compress-Raw-Zlib/config.in <<EOF 133 - BUILD_ZLIB = False 134 - INCLUDE = ${zlib.dev}/include 135 - LIB = ${zlib.out}/lib 136 - OLD_ZLIB = False 137 - GZIP_OS_CODE = AUTO_DETECT 138 - EOF 139 - '' + lib.optionalString stdenv.isDarwin '' 140 - substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" "" 141 - '' + lib.optionalString (!enableThreading) '' 142 - # We need to do this because the bootstrap doesn't have a static libpthread 143 - sed -i 's,\(libswanted.*\)pthread,\1,g' Configure 144 - ''; 145 - 146 - # Default perl does not support --host= & co. 147 - configurePlatforms = []; 148 - 149 - setupHook = ./setup-hook.sh; 150 - 151 - passthru = rec { 152 - interpreter = "${perl}/bin/perl"; 153 - libPrefix = "lib/perl5/site_perl"; 154 - pkgs = callPackage ../../../top-level/perl-packages.nix { 155 - inherit perl buildPerl; 156 - overrides = config.perlPackageOverrides or (p: {}); # TODO: (self: super: {}) like in python 157 - }; 158 - buildEnv = callPackage ./wrapper.nix { 159 - inherit perl; 160 - inherit (pkgs) requiredPerlModules; 161 - }; 162 - withPackages = f: buildEnv.override { extraLibs = f pkgs; }; 163 - }; 4 + # Common passthru for all perl interpreters. 5 + # copied from lua 6 + passthruFun = 7 + { overrides 8 + , perlOnBuildForBuild 9 + , perlOnBuildForHost 10 + , perlOnBuildForTarget 11 + , perlOnHostForHost 12 + , perlOnTargetForTarget 13 + , perlAttr ? null 14 + , self # is perlOnHostForTarget 15 + }: let 16 + perlPackages = callPackage 17 + # Function that when called 18 + # - imports perl-packages.nix 19 + # - adds spliced package sets to the package set 20 + ({ stdenv, pkgs, perl, callPackage, makeScopeWithSplicing }: let 21 + perlPackagesFun = callPackage ../../../top-level/perl-packages.nix { 22 + # allow 'perlPackages.override { pkgs = pkgs // { imagemagick = imagemagickBig; }; }' like in python3Packages 23 + # most perl packages aren't called with callPackage so it's not possible to override their arguments individually 24 + # the conditional is because the // above won't be applied to __splicedPackages and hopefully no one is doing that when cross-compiling 25 + pkgs = if stdenv.buildPlatform != stdenv.hostPlatform then pkgs.__splicedPackages else pkgs; 26 + inherit stdenv; 27 + perl = self; 28 + }; 164 29 165 - doCheck = false; # some tests fail, expensive 166 - 167 - # TODO: it seems like absolute paths to some coreutils is required. 168 - postInstall = 169 - '' 170 - # Remove dependency between "out" and "man" outputs. 171 - rm "$out"/lib/perl5/*/*/.packlist 30 + otherSplices = { 31 + selfBuildBuild = perlOnBuildForBuild.pkgs; 32 + selfBuildHost = perlOnBuildForHost.pkgs; 33 + selfBuildTarget = perlOnBuildForTarget.pkgs; 34 + selfHostHost = perlOnHostForHost.pkgs; 35 + selfTargetTarget = perlOnTargetForTarget.pkgs or {}; 36 + }; 37 + keep = self: { }; 38 + extra = spliced0: {}; 39 + in makeScopeWithSplicing 40 + otherSplices 41 + keep 42 + extra 43 + perlPackagesFun) 44 + { 45 + perl = self; 46 + }; 47 + in rec { 48 + buildEnv = callPackage ./wrapper.nix { 49 + perl = self; 50 + inherit (pkgs) requiredPerlModules; 51 + }; 52 + withPackages = f: buildEnv.override { extraLibs = f pkgs; }; 53 + pkgs = perlPackages // (overrides pkgs); 54 + interpreter = "${self}/bin/perl"; 55 + libPrefix = "lib/perl5/site_perl"; 56 + perlOnBuild = perlOnBuildForHost.override { inherit overrides; self = perlOnBuild; }; 57 + }; 172 58 173 - # Remove dependencies on glibc and gcc 174 - sed "/ *libpth =>/c libpth => ' '," \ 175 - -i "$out"/lib/perl5/*/*/Config.pm 176 - # TODO: removing those paths would be cleaner than overwriting with nonsense. 177 - substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \ 178 - --replace "${libcInc}" /no-such-path \ 179 - --replace "${ 180 - if stdenv.hasCC then stdenv.cc.cc else "/no-such-path" 181 - }" /no-such-path \ 182 - --replace "${stdenv.cc}" /no-such-path \ 183 - --replace "$man" /no-such-path 184 - '' + lib.optionalString crossCompiling 185 - '' 186 - mkdir -p $mini/lib/perl5/cross_perl/${version} 187 - for dir in cnf/{stub,cpan}; do 188 - cp -r $dir/* $mini/lib/perl5/cross_perl/${version} 189 - done 190 - 191 - mkdir -p $mini/bin 192 - install -m755 miniperl $mini/bin/perl 193 - 194 - export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})" 195 - # wrapProgram should use a runtime-native SHELL by default, but 196 - # it actually uses a buildtime-native one. If we ever fix that, 197 - # we'll need to fix this to use a buildtime-native one. 198 - # 199 - # Adding the arch-specific directory is morally incorrect, as 200 - # miniperl can't load the native modules there. However, it can 201 - # (and sometimes needs to) load and run some of the pure perl 202 - # code there, so we add it anyway. When needed, stubs can be put 203 - # into $mini/lib/perl5/cross_perl/${version}. 204 - wrapProgram $mini/bin/perl --prefix PERL5LIB : \ 205 - "$mini/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch" 206 - ''; # */ 207 - 208 - meta = with lib; { 209 - homepage = "https://www.perl.org/"; 210 - description = "The standard implementation of the Perl 5 programmming language"; 211 - license = licenses.artistic1; 212 - maintainers = [ maintainers.eelco ]; 213 - platforms = platforms.all; 214 - priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl` 215 - }; 216 - } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec { 217 - crossVersion = "c876045741f5159318085d2737b0090f35a842ca"; # June 5, 2022 218 - 219 - perl-cross-src = fetchFromGitHub { 220 - name = "perl-cross-unstable-${crossVersion}"; 221 - owner = "arsv"; 222 - repo = "perl-cross"; 223 - rev = crossVersion; 224 - sha256 = "sha256-m9UCoTQgXBxSgk9Q1Zv6wl3Qnd0aZm/jEPXkcMKti8U="; 225 - }; 226 - 227 - depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ]; 228 - 229 - postUnpack = '' 230 - unpackFile ${perl-cross-src} 231 - chmod -R u+w ${perl-cross-src.name} 232 - cp -R ${perl-cross-src.name}/* perl-${version}/ 233 - ''; 234 - 235 - configurePlatforms = [ "build" "host" "target" ]; 236 - 237 - # TODO merge setup hooks 238 - setupHook = ./setup-hook-cross.sh; 239 - }); 240 - in { 59 + in rec { 241 60 # Maint version 242 - perl534 = common { 243 - perl = pkgs.perl534; 244 - buildPerl = buildPackages.perl534; 61 + perl534 = callPackage ./intepreter.nix { 62 + self = perl534; 245 63 version = "5.34.1"; 246 64 sha256 = "sha256-NXlRpJGwuhzjYRJjki/ux4zNWB3dwkpEawM+JazyQqE="; 65 + inherit passthruFun; 247 66 }; 248 67 249 68 # Maint version 250 - perl536 = common { 251 - perl = pkgs.perl536; 252 - buildPerl = buildPackages.perl536; 69 + perl536 = callPackage ./intepreter.nix { 70 + self = perl536; 253 71 version = "5.36.0"; 254 72 sha256 = "sha256-4mCFr4rDlvYq3YpTPDoOqMhJfYNvBok0esWr17ek4Ao="; 73 + inherit passthruFun; 255 74 }; 256 75 257 76 # the latest Devel version 258 - perldevel = common { 259 - perl = pkgs.perldevel; 260 - buildPerl = buildPackages.perldevel; 77 + perldevel = callPackage ./intepreter.nix { 78 + self = perldevel; 79 + perlAttr = "perldevel"; 261 80 version = "5.37.0"; 262 81 sha256 = "sha256-8RQO6gtH+WmghqzRafbqAH1MhKv/vJCcvysi7/+T9XI="; 82 + inherit passthruFun; 263 83 }; 264 84 }
+257
pkgs/development/interpreters/perl/intepreter.nix
··· 1 + { stdenv 2 + , fetchurl 3 + , fetchFromGitHub 4 + , buildPackages 5 + , lib 6 + , self 7 + , version 8 + , sha256 9 + , pkgsBuildBuild 10 + , pkgsBuildHost 11 + , pkgsBuildTarget 12 + , pkgsHostHost 13 + , pkgsTargetTarget 14 + , zlib 15 + , config 16 + , passthruFun 17 + , perlAttr ? "perl${lib.versions.major version}${lib.versions.minor version}" 18 + , enableThreading ? true, coreutils, makeWrapper 19 + , enableCrypt ? true, libxcrypt ? null 20 + , overrides ? config.perlPackageOverrides or (p: {}) # TODO: (self: super: {}) like in python 21 + } @ inputs: 22 + 23 + # Note: this package is used for bootstrapping fetchurl, and thus 24 + # cannot use fetchpatch! All mutable patches (generated by GitHub or 25 + # cgit) that are needed here should be included directly in Nixpkgs as 26 + # files. 27 + 28 + assert (enableCrypt -> (libxcrypt != null)); 29 + 30 + let 31 + crossCompiling = stdenv.buildPlatform != stdenv.hostPlatform; 32 + libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr"; 33 + libcInc = lib.getDev libc; 34 + libcLib = lib.getLib libc; 35 + in 36 + 37 + stdenv.mkDerivation (rec { 38 + inherit version; 39 + pname = "perl"; 40 + 41 + src = fetchurl { 42 + url = "mirror://cpan/src/5.0/perl-${version}.tar.gz"; 43 + inherit sha256; 44 + }; 45 + 46 + strictDeps = true; 47 + # TODO: Add a "dev" output containing the header files. 48 + outputs = [ "out" "man" "devdoc" ] ++ 49 + lib.optional crossCompiling "mini"; 50 + setOutputFlags = false; 51 + 52 + # On FreeBSD, if Perl is built with threads support, having 53 + # libxcrypt available will result in a build failure, because 54 + # perl.h will get conflicting definitions of struct crypt_data 55 + # from libc's unistd.h and libxcrypt's crypt.h. 56 + # 57 + # FreeBSD Ports has the same issue building the perl port if 58 + # the libxcrypt port has been installed. 59 + # 60 + # Without libxcrypt, Perl will still find FreeBSD's crypt functions. 61 + propagatedBuildInputs = lib.optional (enableCrypt && !stdenv.isFreeBSD) libxcrypt; 62 + 63 + disallowedReferences = [ stdenv.cc ]; 64 + 65 + patches = 66 + [ 67 + # Do not look in /usr etc. for dependencies. 68 + ./no-sys-dirs-5.31.patch 69 + 70 + # Enable TLS/SSL verification in HTTP::Tiny by default 71 + ./http-tiny-verify-ssl-by-default.patch 72 + ] 73 + ++ lib.optional stdenv.isSunOS ./ld-shared.patch 74 + ++ lib.optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ] 75 + ++ lib.optional crossCompiling ./MakeMaker-cross.patch; 76 + 77 + # This is not done for native builds because pwd may need to come from 78 + # bootstrap tools when building bootstrap perl. 79 + postPatch = (if crossCompiling then '' 80 + substituteInPlace dist/PathTools/Cwd.pm \ 81 + --replace "/bin/pwd" '${coreutils}/bin/pwd' 82 + substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E" 83 + '' else '' 84 + substituteInPlace dist/PathTools/Cwd.pm \ 85 + --replace "/bin/pwd" "$(type -P pwd)" 86 + '') + 87 + # Perl's build system uses the src variable, and its value may end up in 88 + # the output in some cases (when cross-compiling) 89 + '' 90 + unset src 91 + ''; 92 + 93 + # Build a thread-safe Perl with a dynamic libperl.so. We need the 94 + # "installstyle" option to ensure that modules are put under 95 + # $out/lib/perl5 - this is the general default, but because $out 96 + # contains the string "perl", Configure would select $out/lib. 97 + # Miniperl needs -lm. perl needs -lrt. 98 + configureFlags = 99 + (if crossCompiling 100 + then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" "-Ddefault_inc_excludes_dot" ] 101 + else [ "-de" "-Dcc=cc" ]) 102 + ++ [ 103 + "-Uinstallusrbinperl" 104 + "-Dinstallstyle=lib/perl5" 105 + ] ++ lib.optional (!crossCompiling) "-Duseshrplib" ++ [ 106 + "-Dlocincpth=${libcInc}/include" 107 + "-Dloclibpth=${libcLib}/lib" 108 + ] 109 + ++ lib.optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [ "-Dusedevel" "-Uversiononly" ] 110 + ++ lib.optional stdenv.isSunOS "-Dcc=gcc" 111 + ++ lib.optional enableThreading "-Dusethreads" 112 + ++ lib.optional (!enableCrypt) "-A clear:d_crypt_r" 113 + ++ lib.optional stdenv.hostPlatform.isStatic "--all-static" 114 + ++ lib.optionals (!crossCompiling) [ 115 + "-Dprefix=${placeholder "out"}" 116 + "-Dman1dir=${placeholder "out"}/share/man/man1" 117 + "-Dman3dir=${placeholder "out"}/share/man/man3" 118 + ]; 119 + 120 + configureScript = lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure"; 121 + 122 + dontAddStaticConfigureFlags = true; 123 + 124 + dontAddPrefix = !crossCompiling; 125 + 126 + enableParallelBuilding = !crossCompiling; 127 + 128 + # perl includes the build date, the uname of the build system and the 129 + # username of the build user in some files. 130 + # We override these to make it build deterministically. 131 + # other distro solutions 132 + # https://github.com/bmwiedemann/openSUSE/blob/master/packages/p/perl/perl-reproducible.patch 133 + # https://github.com/archlinux/svntogit-packages/blob/packages/perl/trunk/config.over 134 + # https://salsa.debian.org/perl-team/interpreter/perl/blob/debian-5.26/debian/config.over 135 + # A ticket has been opened upstream to possibly clean some of this up: https://rt.perl.org/Public/Bug/Display.html?id=133452 136 + preConfigure = '' 137 + cat > config.over <<EOF 138 + ${lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu) ''osvers="gnulinux"''} 139 + myuname="nixpkgs" 140 + myhostname="nixpkgs" 141 + cf_by="nixpkgs" 142 + cf_time="$(date -d "@$SOURCE_DATE_EPOCH")" 143 + EOF 144 + 145 + # Compress::Raw::Zlib should use our zlib package instead of the one 146 + # included with the distribution 147 + cat > ./cpan/Compress-Raw-Zlib/config.in <<EOF 148 + BUILD_ZLIB = False 149 + INCLUDE = ${zlib.dev}/include 150 + LIB = ${zlib.out}/lib 151 + OLD_ZLIB = False 152 + GZIP_OS_CODE = AUTO_DETECT 153 + EOF 154 + '' + lib.optionalString stdenv.isDarwin '' 155 + substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" "" 156 + '' + lib.optionalString (!enableThreading) '' 157 + # We need to do this because the bootstrap doesn't have a static libpthread 158 + sed -i 's,\(libswanted.*\)pthread,\1,g' Configure 159 + ''; 160 + 161 + # Default perl does not support --host= & co. 162 + configurePlatforms = [ ]; 163 + 164 + setupHook = ./setup-hook.sh; 165 + 166 + # copied from python 167 + passthru = 168 + let 169 + # When we override the interpreter we also need to override the spliced versions of the interpreter 170 + inputs' = lib.filterAttrs (n: v: ! lib.isDerivation v && n != "passthruFun") inputs; 171 + override = attr: let perl = attr.override (inputs' // { self = perl; }); in perl; 172 + in 173 + passthruFun rec { 174 + inherit self perlAttr; 175 + inherit overrides; 176 + perlOnBuildForBuild = override pkgsBuildBuild.${perlAttr}; 177 + perlOnBuildForHost = override pkgsBuildHost.${perlAttr}; 178 + perlOnBuildForTarget = override pkgsBuildTarget.${perlAttr}; 179 + perlOnHostForHost = override pkgsHostHost.${perlAttr}; 180 + perlOnTargetForTarget = if lib.hasAttr perlAttr pkgsTargetTarget then (override pkgsTargetTarget.${perlAttr}) else { }; 181 + }; 182 + 183 + doCheck = false; # some tests fail, expensive 184 + 185 + # TODO: it seems like absolute paths to some coreutils is required. 186 + postInstall = 187 + '' 188 + # Remove dependency between "out" and "man" outputs. 189 + rm "$out"/lib/perl5/*/*/.packlist 190 + 191 + # Remove dependencies on glibc and gcc 192 + sed "/ *libpth =>/c libpth => ' '," \ 193 + -i "$out"/lib/perl5/*/*/Config.pm 194 + # TODO: removing those paths would be cleaner than overwriting with nonsense. 195 + substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \ 196 + --replace "${libcInc}" /no-such-path \ 197 + --replace "${ 198 + if stdenv.hasCC then stdenv.cc.cc else "/no-such-path" 199 + }" /no-such-path \ 200 + --replace "${stdenv.cc}" /no-such-path \ 201 + --replace "$man" /no-such-path 202 + '' + lib.optionalString crossCompiling 203 + '' 204 + mkdir -p $mini/lib/perl5/cross_perl/${version} 205 + for dir in cnf/{stub,cpan}; do 206 + cp -r $dir/* $mini/lib/perl5/cross_perl/${version} 207 + done 208 + 209 + mkdir -p $mini/bin 210 + install -m755 miniperl $mini/bin/perl 211 + 212 + export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})" 213 + # wrapProgram should use a runtime-native SHELL by default, but 214 + # it actually uses a buildtime-native one. If we ever fix that, 215 + # we'll need to fix this to use a buildtime-native one. 216 + # 217 + # Adding the arch-specific directory is morally incorrect, as 218 + # miniperl can't load the native modules there. However, it can 219 + # (and sometimes needs to) load and run some of the pure perl 220 + # code there, so we add it anyway. When needed, stubs can be put 221 + # into $mini/lib/perl5/cross_perl/${version}. 222 + wrapProgram $mini/bin/perl --prefix PERL5LIB : \ 223 + "$mini/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch" 224 + ''; # */ 225 + 226 + meta = with lib; { 227 + homepage = "https://www.perl.org/"; 228 + description = "The standard implementation of the Perl 5 programmming language"; 229 + license = licenses.artistic1; 230 + maintainers = [ maintainers.eelco ]; 231 + platforms = platforms.all; 232 + priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl` 233 + }; 234 + } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec { 235 + crossVersion = "c876045741f5159318085d2737b0090f35a842ca"; # June 5, 2022 236 + 237 + perl-cross-src = fetchFromGitHub { 238 + name = "perl-cross-unstable-${crossVersion}"; 239 + owner = "arsv"; 240 + repo = "perl-cross"; 241 + rev = crossVersion; 242 + sha256 = "sha256-m9UCoTQgXBxSgk9Q1Zv6wl3Qnd0aZm/jEPXkcMKti8U="; 243 + }; 244 + 245 + depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ]; 246 + 247 + postUnpack = '' 248 + unpackFile ${perl-cross-src} 249 + chmod -R u+w ${perl-cross-src.name} 250 + cp -R ${perl-cross-src.name}/* perl-${version}/ 251 + ''; 252 + 253 + configurePlatforms = [ "build" "host" "target" ]; 254 + 255 + # TODO merge setup hooks 256 + setupHook = ./setup-hook-cross.sh; 257 + })
+3 -3
pkgs/development/perl-modules/generic/default.nix
··· 1 - { lib, stdenv, perl, buildPerl, toPerlModule }: 1 + { lib, stdenv, perl, toPerlModule }: 2 2 3 3 { buildInputs ? [] 4 4 , nativeBuildInputs ? [] ··· 43 43 builder = ./builder.sh; 44 44 45 45 buildInputs = buildInputs ++ [ perl ]; 46 - nativeBuildInputs = nativeBuildInputs ++ [ (perl.mini or perl) ]; 46 + nativeBuildInputs = nativeBuildInputs ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [ perl.mini ] else [ perl ]); 47 47 48 48 inherit outputs src doCheck checkTarget enableParallelBuilding; 49 49 env = { 50 50 inherit PERL_AUTOINSTALL AUTOMATED_TESTING PERL_USE_UNSAFE_INC; 51 - fullperl = buildPerl; 51 + fullperl = perl.__spliced.buildHost or perl; 52 52 } // env; 53 53 54 54 meta = defaultMeta // (attrs.meta or { });
+1 -1
pkgs/top-level/all-packages.nix
··· 24451 24451 24452 24452 ### DEVELOPMENT / PERL MODULES 24453 24453 24454 - perlInterpreters = callPackages ../development/interpreters/perl { }; 24454 + perlInterpreters = import ../development/interpreters/perl { inherit callPackage; }; 24455 24455 inherit (perlInterpreters) perl534 perl536 perldevel; 24456 24456 24457 24457 perl534Packages = recurseIntoAttrs perl534.pkgs;
+11 -12
pkgs/top-level/perl-packages.nix
··· 8 8 { config 9 9 , stdenv, lib, buildPackages, pkgs, darwin 10 10 , fetchurl, fetchpatch, fetchFromGitHub, fetchFromGitLab 11 - , perl, overrides, buildPerl, shortenPerlShebang 11 + , perl, shortenPerlShebang 12 12 , nixosTests 13 13 }: 14 14 15 + self: 16 + 15 17 # cpan2nix assumes that perl-packages.nix will be used only with perl 5.30.3 or above 16 18 assert lib.versionAtLeast perl.version "5.30.3"; 17 19 let 18 20 inherit (lib) maintainers teams; 19 - self = _self // (overrides pkgs); 20 - _self = with self; { 21 + 22 + in 23 + with self; { 21 24 22 25 inherit perl; 23 26 perlPackages = self; 24 - 25 - callPackage = pkgs.newScope self; 26 27 27 28 # Check whether a derivation provides a perl module. 28 29 hasPerlModule = drv: drv ? perlModule ; ··· 41 42 }; 42 43 }); 43 44 44 - buildPerlPackage = callPackage ../development/perl-modules/generic { 45 - inherit buildPerl; 46 - }; 45 + buildPerlPackage = callPackage ../development/perl-modules/generic { }; 47 46 48 47 # Helper functions for packages that use Module::Build to build. 49 48 buildPerlModule = args: ··· 23039 23038 23040 23039 # use native libraries from the host when running build commands 23041 23040 postConfigure = lib.optionalString cross (let 23042 - host_perl = buildPerl; 23043 - host_self = buildPerl.pkgs.TermReadKey; 23041 + host_perl = perl.perlOnBuild; 23042 + host_self = perl.perlOnBuild.pkgs.TermReadKey; 23044 23043 perl_lib = "${host_perl}/lib/perl5/${host_perl.version}"; 23045 23044 self_lib = "${host_self}/lib/perl5/site_perl/${host_perl.version}"; 23046 23045 in '' ··· 23049 23048 23050 23049 # TermReadKey uses itself in the build process 23051 23050 nativeBuildInputs = lib.optionals cross [ 23052 - buildPerl.pkgs.TermReadKey 23051 + perl.perlOnBuild.pkgs.TermReadKey 23053 23052 ]; 23054 23053 meta = { 23055 23054 description = "A perl module for simple terminal control"; ··· 27995 27994 version = self.Version; 27996 27995 27997 27996 Gtk2GladeXML = throw "Gtk2GladeXML has been removed"; # 2022-01-15 27998 - }; in self 27997 + }