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.

103 lines
3.1 KiB

  1. #
  2. # Copyright (C) 2017 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. include $(TOPDIR)/rules.mk
  7. PKG_NAME:=v4l2rtspserver
  8. PKG_VERSION:=0.1.1
  9. PKG_RELEASE:=1
  10. #cannot use codeload as this uses submodules
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://github.com/mpromonet/v4l2rtspserver
  13. PKG_SOURCE_VERSION:=v$(PKG_VERSION)
  14. PKG_MIRROR_HASH:=3e3c106b41562be010ba2132903ebf9cdc75a2caceca468b10e2cd0d2939e940
  15. PKG_MAINTAINER:=Roger Dammit <rogerdammit@gmail.com>
  16. PKG_LICENSE:=Unlicense
  17. PKG_LICENSE_FILES:=LICENSE
  18. LIVE555_VERSION:=2018.12.14
  19. LIVE555_HASH:=8dc31f76909602c3c07c8f876237e6ab7ac674d00f1bb065eda20e719f772a47
  20. LIVE555_FILE:=live.$(LIVE555_VERSION).tar.gz
  21. PKG_BUILD_PARALLEL:=1
  22. CMAKE_INSTALL:=1
  23. include $(INCLUDE_DIR)/uclibc++.mk
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/cmake.mk
  26. define Package/v4l2rtspserver
  27. SECTION:=multimedia
  28. CATEGORY:=Multimedia
  29. TITLE:=v4l2rtspserver
  30. DEPENDS:=$(CXX_DEPENDS)
  31. URL:=https://github.com/mpromonet/v4l2rtspserver
  32. endef
  33. define Package/v4l2rtspserver/description
  34. RTSP server for v4L2 video sources
  35. endef
  36. define Package/v4l2rtspserver/conffiles
  37. /etc/config/v4l2rtspserver
  38. endef
  39. define Download/live555
  40. URL:=https://download.videolan.org/pub/contrib/live555/
  41. FILE:=$(LIVE555_FILE)
  42. HASH:=$(LIVE555_HASH)
  43. endef
  44. TARGET_CFLAGS += -flto
  45. TARGET_CXXFLAGS += -fno-rtti
  46. TARGET_LDFLAGS += -Wl,--gc-sections
  47. define Build/Prepare
  48. $(Build/Prepare/Default)
  49. ## need to compile some dependencies so that cmake will find them
  50. # build live555
  51. $(eval $(call Download,live555))
  52. mkdir -p $(PKG_BUILD_DIR)/live555
  53. $(TAR) -xf $(DL_DIR)/$(LIVE555_FILE) --strip=1 -C $(PKG_BUILD_DIR)/live555
  54. $(CP) files/config.openwrt $(PKG_BUILD_DIR)/live555
  55. ( cd $(PKG_BUILD_DIR)/live555; ./genMakefiles openwrt )
  56. +$(MAKE_VARS) $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR)/live555
  57. $(MAKE_VARS) $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR)/live555 PREFIX="$(STAGING_DIR)/usr/" install
  58. # build v4l2wrapper
  59. +$(MAKE_VARS) $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR)/v4l2wrapper
  60. $(CP) $(PKG_BUILD_DIR)/v4l2wrapper/libv4l2wrapper.a $(PKG_BUILD_DIR)
  61. # cmake patches (these are very hacky and should be a lot cleaner)
  62. # prevent root path override
  63. $(SED) 's/SET(CMAKE_FIND_ROOT_PATH/#SET(CMAKE_FIND_ROOT_PATH/' $(PKG_BUILD_DIR)/CMakeLists.txt
  64. # set search path for v4l2wrapper to current build dir
  65. $(SED) 's/V4L2WRAPPER_LIBRARY libv4l2wrapper.a/V4L2WRAPPER_LIBRARY libv4l2wrapper.a PATHS "." NO_CMAKE_FIND_ROOT_PATH/' $(PKG_BUILD_DIR)/CMakeLists.txt
  66. # disable ALSA
  67. $(SED) 's/find_package(ALSA QUIET)//' $(PKG_BUILD_DIR)/CMakeLists.txt
  68. endef
  69. define Package/v4l2rtspserver/install
  70. $(INSTALL_DIR) $(1)/usr/bin
  71. $(INSTALL_BIN) $(PKG_BUILD_DIR)/v4l2rtspserver-$(PKG_VERSION) $(1)/usr/bin/
  72. mv $(1)/usr/bin/v4l2rtspserver-$(PKG_VERSION) $(1)/usr/bin/v4l2rtspserver
  73. $(INSTALL_DIR) $(1)/etc/init.d
  74. $(INSTALL_BIN) files/v4l2rtspserver.init $(1)/etc/init.d/v4l2rtspserver
  75. $(INSTALL_DIR) $(1)/etc/config
  76. $(INSTALL_CONF) files/v4l2rtspserver.config $(1)/etc/config/v4l2rtspserver
  77. endef
  78. $(eval $(call BuildPackage,v4l2rtspserver))