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.

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