|
1 | 1 | { |
2 | | - stdenv, |
3 | | - lib, |
4 | | - fetchzip, |
5 | 2 | autoconf, |
6 | 3 | automake, |
| 4 | + autoPatchelfHook, |
7 | 5 | cups, |
| 6 | + fetchpatch2, |
| 7 | + fetchzip, |
8 | 8 | glib, |
9 | | - libxml2, |
10 | | - libusb1, |
| 9 | + lib, |
11 | 10 | libtool, |
12 | | - withDebug ? false, |
| 11 | + libusb1, |
| 12 | + libxml2, |
| 13 | + stdenv, |
13 | 14 | }: |
14 | | - |
| 15 | +let |
| 16 | + blobDir = "com/libs_bin_${stdenv.hostPlatform.uname.processor}"; |
| 17 | +in |
15 | 18 | stdenv.mkDerivation { |
16 | 19 | pname = "cnijfilter2"; |
17 | | - |
18 | | - version = "6.40"; |
| 20 | + version = "6.90-1"; |
19 | 21 |
|
20 | 22 | src = fetchzip { |
21 | | - url = "https://gdlp01.c-wss.com/gds/1/0100011381/01/cnijfilter2-source-6.40-1.tar.gz"; |
22 | | - sha256 = "3RoG83jLOsdTEmvUkkxb7wa8oBrJA4v1mGtxTGwSowU="; |
| 23 | + url = "https://gdlp01.c-wss.com/gds/9/0100012819/01/cnijfilter2-source-6.90-1.tar.gz"; |
| 24 | + hash = "sha256-kvMEC2IR448JAM8unoLzF01GDlWhTSk/gi6giHI0u0E="; |
23 | 25 | }; |
24 | 26 |
|
| 27 | + patches = [ |
| 28 | + ./stdlib.patch |
| 29 | + ./bool.patch |
| 30 | + |
| 31 | + # See: |
| 32 | + # - https://github.com/NixOS/nixpkgs/pull/180681#issuecomment-1192304711 |
| 33 | + # - https://bugs.gentoo.org/723186 |
| 34 | + (fetchpatch2 { |
| 35 | + url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-print/cnijfilter2/files/cnijfilter2-5.80-fno-common.patch?id=24688d64544b43f2c14be54531ad8764419dde09"; |
| 36 | + hash = "sha256-ygAfS68100ducWsxeA2Q2eoE8cBFMVO7KiXn/RGIHFw="; |
| 37 | + }) |
| 38 | + ]; |
| 39 | + |
25 | 40 | nativeBuildInputs = [ |
26 | 41 | automake |
27 | 42 | autoconf |
28 | | - ]; |
29 | | - buildInputs = [ |
30 | | - cups |
| 43 | + autoPatchelfHook |
31 | 44 | glib |
32 | | - libxml2 |
33 | | - libusb1 |
34 | 45 | libtool |
35 | 46 | ]; |
36 | 47 |
|
37 | | - patches = [ |
38 | | - ./patches/get_protocol.patch |
39 | | - ./patches/add_missing_import.patch |
| 48 | + buildInputs = [ |
| 49 | + cups |
| 50 | + libusb1 |
| 51 | + libxml2 |
40 | 52 | ]; |
41 | 53 |
|
42 | | - # lgmon3's --enable-libdir flag is used solely for specifying in which |
43 | | - # directory the cnnnet.ini cache file should reside. |
44 | | - # NixOS uses /var/cache/cups, and given the name, it seems like a reasonable |
45 | | - # place to put the cnnet.ini file, and thus we do so. |
46 | | - # |
47 | | - # Note that the drivers attempt to dlopen |
48 | | - # $out/lib/cups/filter/libcnbpcnclapicom2.so |
49 | | - buildPhase = '' |
50 | | - mkdir -p $out/lib |
51 | | - cp com/libs_bin_x86_64/* $out/lib |
52 | | - mkdir -p $out/lib/cups/filter |
53 | | - ln -s $out/lib/libcnbpcnclapicom2.so $out/lib/cups/filter |
54 | | -
|
55 | | - export NIX_LDFLAGS="$NIX_LDFLAGS -L$out/lib" |
56 | | - '' |
57 | | - + lib.optionalString withDebug '' |
58 | | - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D__DEBUG__ -DDEBUG_LOG" |
59 | | - '' |
60 | | - + '' |
61 | | -
|
62 | | - ( |
63 | | - cd lgmon3 |
64 | | - substituteInPlace src/Makefile.am \ |
65 | | - --replace /usr/include/libusb-1.0 \ |
66 | | - ${libusb1.dev}/include/libusb-1.0 |
67 | | - ./autogen.sh --prefix=$out --enable-progpath=$out/bin \ |
68 | | - --datadir=$out/share \ |
69 | | - --enable-libdir=/var/cache/cups |
70 | | - make |
71 | | - ) |
72 | | -
|
73 | | - ( |
74 | | - cd cmdtocanonij2 |
75 | | - ./autogen.sh --prefix=$out |
76 | | - make |
77 | | - ) |
78 | | -
|
79 | | - ( |
80 | | - cd cmdtocanonij3 |
81 | | - ./autogen.sh --prefix=$out |
82 | | - make |
83 | | - ) |
84 | | -
|
85 | | - ( |
86 | | - cd cnijbe2 |
87 | | - substituteInPlace src/Makefile.am \ |
88 | | - --replace "/usr/lib/cups/backend" \ |
89 | | - "$out/lib/cups/backend" |
90 | | - ./autogen.sh --prefix=$out --enable-progpath=$out/bin |
91 | | - make |
92 | | - ) |
| 54 | + postPatch = '' |
| 55 | + substituteInPlace lgmon3/src/Makefile.am \ |
| 56 | + --replace-fail /usr/include/libusb-1.0 ${lib.getDev libusb1}/include/libusb-1.0 |
| 57 | + substituteInPlace \ |
| 58 | + cmdtocanonij2/filter/cnijutil.c \ |
| 59 | + cmdtocanonij3/filter/cmdtocanonij.c \ |
| 60 | + cmdtocanonij3/filter/cnijutil.c \ |
| 61 | + lgmon3/src/cnijlgmon3.h \ |
| 62 | + lgmon3/src/cnijutil.c \ |
| 63 | + tocanonij/src/cnijutil.c \ |
| 64 | + tocanonij/src/main.c \ |
| 65 | + --subst-var out |
| 66 | + ''; |
93 | 67 |
|
94 | | - ( |
95 | | - cd rastertocanonij |
96 | | - ./autogen.sh --prefix=$out --enable-progpath=$out/bin |
97 | | - make |
98 | | - ) |
| 68 | + preConfigure = '' |
| 69 | + for i in cmdtocanonij2 cmdtocanonij3 cnijbe2 lgmon3 rastertocanonij tocanonij tocnpwg; do |
| 70 | + cd $i |
| 71 | + env NOCONFIGURE=1 ./autogen.sh |
| 72 | + cd .. |
| 73 | + done |
| 74 | + ''; |
99 | 75 |
|
100 | | - ( |
101 | | - cd tocanonij |
102 | | - ./autogen.sh --prefix=$out --enable-progpath=$out/bin |
103 | | - make |
104 | | - ) |
| 76 | + configurePhase = '' |
| 77 | + runHook preConfigure |
| 78 | + for i in cmdtocanonij2 cmdtocanonij3 cnijbe2 lgmon3 rastertocanonij tocanonij tocnpwg; do |
| 79 | + cd $i |
| 80 | + configureFlags="--build=${stdenv.buildPlatform.config}" |
| 81 | + configureFlags="$configureFlags --host=${stdenv.hostPlatform.config}" |
| 82 | + configureFlags="$configureFlags --target=${stdenv.targetPlatform.config}" |
| 83 | + configureFlags="$configureFlags --prefix=$out --disable-dependency-tracking --disable-static" |
| 84 | + if [ $i = cnijbe2 -o $i = lgmon3 -o $i = rastertocanonij ]; then |
| 85 | + configureFlags="$configureFlags --enable-progpath=$out/bin" |
| 86 | + fi |
| 87 | + if [ $i = lgmon3 ]; then |
| 88 | + # lgmon3's --enable-libdir flag is used solely for specifying in which |
| 89 | + # directory the cnnnet.ini cache file should reside. |
| 90 | + # NixOS uses /var/cache/cups, and given the name, it seems like a reasonable |
| 91 | + # place to put the cnnet.ini file, and thus we do so. |
| 92 | + configureFlags="$configureFlags --enable-libpath=/var/cache/cups" |
| 93 | + fi |
| 94 | + ./configure $configureFlags |
| 95 | + cd .. |
| 96 | + done |
| 97 | + runHook postConfigure |
| 98 | + ''; |
105 | 99 |
|
106 | | - ( |
107 | | - cd tocnpwg |
108 | | - ./autogen.sh --prefix=$out --enable-progpath=$out/bin |
| 100 | + buildPhase = '' |
| 101 | + runHook preBuild |
| 102 | + for i in cmdtocanonij2 cmdtocanonij3 cnijbe2 lgmon3 rastertocanonij tocanonij tocnpwg; do |
| 103 | + cd $i |
109 | 104 | make |
110 | | - ) |
| 105 | + cd .. |
| 106 | + done |
| 107 | + runHook postBuild |
111 | 108 | ''; |
112 | 109 |
|
113 | 110 | installPhase = '' |
114 | | - ( |
115 | | - cd lgmon3 |
116 | | - make install |
117 | | - ) |
118 | | -
|
119 | | - ( |
120 | | - cd cmdtocanonij2 |
| 111 | + runHook preInstall |
| 112 | + for i in cmdtocanonij2 cmdtocanonij3 cnijbe2 lgmon3 rastertocanonij tocanonij tocnpwg; do |
| 113 | + cd $i |
121 | 114 | make install |
122 | | - ) |
123 | | -
|
124 | | - ( |
125 | | - cd cmdtocanonij3 |
126 | | - make install |
127 | | - ) |
128 | | -
|
129 | | - ( |
130 | | - cd cnijbe2 |
131 | | - make install |
132 | | - ) |
133 | | -
|
134 | | - ( |
135 | | - cd rastertocanonij |
136 | | - make install |
137 | | - ) |
138 | | -
|
139 | | - ( |
140 | | - cd tocanonij |
141 | | - make install |
142 | | - ) |
143 | | -
|
144 | | - ( |
145 | | - cd tocnpwg |
146 | | - make install |
147 | | - ) |
| 115 | + cd .. |
| 116 | + done |
| 117 | + runHook postInstall |
| 118 | + ''; |
148 | 119 |
|
149 | | - mkdir -p $out/share/cups/model |
150 | | - cp ppd/*.ppd $out/share/cups/model |
| 120 | + postInstall = '' |
| 121 | + install -Dm755 -t $out/lib ${blobDir}/* |
| 122 | + install -Dm644 -t $out/share/cups/model ppd/*.ppd |
151 | 123 | ''; |
152 | 124 |
|
| 125 | + env = { |
| 126 | + NIX_CFLAGS_COMPILE = "-I${lib.getDev libxml2}/include/libxml2"; |
| 127 | + NIX_LDFLAGS = "-L../../${blobDir}"; |
| 128 | + }; |
| 129 | + |
153 | 130 | meta = { |
154 | 131 | description = "Canon InkJet printer drivers for many Pixma series printers"; |
155 | 132 | longDescription = '' |
156 | | - Canon InjKet printer drivers for series E200, E300, E3100, E3300, E4200, E450, E470, E480, |
157 | | - G3000, G3010, G4000, G4010, G5000, G5080, G6000, G6050, G6080, G7000, G7050, G7080, GM2000, |
158 | | - GM2080, GM4000, GM4080, iB4000, iB4100, iP110, MB2000, MB2100, MB2300, MB2700, MB5000, |
159 | | - MB5100, MB5300, MB5400, MG2900, MG3000, MG3600, MG5600, MG5700, MG6600, MG6700, MG6800, |
160 | | - MG6900, MG7500, MG7700, MX490, TR4500, TR703, TR7500, TR7530, TR8500, TR8530, TR8580, TR9530, |
161 | | - TS200, TS300, TS3100, TS3300, TS5000, TS5100, TS5300, TS5380, TS6000, TS6100, TS6130, TS6180, |
162 | | - TS6200, TS6230, TS6280, TS6300, TS6330, TS6380, TS700, TS708, TS7330, TS8000, TS8100, TS8130, |
163 | | - TS8180, TS8200, TS8230, TS8280, TS8300, TS8330, TS8380, TS9000, TS9100, TS9180, TS9500, |
164 | | - TS9580, XK50, XK60, XK70, XK80. |
| 133 | + Canon InkJet printer drivers for series BX110, E200, E300, E460, E470, |
| 134 | + E480, E3100, E3300, E3400, E3600, E4200, E4500, G500, G600, G1020, G1030, |
| 135 | + G2020, G2030, G2060, G2070, G3000, G3010, G3020, G3030, G3060, G3070, |
| 136 | + G3080, G3090, G4000, G4010, G4070, G4080, G4090, G5000, G5080, G6000, |
| 137 | + G6080, G7000, G7080, GM2000, GM2080, GM4000, GM4080, GX1000, GX2000, |
| 138 | + GX3000, GX4000, GX4000i, GX5000, GX5100, GX5500, GX6000, GX6100, GX6500, |
| 139 | + GX7000, GX7100, GX7100i, iB4000, iB4100, iP110, MB2000, MB2100, MB2300, |
| 140 | + MB2700, MB5000, MB5100, MB5300, MB5400, MG2900, MG3000, MG3600, MG5600, |
| 141 | + MG5700, MG6600, MG6800, MG6900, MG7500, MG7700, MX490, TR150, TR160, |
| 142 | + TR703, TR4500, TR4600, TR4700, TR7000, TR7100, TR7500, TR7530, TR7600, |
| 143 | + TR7800, TR8500, TR8530, TR8580, TR8600, TR8630, TR9530, TS200, TS300, |
| 144 | + TS700, TS708, TS2400, TS2600, TS3100, TS3300, TS3400, TS3500, TS3600, |
| 145 | + TS3700, TS4000, TS4100i, TS4300, TS5000, TS5100, TS5300, TS5350i, TS5380, |
| 146 | + TS5400, TS5500, TS5630, TS6000, TS6100, TS6130, TS6180, TS6200, TS6230, |
| 147 | + TS6280, TS6300, TS6330, TS6380, TS6400, TS6500, TS6500i, TS6630, TS6730, |
| 148 | + TS7330, TS7400, TS7430, TS7450i, TS7500i, TS7530, TS7600i, TS7630, TS7700, |
| 149 | + TS7700A, TS7700i, TS8000, TS8100, TS8130, TS8180, TS8200, TS8230, TS8280, |
| 150 | + TS8300, TS8330, TS8380, TS8430, TS8530, TS8630, TS8700, TS8800, TS8930, |
| 151 | + TS9000, TS9100, TS9180, TS9500, TS9580, XK50, XK60, XK70, XK80, XK90, |
| 152 | + XK100, XK110, XK120, XK130, XK140, XK500, XK510. |
165 | 153 | ''; |
166 | | - homepage = "https://hk.canon/en/support/0101048401/1"; |
| 154 | + downloadPage = "https://hk.canon/en/support/0101281901"; |
167 | 155 | license = lib.licenses.unfree; |
| 156 | + sourceProvenance = with lib.sourceTypes; [ |
| 157 | + fromSource |
| 158 | + binaryNativeCode |
| 159 | + ]; |
| 160 | + maintainers = with lib.maintainers; [ prince213 ]; |
168 | 161 | platforms = [ |
| 162 | + "aarch64-linux" |
169 | 163 | "i686-linux" |
| 164 | + "mips64el-linux" |
170 | 165 | "x86_64-linux" |
171 | 166 | ]; |
172 | | - maintainers = [ ]; |
173 | 167 | }; |
174 | 168 | } |
0 commit comments