diff --git a/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch b/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch new file mode 100644 index 000000000000..ff5fe4984dfb --- /dev/null +++ b/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch @@ -0,0 +1,77 @@ +--- a/Pari.xs ++++ b/Pari.xs +@@ -1518,21 +1518,63 @@ + } + + GEN +-callPerlFunction(PerlFunctionArg1 long_ep, ...) +-{ +- GEN res; ++callPerlFunction_args(PerlFunctionArg1 long_ep, GEN *args) ++{ + entree *ep = toEntreeP(long_ep); +- va_list args; + SV *cv = (SV*) ep->elt_CV; + int numargs = CV_NUMARGS_get(cv); +- +- va_start(args, long_ep); +-/* warn("calling with numargs=%d", numargs); */ +- res = callPerlFunction_va_list(G_SCALAR, numargs, cv, args); +-/* warn("ending call"); */ +- va_end(args); +-/* warn("ended call"); */ ++ GEN res; ++ int i; ++ dSP; ++ int count; ++ pari_sp oldavma = avma; ++ SV *oPariStack = PariStack; ++ SV *sv; ++ ++ ENTER; ++ SAVETMPS; ++ SAVEINT(sentinel); ++ sentinel = avma; ++ PUSHMARK(sp); ++ EXTEND(sp, numargs + 1); ++ for (i = 0; i < numargs; i++) ++ PUSHs(pari2mortalsv(args[i], oldavma)); ++ PUTBACK; ++ count = perl_call_sv(cv, G_SCALAR); ++ ++ SPAGAIN; ++ if (count != 1) ++ croak("Perl function exported into PARI returns unexpected number %d of values (need 1)", count); ++ ++ sv = SvREFCNT_inc(POPs); ++ ++ PUTBACK; ++ FREETMPS; ++ LEAVE; ++ ++ if (PariStack != oPariStack) ++ moveoffstack_newer_than(oPariStack); ++ res = sv2pari(sv); ++ res = myforcecopy(res); ++ SvREFCNT_dec(sv); ++ + return res; ++} ++ ++GEN ++callPerlFunction(PerlFunctionArg1 long_ep, GEN arg0, GEN arg1, GEN arg2, GEN arg3, GEN arg4, GEN arg5, GEN arg6, GEN arg7) ++{ ++ GEN args[8]; ++ ++ args[0] = arg0; ++ args[1] = arg1; ++ args[2] = arg2; ++ args[3] = arg3; ++ args[4] = arg4; ++ args[5] = arg5; ++ args[6] = arg6; ++ args[7] = arg7; ++ return callPerlFunction_args(long_ep, args); + } + + entree * diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 0cf13f437f77..e8fae734e416 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -2416,8 +2416,8 @@ with self; }; preConfigure = '' - echo "LIB = ${pkgs.db.out}/lib" > config.in - echo "INCLUDE = ${pkgs.db.dev}/include" >> config.in + echo "LIB = ${pkgs.db4.out}/lib" > config.in + echo "INCLUDE = ${pkgs.db4.dev}/include" >> config.in ''; meta = { description = "Perl extension for Berkeley DB version 2, 3, 4, 5 or 6"; @@ -2656,6 +2656,34 @@ with self; # Fix out of memory error on Perl 5.19.4 and later. ../development/perl-modules/boost-geometry-utils-fix-oom.patch ]; + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + # Clang on Darwin defaults to a newer C++ mode where the old bundled Boost + # headers no longer compile. + substituteInPlace Build.PL \ + --replace-fail "extra_compiler_flags => [qw(-DHAS_BOOL)]" \ + "extra_compiler_flags => [qw(-DHAS_BOOL -std=c++14)]" + + # Avoid Boost.MPL enum wrappers that modern Clang rejects as out-of-range + # enum constant expressions. + substituteInPlace src/boost/numeric/conversion/detail/int_float_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" + perl -i -pe 'if ($. == 22) { $_ .= " template struct int_float_mixture_constant { static const int_float_mixture_enum value = v; typedef int_float_mixture_constant type; typedef int_float_mixture_enum value_type; operator int_float_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/int_float_mixture.hpp + + # Same workaround for the user-defined-type/builtin-type conversion enum. + substituteInPlace src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" + perl -i -pe 'if ($. == 21) { $_ .= " template struct udt_builtin_mixture_constant { static const udt_builtin_mixture_enum value = v; typedef udt_builtin_mixture_constant type; typedef udt_builtin_mixture_enum value_type; operator udt_builtin_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp + ''; buildInputs = [ ExtUtilsCppGuess ExtUtilsTypemapsDefault @@ -7582,6 +7610,9 @@ with self; ]; env.NIX_CFLAGS_COMPILE = "-I${pkgs.openssl.dev}/include"; env.NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.openssl}/lib -lcrypto"; + # Needed on Darwin so Crypt::OpenSSL::Guess does not pick /usr/bin/openssl and mix + # system libcrypto with the Nix one (perl aborts: "loading libcrypto in an unsafe way"). + env.OPENSSL_PREFIX = pkgs.openssl; meta = { description = "Perl wrapper around OpenSSL's AES library"; license = with lib.licenses; [ @@ -18618,6 +18649,8 @@ with self; hash = "sha256-BGSH8ITBL6HIIq/8X33lbv7ZtIkFpCbmMaa5ScEU2Gw="; }; outputs = [ "out" ]; + # Keep generated XS code stable across rebuilds. + env.PERL_HASH_SEED = "0"; buildInputs = [ pkgs.apacheHttpd pkgs.apr @@ -18626,6 +18659,8 @@ with self; ExtUtilsXSBuilder ]; propagatedBuildInputs = [ (pkgs.apacheHttpdPackages.mod_perl.override { inherit perl; }) ]; + # Avoid libtool misdetecting gcc as the linker. + configureFlags = [ "LD=ld" ]; makeMakerFlags = [ "--with-apache2-src=${pkgs.apacheHttpd.dev}" "--with-apache2-apxs=${pkgs.apacheHttpd.dev}/bin/apxs" @@ -18635,10 +18670,10 @@ with self; ]; preConfigure = '' # override broken prereq check - substituteInPlace configure --replace "prereq_check=\"\$PERL \$PERL_OPTS build/version_check.pl\"" "prereq_check=\"echo\"" + substituteInPlace configure --replace-fail "prereq_check=\"\$PERL \$PERL_OPTS build/version_check.pl\"" "prereq_check=\"echo\"" ''; preBuild = '' - substituteInPlace apreq2-config --replace "dirname" "${pkgs.coreutils}/bin/dirname" + substituteInPlace apreq2-config --replace-fail "dirname" "${pkgs.coreutils}/bin/dirname" ''; installPhase = '' mkdir $out @@ -18667,6 +18702,8 @@ with self; rm -r $out/nix ''; doCheck = false; # test would need to start apache httpd + # Apache::Test resolves localhost while generating glue/perl (Makefile.PL / t/TEST). + __darwinAllowLocalNetworking = true; meta = { description = "Wrapper for libapreq2's module/handle API"; license = with lib.licenses; [ asl20 ]; @@ -20926,13 +20963,16 @@ with self; # Workaround build failure on -fno-common toolchains: # ld: libPARI/libPARI.a(compat.o):(.bss+0x8): multiple definition of # `overflow'; Pari.o:(.bss+0x80): first defined here - env.NIX_CFLAGS_COMPILE = "-fcommon -Wno-error=implicit-int -Wno-error=implicit-function-declaration"; + env.NIX_CFLAGS_COMPILE = "-std=gnu17 -fcommon -Wno-error=implicit-int -Wno-error=implicit-function-declaration"; preConfigure = "cp ${pari_tgz} pari-${pariversion}.tar.gz"; makeMakerFlags = [ "pari_tgz=pari-${pariversion}.tar.gz" ]; src = fetchurl { url = "mirror://cpan/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.030528.tar.gz"; hash = "sha256-Z/dNIWxpY1qxxuo+J84ZdQqUorVgrnKIuy1s9xT85sg="; }; + patches = lib.optionals stdenv.hostPlatform.isDarwin [ + ../development/perl-modules/Math-Pari-darwin-callback-abi.patch + ]; meta = { description = "Perl interface to PARI"; license = with lib.licenses; [ @@ -25928,6 +25968,11 @@ with self; url = "mirror://cpan/authors/id/R/RU/RURBAN/Net-Ping-2.75.tar.gz"; hash = "sha256-tH3zz9lpLM0Aca05/nRxjrwy9ZcBVWpgT9FaCfCeDXQ="; }; + preCheck = '' + # On Linux these are skipped early ("no echo port"); on Darwin they proceed and + # hit external DNS (www.about.com), which fails in the sandbox. + rm -f t/400_ping_syn.t t/410_syn_host.t + ''; meta = { description = "Check a remote host for reachability"; license = with lib.licenses; [ @@ -30863,6 +30908,7 @@ with self; artistic1 gpl1Plus ]; + platforms = lib.platforms.linux; # configure probes PF_NETLINK; unavailable on Darwin }; };