about summary refs log tree commit diff
path: root/pkgs/development/libraries/allegro/5.nix
blob: ee337673ee070af896aaeb17caacebb16de2c058 (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
{ lib
, alsa-lib
, cmake
, enet
, fetchFromGitHub
, flac
, freetype
, gtk3
, libGL
, libGLU
, libjpeg
, libopus
, libpng
, libpthreadstubs
, libpulseaudio
, libtheora
, libvorbis
, libwebp
, libX11
, libXcursor
, libXdmcp
, libXext
, libXfixes
, libXi
, libXpm
, libXt
, libXxf86dga
, libXxf86misc
, libXxf86vm
, openal
, pcre
, physfs
, pkg-config
, stdenv
, texinfo
, xorgproto
, zlib
}:

stdenv.mkDerivation rec {
  pname = "allegro";
  version = "5.2.9.1";

  src = fetchFromGitHub {
    owner = "liballeg";
    repo = "allegro5";
    rev = version;
    sha256 = "sha256-n2OCmZmAqeXjtnCTqJgQ5q4j8/lnPfH+5tpWKIFKle0=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    enet
    flac
    freetype
    gtk3
    libGL
    libGLU
    libjpeg
    libopus
    libpng
    libtheora
    libvorbis
    libwebp
    openal
    pcre
    physfs
    texinfo
    zlib
  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
    alsa-lib
    libpthreadstubs
    libpulseaudio
    libX11
    libXcursor
    libXdmcp
    libXext
    libXfixes
    libXi
    libXpm
    libXt
    libXxf86dga
    libXxf86misc
    libXxf86vm
    xorgproto
  ];

  postPatch = ''
    sed -e 's@/XInput2.h@/XI2.h@g' -i CMakeLists.txt "src/"*.c
    sed -e 's@Kernel/IOKit/hidsystem/IOHIDUsageTables.h@IOKit/hid/IOHIDUsageTables.h@g' -i include/allegro5/platform/alosx.h
    sed -e 's@OpenAL/@AL/@g' -i addons/audio/openal.c
  '';

  cmakeFlags = [ "-DCMAKE_SKIP_RPATH=ON" ];

  meta = with lib; {
    description = "Game programming library";
    homepage = "https://liballeg.org/";
    license = licenses.zlib;
    maintainers = [ maintainers.raskin ];
    platforms = platforms.linux ++ platforms.darwin;
  };
}