Makefile 2.65 KB
Newer Older
1
2
3
include $(TOPDIR)/rules.mk

PKG_NAME:=libubox
4
PKG_RELEASE=1
5
6

PKG_SOURCE_PROTO:=git
7
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
8
9
10
PKG_MIRROR_HASH:=f3b5c23280016bbe4b825de81cd455507ca817f599c5cd9f888370d9a33f6c9e
PKG_SOURCE_DATE:=2020-02-27
PKG_SOURCE_VERSION:=7da66430de3fc235bfc6ebb0b85fb90ea246138d
11
12
CMAKE_INSTALL:=1

John Crispin's avatar
John Crispin committed
13
PKG_LICENSE:=ISC
14
15
PKG_LICENSE_FILES:=

16
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
17

18
PKG_BUILD_DEPENDS:=lua
19
HOST_BUILD_DEPENDS:=libjson-c/host
Daniel Golle's avatar
Daniel Golle committed
20
HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
21

22
include $(INCLUDE_DIR)/package.mk
Jo-Philipp Wich's avatar
Jo-Philipp Wich committed
23
include $(INCLUDE_DIR)/host-build.mk
24
25
26
27
28
29
include $(INCLUDE_DIR)/cmake.mk

define Package/libubox
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Basic utility library
30
  ABI_VERSION:=20191228
31
  DEPENDS:=
32
33
34
35
36
37
endef

define Package/libblobmsg-json
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=blobmsg <-> json conversion library
38
  DEPENDS:=+libjson-c +libubox
39
40
endef

41
42
43
define Package/jshn
  SECTION:=utils
  CATEGORY:=Utilities
44
  DEPENDS:=+libjson-c +libubox +libblobmsg-json
45
46
47
48
49
50
  TITLE:=JSON SHell Notation
endef

define Package/jshn/description
  Library for parsing and generating JSON from shell scripts
endef
51

52
53
54
55
56
57
58
define Package/libjson-script
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=+libubox
  TITLE:=Minimalistic JSON based scripting engine
endef

59
60
61
62
63
64
65
define Package/libubox-lua
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libubox +liblua
  TITLE:=Lua binding for the OpenWrt Basic utility library
endef

66
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
67
68
CMAKE_OPTIONS = \
	-DLUAPATH=/usr/lib/lua
69
70
71

define Package/libubox/install
	$(INSTALL_DIR) $(1)/lib/
72
73
74
75
76
77
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libubox.so $(1)/lib/
endef

define Package/libblobmsg-json/install
	$(INSTALL_DIR) $(1)/lib/
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblobmsg_json.so $(1)/lib/
78
79
endef

80
81
82
83
84
85
define Package/jshn/install
	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/share/libubox
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/jshn $(1)/usr/bin
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/libubox/jshn.sh $(1)/usr/share/libubox
endef

86
87
88
89
90
define Package/libjson-script/install
	$(INSTALL_DIR) $(1)/lib/
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so $(1)/lib/
endef

91
92
93
94
95
define Package/libubox-lua/install
	$(INSTALL_DIR) $(1)/usr/lib/lua
	$(CP) $(PKG_BUILD_DIR)/lua/uloop.so $(1)/usr/lib/lua/
endef

Jo-Philipp Wich's avatar
Jo-Philipp Wich committed
96
97
98
99

CMAKE_HOST_OPTIONS += \
	-DBUILD_LUA=OFF \
	-DBUILD_EXAMPLES=OFF \
100
101
102
	-DCMAKE_SKIP_RPATH=FALSE \
	-DCMAKE_MACOSX_RPATH=1 \
	-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \
Jo-Philipp Wich's avatar
Jo-Philipp Wich committed
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))
Jo-Philipp Wich's avatar
Jo-Philipp Wich committed
109
$(eval $(call HostBuild))