2021-08-18 13:19:15 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, unzip
|
|
|
|
, autoconf
|
|
|
|
, automake
|
2022-01-22 01:22:15 +00:00
|
|
|
, libtool_1_5
|
2021-08-18 13:19:15 +00:00
|
|
|
, makeWrapper
|
|
|
|
, cups
|
2022-01-22 01:22:15 +00:00
|
|
|
, jbigkit
|
|
|
|
, glib
|
|
|
|
, gtk3
|
2022-01-25 03:21:06 +00:00
|
|
|
, gdk-pixbuf
|
|
|
|
, pango
|
|
|
|
, cairo
|
|
|
|
, coreutils
|
|
|
|
, atk
|
2022-01-22 01:22:15 +00:00
|
|
|
, pkg-config
|
|
|
|
, gnome2
|
|
|
|
, libxml2
|
2022-01-25 03:21:06 +00:00
|
|
|
, runtimeShell
|
|
|
|
, proot
|
2021-08-18 13:19:15 +00:00
|
|
|
, ghostscript
|
2022-01-25 03:21:06 +00:00
|
|
|
, pkgs
|
2021-08-18 13:19:15 +00:00
|
|
|
, pkgsi686Linux
|
|
|
|
, zlib
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
i686_NIX_GCC = pkgsi686Linux.callPackage ({ gcc }: gcc) { };
|
2022-01-25 03:21:06 +00:00
|
|
|
ld32 =
|
|
|
|
if stdenv.hostPlatform.system == "x86_64-linux" then "${stdenv.cc}/nix-support/dynamic-linker-m32"
|
|
|
|
else if stdenv.hostPlatform.system == "i686-linux" then "${stdenv.cc}/nix-support/dynamic-linker"
|
|
|
|
else throw "Unsupported platform for Canon UFR2 Drivers: ${stdenv.hostPlatform.system}";
|
|
|
|
ld64 = "${stdenv.cc}/nix-support/dynamic-linker";
|
|
|
|
libs = pkgs: lib.makeLibraryPath buildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
version = "5.40";
|
|
|
|
dl = "6/0100009236/10";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
versionNoDots = builtins.replaceStrings [ "." ] [ "" ] version;
|
2020-04-24 23:36:52 +00:00
|
|
|
src_canon = fetchurl {
|
2022-01-22 01:22:15 +00:00
|
|
|
url = "http://gdlp01.c-wss.com/gds/${dl}/linux-UFRII-drv-v${versionNoDots}-usen-20.tar.gz";
|
|
|
|
sha256 = "sha256:069z6ijmql62mcdyxnzc9mf0dxa6z1107cd0ab4i1adk8kr3d75k";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
buildInputs = [ cups zlib jbigkit glib gtk3 pkg-config gnome2.libglade libxml2 gdk-pixbuf pango cairo atk ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "canon-cups-ufr2";
|
2021-03-15 08:37:03 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
src = src_canon;
|
|
|
|
|
|
|
|
postUnpack = ''
|
2022-01-22 01:22:15 +00:00
|
|
|
(cd $sourceRoot; tar -xzf Sources/cnrdrvcups-lb-${version}-1.tar.gz)
|
|
|
|
(cd $sourceRoot; sed -ie "s@_prefix=/usr@_prefix=$out@" cnrdrvcups-common-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@_libdir=/usr/lib@_libdir=$out/lib@" cnrdrvcups-common-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@_bindir=/usr/bin@_libdir=$out/bin@" cnrdrvcups-common-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@etc/cngplp@$out/etc/cngplp@" cnrdrvcups-common-${version}/cngplp/Makefile.am)
|
|
|
|
(cd $sourceRoot; sed -ie "s@usr/share/cngplp@$out/usr/share/cngplp@" cnrdrvcups-common-${version}/cngplp/src/Makefile.am)
|
|
|
|
(cd $sourceRoot; patchShebangs cnrdrvcups-common-${version})
|
|
|
|
|
|
|
|
(cd $sourceRoot; sed -ie "s@_prefix=/usr@_prefix=$out@" cnrdrvcups-lb-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@_libdir=/usr/lib@_libdir=$out/lib@" cnrdrvcups-lb-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@_bindir=/usr/bin@_libdir=$out/bin@" cnrdrvcups-lb-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie '/^cd \.\.\/cngplp/,/^cd files/{/^cd files/!{d}}' cnrdrvcups-lb-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -ie "s@cd \.\./pdftocpca@cd pdftocpca@" cnrdrvcups-lb-${version}/allgen.sh)
|
|
|
|
(cd $sourceRoot; sed -i "/CNGPLPDIR/d" cnrdrvcups-lb-${version}/Makefile)
|
|
|
|
(cd $sourceRoot; patchShebangs cnrdrvcups-lb-${version})
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper unzip autoconf automake libtool_1_5 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
inherit buildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-08-18 13:19:15 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd cnrdrvcups-common-${version}
|
|
|
|
./allgen.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
make install
|
|
|
|
)
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd cnrdrvcups-common-${version}/Rule
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/share/usb
|
2022-01-22 01:22:15 +00:00
|
|
|
install -m 644 *.usb-quirks $out/share/usb
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd cnrdrvcups-lb-${version}
|
|
|
|
./allgen.sh
|
|
|
|
make install
|
2022-01-25 03:21:06 +00:00
|
|
|
|
|
|
|
mkdir -p $out/share/cups/model
|
|
|
|
install -m 644 ppd/*.ppd $out/share/cups/model/
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd lib
|
|
|
|
mkdir -p $out/lib32
|
|
|
|
install -m 755 libs32/intel/libColorGearCufr2.so.2.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcaepcmufr2.so.1.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcaiocnpkbidir.so.1.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcaiousb.so.1.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcaiowrapufr2.so.1.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcanon_slimufr2.so.1.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcanonufr2r.so.1.0.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcnaccm.so.1.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcnlbcmr.so.1.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libcnncapcmr.so.1.0 $out/lib32
|
|
|
|
install -m 755 libs32/intel/libufr2filterr.so.1.0.0 $out/lib32
|
|
|
|
|
|
|
|
mkdir -p $out/lib
|
|
|
|
install -m 755 libs64/intel/libColorGearCufr2.so.2.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcaepcmufr2.so.1.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcaiocnpkbidir.so.1.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcaiousb.so.1.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcaiowrapufr2.so.1.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcanon_slimufr2.so.1.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcanonufr2r.so.1.0.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcnaccm.so.1.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcnlbcmr.so.1.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libcnncapcmr.so.1.0 $out/lib
|
|
|
|
install -m 755 libs64/intel/libufr2filterr.so.1.0.0 $out/lib
|
|
|
|
|
|
|
|
install -m 755 libs64/intel/cnpdfdrv $out/bin
|
|
|
|
install -m 755 libs64/intel/cnpkbidir $out/bin
|
|
|
|
install -m 755 libs64/intel/cnpkmoduleufr2r $out/bin
|
|
|
|
install -m 755 libs64/intel/cnrsdrvufr2 $out/bin
|
2022-01-25 03:21:06 +00:00
|
|
|
install -m 755 libs64/intel/cnsetuputil2 $out/bin/cnsetuputil2
|
2022-01-22 01:22:15 +00:00
|
|
|
|
|
|
|
mkdir -p $out/share/cnpkbidir
|
|
|
|
install -m 644 libs64/intel/cnpkbidir_info* $out/share/cnpkbidir
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
mkdir -p $out/share/ufr2filter
|
|
|
|
install -m 644 libs64/intel/ThLB* $out/share/ufr2filter
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd $out/lib32
|
|
|
|
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so
|
2022-01-25 03:21:06 +00:00
|
|
|
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so.1
|
2022-01-22 01:22:15 +00:00
|
|
|
ln -sf libcaiowrapufr2.so.1.0.0 libcaiowrapufr2.so
|
|
|
|
ln -sf libcaiowrapufr2.so.1.0.0 libcaiowrapufr2.so.1
|
|
|
|
ln -sf libcanon_slimufr2.so.1.0.0 libcanon_slimufr2.so
|
|
|
|
ln -sf libcanon_slimufr2.so.1.0.0 libcanon_slimufr2.so.1
|
|
|
|
ln -sf libufr2filterr.so.1.0.0 libufr2filterr.so
|
|
|
|
ln -sf libufr2filterr.so.1.0.0 libufr2filterr.so.1
|
2022-01-25 03:21:06 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib:${libs pkgsi686Linux}:${pkgsi686Linux.stdenv.cc.libc}/lib:${pkgsi686Linux.libxml2.out}/lib:$out/lib32" libcanonufr2r.so.1.0.0
|
|
|
|
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib:${libs pkgsi686Linux}:${pkgsi686Linux.stdenv.cc.libc}/lib" libcaepcmufr2.so.1.0
|
|
|
|
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib:${libs pkgsi686Linux}:${pkgsi686Linux.stdenv.cc.libc}/lib" libColorGearCufr2.so.2.0.0
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd $out/lib
|
|
|
|
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so
|
2022-01-25 03:21:06 +00:00
|
|
|
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so.1
|
2022-01-22 01:22:15 +00:00
|
|
|
ln -sf libcaiowrapufr2.so.1.0.0 libcaiowrapufr2.so
|
|
|
|
ln -sf libcaiowrapufr2.so.1.0.0 libcaiowrapufr2.so.1
|
|
|
|
ln -sf libcanon_slimufr2.so.1.0.0 libcanon_slimufr2.so
|
|
|
|
ln -sf libcanon_slimufr2.so.1.0.0 libcanon_slimufr2.so.1
|
|
|
|
ln -sf libufr2filterr.so.1.0.0 libufr2filterr.so
|
|
|
|
ln -sf libufr2filterr.so.1.0.0 libufr2filterr.so.1
|
2022-01-25 03:21:06 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
patchelf --set-rpath "$(cat $NIX_CC/nix-support/orig-cc)/lib:${libs pkgs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64:$out/lib" libcanonufr2r.so.1.0.0
|
|
|
|
patchelf --set-rpath "$(cat $NIX_CC/nix-support/orig-cc)/lib:${libs pkgs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64" libcaepcmufr2.so.1.0
|
|
|
|
patchelf --set-rpath "$(cat $NIX_CC/nix-support/orig-cc)/lib:${libs pkgs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64" libColorGearCufr2.so.2.0.0
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
(
|
|
|
|
cd $out/bin
|
2022-06-16 17:23:12 +00:00
|
|
|
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64" cnsetuputil2
|
|
|
|
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64" cnpdfdrv
|
|
|
|
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64:$out/lib" cnpkbidir
|
|
|
|
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.libc}/lib64:$out/lib" cnrsdrvufr2
|
2022-01-25 03:21:06 +00:00
|
|
|
|
|
|
|
mv cnsetuputil2 cnsetuputil2.wrapped
|
|
|
|
echo "#!${runtimeShell} -e" > cnsetuputil2
|
|
|
|
echo "exec ${proot}/bin/proot -b $out/usr/share/cnsetuputil2:/usr/share/cnsetuputil2 -b ${coreutils}/bin/ls:/bin/ls -b ${cups}/share:/usr/share/cups $out/bin/cnsetuputil2.wrapped" > cnsetuputil2
|
|
|
|
chmod +x cnsetuputil2
|
|
|
|
)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
(
|
|
|
|
cd lib/data/ufr2
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/share/caepcm
|
2022-01-22 01:22:15 +00:00
|
|
|
install -m 644 *.ICC $out/share/caepcm
|
|
|
|
install -m 644 *.icc $out/share/caepcm
|
|
|
|
install -m 644 *.PRF $out/share/caepcm
|
|
|
|
install -m 644 CnLB* $out/share/caepcm
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
(
|
|
|
|
cd cnrdrvcups-utility-${version}/data
|
|
|
|
mkdir -p $out/usr/share/cnsetuputil2
|
|
|
|
install -m 644 cnsetuputil* $out/usr/share/cnsetuputil2
|
|
|
|
)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeWrapper "${ghostscript}/bin/gs" "$out/bin/gs" \
|
|
|
|
--prefix LD_LIBRARY_PATH ":" "$out/lib" \
|
|
|
|
--prefix PATH ":" "$out/bin"
|
2021-08-18 13:19:15 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "CUPS Linux drivers for Canon printers";
|
|
|
|
homepage = "http://www.canon.com/";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [
|
2022-01-22 01:22:15 +00:00
|
|
|
# please consider maintaining if you are updating this package
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|