From 2d56a18c3ee4f4f199c2884f765b5b8e84bc72cd Mon Sep 17 00:00:00 2001 From: James Atkins Date: Tue, 19 Nov 2024 19:19:31 -0600 Subject: [PATCH 1/4] epsonscan2: move to pkgs/by-name --- pkgs/{misc/drivers => by-name/ep}/epsonscan2/build.patch | 0 .../default.nix => by-name/ep/epsonscan2/package.nix} | 0 pkgs/top-level/all-packages.nix | 4 +++- 3 files changed, 3 insertions(+), 1 deletion(-) rename pkgs/{misc/drivers => by-name/ep}/epsonscan2/build.patch (100%) rename pkgs/{misc/drivers/epsonscan2/default.nix => by-name/ep/epsonscan2/package.nix} (100%) diff --git a/pkgs/misc/drivers/epsonscan2/build.patch b/pkgs/by-name/ep/epsonscan2/build.patch similarity index 100% rename from pkgs/misc/drivers/epsonscan2/build.patch rename to pkgs/by-name/ep/epsonscan2/build.patch diff --git a/pkgs/misc/drivers/epsonscan2/default.nix b/pkgs/by-name/ep/epsonscan2/package.nix similarity index 100% rename from pkgs/misc/drivers/epsonscan2/default.nix rename to pkgs/by-name/ep/epsonscan2/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6743c8d357fc..0fd2c9934860 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17917,7 +17917,9 @@ with pkgs; cups-pk-helper = callPackage ../misc/cups/cups-pk-helper.nix { }; - epsonscan2 = pkgs.libsForQt5.callPackage ../misc/drivers/epsonscan2 { }; + epsonscan2 = callPackage ../by-name/ep/epsonscan2/package.nix { + inherit (qt5) wrapQtAppsHook qtbase; + }; foomatic-db-ppds-withNonfreeDb = callPackage ../by-name/fo/foomatic-db-ppds/package.nix { withNonfreeDb = true; }; From 679595318fd819b3a9909b5c5b0525c798affa4e Mon Sep 17 00:00:00 2001 From: James Atkins Date: Tue, 19 Nov 2024 20:22:25 -0600 Subject: [PATCH 2/4] epsonscan2: 6.7.63.0 -> 6.7.70.0 Epson doesn't seem to publish a changelog anywhere. Remove 32-bit version as it is 2024. --- pkgs/by-name/ep/epsonscan2/build.patch | 24 +++++++------- pkgs/by-name/ep/epsonscan2/package.nix | 43 +++++++++++--------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/pkgs/by-name/ep/epsonscan2/build.patch b/pkgs/by-name/ep/epsonscan2/build.patch index 6a916511b84a..e7b11ffdb7a3 100644 --- a/pkgs/by-name/ep/epsonscan2/build.patch +++ b/pkgs/by-name/ep/epsonscan2/build.patch @@ -64,20 +64,20 @@ index 387561e..15448ad 100644 static const int kMaxBuf = 256; diff --git a/src/Controller/Src/Scanner/Engine.cpp b/src/Controller/Src/Scanner/Engine.cpp -index 9489d4b..670bad9 100644 +index 8bd842e..d011329 100755 --- a/src/Controller/Src/Scanner/Engine.cpp +++ b/src/Controller/Src/Scanner/Engine.cpp -@@ -263,8 +263,8 @@ SDIError Engine::Open() - //kill es2netif - //kill es2intif - -- system("killall -9 -q es2netif > /dev/null"); -- system("killall -9 -q es2intif > /dev/null"); -+ system("@KILLALL@ -9 -q es2netif > /dev/null"); -+ system("@KILLALL@ -9 -q es2intif > /dev/null"); - - if (engine_) { - return ExchangeError(engine_->Open()); +@@ -210,8 +210,8 @@ bool Engine::InitWithDeviceInfoDict(const char *deviceInfo) { + SDIError Engine::Open() + { + SDI_TRACE_LOG("Enter"); +- system("killall -9 -q es2netif > /dev/null"); +- system("killall -9 -q es2intif > /dev/null"); ++ system("@KILLALL@ -9 -q es2netif > /dev/null"); ++ system("@KILLALL@ -9 -q es2intif > /dev/null"); + if (engine_) { + return ExchangeError(engine_->Open()); + } diff --git a/src/Standalone/CMakeLists.txt b/src/Standalone/CMakeLists.txt index eff3dd3..c2b3803 100644 --- a/src/Standalone/CMakeLists.txt diff --git a/pkgs/by-name/ep/epsonscan2/package.nix b/pkgs/by-name/ep/epsonscan2/package.nix index a13f4da4daec..9a9320fc9431 100644 --- a/pkgs/by-name/ep/epsonscan2/package.nix +++ b/pkgs/by-name/ep/epsonscan2/package.nix @@ -25,26 +25,20 @@ let pname = "epsonscan2"; description = "Epson Scan 2 scanner driver for many modern Epson scanners and multifunction printers"; - version = "6.7.63.0"; + version = "6.7.70.0"; system = stdenv.hostPlatform.system; src = fetchzip { - url = "https://download3.ebz.epson.net/dsc/f/03/00/15/17/69/0ef02802c476a6564f13cac929859c394f40326a/epsonscan2-6.7.63.0-1.src.tar.gz"; - hash = "sha256-ZLnbIk0I7g6ext5anPD+/lD4qNlk6f2fL0xdIWLcfbY="; + url = "https://download3.ebz.epson.net/dsc/f/03/00/16/14/37/7577ee65efdad48ee2d2f38d9eda75418e490552/epsonscan2-6.7.70.0-1.src.tar.gz"; + hash = "sha256-y7XGxrOpVou/ZSfUffV3qv+SsFFpTiU7pWvtfsiLZWc="; }; bundle = { - "i686-linux" = fetchzip { - name = "${pname}-bundle"; - url = "https://download3.ebz.epson.net/dsc/f/03/00/15/17/67/ceae6a02aaa81cb61012899987fbb5ab891b6ab2/epsonscan2-bundle-6.7.63.0.i686.deb.tar.gz"; - hash = "sha256-h9beAzNdjOhTlZqW0rJbSQXGOpvFRGvTcWw0ZtOqiYY="; - }; - "x86_64-linux" = fetchzip { name = "${pname}-bundle"; - url = "https://download3.ebz.epson.net/dsc/f/03/00/15/17/68/050e5a55ed90f4efb4ca3bdd34e5797b149443ca/epsonscan2-bundle-6.7.63.0.x86_64.deb.tar.gz"; - hash = "sha256-+S17FfS2h4zZCvE6W+yZvdJb6+OWYTt0ZWCA+pe1NZc="; + url = "https://download3.ebz.epson.net/dsc/f/03/00/16/14/38/7b1780ace96e2c6033bbb667c7f3ed281e4e9f38/epsonscan2-bundle-6.7.70.0.x86_64.deb.tar.gz"; + hash = "sha256-fPNNFgW/VU/YG+jjmSvPZ0WsHibsXY1TNp164GxLHKw="; }; } ."${system}" or (throw "Unsupported system: ${system}"); @@ -56,25 +50,27 @@ stdenv.mkDerivation { patches = [ ./build.patch (fetchpatch { - url = "https://github.com/flathub/net.epson.epsonscan2/raw/master/patches/epsonscan2-crash.patch"; - hash = "sha256-srMxlFfnZuJ3ed5veFcJIiZuW27F/3xOS0yr4ywn4FI="; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0002-Fix-crash.patch"; + hash = "sha256-rNsFnHq//CJcIZl0M6RLRkIY3YhnJZbikO8SeeC2ktg="; }) (fetchpatch { - url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/epsonscan2-oob-container.patch"; - hash = "sha256-FhXZT0bIBYwdFow2USRJl8Q7j2eqpq98Hh0lHFQlUQY="; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0004-Fix-a-crash-on-an-OOB-container-access.patch"; + hash = "sha256-WmA8pmPSJ1xUdeBbE8Jzi6w9p96aIOm0erF3T4EQ6VA="; }) (fetchpatch { - url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/epsonscan2-xdg-open.patch"; - hash = "sha256-4ih3vZjPwWiiAxKfpLIwbbsk1K2oXSuxGbT5PVwfUsc="; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0003-Use-XDG-open-to-open-the-directory.patch"; + hash = "sha256-H3lle1SXkkpbBkozYEwiX0z9oTUubTpB+l91utxH03M="; }) ]; postPatch = '' + rm CMakeCache.txt + substituteInPlace src/Controller/Src/Scanner/Engine.cpp \ - --replace '@KILLALL@' ${killall}/bin/killall + --replace-fail '@KILLALL@' ${killall}/bin/killall substituteInPlace src/Controller/Src/Filter/GetOrientation.cpp \ - --replace '@OCR_ENGINE_GETROTATE@' $out/libexec/epsonscan2-ocr/ocr-engine-getrotate + --replace-fail '@OCR_ENGINE_GETROTATE@' $out/libexec/epsonscan2-ocr/ocr-engine-getrotate ''; nativeBuildInputs = @@ -127,8 +123,8 @@ stdenv.mkDerivation { + lib.optionalString withGui '' # The icon file extension is .ico but it's actually a png! mkdir -p $out/share/icons/hicolor/{48x48,128x128}/apps - convert $src/Resources/Icons/escan2_app.ico -resize 48x48 $out/share/icons/hicolor/48x48/apps/epsonscan2.png - convert $src/Resources/Icons/escan2_app.ico -resize 128x128 $out/share/icons/hicolor/128x128/apps/epsonscan2.png + magick $src/Resources/Icons/escan2_app.ico -resize 48x48 $out/share/icons/hicolor/48x48/apps/epsonscan2.png + magick $src/Resources/Icons/escan2_app.ico -resize 128x128 $out/share/icons/hicolor/128x128/apps/epsonscan2.png '' + lib.optionalString withNonFreePlugins '' ar xf ${bundle}/plugins/epsonscan2-non-free-plugin_*.deb @@ -170,10 +166,7 @@ stdenv.mkDerivation { ''; homepage = "https://support.epson.net/linux/en/epsonscan2.php"; - platforms = [ - "i686-linux" - "x86_64-linux" - ]; + platforms = [ "x86_64-linux" ]; sourceProvenance = with lib.sourceTypes; [ fromSource ] ++ lib.optionals withNonFreePlugins [ binaryNativeCode ]; From 794d4f89bac1126d7a7465df4affbf5ff0827091 Mon Sep 17 00:00:00 2001 From: Shawn8901 Date: Sat, 21 Dec 2024 17:18:43 +0100 Subject: [PATCH 3/4] epsonscan2: use pinned patches, add gcc14 patch --- pkgs/by-name/ep/epsonscan2/gcc14.patch | 37 ++++++++++++++++++++++++++ pkgs/by-name/ep/epsonscan2/package.nix | 7 ++--- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/ep/epsonscan2/gcc14.patch diff --git a/pkgs/by-name/ep/epsonscan2/gcc14.patch b/pkgs/by-name/ep/epsonscan2/gcc14.patch new file mode 100644 index 000000000000..803977574d0a --- /dev/null +++ b/pkgs/by-name/ep/epsonscan2/gcc14.patch @@ -0,0 +1,37 @@ +diff --git a/thirdparty/zlib/gzlib.c b/thirdparty/zlib/gzlib.c +index 4105e6a..eae3a38 100644 +--- a/thirdparty/zlib/gzlib.c ++++ b/thirdparty/zlib/gzlib.c +@@ -3,6 +3,7 @@ + * For conditions of distribution and use, see copyright notice in zlib.h + */ + ++#include + #include "gzguts.h" + + #if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__) +diff --git a/thirdparty/zlib/gzread.c b/thirdparty/zlib/gzread.c +index 956b91e..66089b6 100644 +--- a/thirdparty/zlib/gzread.c ++++ b/thirdparty/zlib/gzread.c +@@ -3,6 +3,7 @@ + * For conditions of distribution and use, see copyright notice in zlib.h + */ + ++#include + #include "gzguts.h" + + /* Local functions */ +diff --git a/thirdparty/zlib/gzwrite.c b/thirdparty/zlib/gzwrite.c +index c7b5651..e685f3e 100644 +--- a/thirdparty/zlib/gzwrite.c ++++ b/thirdparty/zlib/gzwrite.c +@@ -3,6 +3,7 @@ + * For conditions of distribution and use, see copyright notice in zlib.h + */ + ++#include + #include "gzguts.h" + + /* Local functions */ + \ No newline at end of file diff --git a/pkgs/by-name/ep/epsonscan2/package.nix b/pkgs/by-name/ep/epsonscan2/package.nix index 9a9320fc9431..e94bc1f90bd6 100644 --- a/pkgs/by-name/ep/epsonscan2/package.nix +++ b/pkgs/by-name/ep/epsonscan2/package.nix @@ -49,16 +49,17 @@ stdenv.mkDerivation { patches = [ ./build.patch + ./gcc14.patch (fetchpatch { - url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0002-Fix-crash.patch"; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/a489ac2f8cbd03afeda86673930cc17663c31a53/patches/0002-Fix-crash.patch"; hash = "sha256-rNsFnHq//CJcIZl0M6RLRkIY3YhnJZbikO8SeeC2ktg="; }) (fetchpatch { - url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0004-Fix-a-crash-on-an-OOB-container-access.patch"; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/a489ac2f8cbd03afeda86673930cc17663c31a53/patches/0004-Fix-a-crash-on-an-OOB-container-access.patch"; hash = "sha256-WmA8pmPSJ1xUdeBbE8Jzi6w9p96aIOm0erF3T4EQ6VA="; }) (fetchpatch { - url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/master/patches/0003-Use-XDG-open-to-open-the-directory.patch"; + url = "https://raw.githubusercontent.com/flathub/net.epson.epsonscan2/a489ac2f8cbd03afeda86673930cc17663c31a53/patches/0003-Use-XDG-open-to-open-the-directory.patch"; hash = "sha256-H3lle1SXkkpbBkozYEwiX0z9oTUubTpB+l91utxH03M="; }) ]; From 5ea32c66f0dd51fe94e57f6eba74e6008694c021 Mon Sep 17 00:00:00 2001 From: Shawn8901 Date: Sat, 21 Dec 2024 17:19:31 +0100 Subject: [PATCH 4/4] epsonscan2: fix not showing icons when built with withGui = true upstream ico file contains multiple resolutions, those need to be deleted on convert --- pkgs/by-name/ep/epsonscan2/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ep/epsonscan2/package.nix b/pkgs/by-name/ep/epsonscan2/package.nix index e94bc1f90bd6..e606db517226 100644 --- a/pkgs/by-name/ep/epsonscan2/package.nix +++ b/pkgs/by-name/ep/epsonscan2/package.nix @@ -124,8 +124,8 @@ stdenv.mkDerivation { + lib.optionalString withGui '' # The icon file extension is .ico but it's actually a png! mkdir -p $out/share/icons/hicolor/{48x48,128x128}/apps - magick $src/Resources/Icons/escan2_app.ico -resize 48x48 $out/share/icons/hicolor/48x48/apps/epsonscan2.png - magick $src/Resources/Icons/escan2_app.ico -resize 128x128 $out/share/icons/hicolor/128x128/apps/epsonscan2.png + magick $src/Resources/Icons/escan2_app.ico -resize 48x48 -delete 1,2,3 $out/share/icons/hicolor/48x48/apps/epsonscan2.png + magick $src/Resources/Icons/escan2_app.ico -resize 128x128 -delete 1,2,3 $out/share/icons/hicolor/128x128/apps/epsonscan2.png '' + lib.optionalString withNonFreePlugins '' ar xf ${bundle}/plugins/epsonscan2-non-free-plugin_*.deb