Merge pull request #16078 from ja-pa/fix-email
[feed/packages.git] / utils / sane-backends / Makefile
1 #
2 # Copyright (C) 2006-2016 OpenWrt.org
3 # Copyright (C) 2017-2020 Luiz Angelo Daros de Luca <luizluca@gmail.com>
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=sane-backends
12 PKG_VERSION:=1.0.32
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=https://gitlab.com/sane-project/backends/uploads/104f09c07d35519cc8e72e604f11643f
17 PKG_HASH:=3a28c237c0a72767086202379f6dc92dbb63ec08dfbab22312cba80e238bb114
18
19 PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
20 PKG_LICENSE:=GPL-2.0 GPL-2.0-or-later
21 PKG_LICENSE_FILES:=COPYING LICENSE
22 PKG_CPE_ID:=cpe:/a:sane-backends_project:sane-backends
23
24 PKG_INSTALL:=1
25 PKG_BUILD_PARALLEL:=1
26
27 include $(INCLUDE_DIR)/package.mk
28
29 SANE_BACKENDS:=
30
31 define Package/sane-backends/Default
32 TITLE:=Scanner Access Now Easy
33 URL:=http://www.sane-project.org/
34 endef
35
36 define Package/sane-backends/Default/description
37 SANE (Scanner Access Now Easy) is a universal scanner interface.
38 endef
39
40 define Package/sane-backends
41 $(call Package/sane-backends/Default)
42 SECTION:=utils
43 CATEGORY:=Utilities
44 TITLE+= (drivers)
45 DEPENDS:=+ALL:sane-backends-all
46 endef
47
48 define Package/sane-backends/description
49 $(call Package/sane-backends/Default/description)
50 .
51 This
52 endef
53
54 define Package/sane-backends/config
55 menu "Select SANE backends"
56 depends on PACKAGE_sane-backends
57
58
59 config PACKAGE_sane-backends-all
60 depends on PACKAGE_sane-backends
61 tristate "Include all SANE backends (sane-backends-all)"
62
63 comment "Backends"
64
65 $(foreach backend,$(SANE_BACKENDS), \
66 $(eval \
67 $(call Package/Default)
68 $(call Package/sane-$(backend))
69 )\
70 config PACKAGE_sane-$(backend)
71 tristate "$(TITLE)"
72 $(foreach config_dep,\
73 $(filter @%,
74 $(foreach v, $(DEPENDS), $(if $(findstring :,$v),,$v))
75 ),\
76 depends on $(strip $(subst @,,$(config_dep)))
77 )
78 )
79 endmenu
80
81 endef
82
83 # returns conditional dependency on sane backend
84 # 1: backend name
85 #
86 # If there is no config deps on $(1), returns +sane-$(1).
87 # Otherwise, +(CONFIG1&&CONFIG2&&..):sane-$(1)
88 define SaneBackendDependency
89 $(eval \
90 $(call Package/Default)
91 $(call Package/sane-$(1))
92 FILTER_CONFIG:=$$(strip \
93 $$(foreach config_dep, \
94 $$(filter @%, \
95 $$(foreach v, \
96 $$(DEPENDS), \
97 $$(if $$(findstring :,$$v),,$$v) \
98 ) \
99 ), \
100 $$(subst @,,$$(config_dep)) \
101 ) \
102 )
103 ifneq (,$$(FILTER_CONFIG))
104 FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))):
105 endif
106 ) \
107 +$(FILTER_CONFIG)sane-$(1)
108 endef
109
110 define Package/sane-backends-all
111 $(call Package/sane-backends/Default)
112 SECTION:=utils
113 CATEGORY:=Utilities
114 TITLE+= (all backends)
115 DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(strip $(call SaneBackendDependency,$(backend))))
116 HIDDEN:=1
117 endef
118
119 define Package/sane-backends-all/description
120 $(call Package/sane-backends/Default/description)
121 .
122 Metapackage for selecting all SANE Backends
123 endef
124
125 define Package/sane-daemon
126 $(call Package/sane-backends/Default)
127 SECTION:=utils
128 CATEGORY:=Utilities
129 DEPENDS:=+libsane
130 TITLE+= (network daemon)
131 USERID:=saned:scanner
132 endef
133
134 define Package/sane-daemon/description
135 $(call Package/sane-backends/Default/description)
136 This package contains the SANE daemon.
137 endef
138
139 # Run hotplug to grant access to existing scanners
140 define Package/sane-daemon/postinst
141 #!/bin/sh
142 # We only need udevtrigger to have the magic work without
143 # rebooting on a real system. In ImageBuilder or
144 # the like, the boot process will call udevtrigger.
145 if [ -z "$${IPKG_INSTROOT}" ]; then
146 udevtrigger
147 fi
148 endef
149
150 define Package/libsane
151 $(call Package/sane-backends/Default)
152 SECTION:=libs
153 CATEGORY:=Libraries
154 DEPENDS+=+libusb-1.0
155 TITLE+= (libraries)
156 endef
157
158 define Package/libsane/description
159 $(call Package/sane-backends/Default/description)
160 This package contains the SANE shared libraries.
161 endef
162
163 define Package/sane-frontends
164 $(call Package/sane-backends/Default)
165 SECTION:=utils
166 CATEGORY:=Utilities
167 DEPENDS:=+libsane +libjpeg +libpng
168 TITLE+= (frontends)
169 endef
170
171 define Package/sane-frontends/description
172 $(call Package/sane-backends/Default/description)
173 This package contains the SANE frontends.
174 endef
175
176 CONFIGURE_ARGS += \
177 --enable-shared \
178 --enable-static \
179 --disable-preload \
180 --without-snmp \
181 --without-avahi \
182 --disable-locking \
183 --without-usb-record-replay \
184
185 # ./configure does not even try to detect mmap if crosscompiling
186 CONFIGURE_VARS += \
187 ac_cv_func_mmap_fixed_mapped="yes"
188
189 define Build/Configure
190 $(INSTALL_DIR) $(PKG_BUILD_DIR)/backend/.libs
191 $(Build/Configure/Default)
192 endef
193
194 define Build/Install
195 $(call Build/Install/Default)
196 $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/sane
197 cd $(PKG_BUILD_DIR)/doc/descriptions && for file in *.desc; do \
198 sed -rn -e '/^:usbid[[:blank:]]+"?0x(....)"?[[:blank:]]+"?0x(....)"?.*/{s//\1 \2/;p}' $$$$file | \
199 sort -u > $(PKG_INSTALL_DIR)/usr/share/sane/$$$${file/\.desc/}.usbid; \
200 awk -v path=$(PKG_INSTALL_DIR)/usr/share/sane -v file=$$$${file/\.desc/}.usbid '{ print $$$$2 > path"/"$$$$1"-"file }' \
201 $(PKG_INSTALL_DIR)/usr/share/sane/$$$${file/\.desc/}.usbid ; \
202 done
203 endef
204
205 define Package/libsane/install
206 $(INSTALL_DIR) $(1)/usr/lib/sane/
207 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/
208 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-dll.so.* $(1)/usr/lib/sane/
209 $(INSTALL_DIR) $(1)/etc/sane.d/dll.d
210 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/sane.d/dll.conf $(1)/etc/sane.d/
211 endef
212
213 define Package/libsane/conffiles
214 /etc/sane.d/dll.conf
215 endef
216
217 define Package/sane-daemon/install
218 $(INSTALL_DIR) $(1)/etc/sane.d
219 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
220 $(INSTALL_DIR) $(1)/usr/sbin
221 $(INSTALL_BIN) ./files/saned.sbin $(1)/usr/sbin/saned
222 $(INSTALL_DIR) $(1)/usr/lib/sane/
223 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/saned $(1)/usr/lib/sane/saned
224 $(INSTALL_DIR) $(1)/etc/xinetd.d
225 $(INSTALL_DATA) ./files/saned.xinetd $(1)/etc/xinetd.d/sane-port
226 $(INSTALL_DIR) $(1)/etc/hotplug.d/usb/
227 $(INSTALL_BIN) ./files/saned.hotplug $(1)/etc/hotplug.d/usb/20-saned
228 endef
229
230 define Package/sane-daemon/conffiles
231 /etc/sane.d/saned.conf
232 /etc/xinetd.d/sane-port
233 endef
234
235 define Package/sane-frontends/install
236 $(INSTALL_DIR) $(1)/usr/bin
237 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
238 endef
239
240 define Package/sane-backends-all/install
241 /bin/true
242 endef
243
244 define Build/InstallDev
245 $(INSTALL_DIR) $(1)/usr/include
246 $(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/
247 $(INSTALL_DIR) $(1)/usr/lib
248 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/
249 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
250 $(CP) $(PKG_BUILD_DIR)/tools/sane-backends.pc $(1)/usr/lib/pkgconfig/
251 endef
252
253 # 1: short name
254 # 2: description
255 # 3: dependencies on other packages
256 define SaneBackend
257 SANE_BACKENDS+= $(1)
258
259 define Package/sane-$(1)
260 $(call Package/sane-backends/Default)
261 TITLE:=SANE backend (sane-$(1)) for $(2)
262 DEPENDS+= +libsane $(3)
263 HIDDEN:=1
264 endef
265
266 define Package/sane-$(1)/description
267 $(call Package/sane-backends/Default/description)
268 .
269 This package contains the SANE backend for $(2).
270 endef
271
272 define Package/sane-$(1)/install
273 if [ -f "$(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf" ]; then \
274 $(INSTALL_DIR) $$(1)/etc/sane.d ; \
275 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf $$(1)/etc/sane.d/ ; \
276 fi ; \
277 $(INSTALL_DIR) $$(1)/usr/lib/sane ; \
278 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-$(1).so.* $$(1)/usr/lib/sane/ ; \
279 if [ -d "$(PKG_INSTALL_DIR)/usr/share/sane/$(1)" ]; then \
280 $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
281 $(CP) -a $(PKG_INSTALL_DIR)/usr/share/sane/$(1) $$(1)/usr/share/sane/ ; \
282 fi ; \
283 if [ -s "$(PKG_INSTALL_DIR)/usr/share/sane/$(1).usbid" ]; then \
284 $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
285 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/sane/????-$(1).usbid $$(1)/usr/share/sane/ ; \
286 fi
287 endef
288
289 define Package/sane-$(1)/conffiles
290 /etc/sane.d/$(1).conf
291 endef
292
293 $$(eval $$(call BuildPackage,sane-$(1)))
294 endef
295
296 $(eval $(call BuildPackage,libsane))
297 $(eval $(call BuildPackage,sane-daemon))
298 $(eval $(call SaneBackend,abaton,Abaton flatbed scanners))
299 $(eval $(call SaneBackend,agfafocus,AGFA Focus flatbed scanners))
300 $(eval $(call SaneBackend,apple,Apple flatbed scanners))
301 $(eval $(call SaneBackend,artec,Artec flatbed scanners))
302 $(eval $(call SaneBackend,artec_eplus48u,Artec E+ 48U and re-badged models,+libusb-1.0))
303 $(eval $(call SaneBackend,as6e,Artec AS6E parallel port interface scanner))
304 $(eval $(call SaneBackend,avision,Avision and Avision OEM scanners and possibly more flatbed and film scanners,+libusb-1.0))
305 $(eval $(call SaneBackend,bh,Bell+Howell Copiscan II series document scanners))
306 $(eval $(call SaneBackend,canon,Canon SCSI scanners,+libusb-1.0))
307 $(eval $(call SaneBackend,canon630u,the Canon 630u USB flatbed scanner,+libusb-1.0))
308 $(eval $(call SaneBackend,canon_dr,Canon DR-series scanners,+libusb-1.0))
309 # Depends on libieee1284
310 #$(eval $(call SaneBackend,canon_pp,Canon CanoScan Parallel Port flatbed scanners,+libieee1284))
311 $(eval $(call SaneBackend,canon_lide70,Canon LiDE 70 USB flatbed scanner,))
312 $(eval $(call SaneBackend,cardscan,Corex CardScan usb scanners,+libusb-1.0))
313 $(eval $(call SaneBackend,coolscan,Nikon film-scanners,+libusb-1.0))
314 $(eval $(call SaneBackend,coolscan2,Nikon Coolscan film scanners,+libusb-1.0))
315 $(eval $(call SaneBackend,coolscan3,Nikon Coolscan film scanners,+libusb-1.0))
316 $(eval $(call SaneBackend,dc210,Kodak DC210 Digital Camera,+libjpeg))
317 $(eval $(call SaneBackend,dc240,Kodak DC240 Digital Camera,+libjpeg))
318 $(eval $(call SaneBackend,dc25,Kodak DC20/DC25 Digital Cameras))
319 $(eval $(call SaneBackend,dell1600n_net,Dell 1600n,+libtiff +libjpeg))
320 $(eval $(call SaneBackend,dmc,Polaroid Digital Microscope Camera))
321 $(eval $(call SaneBackend,epjitsu,Epson-based Fujitsu USB scanners,+libusb-1.0))
322 $(eval $(call SaneBackend,epson,EPSON scanners,+libusb-1.0))
323 $(eval $(call SaneBackend,epsonds,EPSON scanners,+libjpeg +libusb-1.0)) ####
324 $(eval $(call SaneBackend,epson2,EPSON scanners,+libusb-1.0))
325 #$(eval $(call SaneBackend,escl,AirScan/eSCL devices,+libcurl +libxml2 +libnetsnmp +libavahi))
326 $(eval $(call SaneBackend,fujitsu,Fujitsu flatbed and ADF scanners,+libusb-1.0))
327 $(eval $(call SaneBackend,genesys,GL646 GL841 GL843 GL847 and GL124 based USB flatbed scanners,+libstdcpp +libusb-1.0 +libtiff))
328 $(eval $(call SaneBackend,gphoto2,digital cameras supported by gphoto2,+libjpeg +libgphoto2))
329 $(eval $(call SaneBackend,gt68xx,GT-68XX based USB flatbed scanners,+libusb-1.0))
330 $(eval $(call SaneBackend,hp,HP ScanJet scanners,+libusb-1.0))
331 $(eval $(call SaneBackend,hp3500,Hewlett-Packard ScanJet 3500 series scanners,+libusb-1.0))
332 $(eval $(call SaneBackend,hp3900,RTS8822 chipset based scanners,+libtiff +libusb-1.0))
333 $(eval $(call SaneBackend,hp4200,Hewlett-Packard 4200 scanners,+libusb-1.0))
334 $(eval $(call SaneBackend,hp5400,Hewlett-Packard 54XX scanners,+libusb-1.0))
335 $(eval $(call SaneBackend,hp5590,Hewlett-Packard 4500C/4570C/5500C/5550C/5590/7650 Workgroup/Document scanners,+libusb-1.0))
336 $(eval $(call SaneBackend,hpljm1005,Hewlett-Packard LaserJet M1005 MFP Scanner,+libusb-1.0))
337 # Depends on libieee1284
338 #$(eval $(call SaneBackend,hpsj5s,HP ScanJet 5S sheet-fed scanner,+libieee1284))
339 $(eval $(call SaneBackend,hs2p,Ricoh SCSI flatbed/ADF scanners))
340 $(eval $(call SaneBackend,ibm,IBM and Ricoh SCSI flatbed scanners))
341 $(eval $(call SaneBackend,kodak,big Kodak flatbed and ADF scanners,+libusb-1.0))
342 $(eval $(call SaneBackend,kodakaio,Kodak aio printer / scanners,+libusb-1.0))
343 $(eval $(call SaneBackend,kvs1025,Panasonic KV-S102xC USB ADF scanners,+libusb-1.0))
344 $(eval $(call SaneBackend,kvs20xx,Panasonic KV-S20xxC USB/SCSI ADF scanners,+libusb-1.0))
345 $(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners,+libpthread +libusb-1.0))
346 $(eval $(call SaneBackend,leo,LEO Technologies scanners))
347 $(eval $(call SaneBackend,lexmark,Lexmark X1100/X1200 Series scanners,+libusb-1.0))
348 $(eval $(call SaneBackend,ma1509,Mustek BearPaw 1200F USB scanner,+libusb-1.0))
349 $(eval $(call SaneBackend,magicolor,KONICA MINOLTA magicolor scanners,+libusb-1.0))
350 $(eval $(call SaneBackend,matsushita,Panasonic KV-SS high speed scanners))
351 $(eval $(call SaneBackend,microtek,Microtek scanners))
352 $(eval $(call SaneBackend,microtek2,Microtek scanners with SCSI-2 command set))
353 $(eval $(call SaneBackend,mustek,Mustek SCSI flatbed scanners and some other devices))
354 # Depends on libieee1284
355 #$(eval $(call SaneBackend,mustek_pp,Mustek parallel port flatbed scanners,+libieee1284))
356 $(eval $(call SaneBackend,mustek_usb,Mustek USB flatbed scanners,+libusb-1.0))
357 $(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners,+libpthread +libusb-1.0))
358 $(eval $(call SaneBackend,nec,NEC scanners))
359 $(eval $(call SaneBackend,net,network backend))
360 $(eval $(call SaneBackend,niash,scanners based on the NIASH chipset,+libusb-1.0))
361 $(eval $(call SaneBackend,p5,the Primax PagePartner))
362 $(eval $(call SaneBackend,pie,PIE Devcom and AdLib SCSI flatbed scanners))
363 $(eval $(call SaneBackend,pieusb,PIE Devcom and AdLib SCSI flatbed scanners,+libusb-1.0))
364 # requires sys/scanio.h
365 #$(eval $(call SaneBackend,pint,))
366 $(eval $(call SaneBackend,pixma,Canon Multi-Function Printers and CanoScan Scanners,+libusb-1.0 +libjpeg))
367 $(eval $(call SaneBackend,plustek,LM983[1/2/3] based USB flatbed scanners,+libusb-1.0))
368 $(eval $(call SaneBackend,plustek_pp,Plustek parallel port flatbed scanners))
369 $(eval $(call SaneBackend,qcam,Connectix QuickCam cameras,@(TARGET_x86||TARGET_x86_64)))
370 $(eval $(call SaneBackend,ricoh,Ricoh flatbed scanners))
371 $(eval $(call SaneBackend,ricoh2,Ricoh2 flatbed scanners,+libusb-1.0))
372 $(eval $(call SaneBackend,rts8891,rts8891 based scanners,+libusb-1.0))
373 $(eval $(call SaneBackend,s9036,Siemens 9036 flatbed scanners))
374 $(eval $(call SaneBackend,sceptre,SCEPTRE scanners))
375 $(eval $(call SaneBackend,sharp,SHARP scanners))
376 $(eval $(call SaneBackend,sm3600,Microtek scanners with M011 USB chip,+libusb-1.0))
377 $(eval $(call SaneBackend,sm3840,Microtek scanners with SCAN08 USB chip,+libusb-1.0))
378 $(eval $(call SaneBackend,snapscan,AGFA SnapScan flatbed scanners,+libusb-1.0))
379 $(eval $(call SaneBackend,sp15c,Fujitsu ScanPartner 15C flatbed scanner))
380 $(eval $(call SaneBackend,st400,Siemens ST/Highscan flatbed scanners))
381 $(eval $(call SaneBackend,stv680,STV680 cameras,+libusb-1.0))
382 $(eval $(call SaneBackend,tamarack,Tamarack flatbed scanners))
383 $(eval $(call SaneBackend,teco1,TECO / RELISYS scanners))
384 $(eval $(call SaneBackend,teco2,TECO / RELISYS scanners))
385 $(eval $(call SaneBackend,teco3,TECO / RELISYS scanners))
386 $(eval $(call SaneBackend,test,testing frontends))
387 $(eval $(call SaneBackend,u12,Plustek USB flatbed scanners based on older parport designs,+libusb-1.0))
388 $(eval $(call SaneBackend,umax,UMAX scanners,+libusb-1.0))
389 $(eval $(call SaneBackend,umax1220u,the UMAX Astra 1220U and similar scanners,+libusb-1.0))
390 $(eval $(call SaneBackend,umax_pp,Umax Astra parallel port flatbed scanners))
391 $(eval $(call SaneBackend,v4l,Video for Linux API,+libv4l +libjpeg +libusb-1.0))
392 $(eval $(call SaneBackend,xerox_mfp,Xerox Phaser 3200MFP device,+libjpeg +libusb-1.0))
393 $(eval $(call BuildPackage,sane-backends))
394 $(eval $(call BuildPackage,sane-backends-all))
395 $(eval $(call BuildPackage,sane-frontends))