1、openwrt 增加cmake包
cmake包从buildroot参考。
但是camke包依赖rhash、jsoncpp等包,
而openwrt不带有这些,特编写对应包的Makefile
2、rhash包
include $(TOPDIR)/rules.mk
PKG_NAME:=RHash
PKG_VERSION:=1.4.3
PKG_RELEASE:=1
PKG_SOURCE:=rhash-$(PKG_VERSION)-src.tar.gz
PKG_SOURCE_URL:=https://nchc.dl.sourceforge.net/project/rhash/rhash/$(PKG_VERSION)/
PKG_HASH:=1e40fa66966306920f043866cbe8612f4b939b033ba5e2708c3f41be257c8a3e
PKG_LICENSE:=0BSD
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/rhash
SECTION:=libs
CATEGORY:=Libraries
TITLE:=rhash
URL:=https://github.com/rhash/RHash
endef
define Package/rhash/description
LibRHash is a professional, portable, thread-safe C library
for computing a wide variety of hash sums, such as CRC32,
MD4, MD5, SHA1, SHA256, SHA512, SHA3, AICH, ED2K, Tiger,
DC++ TTH, BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160,
HAS-160, EDON-R, Whirlpool and Snefru.
endef
CONFIGURE_ARGS := \
--prefix=/usr \
--cc=$(TARGET_CC) \
--target=$(GNU_TARGET_NAME) \
--disable-gettext \
--disable-openssl
define Build/Configure
$(call Build/Configure/Default,$(CONFIGURE_ARGS))
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/librhash/rhash.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/librhash/rhash_torrent.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/librhash/lib* $(1)/usr/lib/
endef
define Package/rhash/install
$(call Build/Install/Default,)
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/librhash/lib* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,rhash))
3、jsoncpp包
include $(TOPDIR)/rules.mk
PKG_NAME:=jsoncpp
PKG_VERSION:=1.7.7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/open-source-parsers/jsoncpp/archive/$(PKG_VERSION)/
PKG_HASH:=087640ebcf7fbcfe8e2717a0b9528fff89c52fcf69fa2a18cc2b538008098f97
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/jsoncpp
SECTION:=libs
CATEGORY:=Libraries
TITLE:=jsoncpp
URL:=https://github.com/open-source-parsers/jsoncpp
DEPENDS:=+libstdcpp
endef
define Package/jsoncpp/description
JsonCpp is a C++ library that allows manipulating JSON
values, including serialization and deserialization to and
from strings. It can also preserve existing comment in
unserialization/serialization steps, making it a convenient
format to store user input files.
endef
CMAKE_OPTIONS := \
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \
-DJSONCPP_WITH_TESTS=OFF \
-DJSONCPP_WITH_STRICT_ISO=OFF \
-DCMAKE_PREFIX_PATH=$(STAGING_DIR)/usr/lib
define Build/Configure
$(call Build/Configure/Default,)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/json
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/include/json/* $(1)/usr/include/json/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
endef
define Package/jsoncpp/install
$(call Build/Install/Default,)
endef
$(eval $(call BuildPackage,jsoncpp))