crtmpserver: Switch to CMake and uClibc++
authorRosen Penev <rosenp@gmail.com>
Thu, 17 Oct 2019 02:21:02 +0000 (19:21 -0700)
committerRosen Penev <rosenp@gmail.com>
Thu, 17 Oct 2019 02:21:02 +0000 (19:21 -0700)
Smaller size.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
multimedia/crtmpserver/Makefile
multimedia/crtmpserver/patches/010-no-werror.patch [new file with mode: 0644]
multimedia/crtmpserver/patches/040-syslog.patch [deleted file]

index 0a19c1def346bf7f134c88ddda8be9c718b1464f..796700357418e8a2ab986d355068628da9c92eb2 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=crtmpserver
 PKG_SOURCE_DATE:=2015-10-04
 PKG_SOURCE_VERSION:=b866fffca37c3b967a8878499cd2b91aa2587f34
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/shiretu/crtmpserver/tar.gz/$(PKG_SOURCE_VERSION)?
@@ -18,18 +18,23 @@ PKG_HASH:=3744bef060129fda6f7902eb64f566b0d5049864dc542b2882c550b083ef82aa
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
 
 PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
-PKG_LICENSE:=GPL-3.0
+PKG_LICENSE:=GPL-3.0-or-later
 PKG_LICENSE_FILES:=LICENSE
 
-PKG_BUILD_PARALLEL:=1
+CMAKE_INSTALL:=1
+CMAKE_SOURCE_SUBDIR:=builders/cmake
+PKG_BUILD_PARALLEL:=0
 
+include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
 
 define Package/crtmpserver
   SECTION:=multimedia
   CATEGORY:=Multimedia
-  DEPENDS:=+libstdcpp +libopenssl +liblua
+  DEPENDS:=$(CXX_DEPENDS) +libopenssl +liblua
   TITLE:=C++ RTMP Server
+  URL:=https://github.com/shiretu/crtmpserver
 endef
 
 define Package/crtmpserver/description
@@ -52,42 +57,28 @@ define Package/crtmpserver/conffiles
 /etc/crtmpserver.lua
 endef
 
-# XXX: this hack handles the usr/bin vs bin difference of backfire and trunk
-TS_BASE:=$(wildcard $(TOOLCHAIN_DIR)/bin/$(TARGET_CC))
-TS_BASE:=$(dir $(if $(TS_BASE),$(TS_BASE),$(wildcard $(TOOLCHAIN_DIR)/usr/bin/$(TARGET_CC))))
+CMAKE_OPTIONS += \
+       -DCRTMPSERVER_INSTALL_PREFIX="$(CMAKE_INSTALL_PREFIX)" \
+       -DDL_INCLUDE_PATH="$(TOOLCHAIN_DIR)/include" \
+       -DLUA_INCLUDE_PATH_="$(STAGING_DIR)/usr/include" \
+       -DLUA_LIBRARY_PATH_="$(STAGING_DIR)/usr/lib/liblua.so" \
+       -DOPENSSL_INCLUDE_PATH="$(STAGING_DIR)/usr/include" \
 
-define Build/Configure
-       (cd $(PKG_BUILD_DIR)/builders/make; \
-               cp linux.mk linux-openwrt-uclibc.mk; \
-               $(SED) 's,^TOOLCHAIN_BASE[[:space:]]*=.*,TOOLCHAIN_BASE=$(TS_BASE),' \
-                       -e 's,^TOOLCHAIN_PREFIX[[:space:]]*=.*,TOOLCHAIN_PREFIX=$(TARGET_CROSS),' \
-                       -e 's,^CCOMPILER[[:space:]]*=.*,CCOMPILER=$(TARGET_CC),' \
-                       -e 's,^CXXCOMPILER[[:space:]]*=.*,CXXCOMPILER=$(TARGET_CXX) -std=gnu++03,' \
-                       -e 's,^OPTIMIZATIONS[[:space:]]*=.*,OPTIMIZATIONS=-O2,' \
-                       -e 's,^SSL_BASE[[:space:]]*=.*,SSL_BASE=$(STAGING_DIR)/usr,' \
-                       linux-openwrt-uclibc.mk)
-       (cd $(PKG_BUILD_DIR)/sources/common/include/; \
-               echo '#define CRTMPSERVER_VERSION_RELEASE_NUMBER "$(PKG_VERSION)\n"' > version.h; \
-               echo '#define CRTMPSERVER_VERSION_CODE_NAME "Git\n"'                >> version.h)
-endef
-
-define Build/Compile
-       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/builders/make \
-               PLATFORM=linux-openwrt-uclibc -Wno-error -j6
-endef
+TARGET_CXXFLAGS +=-std=c++11 -ffunction-sections -fdata-sections
+TARGET_LDFLAGS +=-Wl,--gc-sections,--as-needed
 
 define Package/crtmpserver/install
-       $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/builders/make/output/dynamic/crtmpserver $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/crtmpserver $(1)/usr/sbin
        $(INSTALL_DIR) $(1)/usr/lib/crtmpserver
-       $(CP) $(PKG_BUILD_DIR)/builders/make/output/dynamic/*.so $(1)/usr/lib/crtmpserver/
-       $(foreach app,flvplayback samplefactory admin stresstest appselector vptests applestreamingclient proxypublish, \
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/crtmpserver/lib* $(1)/usr/lib/crtmpserver
+       $(foreach app,flvplayback samplefactory admin stresstest appselector vptests proxypublish, \
                $(INSTALL_DIR) $(1)/usr/lib/crtmpserver/$(app); \
-               $(INSTALL_BIN) $(PKG_BUILD_DIR)/builders/make/output/dynamic/applications/$(app)/lib$(app).so \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/crtmpserver/applications/$(app)/lib$(app).so \
                        $(1)/usr/lib/crtmpserver/$(app)/; \
        )
        $(INSTALL_DIR) $(1)/etc
-       $(INSTALL_CONF) $(PKG_BUILD_DIR)/builders/make/output/dynamic/crtmpserver.lua $(1)/etc/
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/etc/crtmpserver.lua.sample $(1)/etc/
        $(INSTALL_DIR) $(1)/usr/share/crtmpserver/appselector
        $(INSTALL_DIR) $(1)/usr/share/crtmpserver/media
        $(INSTALL_DIR) $(1)/etc/init.d
diff --git a/multimedia/crtmpserver/patches/010-no-werror.patch b/multimedia/crtmpserver/patches/010-no-werror.patch
new file mode 100644 (file)
index 0000000..9a22abf
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/builders/cmake/CMakeLists.txt
++++ b/builders/cmake/CMakeLists.txt
+@@ -140,8 +124,6 @@ ADD_DEFINITIONS(-DHAS_LUA)
+ #ADD_DEFINITIONS(-DUSE_MEM_POOL)
+ #ADD_DEFINITIONS(-DDEBUG_MEM_POOL)
+-SET(GENERIC_FLAGS "-Wall -Werror")
+-
+ #add 64 bit support for 32 but platforms
+ ADD_DEFINITIONS(-D__USE_FILE_OFFSET64)
+ ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
+--- a/sources/thelib/src/streaming/streamcapabilities.cpp
++++ b/sources/thelib/src/streaming/streamcapabilities.cpp
+@@ -28,7 +28,7 @@
+ #define CHECK_BA_LIMITS(name,length) \
+ if(ba.AvailableBits()<length) { \
+-      FATAL("Unable to read `"name"` value. Not enough bits. Wanted: %u; Have: %u", \
++      FATAL("Unable to read \"name\" value. Not enough bits. Wanted: %u; Have: %u", \
+               (uint32_t)length, ba.AvailableBits()); \
+       return false; \
+ }
+@@ -43,7 +43,7 @@ if(ba.AvailableBits()<length) { \
+ { \
+       uint64_t ___value___=0; \
+       if(!ba.ReadExpGolomb(___value___)) { \
+-              FATAL("Unable to read `"name"` value"); \
++              FATAL("Unable to read \"name\" value"); \
+               return false; \
+       } \
+       v[name]=(type)___value___; \
diff --git a/multimedia/crtmpserver/patches/040-syslog.patch b/multimedia/crtmpserver/patches/040-syslog.patch
deleted file mode 100644 (file)
index d45776d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/sources/common/src/utils/logging/syslogloglocation.cpp
-+++ b/sources/common/src/utils/logging/syslogloglocation.cpp
-@@ -35,8 +35,6 @@ SyslogLogLocation::SyslogLogLocation(Variant &configuration, string identifier,
-       _priorities[_WARNING_] = LOG_WARNING;
-       _priorities[_ERROR_] = LOG_ERR;
-       _priorities[_FATAL_] = LOG_ERR;
--      _priorities[_PROD_ACCESS_] = LOG_ERR;
--      _priorities[_PROD_ERROR_] = LOG_ERR;
-       _specificLevel = specificLevel;
-       _enforceLoggerName = (_configuration[CONF_LOG_APPENDER_NAME] != "");
-       _pDefualtFormatter = NULL;