2021-01-17 02:04:36 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, substituteAll, jam, cctools, pkg-config
|
2019-06-19 21:20:34 +00:00
|
|
|
, SDL, SDL_mixer, SDL_sound, gtk2, libvorbis, smpeg }:
|
2017-03-18 23:22:48 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2017-08-25 22:24:21 +00:00
|
|
|
jamenv = ''
|
|
|
|
unset AR
|
|
|
|
'' + (if stdenv.hostPlatform.isDarwin then ''
|
2022-05-10 05:09:27 +00:00
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${lib.getDev SDL}/include/SDL"
|
2017-03-18 23:22:48 +00:00
|
|
|
export GARGLKINI="$out/Applications/Gargoyle.app/Contents/Resources/garglk.ini"
|
|
|
|
'' else ''
|
|
|
|
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/libexec/gargoyle"
|
|
|
|
export DESTDIR="$out"
|
|
|
|
export _BINDIR=libexec/gargoyle
|
|
|
|
export _APPDIR=libexec/gargoyle
|
|
|
|
export _LIBDIR=libexec/gargoyle
|
|
|
|
export GARGLKINI="$out/etc/garglk.ini"
|
2017-08-25 22:24:21 +00:00
|
|
|
'');
|
2017-03-18 23:22:48 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
2020-04-19 19:07:00 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gargoyle";
|
|
|
|
version = "2019.1.1";
|
2017-03-18 23:22:48 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "garglk";
|
|
|
|
repo = "garglk";
|
2020-04-19 19:07:00 +00:00
|
|
|
rev = version;
|
|
|
|
sha256 = "0w54avmbp4i4zps2rb4acmpa641s6wvwbrln4vbdhcz97fx48nzz";
|
2017-03-18 23:22:48 +00:00
|
|
|
};
|
|
|
|
|
2021-01-17 02:04:36 +00:00
|
|
|
nativeBuildInputs = [ jam pkg-config ] ++ lib.optional stdenv.hostPlatform.isDarwin cctools;
|
2017-03-18 23:22:48 +00:00
|
|
|
|
2018-11-11 03:42:39 +00:00
|
|
|
buildInputs = [ SDL SDL_mixer SDL_sound gtk2 ]
|
2021-01-15 04:31:39 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ smpeg libvorbis ];
|
2017-03-18 23:22:48 +00:00
|
|
|
|
2022-06-06 17:46:42 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains:
|
|
|
|
# ld: build/linux.release/alan3/Location.o:(.bss+0x0): multiple definition of
|
|
|
|
# `logFile'; build/linux.release/alan3/act.o:(.bss+0x0): first defined here
|
|
|
|
# TODO: drop once updated to 2022.1 or later.
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2022-06-06 17:46:42 +00:00
|
|
|
|
2017-03-18 23:22:48 +00:00
|
|
|
buildPhase = jamenv + "jam -j$NIX_BUILD_CORES";
|
|
|
|
|
2019-01-15 22:41:31 +00:00
|
|
|
installPhase =
|
|
|
|
if stdenv.hostPlatform.isDarwin then
|
2019-03-05 23:10:34 +00:00
|
|
|
(substituteAll {
|
|
|
|
inherit (stdenv) shell;
|
|
|
|
isExecutable = true;
|
|
|
|
src = ./darwin.sh;
|
|
|
|
})
|
2019-01-15 22:41:31 +00:00
|
|
|
else jamenv + ''
|
2017-03-18 23:22:48 +00:00
|
|
|
jam -j$NIX_BUILD_CORES install
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
ln -s ../libexec/gargoyle/gargoyle "$out/bin"
|
|
|
|
mkdir -p "$out/etc"
|
|
|
|
cp garglk/garglk.ini "$out/etc"
|
|
|
|
mkdir -p "$out/share/applications"
|
|
|
|
cp garglk/gargoyle.desktop "$out/share/applications"
|
|
|
|
mkdir -p "$out/share/icons/hicolor/32x32/apps"
|
|
|
|
cp garglk/gargoyle-house.png "$out/share/icons/hicolor/32x32/apps"
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2022-05-28 13:23:50 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://ccxvii.net/gargoyle/";
|
2017-03-18 23:22:48 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
description = "Interactive fiction interpreter GUI";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "gargoyle";
|
2017-03-18 23:22:48 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ orivej ];
|
|
|
|
};
|
|
|
|
}
|