buildRebar3: fix buildPhase & cleanup (#22744)
This commit is contained in:
parent
8a6fa4a320
commit
979d20794d
|
@ -26,6 +26,10 @@ let
|
||||||
buildInputs = [ drv ];
|
buildInputs = [ drv ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
customPhases = filterAttrs
|
||||||
|
(_: v: v != null)
|
||||||
|
{ inherit setupHook configurePhase buildPhase installPhase; };
|
||||||
|
|
||||||
pkg = self: stdenv.mkDerivation (attrs // {
|
pkg = self: stdenv.mkDerivation (attrs // {
|
||||||
|
|
||||||
name = "${name}-${version}";
|
name = "${name}-${version}";
|
||||||
|
@ -41,37 +45,30 @@ let
|
||||||
|
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
setupHook = if setupHook == null
|
setupHook = writeText "setupHook.sh" ''
|
||||||
then writeText "setupHook.sh" ''
|
|
||||||
addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
|
addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
|
||||||
''
|
'';
|
||||||
else setupHook;
|
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
rm -f rebar rebar3
|
rm -f rebar rebar3
|
||||||
'' + postPatch;
|
'' + postPatch;
|
||||||
|
|
||||||
configurePhase = if configurePhase == null
|
configurePhase = ''
|
||||||
then ''
|
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
${erlang}/bin/escript ${rebar3.bootstrapper} ${debugInfoFlag}
|
${erlang}/bin/escript ${rebar3.bootstrapper} ${debugInfoFlag}
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
''
|
'';
|
||||||
else configurePhase;
|
|
||||||
|
|
||||||
buildPhase = if buildPhase == null
|
buildPhase = ''
|
||||||
then ''
|
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
HOME=. rebar3 compile
|
HOME=. rebar3 compile
|
||||||
${if compilePorts then ''
|
${if compilePorts then ''
|
||||||
HOME=. rebar3 pc compile
|
HOME=. rebar3 pc compile
|
||||||
'' else ''''}
|
'' else ''''}
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
''
|
'';
|
||||||
else installPhase;
|
|
||||||
|
|
||||||
installPhase = if installPhase == null
|
installPhase = ''
|
||||||
then ''
|
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p "$out/lib/erlang/lib/${name}-${version}"
|
mkdir -p "$out/lib/erlang/lib/${name}-${version}"
|
||||||
for reldir in src ebin priv include; do
|
for reldir in src ebin priv include; do
|
||||||
|
@ -81,8 +78,7 @@ let
|
||||||
success=1
|
success=1
|
||||||
done
|
done
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
''
|
'';
|
||||||
else installPhase;
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
inherit (erlang.meta) platforms;
|
inherit (erlang.meta) platforms;
|
||||||
|
@ -93,6 +89,6 @@ let
|
||||||
env = shell self;
|
env = shell self;
|
||||||
inherit beamDeps;
|
inherit beamDeps;
|
||||||
};
|
};
|
||||||
});
|
} // customPhases);
|
||||||
in
|
in
|
||||||
fix pkg
|
fix pkg
|
||||||
|
|
Loading…
Reference in New Issue