ffado: support cross compilation

This commit is contained in:
Colin 2024-04-27 19:01:44 +00:00
parent f59a0e42ec
commit b0b57ad3c7
2 changed files with 28 additions and 13 deletions

View File

@ -1,6 +1,5 @@
{ lib
, stdenv
, mkDerivation
, argp-standalone
, dbus
, dbus_cplusplus
@ -16,16 +15,18 @@
, libxmlxx3
, pkg-config
, python3
, qt5
, scons
, which
, wrapQtAppsHook
# only build the mixer for environments supported by qt5
, withMixer ? stdenv.buildPlatform == stdenv.targetPlatform
}:
let
inherit (python3.pkgs) pyqt5 dbus-python;
python = python3.withPackages (pkgs: with pkgs; [ pyqt5 dbus-python ]);
inherit (python3.pkgs) pyqt5;
python = python3.withPackages (pkgs: with pkgs; [ dbus-python ] ++ lib.optionals withMixer [ pyqt5 ]);
in
mkDerivation rec {
stdenv.mkDerivation rec {
pname = "ffado";
version = "2.4.8";
@ -53,6 +54,19 @@ mkDerivation rec {
})
];
postPatch = ''
# prevent build tools from leaking into closure
substituteInPlace support/tools/SConscript --replace-fail \
'support/tools/ffado-diag --static' \
"echo 'See `nix-store --query --tree ${placeholder "out"}`.'"
'' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace SConstruct \
--replace-fail 'conf.CompilerCheck()' 'True' \
--replace-fail "pkg-config" "$PKG_CONFIG"
substituteInPlace admin/pkgconfig.py \
--replace-fail "pkg-config" "$PKG_CONFIG"
'';
outputs = [ "out" "bin" "dev" ];
nativeBuildInputs = [
@ -61,22 +75,26 @@ mkDerivation rec {
pkg-config
which
python
] ++ lib.optionals withMixer [
pyqt5
wrapQtAppsHook
qt5.wrapQtAppsHook
];
prefixKey = "PREFIX=";
sconsFlags = [
"CUSTOM_ENV=True" # tell SConstruct to use nixpkgs' CC/CXX/CFLAGS
"DETECT_USERSPACE_ENV=False"
"DEBUG=False"
"ENABLE_ALL=True"
"BUILD_TESTS=True"
"WILL_DEAL_WITH_XDG_MYSELF=True"
"BUILD_MIXER=True"
"UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
"PYPKGDIR=${placeholder "out"}/${python3.sitePackages}"
"BINDIR=${placeholder "bin"}/bin"
"INCLUDEDIR=${placeholder "dev"}/include"
"PYTHON_INTERPRETER=${python.interpreter}"
] ++ lib.optionals withMixer [
"BUILD_MIXER=True"
];
buildInputs = [
@ -98,19 +116,16 @@ mkDerivation rec {
enableParallelBuilding = true;
dontWrapQtApps = true;
postInstall = ''
postInstall = lib.optionalString withMixer ''
desktop="$bin/share/applications/ffado-mixer.desktop"
install -DT -m 444 support/xdg/ffado.org-ffadomixer.desktop $desktop
substituteInPlace "$desktop" \
--replace Exec=ffado-mixer "Exec=$bin/bin/ffado-mixer" \
--replace hi64-apps-ffado ffado-mixer
install -DT -m 444 support/xdg/hi64-apps-ffado.png "$bin/share/icons/hicolor/64x64/apps/ffado-mixer.png"
# prevent build tools from leaking into closure
echo 'See `nix-store --query --tree ${placeholder "out"}`.' > $out/lib/libffado/static_info.txt
'';
preFixup = ''
preFixup = lib.optionalString withMixer ''
wrapQtApp $bin/bin/ffado-mixer
'';

View File

@ -27199,7 +27199,7 @@ with pkgs;
fatrace = callPackage ../os-specific/linux/fatrace { };
ffado = libsForQt5.callPackage ../os-specific/linux/ffado {
ffado = callPackage ../os-specific/linux/ffado {
inherit (linuxPackages) kernel;
};
libffado = ffado;