f5a1f12f22f0967cfb2ac8b4f27e423fcce4abea
[openwrt/openwrt.git] / package / libs / libubox / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=libubox
4 PKG_RELEASE=3
5
6 PKG_SOURCE_PROTO:=git
7 PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
8 PKG_SOURCE_DATE:=2018-07-25
9 PKG_SOURCE_VERSION:=c83a84afbef2b24f960ddeda0b5e2ab01fba6981
10 PKG_MIRROR_HASH:=4a9594d2ae3706174d182a21fe815f1d18c20beca6593707cc757994975dc670
11 CMAKE_INSTALL:=1
12
13 PKG_LICENSE:=ISC
14 PKG_LICENSE_FILES:=
15
16 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
17
18 PKG_BUILD_DEPENDS:=lua
19 HOST_BUILD_DEPENDS:=libjson-c/host
20 HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
21
22 include $(INCLUDE_DIR)/package.mk
23 include $(INCLUDE_DIR)/host-build.mk
24 include $(INCLUDE_DIR)/cmake.mk
25
26 define Package/libubox
27 SECTION:=libs
28 CATEGORY:=Libraries
29 TITLE:=Basic utility library
30 ABI_VERSION:=$(PKG_VERSION)
31 DEPENDS:=
32 endef
33
34 define Package/libblobmsg-json
35 SECTION:=libs
36 CATEGORY:=Libraries
37 TITLE:=blobmsg <-> json conversion library
38 DEPENDS:=+libjson-c +libubox
39 endef
40
41 define Package/jshn
42 SECTION:=utils
43 CATEGORY:=Utilities
44 DEPENDS:=+libjson-c +libubox +libblobmsg-json
45 TITLE:=JSON SHell Notation
46 endef
47
48 define Package/jshn/description
49 Library for parsing and generating JSON from shell scripts
50 endef
51
52 define Package/libjson-script
53 SECTION:=utils
54 CATEGORY:=Utilities
55 DEPENDS:=+libubox
56 TITLE:=Minimalistic JSON based scripting engine
57 endef
58
59 define Package/libubox-lua
60 SECTION:=libs
61 CATEGORY:=Libraries
62 DEPENDS:=+libubox +liblua
63 TITLE:=Lua binding for the OpenWrt Basic utility library
64 endef
65
66 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
67 CMAKE_OPTIONS = \
68 -DLUAPATH=/usr/lib/lua
69
70 define Package/libubox/install
71 $(INSTALL_DIR) $(1)/lib/
72 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so $(1)/lib/
73 endef
74
75 define Package/libblobmsg-json/install
76 $(INSTALL_DIR) $(1)/lib/
77 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so $(1)/lib/
78 endef
79
80 define Package/jshn/install
81 $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/share/libubox
82 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/jshn $(1)/usr/bin
83 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/libubox/jshn.sh $(1)/usr/share/libubox
84 endef
85
86 define Package/libjson-script/install
87 $(INSTALL_DIR) $(1)/lib/
88 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so $(1)/lib/
89 endef
90
91 define Package/libubox-lua/install
92 $(INSTALL_DIR) $(1)/usr/lib/lua
93 $(CP) $(PKG_BUILD_DIR)/lua/uloop.so $(1)/usr/lib/lua/
94 endef
95
96
97 CMAKE_HOST_OPTIONS += \
98 -DBUILD_LUA=OFF \
99 -DBUILD_EXAMPLES=OFF \
100 -DCMAKE_SKIP_RPATH=FALSE \
101 -DCMAKE_MACOSX_RPATH=1 \
102 -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \
103
104 $(eval $(call BuildPackage,libubox))
105 $(eval $(call BuildPackage,libblobmsg-json))
106 $(eval $(call BuildPackage,jshn))
107 $(eval $(call BuildPackage,libjson-script))
108 $(eval $(call BuildPackage,libubox-lua))
109 $(eval $(call HostBuild))