1 { lib, stdenv, fetchFromGitHub, substituteAll, jam, cctools, pkg-config
2 , SDL, SDL_mixer, SDL_sound, gtk2, libvorbis, smpeg }:
8 '' + (if stdenv.hostPlatform.isDarwin then ''
9 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${lib.getDev SDL}/include/SDL"
10 export GARGLKINI="$out/Applications/Gargoyle.app/Contents/Resources/garglk.ini"
12 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/libexec/gargoyle"
14 export _BINDIR=libexec/gargoyle
15 export _APPDIR=libexec/gargoyle
16 export _LIBDIR=libexec/gargoyle
17 export GARGLKINI="$out/etc/garglk.ini"
22 stdenv.mkDerivation rec {
26 src = fetchFromGitHub {
30 sha256 = "0w54avmbp4i4zps2rb4acmpa641s6wvwbrln4vbdhcz97fx48nzz";
33 nativeBuildInputs = [ jam pkg-config ] ++ lib.optional stdenv.hostPlatform.isDarwin cctools;
35 buildInputs = [ SDL SDL_mixer SDL_sound gtk2 ]
36 ++ lib.optionals stdenv.hostPlatform.isDarwin [ smpeg libvorbis ];
38 # Workaround build failure on -fno-common toolchains:
39 # ld: build/linux.release/alan3/Location.o:(.bss+0x0): multiple definition of
40 # `logFile'; build/linux.release/alan3/act.o:(.bss+0x0): first defined here
41 # TODO: drop once updated to 2022.1 or later.
42 env.NIX_CFLAGS_COMPILE = "-fcommon";
44 buildPhase = jamenv + "jam -j$NIX_BUILD_CORES";
47 if stdenv.hostPlatform.isDarwin then
49 inherit (stdenv) shell;
54 jam -j$NIX_BUILD_CORES install
56 ln -s ../libexec/gargoyle/gargoyle "$out/bin"
58 cp garglk/garglk.ini "$out/etc"
59 mkdir -p "$out/share/applications"
60 cp garglk/gargoyle.desktop "$out/share/applications"
61 mkdir -p "$out/share/icons/hicolor/32x32/apps"
62 cp garglk/gargoyle-house.png "$out/share/icons/hicolor/32x32/apps"
65 enableParallelBuilding = true;
68 broken = stdenv.hostPlatform.isDarwin;
69 homepage = "http://ccxvii.net/gargoyle/";
70 license = licenses.gpl2Plus;
71 description = "Interactive fiction interpreter GUI";
72 mainProgram = "gargoyle";
73 platforms = platforms.unix;
74 maintainers = with maintainers; [ orivej ];