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.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:=2019-05-24
  8. PKG_RELEASE:=1
  9. PKG_SOURCE_PROTO:=git
  10. PKG_SOURCE_URL:=https://github.com/jacksonliam/mjpg-streamer
  11. PKG_SOURCE_VERSION:=501f6362c5afddcfb41055f97ae484252c85c912
  12. PKG_MIRROR_HASH:=9e1f098c5092ae6cc70916caf9d45808a312333973524725ae5e729a4af18657
  13. PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>, \
  14. Ted Hess <thess@kitschensync.net>
  15. PKG_LICENSE:=GPL-2.0-or-later
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_BUILD_DEPENDS:=MJPG_STREAMER_V4L2:libv4l zmq protobuf-c/host
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/cmake.mk
  21. define Package/mjpg-streamer
  22. SECTION:=multimedia
  23. CATEGORY:=Multimedia
  24. TITLE:=MJPG-streamer
  25. DEPENDS:=+libpthread +libjpeg +MJPG_STREAMER_V4L2:libv4l
  26. URL:=https://github.com/jacksonliam/mjpg-streamer
  27. endef
  28. define Package/mjpg-streamer/Default/description
  29. Streaming application for Linux-UVC compatible webcams
  30. endef
  31. define Package/mjpg-streamer/description
  32. $(call Package/mjpg-streamer/Default/description)
  33. endef
  34. define Package/mjpg-streamer/conffiles
  35. /etc/config/mjpg-streamer
  36. endef
  37. define Package/mjpg-streamer/config
  38. if PACKAGE_mjpg-streamer-input-uvc
  39. config MJPG_STREAMER_V4L2
  40. bool "Build input_uvc with libv4l2 (camera controls)"
  41. default n
  42. select PACKAGE_libv4l
  43. endif
  44. endef
  45. define Package/mjpg-streamer/Default
  46. SECTION:=multimedia
  47. CATEGORY:=Multimedia
  48. TITLE:=MJPG-streamer
  49. URL:=https://github.com/jacksonliam/mjpg-streamer
  50. DEPENDS:=mjpg-streamer
  51. endef
  52. define Package/mjpg-streamer-input-file
  53. $(call Package/mjpg-streamer/Default)
  54. TITLE+= (file input)
  55. endef
  56. define Package/mjpg-streamer-input-file/description
  57. $(call Package/mjpg-streamer/Default/description)
  58. This package provides the file input plugin.
  59. endef
  60. define Package/mjpg-streamer-input-uvc
  61. $(call Package/mjpg-streamer/Default)
  62. TITLE+= (UVC input)
  63. endef
  64. define Package/mjpg-streamer-input-uvc/description
  65. $(call Package/mjpg-streamer/Default/description)
  66. This package provides the UVC input plugin.
  67. endef
  68. define Package/mjpg-streamer-input-http
  69. $(call Package/mjpg-streamer/Default)
  70. TITLE+= (HTTP input)
  71. endef
  72. define Package/mjpg-streamer-input-http/description
  73. $(call Package/mjpg-streamer/Default/description)
  74. This package provides the http input plugin.
  75. endef
  76. define Package/mjpg-streamer-output-rtsp
  77. $(call Package/mjpg-streamer/Default)
  78. TITLE+= (RTSP output)
  79. endef
  80. define Package/mjpg-streamer-output-rtsp/description
  81. $(call Package/mjpg-streamer/Default/description)
  82. This package provides the RTSP output plugin.
  83. endef
  84. define Package/mjpg-streamer-output-udp
  85. $(call Package/mjpg-streamer/Default)
  86. TITLE+= (UDP output)
  87. endef
  88. define Package/mjpg-streamer-output-udp/description
  89. $(call Package/mjpg-streamer/Default/description)
  90. This package provides the UDP output plugin.
  91. endef
  92. define Package/mjpg-streamer-output-file
  93. $(call Package/mjpg-streamer/Default)
  94. TITLE+= (file output)
  95. endef
  96. define Package/mjpg-streamer-output-file/description
  97. $(call Package/mjpg-streamer/Default/description)
  98. This package provides the file output plugin.
  99. endef
  100. define Package/mjpg-streamer-output-http
  101. $(call Package/mjpg-streamer/Default)
  102. TITLE+= (HTTP output)
  103. endef
  104. define Package/mjpg-streamer-output-http/description
  105. $(call Package/mjpg-streamer/Default/description)
  106. This package provides the HTTP output plugin.
  107. endef
  108. define Package/mjpg-streamer-output-zmq
  109. $(call Package/mjpg-streamer/Default)
  110. TITLE+= (zmq output)
  111. DEPENDS+= +libzmq +libprotobuf-c
  112. endef
  113. define Package/mjpg-streamer-output-zmq/description
  114. $(call Package/mjpg-streamer/Default/description)
  115. This package provides the ZeroMQ output plugin.
  116. endef
  117. define Package/mjpg-streamer-www
  118. $(call Package/mjpg-streamer/Default)
  119. TITLE+= (full www)
  120. CONFLICTS:=mjpg-streamer-www-simple
  121. endef
  122. define Package/mjpg-streamer-www/description
  123. $(call Package/mjpg-streamer/Default/description)
  124. This package provides full version of the web content.
  125. Includes cambozola applet.
  126. endef
  127. define Package/mjpg-streamer-www-simple
  128. $(call Package/mjpg-streamer/Default)
  129. TITLE+= (simple www)
  130. endef
  131. define Package/mjpg-streamer-www-simple/description
  132. $(call Package/mjpg-streamer/Default/description)
  133. This package provides simple version of the web content.
  134. endef
  135. CMAKE_OPTIONS += -DCMAKE_SKIP_RPATH=FALSE
  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:=https://sources.openwrt.org/
  142. FILE:=$(CAMBOZOLA)
  143. HASH:=4e4e92d95673edd051e6b4d36bed8c5328873f5fc374073760b457d4be33415b
  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))