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.

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