treewide: add preConfigure and postConfigure for

configurePhase
This commit is contained in:
mivorasu 2025-07-27 12:21:19 +00:00
parent e8021f7cb4
commit 3c0ff7e40f
45 changed files with 180 additions and 0 deletions

View File

@ -27,6 +27,8 @@ stdenv.mkDerivation (finalAttrs: {
# FIXME: This package does not support `distmp3', `eject', etc.
configurePhase = ''
runHook preConfigure
sed -i "s|^[[:blank:]]*prefix *=.*$|prefix = $out|g ;
s|^[[:blank:]]*etcdir *=.*$|etcdir = $out/etc|g ;
s|^[[:blank:]]*INSTALL *=.*$|INSTALL = install -c|g" \
@ -37,6 +39,8 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace "abcde" \
--replace "/etc/abcde.conf" "$out/etc/abcde.conf"
runHook postConfigure
'';
nativeBuildInputs = [ makeWrapper ];

View File

@ -46,12 +46,16 @@ stdenv.mkDerivation rec {
};
configurePhase = ''
runHook preConfigure
# Set up picosat, so we can build 'aigbmc'
mkdir ../picosat
ln -s ${picosat}/include/picosat/picosat.h ../picosat/picosat.h
ln -s ${picosat}/lib/picosat.o ../picosat/picosat.o
ln -s ${picosat}/share/picosat.version ../picosat/VERSION
./configure.sh
runHook postConfigure
'';
postBuild = ''

View File

@ -12,7 +12,11 @@ stdenv.mkDerivation rec {
};
configurePhase = ''
runHook preConfigure
echo "PREFIX = $out" > defines.make
runHook postConfigure
'';
meta = {

View File

@ -25,7 +25,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
sh fix.sh unix
runHook postConfigure
'';
hardeningDisable = [ "format" ];

View File

@ -87,6 +87,8 @@ stdenv.mkDerivation {
'';
configurePhase = ''
runHook preConfigure
cd libs
./autogen.sh --prefix=$out
@ -127,6 +129,8 @@ stdenv.mkDerivation {
sed -e "s,cnijlgmon2_LDADD =,cnijlgmon2_LDADD = -L../../com/libs_bin${arch}," \
-i lgmon2/src/Makefile.am || die
runHook postConfigure
'';
preInstall = ''

View File

@ -38,6 +38,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ installShellFiles ];
configurePhase = ''
runHook preConfigure
cd daemontools-${version}
sed -i -e '1 s_$_ -include ${glibc.dev}/include/errno.h_' src/conf-cc
@ -48,6 +50,8 @@ stdenv.mkDerivation rec {
sed -i -e "s_^PATH=.*_PATH=$src/daemontools-${version}/compile:''${PATH}_" src/rts.tests
cat ${glibc.dev}/include/errno.h
runHook postConfigure
'';
buildPhase = ''

View File

@ -20,8 +20,12 @@ stdenv.mkDerivation {
buildInputs = [ mpi ];
configurePhase = ''
runHook preConfigure
cd source
cp -v ../build/MakePAR Makefile
runHook postConfigure
'';
# https://gitlab.com/DL_POLY_Classic/dl_poly/-/blob/master/README

View File

@ -122,8 +122,12 @@ rustPlatform.buildRustPackage (finalAttrs: {
'';
configurePhase = ''
runHook preConfigure
cmakeConfigurePhase
pnpmConfigHook
runHook postConfigure
'';
buildPhase = ''

View File

@ -16,8 +16,12 @@ stdenv.mkDerivation {
};
configurePhase = ''
runHook preConfigure
./autogen.sh
./configure --prefix=$out
runHook postConfigure
'';
patches = [

View File

@ -48,6 +48,8 @@ stdenv.mkDerivation {
modelines = "";
configurePhase = ''
runHook preConfigure
test "$clean" != 1 || rm *x*.S
./modeline2edid - <"$modelinesPath"
@ -56,6 +58,8 @@ stdenv.mkDerivation {
cat "$file"
done
make clean
runHook postConfigure
'';
buildPhase = ''

View File

@ -31,7 +31,11 @@ stdenv.mkDerivation rec {
cmakeFlags = lib.optionals osi.withCplex [ "-DDOWNWARD_CPLEX_ROOT=${cplex}/cplex" ];
configurePhase = ''
runHook preConfigure
python build.py release
runHook postConfigure
'';
postPatch = ''

View File

@ -36,7 +36,11 @@ stdenv.mkDerivation rec {
# Remove when updating to next version
configurePhase = ''
runHook preConfigure
./configure --prefix=$out --with-lisp='sbcl --dynamic-space-size 3072'
runHook postConfigure
'';
dontStrip = true;

View File

@ -30,10 +30,14 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
substituteInPlace Makefile --replace-fail "/usr/local" "$out"
substituteInPlace GNUmakefile --replace-fail "/opt/diet" "$out"
substituteInPlace tryalloca.c --replace-fail "main() {" "int main() {"
substituteInPlace trysocket.c --replace-fail "main() {" "int main() {"
runHook postConfigure
'';
buildPhase = ''

View File

@ -68,11 +68,15 @@ stdenv.mkDerivation rec {
env.GAG_CPP = lib.optionalString stdenv.hostPlatform.isDarwin "${gfortran.outPath}/bin/cpp";
configurePhase = ''
runHook preConfigure
substituteInPlace admin/wrapper.sh --replace '%%OUT%%' $out
substituteInPlace admin/wrapper.sh --replace '%%PYTHONHOME%%' ${python3Env}
substituteInPlace utilities/main/gag-makedepend.pl --replace '/usr/bin/perl' ${perl}/bin/perl
source admin/gildas-env.sh -c gfortran -o openmp
echo "gag_doc: $out/share/doc/" >> kernel/etc/gag.dico.lcl
runHook postConfigure
'';
userExec = "astro class greg mapping sic";

View File

@ -32,9 +32,13 @@ stdenv.mkDerivation rec {
installFlags = [ "INSTALL_DIR=$(out)/lib/lv2" ];
configurePhase = ''
runHook preConfigure
for i in GxBoobTube GxValveCaster; do
substituteInPlace $i.lv2/Makefile --replace "\$(shell which echo) -e" "echo -e"
done
runHook postConfigure
'';
meta = with lib; {

View File

@ -73,10 +73,14 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
configurePhase = ''
runHook preConfigure
# let stdenv handle stripping
export "CARGO_PROFILE_''${cargoBuildType@U}_STRIP"=false
prependToVar cargoCFlags -j "$NIX_BUILD_CORES"
runHook postConfigure
'';
buildPhase = ''

View File

@ -21,10 +21,14 @@ stdenv.mkDerivation {
propagatedBuildInputs = [ openssl ];
configurePhase = ''
runHook preConfigure
autoreconf -i
mkdir -pv build
cd build
../configure
runHook postConfigure
'';
installPhase = ''

View File

@ -39,7 +39,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
bash ./configure
runHook postConfigure
'';
installPhase = ''

View File

@ -59,7 +59,11 @@ stdenv.mkDerivation rec {
setOutputFlags = false;
configurePhase = ''
runHook preConfigure
./configure
runHook postConfigure
'';
buildPhase = ''

View File

@ -29,10 +29,14 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper ];
configurePhase = ''
runHook preConfigure
./configure \
--prefix="$out" \
--without-mktexlsr \
--with-texpath=$out/share/texmf/tex/latex/html
runHook postConfigure
'';
postInstall = ''

View File

@ -18,6 +18,8 @@ stdenv.mkDerivation {
};
configurePhase = ''
runHook preConfigure
./configure.sh
# Rather than patch ./configure, just sneak in use of aiger here, since it
@ -28,6 +30,8 @@ stdenv.mkDerivation {
--replace-fail '$(AIGER)/aiger.o' '${aiger.lib}/lib/libaiger.a' \
--replace-fail '$(AIGER)/aiger.h' '${aiger.dev}/include/aiger.h' \
--replace-fail '-I$(AIGER)' '-I${aiger.dev}/include'
runHook postConfigure
'';
installPhase = ''

View File

@ -37,9 +37,13 @@ stdenv.mkDerivation rec {
'';
configurePhase = ''
runHook preConfigure
mkdir Build
cd Build;
cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON -DCMAKE_INSTALL_PREFIX=$out ..
runHook postConfigure
'';
meta = with lib; {

View File

@ -23,6 +23,8 @@ stdenv.mkDerivation rec {
makeFlags = [ "PREFIX=${placeholder "out"}" ];
configurePhase = ''
runHook preConfigure
${lib.getExe' buildPackages.stdenv.cc "cc"} setup/tool.c -o setup_t
./setup_t -t lx64 > setup.sh
@ -31,6 +33,8 @@ stdenv.mkDerivation rec {
substituteInPlace setup.sh --replace 'strip --strip-unneeded' '${stdenv.cc.targetPrefix}strip --strip-unneeded'
sh < ./setup.sh
runHook postConfigure
'';
installPhase = ''

View File

@ -49,7 +49,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
make PREFIX=$out USE_WIDE=1 RELEASE=1 build/Makefile
runHook postConfigure
'';
meta = with lib; {

View File

@ -27,8 +27,12 @@ stdenv.mkDerivation {
];
configurePhase = ''
runHook preConfigure
export RST2MAN=rst2man
./configure
runHook postConfigure
'';
installPhase = ''

View File

@ -53,9 +53,13 @@ stdenv.mkDerivation rec {
# ./configure is not autoGNU but some home-brewn magic
configurePhase = ''
runHook preConfigure
patchShebangs configure
substituteInPlace configure --replace "which" "command -v"
NACL_INC_DIR=${libsodium.dev}/include/sodium NACL_LIB=sodium ./configure
runHook postConfigure
'';
enableParallelBuilding = true;

View File

@ -23,9 +23,13 @@ stdenv.mkDerivation {
buildInputs = [ mpi ];
configurePhase = ''
runHook preConfigure
tar xf ${metis.src}
mv metis-* metis
make config metis_path=metis gklib_path=metis/GKlib prefix=$out
runHook postConfigure
'';
meta = with lib; {

View File

@ -20,11 +20,15 @@ stdenv.mkDerivation rec {
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
configurePhase = ''
runHook preConfigure
sed -i -r Makefile \
-e 's,/usr/,/,g' \
-e "s,^DESTDIR =.*$,DESTDIR = $out," \
-e "s,^INSTALL = install.*$,INSTALL = install," \
-e "s,^all:.*$,all: \$(PROGS),"
runHook postConfigure
'';
checkPhase = "make test";

View File

@ -28,7 +28,11 @@ stdenv.mkDerivation rec {
]; # gcc and/or clang compat
configurePhase = ''
runHook preConfigure
sed -i s,/usr,$out, Makefile
runHook postConfigure
'';
buildInputs = [ libpng ];

View File

@ -23,7 +23,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
sed -i s,/usr/local,$out, Makefile
runHook postConfigure
'';
buildInputs = [ libpng ];

View File

@ -52,8 +52,12 @@ stdenv.mkDerivation {
]);
configurePhase = ''
runHook preConfigure
cmake RetroFE/Source -BRetroFE/Build -DCMAKE_BUILD_TYPE=Release \
-DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0 \
runHook postConfigure
'';
buildPhase = ''

View File

@ -40,6 +40,8 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
substituteInPlace configure.ac --replace "@@NIX_GNUEFI@@" "${gnu-efi}"
lib/ccan.git/tools/create-ccan-tree --build-type=automake lib/ccan "talloc read_write_all build_assert array_size endian"
@ -54,6 +56,8 @@ stdenv.mkDerivation rec {
automake --add-missing -Wno-portability
./configure --prefix=$out
runHook postConfigure
'';
meta = with lib; {

View File

@ -23,9 +23,13 @@ stdenv.mkDerivation rec {
gtk2
];
configurePhase = ''
runHook preConfigure
sed -i 's/.*home.*/#&/' ./Makefile
substituteInPlace ./Makefile \
--replace "/usr/share" "$out/usr/share"
runHook postConfigure
'';
installPhase = ''
install -Dm755 spectrojack $out/bin/spectrojack

View File

@ -19,8 +19,12 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
cd src
cp Makefile.${if stdenv.hostPlatform.isLinux then "Linux" else "MacOS"} Makefile
runHook postConfigure
'';
makeFlags = [ "CC_EXEC=cc" ];

View File

@ -22,7 +22,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
sed -i s,data/,$out/share/teetertorture/, src/teetertorture.c
runHook postConfigure
'';
patchPhase = ''

View File

@ -33,7 +33,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
./configure --prefix $out
runHook postConfigure
'';
meta = with lib; {

View File

@ -113,11 +113,15 @@ stdenv.mkDerivation rec {
# uqm has a 'unique' build system with a root script incidentally called
# 'build.sh'.
configurePhase = ''
runHook preConfigure
echo "INPUT_install_prefix_VALUE='$out'" >> config.state
echo "INPUT_install_bindir_VALUE='$out/bin'" >> config.state
echo "INPUT_install_libdir_VALUE='$out/lib'" >> config.state
echo "INPUT_install_sharedir_VALUE='$out/share'" >> config.state
PREFIX=$out ./build.sh uqm config
runHook postConfigure
'';
buildPhase = ''

View File

@ -58,7 +58,11 @@ let
};
# PREFIX is important
configurePhase = ''
runHook preConfigure
perl Makefile.PL PREFIX=$out INSTALLDIRS=site
runHook postConfigure
'';
# Test do not work -- wrong include path
doCheck = false;

View File

@ -27,8 +27,12 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
mkdir -p $out/bin
sed -e "s@/usr/local@$out@" -i Makefile
runHook postConfigure
'';
makeFlags = [

View File

@ -45,7 +45,11 @@ stdenv.mkDerivation rec {
'';
configurePhase = ''
runHook preConfigure
cp config/make.inc.gfort make.inc
runHook postConfigure
'';
buildFlags = [

View File

@ -23,6 +23,8 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
makeFlagsArray=( CFLAGS="-I. -O3"
STRIP="-s"
INSTALL="install"
@ -30,6 +32,8 @@ stdenv.mkDerivation rec {
MANDIR="$out/share/man"
)
patchShebangs .
runHook postConfigure
'';
meta = with lib; {

View File

@ -20,7 +20,11 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
sed -e 's@/usr/bin/@@' -i Makefile
runHook postConfigure
'';
makeFlags = [ "PREFIX=$(out)" ];

View File

@ -51,8 +51,12 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
./bootstrap --gnulib-srcdir=${gnulib}
./configure --prefix="$out"
runHook postConfigure
'';
buildInputs = [

View File

@ -109,6 +109,8 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
runHook preConfigure
# Delete shipped libraries which we don't need.
rm -rf libraries/source/{cxxtest-4.4,nvtt,premake-core,spidermonkey,spirv-reflect}
@ -138,6 +140,8 @@ stdenv.mkDerivation rec {
# Move to the build directory.
pushd build/workspaces/gcc
runHook postConfigure
'';
enableParallelBuilding = true;

View File

@ -24,8 +24,12 @@ mkYarnPackage rec {
};
configurePhase = ''
runHook preConfigure
cp -r $node_modules node_modules
chmod +w node_modules
runHook postConfigure
'';
buildPhase = ''