Merge pull request #291609 from Artturin/printcleanup1

{mfcj6510,mfcj470}dwcupswrapper: cleanup
This commit is contained in:
Artturi 2024-02-29 02:58:59 +02:00 committed by GitHub
commit 70576b917e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 38 deletions

View File

@ -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/";

View File

@ -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/";