1{ stdenv, lib, fetchFromGitHub
2, cgreen, openjdk, pkg-config, which
3}:
4
5stdenv.mkDerivation rec {
6 pname = "alan";
7 version = "3.0beta8";
8
9 src = fetchFromGitHub {
10 owner = "alan-if";
11 repo = "alan";
12 rev = "v${version}";
13 sha256 = "0zfg1frmb4yl39hk8h733bmlwk4rkikzfhvv7j34cxpdpsp7spzl";
14 };
15
16 postPatch = ''
17 patchShebangs --build bin
18 # The Makefiles have complex CFLAGS that don't allow separate control of optimization
19 sed -i 's/-O0/-O2/g' compiler/Makefile.common
20 sed -i 's/-Og/-O2/g' interpreter/Makefile.common
21 '';
22
23 installPhase = ''
24 mkdir -p $out/bin $out/share/alan/examples
25 # Build the release tarball
26 make package
27 # The release tarball isn't split up into subdirectories
28 tar -xf alan*.tgz --strip-components=1 -C $out/share/alan
29 mv $out/share/alan/*.alan $out/share/alan/examples
30 chmod a-x $out/share/alan/examples/*.alan
31 mv $out/share/alan/{alan,arun} $out/bin
32 # a2a3 isn't included in the release tarball
33 cp bin/a2a3 $out/bin
34 '';
35
36 nativeBuildInputs = [
37 cgreen
38 openjdk pkg-config which
39 ];
40
41 meta = with lib; {
42 homepage = "https://www.alanif.se/";
43 description = "The Alan interactive fiction language";
44 license = licenses.artistic2;
45 platforms = platforms.linux;
46 maintainers = with maintainers; [ neilmayhew ];
47 };
48}