premake: add setup-hook

Adds a configure phase for packages using premake.
premakeConfigurePhase runs the correct premake version for the premake
you are using (see premake_cmd).
This commit is contained in:
Matthew Bauer 2018-11-26 18:00:08 -06:00
parent 2d2f85876a
commit fd78464de9
4 changed files with 30 additions and 2 deletions

View file

@ -18,6 +18,9 @@ stdenv.mkDerivation {
install -Dm755 bin/premake $out/bin/premake
'';
premake_cmd = "premake3";
setupHook = ./setup-hook.sh;
meta = {
homepage = http://industriousone.com/premake;
description = "A simple build configuration and project generation tool using lua";

View file

@ -31,6 +31,9 @@ stdenv.mkDerivation rec {
install -Dm755 bin/release/premake5 $out/bin/premake5
'';
premake_cmd = "premake5";
setupHook = ./setup-hook.sh;
meta = {
homepage = https://premake.github.io;
description = "A simple build configuration and project generation tool using lua";

View file

@ -12,7 +12,7 @@ stdenv.mkDerivation {
sha256 = "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn";
};
buildInputs = [ unzip ];
nativeBuildInputs = [ unzip ];
buildPhase = ''
make -C build/gmake.unix/
@ -22,11 +22,14 @@ stdenv.mkDerivation {
install -Dm755 bin/release/premake4 $out/bin/premake4
'';
premake_cmd = "premake4";
setupHook = ./setup-hook.sh;
meta = with stdenv.lib; {
homepage = http://industriousone.com/premake;
description = "A simple build configuration and project generation tool using lua";
license = stdenv.lib.licenses.bsd3;
platforms = platforms.linux;
platforms = platforms.unix;
maintainers = [ maintainers.bjornfor ];
};
}

View file

@ -0,0 +1,19 @@
premakeConfigurePhase() {
runHook preConfigure
local flagsArray=(
${premakefile:+--file=$premakefile}
$premakeFlags ${premakeFlagsArray[@]}
${premakeBackend:-gmake}
)
echoCmd 'configure flags' "${flagsArray[@]}"
@premake_cmd@ "${flagsArray[@]}"
runHook postConfigure
}
if [ -z "$configurePhase" ]; then
configurePhase=premakeConfigurePhase
fi