-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathpingus.nix
More file actions
108 lines (94 loc) · 2.21 KB
/
Copy pathpingus.nix
File metadata and controls
108 lines (94 loc) · 2.21 KB
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
{ self
, stdenv
, lib
, tinycmmc_lib
, SDL2
, SDL2_image
, cmake
, gtest
, libsigcxx
, makeWrapper
, libGL
, libGLU
, pkg-config
, mcfgthreads
, argpp
, geomcpp
, logmich
, priocpp
, strutcpp
, tinygettext
, uitest
, wstsound
, xdgcpp
, useGLES2 ? false
, libglvnd ? null
, addDriverRunpath ? null
}:
let
pingus_version = tinycmmc_lib.versionFromVERSION self;
in
stdenv.mkDerivation rec {
pname = if useGLES2 then "pingus-gles2" else "pingus";
version = pingus_version;
src = lib.cleanSourceWith {
src = ./.;
filter = path: type:
let base = baseNameOf path; in
!(base == ".git" || base == "result" || base == "build"
|| lib.hasSuffix ".bundle" base);
};
enableParallelBuilding = true;
cmakeFlags = [
"-DWARNINGS=ON"
"-DWERROR=ON"
"-DBUILD_EXTRA=OFF"
"-DBUILD_TESTS=OFF" # tests fail due to SDLmain vs GTest::Main
"-DPROJECT_VERSION_FULL=${pingus_version}"
"-DPINGUS_USE_GLES=${if useGLES2 then "ON" else "OFF"}"
];
nativeBuildInputs = [
cmake
pkg-config
] ++ (lib.optional (!stdenv.hostPlatform.isWindows) makeWrapper)
++ (lib.optional (useGLES2 && addDriverRunpath != null) addDriverRunpath);
preConfigure = ''
echo "$version" > VERSION
'';
postFixup = ''
''
+ (lib.optionalString (useGLES2 && !stdenv.hostPlatform.isWindows && addDriverRunpath != null) ''
addDriverRunpath $out/bin/pingus
'')
+ (lib.optionalString stdenv.hostPlatform.isWindows ''
mkdir -p $out/bin/
find ${mcfgthreads} -iname "*.dll" -exec ln -sfv {} $out/bin/ \;
find ${stdenv.cc.cc} -iname "*.dll" -exec ln -sfv {} $out/bin/ \;
ln -sfv ${SDL2}/bin/*.dll $out/bin/
ln -sfv ${SDL2_image}/bin/*.dll $out/bin/
ln -sfv ${libsigcxx}/bin/*.dll $out/bin/ || true
ln -sfv ${wstsound}/bin/*.dll $out/bin/ || true
ln -sfv ${tinygettext}/bin/*.dll $out/bin/ || true
ln -sfv ${priocpp}/bin/*.dll $out/bin/ || true
'');
buildInputs = [
SDL2
SDL2_image
libsigcxx
argpp
geomcpp
logmich
priocpp
strutcpp
tinygettext
uitest
wstsound
]
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
libGL
libGLU
gtest
xdgcpp
]
++ lib.optional (useGLES2 && libglvnd != null) libglvnd;
}