From 04108965e63d3a6e2f28fa81f7a53cdd396dd3d1 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 18 Jul 2026 09:43:58 +0200 Subject: [PATCH] rPackages.buildRPackage: patch shebangs automatically in configure --- pkgs/development/r-modules/default.nix | 392 +----------------- .../development/r-modules/generic-builder.nix | 6 + 2 files changed, 7 insertions(+), 391 deletions(-) diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 098ab6a0ac9a..d6ed55e92899 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -1919,10 +1919,6 @@ let ''; }); - BigDataStatMeth = old.BigDataStatMeth.overrideAttrs (_: { - preConfigure = "patchShebangs configure"; - }); - BiocParallel = old.BiocParallel.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = @@ -1957,14 +1953,6 @@ let }; }); - Colossus = old.Colossus.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - - Cyclops = old.Cyclops.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - FLAMES = old.FLAMES.overrideAttrs (attrs: { patches = [ ./patches/FLAMES.patch ]; }); @@ -2018,9 +2006,6 @@ let # needed to avoid "log limit exceeded" on Hydra NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -Wno-ignored-attributes"; }; - preConfigure = '' - patchShebangs configure - ''; }); PICS = old.PICS.overrideAttrs (attrs: { @@ -2074,18 +2059,10 @@ let ]; }); - RPesto = old.RPesto.overrideAttrs (_: { - preConfigure = "patchShebangs configure"; - }); - RProtoBuf = old.RProtoBuf.overrideAttrs (attrs: { configureFlags = [ "ac_cv_prog_cxx_cxx11=" ]; }); - RSQLite = old.RSQLite.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - RVowpalWabbit = old.RVowpalWabbit.overrideAttrs (attrs: { configureFlags = [ "--with-boost=${pkgs.boost.dev}" @@ -2106,22 +2083,6 @@ let ''; }); - RcppArmadillo = old.RcppArmadillo.overrideAttrs (attrs: { - patchPhase = "patchShebangs configure"; - }); - - RcppCGAL = old.RcppCGAL.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - - RcppGetconf = old.RcppGetconf.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - RcppParallel = old.RcppParallel.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - Rdisop = old.Rdisop.overrideAttrs (_: { hardeningDisable = [ "format" ]; }); @@ -2184,10 +2145,6 @@ let hardeningDisable = [ "format" ]; }); - SQLFormatteR = old.SQLFormatteR.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - SamplerCompare = old.SamplerCompare.overrideAttrs (attrs: { env = (attrs.env or { }) // { PKG_LIBS = "-L${pkgs.blas}/lib -lblas -L${pkgs.lapack}/lib -llapack"; @@ -2202,10 +2159,6 @@ let ''; }); - SpliceWiz = old.SpliceWiz.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - SynExtend = old.SynExtend.overrideAttrs (attrs: { # build might fail due to race condition enableParallelBuilding = false; @@ -2215,7 +2168,6 @@ let preConfigure = '' export V8_PKG_CFLAGS="$(pkg-config --cflags v8)"; export V8_PKG_LIBS="$(pkg-config --libs v8)"; - patchShebangs configure ''; env = (attrs.env or { }) // { @@ -2304,34 +2256,12 @@ let ''; }); - acs = old.acs.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - alcyon = old.alcyon.overrideAttrs (attrs: { configureFlags = [ "--enable-force-openmp" ]; }); - arcgisgeocode = old.arcgisgeocode.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - - arcgisplaces = old.arcgisplaces.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - arcgisutils = old.arcgisutils.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - - arcpbf = old.arcpbf.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - # it can happen that the major version of arrow-cpp is ahead of the # rPackages.arrow that would be built from CRAN sources; therefore, to avoid # build failures and manual updates of the hash, we use the R source at @@ -2345,62 +2275,15 @@ let src = pkgs.arrow-cpp.src; name = "r-arrow-${pkgs.arrow-cpp.version}"; prePatch = "cd r"; - postPatch = '' - patchShebangs configure - ''; buildInputs = attrs.buildInputs ++ [ pkgs.arrow-cpp ]; }); - astgrepr = old.astgrepr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - awdb = old.awdb.overrideAttrs (attrs: { - postPatch = '' - patchShebangs configure - ''; - }); - - b32 = old.b32.overrideAttrs (_: { - preConfigure = "patchShebangs configure"; - }); - - b64 = old.b64.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - bigPLSR = old.bigPLSR.overrideAttrs (_: { - preConfigure = "patchShebangs configure"; - }); - - cartogramR = old.cartogramR.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - caugi = old.caugi.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - ciflyr = old.ciflyr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - cisPath = old.cisPath.overrideAttrs (attrs: { hardeningDisable = [ "format" ]; }); - clarabel = old.clarabel.overrideAttrs (attrs: { - postPatch = '' - patchShebangs configure - ''; - }); - - clustermq = old.clustermq.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - covidsymptom = old.covidsymptom.overrideAttrs (attrs: { preConfigure = "rm R/covidsymptomdata.R"; }); @@ -2409,27 +2292,14 @@ let enableParallelBuilding = false; }); - curl = old.curl.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - data_table = old.data_table.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -fopenmp"; }; - patchPhase = "patchShebangs configure"; - }); - - datefixR = old.datefixR.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; }); dbarts = old.dbarts.override { platforms = lib.platforms.x86_64 ++ lib.platforms.x86; }; - enderecobr = old.enderecobr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - exifr = old.exifr.overrideAttrs (attrs: { postPatch = '' for f in .onLoad .onAttach ; do @@ -2445,10 +2315,6 @@ let ''; }); - fcl = old.fcl.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - findpython = old.findpython.overrideAttrs (attrs: { postPatch = '' substituteInPlace "R/find_python_cmd.r" \ @@ -2458,28 +2324,13 @@ let ''; }); - fio = old.fio.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - fixest = old.fixest.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - float = old.float.overrideAttrs (attrs: { enableParallelBuilding = false; }); flowClust = old.flowClust.override { platforms = lib.platforms.x86_64 ++ lib.platforms.x86; }; - gadjid = old.gadjid.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - gdtools = old.gdtools.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; env = (attrs.env or { }) // { NIX_LDFLAGS = "-lfontconfig -lfreetype"; }; @@ -2504,10 +2355,6 @@ let }; }); - gmailr = old.gmailr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - gmapR = old.gmapR.overrideAttrs (attrs: { env = (attrs.env or { }) // { # Avoid incompatible pointer type error @@ -2534,10 +2381,6 @@ let ''; }); - h3o = old.h3o.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - harbinger = old.harbinger.overrideAttrs (attrs: { env = (attrs.env or { }) // { LC_ALL = "en_US.UTF-8"; @@ -2549,26 +2392,6 @@ let buildInputs = attrs.buildInputs ++ [ new.Rhdf5lib.hdf5 ]; }); - heck = old.heck.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - httpuv = old.httpuv.overrideAttrs (_: { - preConfigure = '' - patchShebangs configure - ''; - }); - - httr2 = old.httr2.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - - ijtiff = old.ijtiff.overrideAttrs (_: { - preConfigure = '' - patchShebangs configure - ''; - }); - immunotation = let MHC41alleleList = fetchurl { @@ -2607,14 +2430,6 @@ let ''; }); - instantiate = old.instantiate.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - ironseed = old.ironseed.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - iscream = old.iscream.overrideAttrs (attrs: { # https://huishenlab.github.io/iscream/articles/htslib.html # Rhtslib (in LinkingTo) is not needed if we provide a proper htslib @@ -2623,28 +2438,6 @@ let ++ [ pkgs.htslib ]; }); - jqr = old.jqr.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - - keyring = old.keyring.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - - libdeflate = old.libdeflate.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - libgeos = old.libgeos.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - littler = old.littler.overrideAttrs (attrs: { postInstall = '' install -d $out/bin $out/share/man/man1 @@ -2661,19 +2454,11 @@ let substituteInPlace configure \ --replace-fail '--libs SYMPHONY' '--libs symphony' \ --replace-fail '--cflags SYMPHONY' '--cflags symphony' - patchShebangs configure ''; }); luajr = old.luajr.overrideAttrs (attrs: { hardeningDisable = [ "format" ]; - postPatch = "patchShebangs configure"; - }); - - magick = old.magick.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; }); metahdep = old.metahdep.overrideAttrs (attrs: { @@ -2684,9 +2469,6 @@ let }); mongolite = old.mongolite.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; env = (attrs.env or { }) // { PKGCONFIG_CFLAGS = "-I${pkgs.openssl.dev}/include -I${pkgs.cyrus_sasl.dev}/include -I${pkgs.zlib.dev}/include"; PKGCONFIG_LIBS = "-Wl,-rpath,${lib.getLib pkgs.openssl}/lib -L${lib.getLib pkgs.openssl}/lib -L${pkgs.cyrus_sasl.out}/lib -L${pkgs.zlib.out}/lib -lssl -lcrypto -lsasl2 -lz"; @@ -2699,10 +2481,6 @@ let }; }); - nanoparquet = old.nanoparquet.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - nearfar = let angrist = fetchurl { @@ -2727,16 +2505,6 @@ let enableParallelBuilding = false; }); - ocf = old.ocf.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - odbc = old.odbc.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - oligo = old.oligo.overrideAttrs (_: { hardeningDisable = [ "format" ]; }); @@ -2758,23 +2526,9 @@ let }; }); - orbweaver = old.orbweaver.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - otelsdk = old.otelsdk.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - pak = old.pak.overrideAttrs (attrs: { preConfigure = '' - patchShebangs configure - patchShebangs src/library/curl/configure - patchShebangs src/library/keyring/configure - patchShebangs src/library/pkgdepends/configure - patchShebangs src/library/ps/configure - patchShebangs src/library/tsitter/configure - patchShebangs src/library/tstoml/configure + patchShebangs src/library/*/configure ''; }); @@ -2786,34 +2540,6 @@ let ''; }); - pingr = old.pingr.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - - pkgdepends = old.pkgdepends.overrideAttrs (attrs: { - postPatch = '' - patchShebangs configure - ''; - }); - - protolite = old.protolite.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - - prqlr = old.prqlr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - ps = old.ps.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - - purrr = old.purrr.overrideAttrs (attrs: { - patchPhase = "patchShebangs configure"; - }); - quarto = old.quarto.overrideAttrs (attrs: { propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ pkgs.quarto ]; postPatch = '' @@ -2837,10 +2563,6 @@ let ''; }); - ramr = old.ramr.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - rawrr = old.rawrr.overrideAttrs (attrs: { postPatch = '' substituteInPlace "R/zzz.R" "R/dotNetAssembly.R" --replace-warn \ @@ -2858,10 +2580,6 @@ let ''; }); - rbm25 = old.rbm25.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - redatamx = old.redatamx.overrideAttrs ( finalAttrs: previousAttrs: let @@ -2944,10 +2662,6 @@ let patches = [ ./patches/rhdf5filters.patch ]; }); - rlang = old.rlang.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - rmarkdown = old.rmarkdown.overrideAttrs (_: { preConfigure = '' substituteInPlace R/pandoc.R \ @@ -2959,7 +2673,6 @@ let env = (attrs.env or { }) // { LIBCLANG_PATH = "${lib.getLib pkgs.libclang}/lib"; }; - postPatch = "patchShebangs configure"; }); rpanel = old.rpanel.overrideAttrs (attrs: { @@ -2971,34 +2684,12 @@ let }; }); - rpf = old.rpf.overrideAttrs (attrs: { - patchPhase = "patchShebangs configure"; - }); - - rrd = old.rrd.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - - rsgeo = old.rsgeo.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - rshift = old.rshift.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - rstan = old.rstan.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION"; }; }); - rtiktoken = old.rtiktoken.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - rvisidata = old.rvisidata.overrideAttrs (attrs: { postPatch = '' substituteInPlace R/main.r --replace-fail \ @@ -3008,10 +2699,6 @@ let ''; }); - rzmq = old.rzmq.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - s2 = old.s2.overrideAttrs (attrs: { preConfigure = '' substituteInPlace "configure" \ @@ -3025,16 +2712,6 @@ let }; }); - socratadata = old.socratadata.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - sodium = old.sodium.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - sparklyr = old.sparklyr.overrideAttrs (attrs: { # Pyspark's spark is full featured and better maintained than pkgs.spark preConfigure = '' @@ -3052,10 +2729,6 @@ let ''; }); - surtvep = old.surtvep.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - symengine = old.symengine.overrideAttrs (_: { preConfigure = '' rm configure @@ -3066,14 +2739,6 @@ let ''; }); - systemfonts = old.systemfonts.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; - }); - - tergo = old.tergo.overrideAttrs (attrs: { - patchPhase = "patchShebangs configure"; - }); - tesseract = old.tesseract.overrideAttrs (_: { preConfigure = '' substituteInPlace configure \ @@ -3086,7 +2751,6 @@ let }); timeless = old.timeless.overrideAttrs (attrs: { - preConfigure = "patchShebangs configure"; cargoDeps = pkgs.rustPlatform.fetchCargoVendor { src = attrs.src; sourceRoot = "timeless/src/rust"; @@ -3101,20 +2765,6 @@ let ]; }); - tok = old.tok.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - tomledit = old.tomledit.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - torch = old.torch.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - trajeR = old.trajeR.overrideAttrs (attrs: { patches = [ ./patches/trajeR.patch ]; }); @@ -3140,24 +2790,12 @@ let ''; }); - unsum = old.unsum.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - vegan3d = old.vegan3d.overrideAttrs (attrs: { env = (attrs.env or { }) // { RGL_USE_NULL = "true"; }; }); - waysign = old.waysign.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - webfakes = old.webfakes.overrideAttrs (_: { - postPatch = "patchShebangs configure"; - }); - websocket = old.websocket.overrideAttrs (attrs: { env = (attrs.env or { }) // { PKGCONFIG_CFLAGS = "-I${pkgs.openssl.dev}/include"; @@ -3165,39 +2803,11 @@ let }; }); - x13binary = old.x13binary.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - - xactonomial = old.xactonomial.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - xml2 = old.xml2.overrideAttrs (attrs: { - preConfigure = '' - patchShebangs configure - ''; - }); - xslt = old.xslt.overrideAttrs (attrs: { env = (attrs.env or { }) // { NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + " -fpermissive"; }; }); - - yaml12 = old.yaml12.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - ymd = old.ymd.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); - - zoomerjoin = old.zoomerjoin.overrideAttrs (attrs: { - postPatch = "patchShebangs configure"; - }); # keep-sorted end }; in diff --git a/pkgs/development/r-modules/generic-builder.nix b/pkgs/development/r-modules/generic-builder.nix index df463e2f564b..cda092362821 100644 --- a/pkgs/development/r-modules/generic-builder.nix +++ b/pkgs/development/r-modules/generic-builder.nix @@ -38,8 +38,14 @@ stdenv.mkDerivation ( configurePhase = '' runHook preConfigure + export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}" export R_LIBS_SITE="$R_LIBS_SITE''${R_LIBS_SITE:+:}$out/library" + + if [ -f ./configure ] && [ -z "''${dontPatchShebangsInConfigure:-}" ]; then + patchShebangs --build ./configure + fi + runHook postConfigure '';