canon-cups-ufr2: fix library patching; use proot to enable cnsetuputil2 (#156090)
This commit is contained in:
parent
b5420031c5
commit
c30f25ffbb
@ -1,5 +1,6 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, stdenv_32bit
|
||||
, fetchurl
|
||||
, unzip
|
||||
, autoconf
|
||||
@ -10,10 +11,18 @@
|
||||
, jbigkit
|
||||
, glib
|
||||
, gtk3
|
||||
, gdk-pixbuf
|
||||
, pango
|
||||
, cairo
|
||||
, coreutils
|
||||
, atk
|
||||
, pkg-config
|
||||
, gnome2
|
||||
, libxml2
|
||||
, runtimeShell
|
||||
, proot
|
||||
, ghostscript
|
||||
, pkgs
|
||||
, pkgsi686Linux
|
||||
, zlib
|
||||
}:
|
||||
@ -21,6 +30,12 @@
|
||||
let
|
||||
|
||||
i686_NIX_GCC = pkgsi686Linux.callPackage ({ gcc }: gcc) { };
|
||||
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;
|
||||
|
||||
version = "5.40";
|
||||
dl = "6/0100009236/10";
|
||||
@ -31,10 +46,12 @@ let
|
||||
sha256 = "sha256:069z6ijmql62mcdyxnzc9mf0dxa6z1107cd0ab4i1adk8kr3d75k";
|
||||
};
|
||||
|
||||
buildInputs = [ cups zlib jbigkit glib gtk3 pkg-config gnome2.libglade libxml2 gdk-pixbuf pango cairo atk ];
|
||||
|
||||
in
|
||||
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "canon-cups-ufr2";
|
||||
inherit version;
|
||||
src = src_canon;
|
||||
@ -59,7 +76,7 @@ stdenv.mkDerivation {
|
||||
|
||||
nativeBuildInputs = [ makeWrapper unzip autoconf automake libtool_1_5 ];
|
||||
|
||||
buildInputs = [ cups zlib jbigkit glib gtk3 pkg-config gnome2.libglade libxml2 ];
|
||||
inherit buildInputs;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
@ -78,6 +95,9 @@ stdenv.mkDerivation {
|
||||
cd cnrdrvcups-lb-${version}
|
||||
./allgen.sh
|
||||
make install
|
||||
|
||||
mkdir -p $out/share/cups/model
|
||||
install -m 644 ppd/*.ppd $out/share/cups/model/
|
||||
)
|
||||
(
|
||||
cd lib
|
||||
@ -111,7 +131,7 @@ stdenv.mkDerivation {
|
||||
install -m 755 libs64/intel/cnpkbidir $out/bin
|
||||
install -m 755 libs64/intel/cnpkmoduleufr2r $out/bin
|
||||
install -m 755 libs64/intel/cnrsdrvufr2 $out/bin
|
||||
install -m 755 libs64/intel/cnsetuputil2 $out/bin
|
||||
install -m 755 libs64/intel/cnsetuputil2 $out/bin/cnsetuputil2
|
||||
|
||||
mkdir -p $out/share/cnpkbidir
|
||||
install -m 644 libs64/intel/cnpkbidir_info* $out/share/cnpkbidir
|
||||
@ -123,27 +143,47 @@ stdenv.mkDerivation {
|
||||
(
|
||||
cd $out/lib32
|
||||
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so
|
||||
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so.1
|
||||
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
|
||||
|
||||
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib:${libs pkgsi686Linux}:${stdenv_32bit.glibc.out}/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}:${stdenv_32bit.glibc.out}/lib" libcaepcmufr2.so.1.0
|
||||
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib:${libs pkgsi686Linux}:${stdenv_32bit.glibc.out}/lib" libColorGearCufr2.so.2.0.0
|
||||
)
|
||||
|
||||
(
|
||||
cd $out/lib
|
||||
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so
|
||||
ln -sf libcaepcmufr2.so.1.0 libcaepcmufr2.so.1
|
||||
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
|
||||
|
||||
patchelf --set-rpath "$(cat $NIX_CC/nix-support/orig-cc)/lib:${libs pkgs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/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.glibc.out}/lib64" libcaepcmufr2.so.1.0
|
||||
patchelf --set-rpath "$(cat $NIX_CC/nix-support/orig-cc)/lib:${libs pkgs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" libColorGearCufr2.so.2.0.0
|
||||
)
|
||||
|
||||
# Perhaps patch the lib64 version as well???
|
||||
patchelf --set-rpath "$(cat ${i686_NIX_GCC}/nix-support/orig-cc)/lib" $out/lib32/libColorGearCufr2.so.2.0.0
|
||||
(
|
||||
cd $out/bin
|
||||
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" cnsetuputil2
|
||||
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64" cnpdfdrv
|
||||
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64:$out/lib" cnpkbidir
|
||||
patchelf --set-interpreter "$(cat ${ld64})" --set-rpath "${lib.makeLibraryPath buildInputs}:${stdenv.cc.cc.lib}/lib64:${stdenv.glibc.out}/lib64:$out/lib" cnrsdrvufr2
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
(
|
||||
cd lib/data/ufr2
|
||||
@ -154,8 +194,11 @@ stdenv.mkDerivation {
|
||||
install -m 644 CnLB* $out/share/caepcm
|
||||
)
|
||||
|
||||
mkdir -p $out/share/cups/model
|
||||
install -m 644 cnrdrvcups-lb-${version}/ppd/*.ppd $out/share/cups/model/
|
||||
(
|
||||
cd cnrdrvcups-utility-${version}/data
|
||||
mkdir -p $out/usr/share/cnsetuputil2
|
||||
install -m 644 cnsetuputil* $out/usr/share/cnsetuputil2
|
||||
)
|
||||
|
||||
makeWrapper "${ghostscript}/bin/gs" "$out/bin/gs" \
|
||||
--prefix LD_LIBRARY_PATH ":" "$out/lib" \
|
||||
|
Loading…
Reference in New Issue
Block a user