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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
{ lib
, stdenv
, fetchFromGitHub
, fetchgit
, SDL2
, cmake
, espeak
, ffmpeg
, file
, freetype
, harfbuzz
, leptonica
, libGL
, libX11
, libXau
, libXcomposite
, libXdmcp
, libXfixes
, libdrm
, libffi
, libusb1
, libuvc
, libvlc
, libvncserver
, libxcb
, libxkbcommon
, lua
, luajit
, makeWrapper
, mesa
, openal
, pkg-config
, sqlite
, tesseract
, valgrind
, wayland
, wayland-protocols
, xcbutil
, xcbutilwm
, xz
, buildManPages ? true, ruby
, useBuiltinLua ? true
, useStaticFreetype ? false
, useStaticLibuvc ? false
, useStaticOpenAL ? true
, useStaticSqlite ? false
}:
stdenv.mkDerivation rec {
pname = "arcan" + lib.optionalString useStaticOpenAL "-static-openal";
version = "0.6.1.1";
src = fetchFromGitHub {
owner = "letoram";
repo = "arcan";
rev = version;
hash = "sha256-+dJaBSKGbHOwzA26/jDyh2UF9YRwGUcysJIeAM4kvfc=";
};
nativeBuildInputs = [
cmake
makeWrapper
pkg-config
] ++ lib.optionals buildManPages [
ruby
];
buildInputs = [
SDL2
espeak
ffmpeg
file
freetype
harfbuzz
leptonica
libGL
libX11
libXau
libXcomposite
libXdmcp
libXfixes
libdrm
libffi
libusb1
libuvc
libvlc
libvncserver
libxcb
libxkbcommon
lua
luajit
mesa
openal
sqlite
tesseract
valgrind
wayland
wayland-protocols
xcbutil
xcbutilwm
xz
];
patches = [
# Nixpkgs-specific: redirect vendoring
./000-openal.patch
./001-luajit.patch
./002-libuvc.patch
];
# Emulate external/git/clone.sh
postUnpack = let
inherit (import ./clone-sources.nix { inherit fetchFromGitHub fetchgit; })
letoram-openal-src freetype-src libuvc-src luajit-src;
in
''
pushd $sourceRoot/external/git/
''
+ (lib.optionalString useStaticOpenAL ''
cp -a ${letoram-openal-src}/ openal
chmod --recursive 744 openal
'')
+ (lib.optionalString useStaticFreetype ''
cp -a ${freetype-src}/ freetype
chmod --recursive 744 freetype
'')
+ (lib.optionalString useStaticLibuvc ''
cp -a ${libuvc-src}/ libuvc
chmod --recursive 744 libuvc
'')
+ (lib.optionalString useBuiltinLua ''
cp -a ${luajit-src}/ luajit
chmod --recursive 744 luajit
'') +
''
popd
'';
postPatch = ''
substituteInPlace ./src/platform/posix/paths.c \
--replace "/usr/bin" "$out/bin" \
--replace "/usr/share" "$out/share"
substituteInPlace ./src/CMakeLists.txt --replace "SETUID" "# SETUID"
'';
# INFO: According to the source code, the manpages need to be generated before
# the configure phase
preConfigure = lib.optionalString buildManPages ''
pushd doc
ruby docgen.rb mangen
popd
'';
cmakeFlags = [
"-DBUILD_PRESET=everything"
# The upstream project recommends tagging the distribution
"-DDISTR_TAG=Nixpkgs"
"-DENGINE_BUILDTAG=${version}"
"-DHYBRID_SDL=on"
"-DBUILTIN_LUA=${if useBuiltinLua then "on" else "off"}"
"-DDISABLE_JIT=${if useBuiltinLua then "on" else "off"}"
"-DSTATIC_FREETYPE=${if useStaticFreetype then "on" else "off"}"
"-DSTATIC_LIBUVC=${if useStaticLibuvc then "on" else "off"}"
"-DSTATIC_OPENAL=${if useStaticOpenAL then "on" else "off"}"
"-DSTATIC_SQLite3=${if useStaticSqlite then "on" else "off"}"
"../src"
];
hardeningDisable = [
"format"
];
meta = with lib; {
homepage = "https://arcan-fe.com/";
description = "Combined Display Server, Multimedia Framework, Game Engine";
longDescription = ''
Arcan is a portable and fast self-sufficient multimedia engine for
advanced visualization and analysis work in a wide range of applications
e.g. game development, real-time streaming video, monitoring and
surveillance, up to and including desktop compositors and window managers.
'';
license = with licenses; [ bsd3 gpl2Plus lgpl2Plus ];
maintainers = with maintainers; [ AndersonTorres ];
platforms = platforms.unix;
};
}
|