mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-08 02:38:11 +09:00
doc: add missing phase hooks
This commit is contained in:
parent
540ddbcf2f
commit
47f000d991
9 changed files with 110 additions and 7 deletions
|
@ -49,6 +49,8 @@ stdenvNoCC.mkDerivation (
|
|||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
substituteInPlace ./languages-frameworks/python.section.md \
|
||||
--subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"
|
||||
|
||||
|
@ -84,9 +86,13 @@ stdenvNoCC.mkDerivation (
|
|||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
out/index.html
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
dest="$out/share/doc/nixpkgs"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mv out "$dest"
|
||||
|
@ -97,6 +103,8 @@ stdenvNoCC.mkDerivation (
|
|||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
|
||||
echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
|
|
@ -27,8 +27,8 @@ let
|
|||
} ":";
|
||||
};
|
||||
|
||||
# the INI file can now be given as plain old nix values
|
||||
in
|
||||
# the INI file can now be given as plain old nix values
|
||||
customToINI {
|
||||
main = {
|
||||
pushinfo = true;
|
||||
|
|
|
@ -208,8 +208,12 @@ mkDerivation {
|
|||
libraryName = "IAL-1.3";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
patchShebangs find-deps.sh
|
||||
make
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -110,8 +110,12 @@ pkgs.stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cp --reflink=auto --no-preserve=mode -R $bowerComponents/bower_components . # note 2
|
||||
${pkgs.nodePackages.gulp}/bin/gulp build # note 4
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = "mv gulpdist $out";
|
||||
|
|
|
@ -47,6 +47,7 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
|
|||
env = (old.env or { }) // {
|
||||
NIX_CFLAGS_COMPILE = "";
|
||||
};
|
||||
|
||||
configurePhase = ''
|
||||
# FIXME: Some tests require writing at $HOME
|
||||
HOME=$TMPDIR
|
||||
|
@ -57,15 +58,29 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
|
|||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
outputs = [ "out" ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
emmake make
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
emmake make install
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
echo "================= testing zlib using node ================="
|
||||
|
||||
echo "Compiling a custom test"
|
||||
|
@ -84,6 +99,8 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
|
|||
echo "it seems to work! very good."
|
||||
fi
|
||||
echo "================= /testing zlib using node ================="
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
postPatch = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
|
||||
|
@ -116,6 +133,7 @@ pkgs.buildEmscriptenPackage rec {
|
|||
openjdk
|
||||
json_c
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
writableTmpDirAsHomeHook
|
||||
|
@ -129,6 +147,8 @@ pkgs.buildEmscriptenPackage rec {
|
|||
};
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
rm -f fastXmlLint.js*
|
||||
# a fix for ERROR:root:For asm.js, TOTAL_MEMORY must be a multiple of 16MB, was 234217728
|
||||
# https://gitlab.com/odfplugfest/xmlmirror/issues/8
|
||||
|
@ -138,10 +158,16 @@ pkgs.buildEmscriptenPackage rec {
|
|||
sed -e "s/\$(JSONC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(LIBXML20_LDFLAGS)/\$(JSONC_LDFLAGS) \$(LIBXML20_LDFLAGS) \$(ZLIB_LDFLAGS) /g" -i Makefile.emEnv
|
||||
# https://gitlab.com/odfplugfest/xmlmirror/issues/11
|
||||
sed -e "s/-o fastXmlLint.js/-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -o fastXmlLint.js/g" -i Makefile.emEnv
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
make -f Makefile.emEnv
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
outputs = [
|
||||
|
@ -150,6 +176,8 @@ pkgs.buildEmscriptenPackage rec {
|
|||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share
|
||||
mkdir -p $doc/share/${name}
|
||||
|
||||
|
@ -163,9 +191,13 @@ pkgs.buildEmscriptenPackage rec {
|
|||
cp *.json $out/share
|
||||
cp *.rng $out/share
|
||||
cp README.md $doc/share/${name}
|
||||
runHook postInstall
|
||||
'';
|
||||
checkPhase = ''
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -651,7 +651,11 @@ It's important to use the `--offline` flag. For example if you script is `"build
|
|||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
yarn --offline build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -33,11 +33,15 @@ maven.buildMavenPackage rec {
|
|||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin $out/share/jd-cli
|
||||
install -Dm644 jd-cli/target/jd-cli.jar $out/share/jd-cli
|
||||
|
||||
makeWrapper ${jre}/bin/java $out/bin/jd-cli \
|
||||
--add-flags "-jar $out/share/jd-cli/jd-cli.jar"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
@ -301,16 +305,24 @@ stdenv.mkDerivation {
|
|||
buildInputs = [ maven ];
|
||||
src = ./.; # or fetchFromGitHub, cleanSourceWith, etc
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mvn package -Dmaven.repo.local=$out
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
find $out -type f \
|
||||
-name \*.lastUpdated -or \
|
||||
-name resolver-status.properties -or \
|
||||
-name _remote.repositories \
|
||||
-delete
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# don't do any fixup
|
||||
|
@ -354,8 +366,8 @@ Regardless of which strategy is chosen above, the step to build the derivation i
|
|||
maven,
|
||||
callPackage,
|
||||
}:
|
||||
# pick a repository derivation, here we will use buildMaven
|
||||
let
|
||||
# pick a repository derivation, here we will use buildMaven
|
||||
repository = callPackage ./build-maven-repository.nix { };
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -366,12 +378,20 @@ stdenv.mkDerivation rec {
|
|||
buildInputs = [ maven ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
echo "Using repository ${repository}"
|
||||
mvn --offline -Dmaven.repo.local=${repository} package;
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm644 target/${pname}-${version}.jar $out/share/java
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 target/${finalAttrs.pname}-${finalAttrs.version}.jar $out/share/java
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
@ -430,11 +450,17 @@ stdenv.mkDerivation rec {
|
|||
buildInputs = [ maven ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
echo "Using repository ${repository}"
|
||||
mvn --offline -Dmaven.repo.local=${repository} package;
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
classpath=$(find ${repository} -name "*.jar" -printf ':%h/%f');
|
||||
|
@ -444,6 +470,8 @@ stdenv.mkDerivation rec {
|
|||
makeWrapper ${jre}/bin/java $out/bin/${pname} \
|
||||
--add-flags "-classpath $out/share/java/${pname}-${version}.jar:''${classpath#:}" \
|
||||
--add-flags "Main"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
@ -502,8 +530,8 @@ We will modify the derivation above to add a symlink to our repository so that i
|
|||
makeWrapper,
|
||||
jre,
|
||||
}:
|
||||
# pick a repository derivation, here we will use buildMaven
|
||||
let
|
||||
# pick a repository derivation, here we will use buildMaven
|
||||
repository = callPackage ./build-maven-repository.nix { };
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -515,11 +543,17 @@ stdenv.mkDerivation rec {
|
|||
buildInputs = [ maven ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
echo "Using repository ${repository}"
|
||||
mvn --offline -Dmaven.repo.local=${repository} package;
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
# create a symbolic link for the repository directory
|
||||
|
@ -530,6 +564,8 @@ stdenv.mkDerivation rec {
|
|||
# this should be the paths from the dependency derivation
|
||||
makeWrapper ${jre}/bin/java $out/bin/${pname} \
|
||||
--add-flags "-jar $out/share/java/${pname}-${version}.jar"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -106,12 +106,16 @@ stdenv.mkDerivation rec {
|
|||
configurePhase = generated.configure;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# This is a special function that invokes swiftpm to find the location
|
||||
# of the binaries it produced.
|
||||
binPath="$(swiftpmBinPath)"
|
||||
# Now perform any installation steps.
|
||||
mkdir -p $out/bin
|
||||
cp $binPath/myproject $out/bin/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -53,13 +53,23 @@ Often it is necessary to override or modify some aspect of the build. To make th
|
|||
stdenv.mkDerivation {
|
||||
pname = "fnord";
|
||||
version = "4.5";
|
||||
|
||||
# ...
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
gcc foo.c -o foo
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp foo $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
@ -225,6 +235,7 @@ stdenv.mkDerivation rec {
|
|||
makeWrapper
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [ libseccomp ];
|
||||
|
||||
postInstall = ''
|
||||
|
@ -249,8 +260,8 @@ stdenv.mkDerivation rec {
|
|||
util-linux
|
||||
qemu
|
||||
];
|
||||
checkPhase = ''[elided] '';
|
||||
}
|
||||
checkPhase = ''[elided]'';
|
||||
})
|
||||
```
|
||||
|
||||
- `makeWrapper` is a setup hook, i.e., a shell script sourced by the generic builder of `stdenv`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue