about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/ffado
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/ffado')
-rw-r--r--pkgs/os-specific/linux/ffado/default.nix121
-rw-r--r--pkgs/os-specific/linux/ffado/fix-build.patch54
2 files changed, 105 insertions, 70 deletions
diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix
index 610f9d31353e2..2196a5730aa26 100644
--- a/pkgs/os-specific/linux/ffado/default.nix
+++ b/pkgs/os-specific/linux/ffado/default.nix
@@ -1,77 +1,79 @@
-{ lib
-, stdenv
-, mkDerivation
-, argp-standalone
-, dbus
-, dbus_cplusplus
-, desktop-file-utils
-, fetchurl
-, fetchpatch
-, glibmm
-, libavc1394
-, libconfig
-, libiec61883
-, libraw1394
-, libxmlxx3
-, pkg-config
-, python3
-, scons
-, which
-, wrapQtAppsHook
+{
+  lib,
+  stdenv,
+  argp-standalone,
+  dbus,
+  dbus_cplusplus,
+  fetchurl,
+  glibmm,
+  libavc1394,
+  libconfig,
+  libiec61883,
+  libraw1394,
+  libxmlxx3,
+  pkg-config,
+  python311,
+  scons,
+  which,
+  withMixer ? false,
+  qt5,
 }:
 
 let
-  python = python3.withPackages (pkgs: with pkgs; [ pyqt5 dbus-python ]);
+  python =
+    if withMixer then
+      python311.withPackages (
+        pkgs: with pkgs; [
+          pyqt5
+          dbus-python
+        ]
+      )
+    else
+      python311;
 in
-mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "ffado";
-  version = "2.4.8";
+  version = "2.4.9";
+
+  outputs = [
+    "out"
+    "bin"
+    "dev"
+  ];
 
   src = fetchurl {
     url = "http://www.ffado.org/files/libffado-${version}.tgz";
-    hash = "sha256-f0x561ehKw6uMSri0RZip+v1JHZuhixtywl0PVU/N44=";
+    hash = "sha256-xELFL60Ryv1VE7tOhGyFHxAchIT4karFRe0ZDo/U0Q8=";
   };
 
-  sourceRoot = "libffado-${version}/libffado";
-
   prePatch = ''
     substituteInPlace ./support/tools/ffado-diag.in \
       --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"
   '';
 
-  patches = [
-    # fix installing metainfo file
-    ./fix-build.patch
-
-    (fetchpatch {
-      name = "musl.patch";
-      url = "http://subversion.ffado.org/changeset?format=diff&new=2846&old=2845";
-      stripLen = 2;
-      hash = "sha256-iWeYnb5J69Uvo1lftc7MWg7WrLa+CGZyOwJPOe8/PKg=";
-    })
-  ];
-
-  outputs = [ "out" "bin" "dev" ];
-
-  nativeBuildInputs = [
-    desktop-file-utils
-    scons
-    pkg-config
-    which
-    python
-    python3.pkgs.pyqt5
-    wrapQtAppsHook
-  ];
+  nativeBuildInputs =
+    [
+      (scons.override {
+        # SConstruct script depends on distutils removed in Python 3.12
+        python3Packages = python311.pkgs;
+      })
+      pkg-config
+      which
+    ]
+    ++ lib.optionals withMixer [
+      python
+      python.pkgs.pyqt5
+      qt5.wrapQtAppsHook
+    ];
 
   prefixKey = "PREFIX=";
   sconsFlags = [
     "DEBUG=False"
     "ENABLE_ALL=True"
     "BUILD_TESTS=True"
-    "WILL_DEAL_WITH_XDG_MYSELF=True"
-    "BUILD_MIXER=True"
+    "BUILD_MIXER=${if withMixer then "True" else "False"}"
     "UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
-    "PYPKGDIR=${placeholder "out"}/${python3.sitePackages}"
+    "PYPKGDIR=${placeholder "out"}/${python.sitePackages}"
     "BINDIR=${placeholder "bin"}/bin"
     "INCLUDEDIR=${placeholder "dev"}/include"
     "PYTHON_INTERPRETER=${python.interpreter}"
@@ -97,26 +99,21 @@ mkDerivation rec {
   dontWrapQtApps = true;
 
   postInstall = ''
-    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 = ''
-    wrapQtApp $bin/bin/ffado-mixer
+  preFixup = lib.optionalString withMixer ''
+    wrapQtApp "$bin/bin/ffado-mixer"
   '';
 
   meta = with lib; {
     homepage = "http://www.ffado.org";
     description = "FireWire audio drivers";
     license = licenses.gpl3;
-    maintainers = with maintainers; [ goibhniu michojel ];
+    maintainers = with maintainers; [
+      michojel
+    ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ffado/fix-build.patch b/pkgs/os-specific/linux/ffado/fix-build.patch
index 7e360932613f7..db4c47fa38d5f 100644
--- a/pkgs/os-specific/linux/ffado/fix-build.patch
+++ b/pkgs/os-specific/linux/ffado/fix-build.patch
@@ -1,9 +1,14 @@
 From b0f2b20b23780dd2e67a01c15462070dd86c4ac1 Mon Sep 17 00:00:00 2001
 From: Jan Tojnar <jtojnar@gmail.com>
 Date: Sun, 3 Mar 2019 11:50:27 +0100
-Subject: [PATCH] Fix build on Nix
+Subject: [PATCH] build: Add datadir option for /usr/share
 
-We do not have global /usr.
+Hardcoded /usr/share does not work for platforms that do not have global /usr like Nix.
+Let’s introduce a new DATADIR option, that allows overriding the directory and use it for metainfodir.
+
+While at it, let’s also use it for SHAREDIR and MANDIR for consistency,
+following the GNU directory convention:
+https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
 ---
  SConstruct | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
@@ -12,15 +17,48 @@ diff --git a/SConstruct b/SConstruct
 index 05755e4b..3fbdc1d8 100644
 --- a/SConstruct
 +++ b/SConstruct
-@@ -537,7 +537,7 @@ env['mandir'] = Template( env.destdir + env['MANDIR'] ).safe_substitute( env )
+@@ -49,9 +49,10 @@
+     PathVariable( "BINDIR", "Overwrite the directory where apps are installed to.", "$PREFIX/bin", PathVariable.PathAccept ),
+     PathVariable( "LIBDIR", "Overwrite the directory where libs are installed to.", "$PREFIX/lib", PathVariable.PathAccept ),
+     PathVariable( "INCLUDEDIR", "Overwrite the directory where headers are installed to.", "$PREFIX/include", PathVariable.PathAccept ),
+-    PathVariable( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$PREFIX/share/libffado", PathVariable.PathAccept ),
++    PathVariable( "DATADIR", "Overwrite the directory where platform-independent files are installed to.", "$PREFIX/share", PathVariable.PathAccept ),
++    PathVariable( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$DATADIR/libffado", PathVariable.PathAccept ),
+     PathVariable( "LIBDATADIR", "Location for architecture-dependent data.", "$LIBDIR/libffado", PathVariable.PathAccept ),
+-    PathVariable( "MANDIR", "Overwrite the directory where manpages are installed", "$PREFIX/man", PathVariable.PathAccept ),
++    PathVariable( "MANDIR", "Overwrite the directory where manpages are installed", "$DATADIR/man", PathVariable.PathAccept ),
+     PathVariable( "PYPKGDIR", "The directory where the python modules get installed.",
+         distutils.sysconfig.get_python_lib( prefix="$PREFIX" ), PathVariable.PathAccept ),
+     PathVariable( "UDEVDIR", "Overwrite the directory where udev rules are installed to.", "/lib/udev/rules.d/", PathVariable.PathAccept ),
+@@ -523,6 +524,7 @@
+ env['BINDIR'] = Template( env['BINDIR'] ).safe_substitute( env )
+ env['LIBDIR'] = Template( env['LIBDIR'] ).safe_substitute( env )
+ env['INCLUDEDIR'] = Template( env['INCLUDEDIR'] ).safe_substitute( env )
++env['DATADIR'] = Template( env['DATADIR'] ).safe_substitute( env )
+ env['SHAREDIR'] = Template( env['SHAREDIR'] ).safe_substitute( env )
+ env['LIBDATADIR'] = Template( env['LIBDATADIR'] ).safe_substitute( env )
+ env['UDEVDIR'] = Template( env['UDEVDIR'] ).safe_substitute( env )
+@@ -531,18 +533,21 @@
+ env['bindir'] = Template( env.destdir + env['BINDIR'] ).safe_substitute( env )
+ env['libdir'] = Template( env.destdir + env['LIBDIR'] ).safe_substitute( env )
+ env['includedir'] = Template( env.destdir + env['INCLUDEDIR'] ).safe_substitute( env )
++env['datadir'] = Template( env.destdir + env['DATADIR'] ).safe_substitute( env )
+ env['sharedir'] = Template( env.destdir + env['SHAREDIR'] ).safe_substitute( env )
+ env['libdatadir'] = Template( env.destdir + env['LIBDATADIR'] ).safe_substitute( env )
+ env['mandir'] = Template( env.destdir + env['MANDIR'] ).safe_substitute( env )
  env['pypkgdir'] = Template( env.destdir + env['PYPKGDIR'] ).safe_substitute( env )
  env['udevdir'] = Template( env.destdir + env['UDEVDIR'] ).safe_substitute( env )
  env['PYPKGDIR'] = Template( env['PYPKGDIR'] ).safe_substitute( env )
 -env['metainfodir'] = Template( env.destdir + "/usr/share/metainfo" ).safe_substitute( env )
-+env['metainfodir'] = Template( env.destdir + env['SHAREDIR'] + "/metainfo" ).safe_substitute( env )
- 
+-
++env['metainfodir'] = Template( env.destdir + env['DATADIR'] + "/metainfo" ).safe_substitute( env )
++
++env.Command( target=env['datadir'], source="", action=Mkdir( env['datadir'] ) )
  env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) )
  
--- 
-2.19.2
-
+ env.Alias( "install", env['libdir'] )
+ env.Alias( "install", env['includedir'] )
++env.Alias( "install", env['datadir'] )
+ env.Alias( "install", env['sharedir'] )
+ env.Alias( "install", env['libdatadir'] )
+ env.Alias( "install", env['bindir'] )