about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/al/alephone/package.nix
blob: 44349b7621e52da69598637ab275b52216f642ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{ lib
, stdenv
, fetchurl
, alsa-lib
, boost
, curl
, ffmpeg_4
, icoutils
, libGLU
, libmad
, libogg
, libpng
, libsndfile
, libvorbis
, lua
, makeDesktopItem
, makeWrapper
, miniupnpc
, openal
, pkg-config
, SDL2
, SDL2_image
, SDL2_net
, SDL2_ttf
, speex
, unzip
, zlib
, zziplib
, alephone
}:

stdenv.mkDerivation (finalAttrs: {
  outputs = [ "out" "icons" ];
  pname = "alephone";
  version = "1.7";

  src = fetchurl {
    url =
      let date = "20231125";
      in "https://github.com/Aleph-One-Marathon/alephone/releases/download/release-${date}/AlephOne-${date}.tar.bz2";
    sha256 = "sha256-qRHmtkzPi6PKeAzoMPdSbboiilG+L2fCXvXXu3vIchs=";
  };

  nativeBuildInputs = [ pkg-config icoutils ];

  buildInputs = [
    alsa-lib
    boost
    curl
    ffmpeg_4
    libGLU
    libmad
    libogg
    libpng
    libsndfile
    libvorbis
    lua
    miniupnpc
    openal
    SDL2
    SDL2_image
    SDL2_net
    SDL2_ttf
    speex
    zlib
    zziplib
  ];

  configureFlags = [ "--with-boost-libdir=${boost.out}/lib" ];
  makeFlags = [ "AR:=$(AR)" ];

  enableParallelBuilding = true;

  postInstall = ''
    mkdir $icons
    icotool -x -i 5 -o $icons Resources/Windows/*.ico
    pushd $icons
    for x in *_5_48x48x32.png; do
      mv $x ''${x%_5_48x48x32.png}.png
    done
    popd
  '';

  meta = {
    description =
      "Aleph One is the open source continuation of Bungie’s Marathon 2 game engine";
    homepage = "https://alephone.lhowon.org/";
    license = [ lib.licenses.gpl3 ];
    maintainers = with lib.maintainers; [ ehmry ];
    platforms = lib.platforms.linux;
  };

  passthru.makeWrapper =
    { pname
    , desktopName
    , version
    , zip
    , meta
    , icon ? alephone.icons + "/alephone.png"
    , ...
    }@extraArgs:
    stdenv.mkDerivation ({
      inherit pname version;

      desktopItem = makeDesktopItem {
        name = desktopName;
        exec = pname;
        genericName = pname;
        categories = [ "Game" ];
        comment = meta.description;
        inherit desktopName icon;
      };

      src = zip;

      nativeBuildInputs = [ makeWrapper unzip ];

      dontConfigure = true;
      dontBuild = true;

      installPhase = ''
        mkdir -p $out/bin $out/data/$pname $out/share/applications
        cp -a * $out/data/$pname
        cp $desktopItem/share/applications/* $out/share/applications
        makeWrapper ${alephone}/bin/alephone $out/bin/$pname \
          --add-flags $out/data/$pname
      '';
    } // extraArgs // {
      meta = alephone.meta // {
        license = lib.licenses.free;
        mainProgram = pname;
        hydraPlatforms = [ ];
      } // meta;
    });
})