Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6 pkg-config,
7 gettext,
8 dbus,
9 dbus-glib,
10 libgaminggear,
11 libgudev,
12 lua,
13 harfbuzz,
14 runtimeShell,
15 coreutils,
16 kmod,
17 udevCheckHook,
18}:
19
20stdenv.mkDerivation rec {
21 pname = "roccat-tools";
22 version = "5.9.0";
23
24 src = fetchurl {
25 url = "mirror://sourceforge/roccat/${pname}-${version}.tar.bz2";
26 sha256 = "12j02rzbz3iqxprz8cj4kcfcdgnqlva142ci177axqmckcq6crvg";
27 };
28
29 postPatch = ''
30 sed -i -re 's,/(etc/xdg),\1,' roccateventhandler/CMakeLists.txt
31
32 sed -i -e '/roccat_profile_dir(void).*{/,/}/ {
33 /return/c \
34 return g_build_path("/", g_get_user_data_dir(), "roccat", NULL);
35 }' libroccat/roccat_helper.c
36
37 substituteInPlace udev/90-roccat-kone.rules \
38 --replace "/bin/sh" "${runtimeShell}" \
39 --replace "/sbin/modprobe" "${kmod}/bin/modprobe" \
40 --replace "/bin/echo" "${coreutils}/bin/echo"
41 '';
42
43 nativeBuildInputs = [
44 cmake
45 pkg-config
46 gettext
47 udevCheckHook
48 ];
49 buildInputs = [
50 dbus
51 dbus-glib
52 libgaminggear
53 libgudev
54 lua
55 ];
56
57 cmakeFlags = [
58 "-DUDEVDIR=\${out}/lib/udev/rules.d"
59 "-DCMAKE_MODULE_PATH=${libgaminggear.dev}/lib/cmake"
60 "-DWITH_LUA=${lua.luaversion}"
61 "-DLIBDIR=lib"
62 ];
63
64 env.NIX_CFLAGS_COMPILE = toString [
65 "-I${harfbuzz.dev}/include/harfbuzz"
66
67 # Workaround build failure on -fno-common toolchains:
68 # ld: ryos_talk.c.o:(.bss+0x0): multiple definition of `RyosWriteCheckWait';
69 # ryos_custom_lights.c.o:(.bss+0x0): first defined here
70 "-fcommon"
71 ];
72
73 doInstallCheck = true;
74
75 meta = {
76 description = "Tools to configure ROCCAT devices";
77 homepage = "https://roccat.sourceforge.net/";
78 platforms = lib.platforms.linux;
79 license = lib.licenses.gpl2Plus;
80 };
81}