nixpkgs/pkgs/os-specific/linux/roccat-tools/default.nix
Artturin f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00

55 lines
1.6 KiB
Nix

{ lib, stdenv, fetchurl, cmake, pkg-config, gettext
, dbus, dbus-glib, libgaminggear, libgudev, lua
, harfbuzz, runtimeShell, coreutils, kmod
}:
stdenv.mkDerivation rec {
pname = "roccat-tools";
version = "5.9.0";
src = fetchurl {
url = "mirror://sourceforge/roccat/${pname}-${version}.tar.bz2";
sha256 = "12j02rzbz3iqxprz8cj4kcfcdgnqlva142ci177axqmckcq6crvg";
};
postPatch = ''
sed -i -re 's,/(etc/xdg),\1,' roccateventhandler/CMakeLists.txt
sed -i -e '/roccat_profile_dir(void).*{/,/}/ {
/return/c \
return g_build_path("/", g_get_user_data_dir(), "roccat", NULL);
}' libroccat/roccat_helper.c
substituteInPlace udev/90-roccat-kone.rules \
--replace "/bin/sh" "${runtimeShell}" \
--replace "/sbin/modprobe" "${kmod}/bin/modprobe" \
--replace "/bin/echo" "${coreutils}/bin/echo"
'';
nativeBuildInputs = [ cmake pkg-config gettext ];
buildInputs = [ dbus dbus-glib libgaminggear libgudev lua ];
cmakeFlags = [
"-DUDEVDIR=\${out}/lib/udev/rules.d"
"-DCMAKE_MODULE_PATH=${libgaminggear.dev}/lib/cmake"
"-DWITH_LUA=${lua.luaversion}"
"-DLIBDIR=lib"
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${harfbuzz.dev}/include/harfbuzz"
# Workaround build failure on -fno-common toolchains:
# ld: ryos_talk.c.o:(.bss+0x0): multiple definition of `RyosWriteCheckWait';
# ryos_custom_lights.c.o:(.bss+0x0): first defined here
"-fcommon"
];
meta = {
description = "Tools to configure ROCCAT devices";
homepage = "https://roccat.sourceforge.net/";
platforms = lib.platforms.linux;
license = lib.licenses.gpl2Plus;
};
}