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.

289 lines
8.2 KiB

  1. #
  2. # This is free software, licensed under the GNU General Public License v2.
  3. # See /LICENSE for more information.
  4. #
  5. include $(TOPDIR)/rules.mk
  6. PKG_NAME:=mjpg-streamer
  7. PKG_VERSION:=2018-10-25
  8. PKG_RELEASE:=3
  9. PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>, \
  10. Ted Hess <thess@kitschensync.net>
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://github.com/jacksonliam/mjpg-streamer.git
  13. PKG_SOURCE_VERSION:=ddb69b7b4f114f3c2ca01adf55712792ca8aed43
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_MIRROR_HASH:=d87ebff5de0c17a35a5b81adad5aa234bc70fe2bb17d1c6277c726845dc043bb
  17. PKG_LICENSE:=GPL-2.0
  18. PKG_LICENSE_FILES:=LICENSE
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/cmake.mk
  21. PKG_BUILD_DEPENDS:=MJPG_STREAMER_V4L2:libv4l zmq protobuf-c/host
  22. define Package/mjpg-streamer
  23. SECTION:=multimedia
  24. CATEGORY:=Multimedia
  25. TITLE:=MJPG-streamer
  26. DEPENDS:=+libpthread +libjpeg +MJPG_STREAMER_V4L2:libv4l
  27. URL:=https://github.com/jacksonliam/mjpg-streamer
  28. endef
  29. define Package/mjpg-streamer/Default/description
  30. Streaming application for Linux-UVC compatible webcams
  31. endef
  32. define Package/mjpg-streamer/description
  33. $(call Package/mjpg-streamer/Default/description)
  34. endef
  35. define Package/mjpg-streamer/conffiles
  36. /etc/config/mjpg-streamer
  37. endef
  38. define Package/mjpg-streamer/config
  39. if PACKAGE_mjpg-streamer-input-uvc
  40. config MJPG_STREAMER_V4L2
  41. bool "Build input_uvc with libv4l2 (camera controls)"
  42. default n
  43. select PACKAGE_libv4l
  44. endif
  45. endef
  46. define Package/mjpg-streamer/Default
  47. SECTION:=multimedia
  48. CATEGORY:=Multimedia
  49. TITLE:=MJPG-streamer
  50. URL:=https://github.com/jacksonliam/mjpg-streamer
  51. DEPENDS:=mjpg-streamer
  52. endef
  53. define Package/mjpg-streamer-input-file
  54. $(call Package/mjpg-streamer/Default)
  55. TITLE+= (file input)
  56. endef
  57. define Package/mjpg-streamer-input-file/description
  58. $(call Package/mjpg-streamer/Default/description)
  59. This package provides the file input plugin.
  60. endef
  61. define Package/mjpg-streamer-input-uvc
  62. $(call Package/mjpg-streamer/Default)
  63. TITLE+= (UVC input)
  64. endef
  65. define Package/mjpg-streamer-input-uvc/description
  66. $(call Package/mjpg-streamer/Default/description)
  67. This package provides the UVC input plugin.
  68. endef
  69. define Package/mjpg-streamer-input-http
  70. $(call Package/mjpg-streamer/Default)
  71. TITLE+= (HTTP input)
  72. endef
  73. define Package/mjpg-streamer-input-http/description
  74. $(call Package/mjpg-streamer/Default/description)
  75. This package provides the http input plugin.
  76. endef
  77. define Package/mjpg-streamer-output-rtsp
  78. $(call Package/mjpg-streamer/Default)
  79. TITLE+= (RTSP output)
  80. endef
  81. define Package/mjpg-streamer-output-rtsp/description
  82. $(call Package/mjpg-streamer/Default/description)
  83. This package provides the RTSP output plugin.
  84. endef
  85. define Package/mjpg-streamer-output-udp
  86. $(call Package/mjpg-streamer/Default)
  87. TITLE+= (UDP output)
  88. endef
  89. define Package/mjpg-streamer-output-udp/description
  90. $(call Package/mjpg-streamer/Default/description)
  91. This package provides the UDP output plugin.
  92. endef
  93. define Package/mjpg-streamer-output-file
  94. $(call Package/mjpg-streamer/Default)
  95. TITLE+= (file output)
  96. endef
  97. define Package/mjpg-streamer-output-file/description
  98. $(call Package/mjpg-streamer/Default/description)
  99. This package provides the file output plugin.
  100. endef
  101. define Package/mjpg-streamer-output-http
  102. $(call Package/mjpg-streamer/Default)
  103. TITLE+= (HTTP output)
  104. endef
  105. define Package/mjpg-streamer-output-http/description
  106. $(call Package/mjpg-streamer/Default/description)
  107. This package provides the HTTP output plugin.
  108. endef
  109. define Package/mjpg-streamer-output-zmq
  110. $(call Package/mjpg-streamer/Default)
  111. TITLE+= (zmq output)
  112. DEPENDS+= +libzmq +libprotobuf-c
  113. endef
  114. define Package/mjpg-streamer-output-zmq/description
  115. $(call Package/mjpg-streamer/Default/description)
  116. This package provides the ZeroMQ output plugin.
  117. endef
  118. define Package/mjpg-streamer-www
  119. $(call Package/mjpg-streamer/Default)
  120. TITLE+= (full www)
  121. CONFLICTS:=mjpg-streamer-www-simple
  122. endef
  123. define Package/mjpg-streamer-www/description
  124. $(call Package/mjpg-streamer/Default/description)
  125. This package provides full version of the web content.
  126. Includes cambozola applet.
  127. endef
  128. define Package/mjpg-streamer-www-simple
  129. $(call Package/mjpg-streamer/Default)
  130. TITLE+= (simple www)
  131. endef
  132. define Package/mjpg-streamer-www-simple/description
  133. $(call Package/mjpg-streamer/Default/description)
  134. This package provides simple version of the web content.
  135. endef
  136. CAMBOZOLA:=cambozola-0.936.tar.gz
  137. # Distribution URL doesn't always have the correct version
  138. # Using the OpenWrt mirror provides a stable version
  139. # orig-URL:=http://www.andywilcock.com/code/cambozola
  140. define Download/cambozola
  141. URL:=http://mirror2.openwrt.org/sources
  142. FILE:=$(CAMBOZOLA)
  143. MD5SUM:=35c45188aa9635aef2b745c35c311396
  144. endef
  145. # redefine prepare to extract to our build dir
  146. # apply patches
  147. define Build/Prepare
  148. rm -rf $(PKG_BUILD_DIR)/
  149. mkdir -p $(PKG_BUILD_DIR)/
  150. $(TAR) -xJf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip=2
  151. $(Build/Patch)
  152. # Fetch latest cambozola that works with latest Java(s)
  153. # Yes, I know this is ugly
  154. ifneq ($(CONFIG_PACKAGE_mjpg-streamer-www),)
  155. $(eval $(call Download,cambozola))
  156. $(TAR) -xf $(DL_DIR)/$(CAMBOZOLA) --strip=2 --wildcards \
  157. -C $(PKG_BUILD_DIR)/www */dist/cambozola.jar
  158. endif
  159. endef
  160. define Build/Configure
  161. $(RM) $(PKG_BUILD_DIR)/plugins/input_uvc/uvcvideo.h
  162. $(call Build/Configure/Default)
  163. endef
  164. TARGET_LDFLAGS+= -ljpeg
  165. ifeq ($(CONFIG_MJPG_STREAMER_V4L2),y)
  166. TARGET_CFLAGS+= -DUSE_LIBV4L2
  167. TARGET_LDFLAGS+= -lv4l2
  168. endif
  169. define Package/mjpg-streamer/install
  170. $(INSTALL_DIR) $(1)/usr/bin
  171. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mjpg_streamer $(1)/usr/bin/
  172. $(INSTALL_DIR) $(1)/etc/config
  173. $(CP) ./files/mjpg-streamer.config $(1)/etc/config/mjpg-streamer
  174. $(INSTALL_DIR) $(1)/etc/init.d
  175. $(INSTALL_BIN) ./files/mjpg-streamer.init $(1)/etc/init.d/mjpg-streamer
  176. $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
  177. $(INSTALL_DATA) ./files/mjpg-streamer.hotplug $(1)/etc/hotplug.d/usb/20-mjpg-streamer
  178. endef
  179. define Package/mjpg-streamer-input-file/install
  180. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  181. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/input_file.so $(1)/usr/lib/mjpg-streamer
  182. endef
  183. define Package/mjpg-streamer-input-uvc/install
  184. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  185. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/input_uvc.so $(1)/usr/lib/mjpg-streamer
  186. endef
  187. define Package/mjpg-streamer-input-http/install
  188. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  189. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/input_http.so $(1)/usr/lib/mjpg-streamer
  190. endef
  191. define Package/mjpg-streamer-output-rtsp/install
  192. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  193. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/output_rtsp.so $(1)/usr/lib/mjpg-streamer
  194. endef
  195. define Package/mjpg-streamer-output-udp/install
  196. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  197. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/output_udp.so $(1)/usr/lib/mjpg-streamer
  198. endef
  199. define Package/mjpg-streamer-output-file/install
  200. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  201. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/output_file.so $(1)/usr/lib/mjpg-streamer
  202. endef
  203. define Package/mjpg-streamer-output-http/install
  204. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  205. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/output_http.so $(1)/usr/lib/mjpg-streamer
  206. endef
  207. define Package/mjpg-streamer-output-zmq/install
  208. $(INSTALL_DIR) $(1)/usr/lib/mjpg-streamer
  209. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mjpg-streamer/output_zmqserver.so $(1)/usr/lib/mjpg-streamer
  210. endef
  211. define Package/mjpg-streamer-www/install
  212. $(INSTALL_DIR) $(1)/www/webcam
  213. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mjpg-streamer/www/* $(1)/www/webcam
  214. endef
  215. define Package/mjpg-streamer-www-simple/install
  216. $(INSTALL_DIR) $(1)/www/webcam
  217. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mjpg-streamer/www/stream_simple.html $(1)/www/webcam/index.html
  218. endef
  219. $(eval $(call BuildPackage,mjpg-streamer))
  220. $(eval $(call BuildPackage,mjpg-streamer-input-file))
  221. $(eval $(call BuildPackage,mjpg-streamer-input-uvc))
  222. $(eval $(call BuildPackage,mjpg-streamer-input-http))
  223. $(eval $(call BuildPackage,mjpg-streamer-output-rtsp))
  224. $(eval $(call BuildPackage,mjpg-streamer-output-file))
  225. $(eval $(call BuildPackage,mjpg-streamer-output-http))
  226. $(eval $(call BuildPackage,mjpg-streamer-output-zmq))
  227. $(eval $(call BuildPackage,mjpg-streamer-www))
  228. $(eval $(call BuildPackage,mjpg-streamer-www-simple))