diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-07-12 02:49:10 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-09-11 13:16:26 +0200 |
commit | 2f316dddef9b31a3e1362ad343df5424cc137187 (patch) | |
tree | 71ab65f79b1e5f816ed48ce48f99afe1b2aa7a2b | |
parent | ccd19d4a1ddc803693d934c19423472ad506ea80 (diff) |
td: add package
Add telegram library for building Telegram clients.
This can be coming handy if you need a Telegram bot
running on your OpenWrt device.
Building the libraries requires building a host tool first.
This is because it uses it's own mtproto which source codes
are autogenerated from *.mt files on the host before
cross compilation can happen.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | libs/td/Makefile | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libs/td/Makefile b/libs/td/Makefile new file mode 100644 index 0000000..48c1d51 --- /dev/null +++ b/libs/td/Makefile @@ -0,0 +1,73 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=td +PKG_VERSION:=1.8.0 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/tdlib/td/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=30d560205fe82fb811cd57a8fcbc7ac853a5b6195e9cb9e6ff142f5e2d8be217 + +PKG_MAINTAINER:=Toni Uhlig <matzeton@googlemail.com> +PKG_LICENSE:=BSL-1.0 +PKG_LICENSE_FILES:=LICENSE_1_0.txt + +PKG_BUILD_DEPENDS:=gperf/host td/host +PKG_BUILD_PARALLEL:=1 +CMAKE_BINARY_SUBDIR:=openwrt-build +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +EXTRA_CFLAGS += -Wno-psabi + +define Package/td + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Telegram Database library + DEPENDS:=+zlib +libopenssl +libstdcpp + URL:=https://github.com/tdlib/td +endef + +define Package/td/description + Cross-platform library for building Telegram clients. +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(INSTALL_DIR) \ + $(PKG_BUILD_DIR)/td/generate/auto \ + $(PKG_BUILD_DIR)/tdutils/generate + $(CP) \ + $(STAGING_DIR_HOSTPKG)/include/td/generate/auto/td \ + $(PKG_BUILD_DIR)/td/generate/auto/td + $(CP) \ + $(STAGING_DIR_HOSTPKG)/include/tdutils/generate/auto \ + $(PKG_BUILD_DIR)/tdutils/generate/auto +endef + +define Host/Compile + $(NINJA) -C $(HOST_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR) prepare_cross_compiling +endef + +define Host/Install + $(INSTALL_DIR) \ + $(STAGING_DIR_HOSTPKG)/include/td/generate/auto \ + $(STAGING_DIR_HOSTPKG)/include/tdutils/generate + $(CP) \ + $(HOST_BUILD_DIR)/td/generate/auto/td \ + $(STAGING_DIR_HOSTPKG)/include/td/generate/auto/td + $(CP) \ + $(HOST_BUILD_DIR)/tdutils/generate/auto \ + $(STAGING_DIR_HOSTPKG)/include/tdutils/generate/auto +endef + +define Package/td/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtdjson.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,td)) +$(eval $(call HostBuild)) |