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.

127 lines
3.7 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-04-14
  8. PKG_RELEASE:=1
  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:=821c330ea6bbb5fbed98d48e00aac156e923161b
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_MIRROR_HASH:=f95e54bc95c808b9867bbca364e58b6c7e08cb26613205f8d87450ab9c899942
  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
  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. MENU:=1
  29. endef
  30. define Package/mjpg-streamer/description
  31. Streaming application for Linux-UVC compatible webcams
  32. endef
  33. define Package/mjpg-streamer/config
  34. source "$(SOURCE)/Config.in"
  35. endef
  36. define Package/mjpg-streamer/conffiles
  37. /etc/config/mjpg-streamer
  38. endef
  39. CAMBOZOLA:=cambozola-0.936.tar.gz
  40. # Distribution URL doesn't always have the correct version
  41. # Using the OpenWrt mirror provides a stable version
  42. # orig-URL:=http://www.andywilcock.com/code/cambozola
  43. define Download/cambozola
  44. URL:=http://mirror2.openwrt.org/sources
  45. FILE:=$(CAMBOZOLA)
  46. MD5SUM:=35c45188aa9635aef2b745c35c311396
  47. endef
  48. # redefine prepare to extract to our build dir
  49. # apply patches
  50. define Build/Prepare
  51. rm -rf $(PKG_BUILD_DIR)/
  52. mkdir -p $(PKG_BUILD_DIR)/
  53. $(TAR) -xJf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip=2
  54. $(Build/Patch)
  55. # Fetch latest cambozola that works with latest Java(s)
  56. # Yes, I know this is ugly
  57. ifeq ($(CONFIG_MJPG_STREAMER_WWW),y)
  58. $(eval $(call Download,cambozola))
  59. $(TAR) -xf $(DL_DIR)/$(CAMBOZOLA) --strip=2 --wildcards \
  60. -C $(PKG_BUILD_DIR)/www */dist/cambozola.jar
  61. endif
  62. endef
  63. define Build/Configure
  64. $(RM) $(PKG_BUILD_DIR)/plugins/input_uvc/uvcvideo.h
  65. endef
  66. TARGET_LDFLAGS+= -ljpeg
  67. ifeq ($(CONFIG_MJPG_STREAMER_V4L2),y)
  68. TARGET_CFLAGS+= -DUSE_LIBV4L2
  69. TARGET_LDFLAGS+= -lv4l2
  70. endif
  71. define Package/mjpg-streamer/install
  72. $(INSTALL_DIR) $(1)/usr/bin
  73. $(INSTALL_BIN) $(PKG_BUILD_DIR)/mjpg_streamer $(1)/usr/bin/
  74. $(INSTALL_DIR) $(1)/etc/config
  75. $(CP) ./files/mjpg-streamer.config $(1)/etc/config/mjpg-streamer
  76. $(INSTALL_DIR) $(1)/etc/init.d
  77. $(INSTALL_BIN) ./files/mjpg-streamer.init $(1)/etc/init.d/mjpg-streamer
  78. $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
  79. $(INSTALL_DATA) ./files/mjpg-streamer.hotplug $(1)/etc/hotplug.d/usb/20-mjpg-streamer
  80. $(INSTALL_DIR) $(1)/usr/lib
  81. ifeq ($(CONFIG_MJPG_STREAMER_INPUT_FILE),y)
  82. $(CP) $(PKG_BUILD_DIR)/input_file.so $(1)/usr/lib
  83. endif
  84. ifeq ($(CONFIG_MJPG_STREAMER_INPUT_UVC),y)
  85. $(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
  86. endif
  87. ifeq ($(CONFIG_MJPG_STREAMER_INPUT_HTTP),y)
  88. $(CP) $(PKG_BUILD_DIR)/input_http.so $(1)/usr/lib
  89. endif
  90. ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_RTSP),y)
  91. $(CP) $(PKG_BUILD_DIR)/output_rtsp.so $(1)/usr/lib
  92. endif
  93. ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_UDP),y)
  94. $(CP) $(PKG_BUILD_DIR)/output_udp.so $(1)/usr/lib
  95. endif
  96. ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_FILE),y)
  97. $(CP) $(PKG_BUILD_DIR)/output_file.so $(1)/usr/lib
  98. endif
  99. ifeq ($(CONFIG_MJPG_STREAMER_OUTPUT_HTTP),y)
  100. $(CP) $(PKG_BUILD_DIR)/output_http.so $(1)/usr/lib
  101. $(INSTALL_DIR) $(1)/www/webcam
  102. ifeq ($(CONFIG_MJPG_STREAMER_WWW),y)
  103. $(INSTALL_DATA) $(PKG_BUILD_DIR)/www/* $(1)/www/webcam
  104. else
  105. $(INSTALL_DATA) $(PKG_BUILD_DIR)/www/stream_simple.html $(1)/www/webcam/index.html
  106. endif
  107. endif
  108. endef
  109. $(eval $(call BuildPackage,mjpg-streamer))