about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2024-02-29 02:58:59 +0200
committerGitHub <noreply@github.com>2024-02-29 02:58:59 +0200
commit70576b917ef0afa1229354e119a05e5bd878e296 (patch)
tree5eb9e1081749ff75b5981ab1cfd72d8089637021
parent16d9f67e6edb056d27c9e9f9685717f4c041a828 (diff)
parent72def8dad282f8e059a52ddd7bda814caf3b070c (diff)
downloadnixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar.gz
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar.bz2
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar.lz
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar.xz
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.tar.zst
nixlib-70576b917ef0afa1229354e119a05e5bd878e296.zip
Merge pull request #291609 from Artturin/printcleanup1
{mfcj6510,mfcj470}dwcupswrapper: cleanup
-rw-r--r--pkgs/misc/cups/drivers/mfcj470dwcupswrapper/default.nix35
-rw-r--r--pkgs/misc/cups/drivers/mfcj6510dwcupswrapper/default.nix35
2 files changed, 32 insertions, 38 deletions
diff --git a/pkgs/misc/cups/drivers/mfcj470dwcupswrapper/default.nix b/pkgs/misc/cups/drivers/mfcj470dwcupswrapper/default.nix
index dc54611d335a..767597548991 100644
--- a/pkgs/misc/cups/drivers/mfcj470dwcupswrapper/default.nix
+++ b/pkgs/misc/cups/drivers/mfcj470dwcupswrapper/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, mfcj470dwlpr, makeWrapper}:
+{ lib, stdenv, fetchurl, mfcj470dwlpr, makeWrapper, bash }:
 
 stdenv.mkDerivation rec {
   pname = "mfcj470dw-cupswrapper";
@@ -10,27 +10,27 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ makeWrapper ];
-  buildInputs = [ mfcj470dwlpr ];
+  buildInputs = [
+    bash # shebang
+  ];
 
-  patchPhase = ''
+  makeFlags = [ "-C" "brcupsconfpt1" "all" ];
+
+  postPatch = ''
     WRAPPER=cupswrapper/cupswrappermfcj470dw
 
     substituteInPlace $WRAPPER \
-    --replace /opt "${mfcj470dwlpr}/opt" \
-    --replace /usr "${mfcj470dwlpr}/usr" \
-    --replace /etc "$out/etc"
+      --replace-fail /opt "${mfcj470dwlpr}/opt" \
+      --replace-fail /usr "${mfcj470dwlpr}/usr" \
+      --replace-fail /etc "$out/etc"
 
     substituteInPlace $WRAPPER \
-    --replace "cp " "cp -p "
-    '';
-
-  buildPhase = ''
-    cd brcupsconfpt1
-    make all
-    cd ..
-    '';
+      --replace-fail "cp " "cp -p "
+  '';
 
   installPhase = ''
+    runHook preInstall
+
     TARGETFOLDER=$out/opt/brother/Printers/mfcj470dw/cupswrapper/
     PPDFOLDER=$out/share/cups/model/
     FILTERFOLDER=$out/lib/cups/filter/
@@ -44,12 +44,9 @@ stdenv.mkDerivation rec {
     cp PPD/brother_mfcj470dw_printer_en.ppd $PPDFOLDER
 
     ln -s ${mfcj470dwlpr}/lib/cups/filter/brother_lpdwrapper_mfcj470dw $FILTERFOLDER/
-    '';
 
-  cleanPhase = ''
-    cd brcupsconfpt1
-    make clean
-    '';
+    runHook postInstall
+  '';
 
   meta = {
     homepage = "http://www.brother.com/";
diff --git a/pkgs/misc/cups/drivers/mfcj6510dwcupswrapper/default.nix b/pkgs/misc/cups/drivers/mfcj6510dwcupswrapper/default.nix
index 1653ced85c5a..4e6f37112087 100644
--- a/pkgs/misc/cups/drivers/mfcj6510dwcupswrapper/default.nix
+++ b/pkgs/misc/cups/drivers/mfcj6510dwcupswrapper/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, mfcj6510dwlpr, makeWrapper}:
+{ lib, stdenv, fetchurl, mfcj6510dwlpr, makeWrapper, bash }:
 
 stdenv.mkDerivation rec {
   pname = "mfcj6510dw-cupswrapper";
@@ -10,15 +10,15 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ makeWrapper ];
-  buildInputs = [ mfcj6510dwlpr ];
+  buildInputs = [
+    bash # shebang
+  ];
 
-  buildPhase = ''
-    cd brcupsconfig
-    make all
-    cd ..
-    '';
+  makeFlags = [ "-C" "brcupsconfig" "all" ];
 
   installPhase = ''
+    runHook preInstall
+
     TARGETFOLDER=$out/opt/brother/Printers/mfcj6510dw/cupswrapper
     mkdir -p $TARGETFOLDER
     cp PPD/brother_mfcj6510dw_printer_en.ppd $TARGETFOLDER
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     cp scripts/cupswrappermfcj6510dw $TARGETFOLDER
     sed -i -e '26,304d' $TARGETFOLDER/cupswrappermfcj6510dw
     substituteInPlace $TARGETFOLDER/cupswrappermfcj6510dw \
-      --replace "\$ppd_file_name" "$TARGETFOLDER/brother_mfcj6510dw_printer_en.ppd"
+      --replace-fail "\$ppd_file_name" "$TARGETFOLDER/brother_mfcj6510dw_printer_en.ppd"
 
     CPUSFILTERFOLDER=$out/lib/cups/filter
     mkdir -p $TARGETFOLDER $CPUSFILTERFOLDER
@@ -37,22 +37,19 @@ stdenv.mkDerivation rec {
     #sed -i -e '33,40d' $CPUSFILTERFOLDER/brother_lpdwrapper_mfcj6510dw
     #sed -i -e '34,35d' $CPUSFILTERFOLDER/brother_lpdwrapper_mfcj6510dw
     #substituteInPlace $CPUSFILTERFOLDER/brother_lpdwrapper_mfcj6510dw \
-    #  --replace "/opt/brother/$``{device_model``}/$``{printer_model``}/lpd/filter$``{printer_model``}" \
+    #  --replace-fail "/opt/brother/$``{device_model``}/$``{printer_model``}/lpd/filter$``{printer_model``}" \
     #    "${mfcj6510dwlpr}/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw" \
-    #  --replace "/opt/brother/Printers/$``{printer_model``}/inf/br$``{printer_model``}rc" \
+    #  --replace-fail "/opt/brother/Printers/$``{printer_model``}/inf/br$``{printer_model``}rc" \
     #    "${mfcj6510dwlpr}/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwrc" \
-    #  --replace "/opt/brother/$``{device_model``}/$``{printer_model``}/cupswrapper/brcupsconfpt1" \
+    #  --replace-fail "/opt/brother/$``{device_model``}/$``{printer_model``}/cupswrapper/brcupsconfpt1" \
     #    "$out/opt/brother/Printers/mfcj6510dw/cupswrapper/brcupsconfpt1" \
-    #  --replace "/usr/share/cups/model/Brother/brother_" "$out/opt/brother/Printers/mfcj6510dw/cupswrapper/brother_"
+    #  --replace-fail "/usr/share/cups/model/Brother/brother_" "$out/opt/brother/Printers/mfcj6510dw/cupswrapper/brother_"
     #substituteInPlace $CPUSFILTERFOLDER/brother_lpdwrapper_mfcj6510dw \
-    #  --replace "$``{printer_model``}" "mfcj6510dw" \
-    #  --replace "$``{printer_name``}" "MFCJ6510DW"
-    '';
+    #  --replace-fail "$``{printer_model``}" "mfcj6510dw" \
+    #  --replace-fail "$``{printer_name``}" "MFCJ6510DW"
 
-  cleanPhase = ''
-    cd brcupsconfpt1
-    make clean
-    '';
+    runHook postInstall
+  '';
 
   meta = with lib; {
     homepage = "http://www.brother.com/";