uxn: refactor

- use finalAttrs pattern
- split projects into its own output
- set strictDeps to true
- set meta.mainProgram to uxnemu
This commit is contained in:
Anderson Torres 2023-08-12 23:24:28 -03:00
parent dbc8e3a3cf
commit 6ec3610cd8

View file

@ -5,7 +5,7 @@
, unstableGitUpdater
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "uxn";
version = "unstable-2023-08-10";
@ -16,12 +16,23 @@ stdenv.mkDerivation {
hash = "sha256-3Q8460pkoATKCEqfa+OfpQ4Lp18Ro5i84s88pkz+uzU=";
};
outputs = [ "out" "projects" ];
nativeBuildInputs = [
SDL2
];
buildInputs = [
SDL2
];
strictDeps = true;
postPatch = ''
sed -i -e 's|UXNEMU_LDFLAGS="$(brew.*$|UXNEMU_LDFLAGS="$(sdl2-config --cflags --libs)"|' build.sh
patchShebangs build.sh
substituteInPlace build.sh \
--replace "-L/usr/local/lib " "" \
--replace "\$(brew --prefix)/lib/libSDL2.a " ""
'';
buildPhase = ''
@ -32,13 +43,15 @@ stdenv.mkDerivation {
runHook postBuild
'';
# ./build.sh --install is meant to install in $HOME, therefore not useful for
# package maintainers
installPhase = ''
runHook preInstall
install -d $out/bin/ $out/share/uxn/
install -d $out/bin/
cp bin/uxnasm bin/uxncli bin/uxnemu $out/bin/
cp -r projects $out/share/uxn/
install -d $projects/share/uxn/
cp -r projects $projects/share/uxn/
runHook postInstall
'';
@ -49,7 +62,8 @@ stdenv.mkDerivation {
homepage = "https://wiki.xxiivv.com/site/uxn.html";
description = "An assembler and emulator for the Uxn stack machine";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ AndersonTorres kototama ];
maintainers = with lib.maintainers; [ AndersonTorres ];
mainProgram = "uxnemu";
inherit (SDL2.meta) platforms;
};
}
})