prometheus-node-exporter-lua: add dawn exporter
[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.29
13 PKG_RELEASE:=1
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://gitlab.com/sane-project/backends/uploads/54f858b20a364fc35d820df935a86478
16 PKG_HASH:=aa027b4e5f59849cd41b8c26d54584cf31fffd986049019be6ad4140e11ea8ed
17 PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
18 PKG_LICENSE:=GPL-2.0 GPL-2.0-or-later
19 PKG_LICENSE_FILES:=COPYING LICENSE
20 PKG_CPE_ID:=cpe:/a:sane-backends_project:sane-backends
21
22 PKG_INSTALL:=1
23 PKG_BUILD_PARALLEL:=1
24
25 include $(INCLUDE_DIR)/package.mk
26
27 SANE_BACKENDS:=
28
29 define Package/sane-backends/Default
30 TITLE:=Scanner Access Now Easy
31 URL:=http://www.sane-project.org/
32 endef
33
34 define Package/sane-backends/Default/description
35 SANE (Scanner Access Now Easy) is a universal scanner interface.
36 endef
37
38 define Package/sane-backends
39 $(call Package/sane-backends/Default)
40 SECTION:=utils
41 CATEGORY:=Utilities
42 TITLE+= (drivers)
43 DEPENDS:=+ALL:sane-backends-all
44 endef
45
46 define Package/sane-backends/description
47 $(call Package/sane-backends/Default/description)
48 .
49 This
50 endef
51
52 define Package/sane-backends/config
53 menu "Select SANE backends"
54 depends on PACKAGE_sane-backends
55
56
57 config PACKAGE_sane-backends-all
58 depends on PACKAGE_sane-backends
59 tristate "Include all SANE backends (sane-backends-all)"
60
61 comment "Backends"
62
63 $(foreach backend,$(SANE_BACKENDS), \
64 $(eval \
65 $(call Package/Default)
66 $(call Package/sane-$(backend))
67 )\
68 config PACKAGE_sane-$(backend)
69 tristate "$(TITLE)"
70 $(foreach config_dep,\
71 $(filter @%,
72 $(foreach v, $(DEPENDS), $(if $(findstring :,$v),,$v))
73 ),\
74 depends on $(strip $(subst @,,$(config_dep)))
75 )
76 )
77 endmenu
78
79 endef
80
81 # returns conditional dependency on sane backend
82 # 1: backend name
83 #
84 # If there is no config deps on $(1), returns +sane-$(1).
85 # Otherwise, +(CONFIG1&&CONFIG2&&..):sane-$(1)
86 define SaneBackendDependency
87 $(eval \
88 $(call Package/Default)
89 $(call Package/sane-$(1))
90 FILTER_CONFIG:=$$(strip \
91 $$(foreach config_dep, \
92 $$(filter @%, \
93 $$(foreach v, \
94 $$(DEPENDS), \
95 $$(if $$(findstring :,$$v),,$$v) \
96 ) \
97 ), \
98 $$(subst @,,$$(config_dep)) \
99 ) \
100 )
101 ifneq (,$$(FILTER_CONFIG))
102 FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))):
103 endif
104 ) \
105 +$(FILTER_CONFIG)sane-$(1)
106 endef
107
108 define Package/sane-backends-all
109 $(call Package/sane-backends/Default)
110 SECTION:=utils
111 CATEGORY:=Utilities
112 TITLE+= (all backends)
113 DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(strip $(call SaneBackendDependency,$(backend))))
114 HIDDEN:=1
115 endef
116
117 define Package/sane-backends-all/description
118 $(call Package/sane-backends/Default/description)
119 .
120 Metapackage for selecting all SANE Backends
121 endef
122
123 define Package/sane-daemon
124 $(call Package/sane-backends/Default)
125 SECTION:=utils
126 CATEGORY:=Utilities
127 DEPENDS:=+libsane
128 TITLE+= (network daemon)
129 USERID:=saned:scanner
130 endef
131
132 define Package/sane-daemon/description
133 $(call Package/sane-backends/Default/description)
134 This package contains the SANE daemon.
135 endef
136
137 # Run hotplug to grant access to existing scanners
138 define Package/sane-daemon/postinst
139 #!/bin/sh
140 # We only need udevtrigger to have the magic work without
141 # rebooting on a real system. In ImageBuilder or
142 # the like, the boot process will call udevtrigger.
143 if [ -z "$${IPKG_INSTROOT}" ]; then
144 udevtrigger
145 fi
146 endef
147
148 define Package/libsane
149 $(call Package/sane-backends/Default)
150 SECTION:=libs
151 CATEGORY:=Libraries
152 DEPENDS+=+libusb-1.0
153 TITLE+= (libraries)
154 endef
155
156 define Package/libsane/description
157 $(call Package/sane-backends/Default/description)
158 This package contains the SANE shared libraries.
159 endef
160
161 define Package/sane-frontends
162 $(call Package/sane-backends/Default)
163 SECTION:=utils
164 CATEGORY:=Utilities
165 DEPENDS:=+libsane +libjpeg +libpng
166 TITLE+= (frontends)
167 endef
168
169 define Package/sane-frontends/description
170 $(call Package/sane-backends/Default/description)
171 This package contains the SANE frontends.
172 endef
173
174 CONFIGURE_ARGS+= \
175 --enable-shared \
176 --enable-static \
177 --disable-preload \
178 --without-snmp \
179 --disable-avahi \
180 --disable-locking \
181 --without-usb-record-replay \
182
183 # ./configure does not even try to detect mmap if crosscompiling
184 CONFIGURE_VARS+= \
185 ac_cv_func_mmap_fixed_mapped="yes" \
186
187 define Build/Configure
188 mkdir -p $(PKG_BUILD_DIR)/backend/.libs
189 $(Build/Configure/Default)
190 endef
191
192 define Build/Install
193 $(call Build/Install/Default)
194 mkdir -p $(PKG_INSTALL_DIR)/usr/share/sane
195 $(foreach file, $(filter-out %/unsupported.desc ,$(wildcard $(PKG_BUILD_DIR)/doc/descriptions/*.desc)),
196 sed -rn -e '/^:usbid[[:blank:]]+"?0x(....)"?[[:blank:]]+"?0x(....)"?.*/{s//\1 \2/;p}' $(file) | \
197 sort -u > $(PKG_INSTALL_DIR)/usr/share/sane/$(basename $(notdir $(file))).usbid; \
198 awk '{ print $$$$2 > "$(PKG_INSTALL_DIR)/usr/share/sane/"$$$$1"-$(basename $(notdir $(file))).usbid" }' \
199 $(PKG_INSTALL_DIR)/usr/share/sane/$(basename $(notdir $(file))).usbid ;
200 )
201 endef
202
203 define Package/libsane/install
204 $(INSTALL_DIR) $(1)/usr/lib/sane/
205 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/
206 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-dll.so.* $(1)/usr/lib/sane/
207 $(INSTALL_DIR) $(1)/etc/sane.d/dll.d
208 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/dll.conf $(1)/etc/sane.d/
209 chmod 0644 $(1)/etc/sane.d/dll.conf
210 endef
211
212 define Package/libsane/conffiles
213 /etc/sane.d/dll.conf
214 endef
215
216 define Package/sane-daemon/install
217 $(INSTALL_DIR) $(1)/etc/sane.d
218 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
219 chmod 0644 $(1)/etc/sane.d/saned.conf
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_CONF) ./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_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf $$(1)/etc/sane.d/ ; \
276 chmod 0644 $$(1)/etc/sane.d/$(1).conf ; \
277 fi ; \
278 $(INSTALL_DIR) $$(1)/usr/lib/sane ; \
279 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-$(1).so.* $$(1)/usr/lib/sane/ ; \
280 if [ -d "$(PKG_INSTALL_DIR)/usr/share/sane/$(1)" ]; then \
281 $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
282 $(CP) -a $(PKG_INSTALL_DIR)/usr/share/sane/$(1) $$(1)/usr/share/sane/ ; \
283 fi ; \
284 if [ -s "$(PKG_INSTALL_DIR)/usr/share/sane/$(1).usbid" ]; then \
285 $(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
286 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/sane/????-$(1).usbid $$(1)/usr/share/sane/ ; \
287 fi
288 endef
289
290 define Package/sane-$(1)/conffiles
291 /etc/sane.d/$(1).conf
292 endef
293
294 $$(eval $$(call BuildPackage,sane-$(1)))
295 endef
296
297 $(eval $(call BuildPackage,libsane))
298 $(eval $(call BuildPackage,sane-daemon))
299 $(eval $(call SaneBackend,abaton,Abaton flatbed scanners))
300 $(eval $(call SaneBackend,agfafocus,AGFA Focus flatbed scanners))
301 $(eval $(call SaneBackend,apple,Apple flatbed scanners))
302 $(eval $(call SaneBackend,artec,Artec flatbed scanners))
303 $(eval $(call SaneBackend,artec_eplus48u,Artec E+ 48U and re-badged models,+libusb-1.0))
304 $(eval $(call SaneBackend,as6e,Artec AS6E parallel port interface scanner))
305 $(eval $(call SaneBackend,avision,Avision and Avision OEM scanners and possibly more flatbed and film scanners,+libusb-1.0))
306 $(eval $(call SaneBackend,bh,Bell+Howell Copiscan II series document scanners))
307 $(eval $(call SaneBackend,canon,Canon SCSI scanners,+libusb-1.0))
308 $(eval $(call SaneBackend,canon630u,the Canon 630u USB flatbed scanner,+libusb-1.0))
309 $(eval $(call SaneBackend,canon_dr,Canon DR-series scanners,+libusb-1.0))
310 # Depends on libieee1284
311 #$(eval $(call SaneBackend,canon_pp,Canon CanoScan Parallel Port flatbed scanners,+libieee1284))
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))
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))