You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

394 lines
15 KiB

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