From 9ab8fb342a04b23b1a8ffd94b6b117ce2fcf12e5 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 19 Jul 2024 17:23:53 +0200 Subject: [PATCH] sane-backends: 1.2.1 -> 1.3.1 --- .../graphics/sane/backends/default.nix | 95 ++++++++++++------- .../sane/backends/sane-desc-cross.patch | 12 +++ 2 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 pkgs/applications/graphics/sane/backends/sane-desc-cross.patch diff --git a/pkgs/applications/graphics/sane/backends/default.nix b/pkgs/applications/graphics/sane/backends/default.nix index 3038d2be2123..4b4850dd07e0 100644 --- a/pkgs/applications/graphics/sane/backends/default.nix +++ b/pkgs/applications/graphics/sane/backends/default.nix @@ -1,49 +1,72 @@ -{ stdenv, lib, fetchurl, fetchpatch, runtimeShell, buildPackages -, gettext, pkg-config, python3 -, avahi, libgphoto2, libieee1284, libjpeg, libpng, libtiff, libusb1, libv4l, net-snmp -, curl, systemd, libxml2, poppler, gawk -, sane-drivers -, nixosTests +{ + stdenv, + lib, + fetchFromGitLab, + runtimeShell, + buildPackages, + gettext, + pkg-config, + python3, + avahi, + libgphoto2, + libieee1284, + libjpeg, + libpng, + libtiff, + libusb1, + libv4l, + net-snmp, + curl, + systemd, + libxml2, + poppler, + gawk, + sane-drivers, + nixosTests, + autoconf, + automake, + libtool, + autoconf-archive, # List of { src name backend } attibute sets - see installFirmware below: -, extraFirmware ? [] + extraFirmware ? [], # For backwards compatibility with older setups; use extraFirmware instead: -, gt68xxFirmware ? null, snapscanFirmware ? null + gt68xxFirmware ? null, snapscanFirmware ? null, # Not included by default, scan snap drivers require fetching of unfree binaries. -, scanSnapDriversUnfree ? false, scanSnapDriversPackage ? sane-drivers.epjitsu + scanSnapDriversUnfree ? false, scanSnapDriversPackage ? sane-drivers.epjitsu, }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "sane-backends"; - version = "1.2.1"; + version = "1.3.1"; - src = fetchurl { - # raw checkouts of the repo do not work because, the configure script is - # only functional in manually uploaded release tarballs. - # https://gitlab.com/sane-project/backends/-/issues/440 - # unfortunately this make the url unpredictable on update, to find the link - # go to https://gitlab.com/sane-project/backends/-/releases and choose - # the link under the heading "Other". - url = "https://gitlab.com/sane-project/backends/uploads/110fc43336d0fb5e514f1fdc7360dd87/sane-backends-1.2.1.tar.gz"; - sha256 = "f832395efcb90bb5ea8acd367a820c393dda7e0dd578b16f48928b8f5bdd0524"; + src = fetchFromGitLab { + owner = "sane-project"; + repo = "backends"; + rev = "refs/tags/${version}"; + hash = "sha256-4mwPGeRsyzngDxBQ8/48mK+VR9LYV6082xr8lTrUZrk="; }; - patches = [ - # sane-desc will be used in postInstall so compile it for build - # https://github.com/void-linux/void-packages/blob/master/srcpkgs/sane/patches/sane-desc-cross.patch - (fetchpatch { - name = "compile-sane-desc-for-build.patch"; - url = "https://raw.githubusercontent.com/void-linux/void-packages/4b97cd2fb4ec38712544438c2491b6d7d5ab334a/srcpkgs/sane/patches/sane-desc-cross.patch"; - sha256 = "sha256-y6BOXnOJBSTqvRp6LwAucqaqv+OLLyhCS/tXfLpnAPI="; - }) - ]; + preConfigure = '' + # create version files, so that autotools macros can use them: + # https://gitlab.com/sane-project/backends/-/issues/440 + printf "%s\n" "$version" > .tarball-version + printf "%s\n" "$version" > .version + + autoreconf -fiv + + # Fixes for cross compilation + # https://github.com/NixOS/nixpkgs/issues/308283 - postPatch = '' # related to the compile-sane-desc-for-build substituteInPlace tools/Makefile.in \ --replace 'cc -I' '$(CC_FOR_BUILD) -I' + + # sane-desc will be used in postInstall so compile it for build + # https://github.com/void-linux/void-packages/blob/master/srcpkgs/sane/patches/sane-desc-cross.patch + patch -p1 -i ${./sane-desc-cross.patch} ''; outputs = [ "out" "doc" "man" ]; @@ -51,7 +74,11 @@ stdenv.mkDerivation { depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ + autoconf + autoconf-archive + automake gettext + libtool pkg-config python3 ]; @@ -134,7 +161,7 @@ stdenv.mkDerivation { inherit (nixosTests) sane; }; - meta = with lib; { + meta = { description = "SANE (Scanner Access Now Easy) backends"; longDescription = '' Collection of open-source SANE backends (device drivers). @@ -144,8 +171,8 @@ stdenv.mkDerivation { scanners, see http://www.sane-project.org/sane-backends.html. ''; homepage = "http://www.sane-project.org/"; - license = licenses.gpl2Plus; - platforms = platforms.linux ++ platforms.darwin; - maintainers = [ maintainers.symphorien ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + maintainers = [ lib.maintainers.symphorien ]; }; } diff --git a/pkgs/applications/graphics/sane/backends/sane-desc-cross.patch b/pkgs/applications/graphics/sane/backends/sane-desc-cross.patch new file mode 100644 index 000000000000..6acee77c0e7a --- /dev/null +++ b/pkgs/applications/graphics/sane/backends/sane-desc-cross.patch @@ -0,0 +1,12 @@ +--- a/tools/Makefile.in ++++ b/tools/Makefile.in +@@ -586,7 +586,7 @@ gamma4scanimage$(EXEEXT): $(gamma4scanimage_OBJECTS) $(gamma4scanimage_DEPENDENC + + sane-desc$(EXEEXT): $(sane_desc_OBJECTS) $(sane_desc_DEPENDENCIES) $(EXTRA_sane_desc_DEPENDENCIES) + @rm -f sane-desc$(EXEEXT) +- $(AM_V_CCLD)$(LINK) $(sane_desc_OBJECTS) $(sane_desc_LDADD) $(LIBS) ++ cc -I. sane-desc.c -I../include ../sanei/sanei_config.c ../sanei/sanei_init_debug.c ../sanei/sanei_constrain_value.c -o $@ + + sane-find-scanner$(EXEEXT): $(sane_find_scanner_OBJECTS) $(sane_find_scanner_DEPENDENCIES) $(EXTRA_sane_find_scanner_DEPENDENCIES) + @rm -f sane-find-scanner$(EXEEXT) +