2022-06-15 20:35:44 +00:00
|
|
|
|
{ pkgs, lib, stdenv, fetchzip, ncurses, libX11, libXaw, libXt, libXext, libXmu
|
|
|
|
|
, makeWrapper, writeScript }:
|
|
|
|
|
|
2021-01-15 04:31:39 +00:00
|
|
|
|
let
|
2018-02-04 22:51:03 +00:00
|
|
|
|
setup = writeScript "setup" ''
|
|
|
|
|
mkdir -p "$ANGBAND_PATH"
|
|
|
|
|
# Copy all the data files into place
|
|
|
|
|
cp -ar $1/* "$ANGBAND_PATH"
|
|
|
|
|
# The copied files are not writable, make them so
|
|
|
|
|
chmod +w -R "$ANGBAND_PATH"
|
|
|
|
|
'';
|
|
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
|
pname = "Sil";
|
2018-02-04 22:51:03 +00:00
|
|
|
|
version = "1.3.0";
|
|
|
|
|
|
|
|
|
|
src = fetchzip {
|
2022-11-09 15:41:13 +00:00
|
|
|
|
url = "https://www.amirrorclear.net/flowers/game/sil/Sil-130-src.zip";
|
2018-02-04 22:51:03 +00:00
|
|
|
|
sha256 = "1amp2mr3fxascra0k76sdsvikjh8g76nqh46kka9379zd35lfq8w";
|
2022-06-15 20:35:44 +00:00
|
|
|
|
stripRoot = false;
|
2018-02-04 22:51:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
buildInputs = [ ncurses libX11 libXaw libXt libXext libXmu ];
|
2018-02-04 22:51:03 +00:00
|
|
|
|
|
2023-07-25 13:27:31 +00:00
|
|
|
|
sourceRoot = "${src.name}/Sil/src";
|
2018-02-04 22:51:03 +00:00
|
|
|
|
|
|
|
|
|
makefile = "Makefile.std";
|
|
|
|
|
|
2022-06-15 20:35:44 +00:00
|
|
|
|
postPatch = ''
|
2018-02-04 22:51:03 +00:00
|
|
|
|
# Allow usage of ANGBAND_PATH
|
2021-01-15 04:31:39 +00:00
|
|
|
|
substituteInPlace config.h --replace "#define FIXED_PATHS" ""
|
2018-02-04 22:51:03 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
|
buildFlagsArray+=("LIBS=-lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 -lncurses")
|
|
|
|
|
'';
|
|
|
|
|
|
2022-05-29 06:36:35 +00:00
|
|
|
|
# Workaround build failure on -fno-common toolchains like upstream
|
|
|
|
|
# gcc-10. Otherwise build fails as:
|
|
|
|
|
# ld: main.o:/build/source/Sil/src/externs.h:57: multiple definition of
|
|
|
|
|
# `mini_screenshot_char'; variable.o:/build/source/Sil/src/externs.h:57: first defined here
|
2023-02-19 19:23:32 +00:00
|
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2022-05-29 06:36:35 +00:00
|
|
|
|
|
2018-02-04 22:51:03 +00:00
|
|
|
|
installPhase = ''
|
2022-06-15 20:35:44 +00:00
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
|
|
# the makefile doesn't have a sensible install target, so we have to do it ourselves
|
2018-02-04 22:51:03 +00:00
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
cp sil $out/bin/sil
|
2022-06-15 20:35:44 +00:00
|
|
|
|
|
|
|
|
|
# Wrap the program to set a user-local ANGBAND_PATH, and run the setup script to copy files into place.
|
2021-01-15 04:31:39 +00:00
|
|
|
|
# We could just use the options for a user-local save and scores dir, but it tried to write to the
|
2018-02-04 22:51:03 +00:00
|
|
|
|
# lib directory anyway, so we might as well give everyone a copy
|
|
|
|
|
wrapProgram $out/bin/sil \
|
|
|
|
|
--run "export ANGBAND_PATH=\$HOME/.sil" \
|
|
|
|
|
--run "${setup} ${src}/Sil/lib"
|
2022-06-15 20:35:44 +00:00
|
|
|
|
|
|
|
|
|
runHook postInstall
|
2018-02-04 22:51:03 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2022-06-15 20:35:44 +00:00
|
|
|
|
passthru.tests = {
|
|
|
|
|
saveDirCreation = pkgs.runCommand "save-dir-creation" {} ''
|
|
|
|
|
HOME=$(pwd) ${lib.getExe pkgs.sil} --help
|
|
|
|
|
test -d .sil && touch $out
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2018-02-04 22:51:03 +00:00
|
|
|
|
meta = {
|
2022-06-15 20:35:44 +00:00
|
|
|
|
description = "Rogue-like game set in the First Age of Middle-earth";
|
2018-02-04 22:51:03 +00:00
|
|
|
|
longDescription = ''
|
2022-06-15 20:35:44 +00:00
|
|
|
|
A game of adventure set in the First Age of Middle-earth, when the world still
|
|
|
|
|
rang with Elven song and gleamed with Dwarven mail.
|
2018-02-04 22:51:03 +00:00
|
|
|
|
|
2021-01-15 04:31:39 +00:00
|
|
|
|
Walk the dark halls of Angband. Slay creatures black and fell. Wrest a shining
|
2018-02-04 22:51:03 +00:00
|
|
|
|
Silmaril from Morgoth’s iron crown.
|
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "http://www.amirrorclear.net/flowers/game/sil/index.html";
|
2024-07-03 09:37:36 +00:00
|
|
|
|
license = lib.licenses.gpl2Only;
|
2022-06-15 20:35:44 +00:00
|
|
|
|
maintainers = with lib.maintainers; [ michaelpj kenran ];
|
2021-01-15 04:31:39 +00:00
|
|
|
|
platforms = lib.platforms.linux;
|
2022-06-15 20:35:44 +00:00
|
|
|
|
mainProgram = "sil";
|
2018-02-04 22:51:03 +00:00
|
|
|
|
};
|
|
|
|
|
}
|