rpcd: update to latest Git HEAD
[openwrt/staging/pepe2k.git] / package / system / rpcd / Makefile
1 #
2 # Copyright (C) 2013-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=rpcd
11 PKG_RELEASE:=1
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
15 PKG_MIRROR_HASH:=f5a8f4342ef581fb8750fc41c4e7dfee808a97b3e2a53dbf9d7f51e48b35bae6
16 PKG_SOURCE_DATE:=2022-05-31
17 PKG_SOURCE_VERSION:=1c4825739b3cf19fe429c19eafa82a7f27aa99b3
18 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
19
20 PKG_LICENSE:=ISC
21 PKG_LICENSE_FILES:=
22
23 PKG_ASLR_PIE_REGULAR:=1
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/cmake.mk
27
28 define Build/InstallDev
29 $(INSTALL_DIR) $(1)/usr/include
30 $(CP) $(PKG_BUILD_DIR)/include/rpcd $(1)/usr/include/
31 endef
32
33 define Package/rpcd/default
34 SECTION:=utils
35 CATEGORY:=Base system
36 TITLE:=OpenWrt ubus RPC backend server
37 DEPENDS:=+libubus +libubox
38 endef
39
40 define Package/rpcd
41 $(Package/rpcd/default)
42 DEPENDS+= +libuci +libblobmsg-json +libjson-c
43 endef
44
45 define Package/rpcd/description
46 This package provides the UBUS RPC backend server to expose various
47 functionality to frontend programs via JSON-RPC.
48 endef
49
50 define Package/rpcd/conffiles
51 /etc/config/rpcd
52 endef
53
54 TARGET_LDFLAGS += -lcrypt
55 # TARGET_CFLAGS += \
56 # -I$(STAGING_DIR)/usr/include/libnl-tiny
57 # -I$(STAGING_DIR)/usr/include \
58 # -D_GNU_SOURCE
59
60 define Package/rpcd/install
61 $(INSTALL_DIR) $(1)/etc/init.d
62 $(INSTALL_BIN) ./files/rpcd.init $(1)/etc/init.d/rpcd
63 $(INSTALL_DIR) $(1)/sbin
64 $(INSTALL_BIN) $(PKG_BUILD_DIR)/rpcd $(1)/sbin/rpcd
65 $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
66 $(INSTALL_DATA) $(PKG_BUILD_DIR)/unauthenticated.json $(1)/usr/share/rpcd/acl.d/unauthenticated.json
67 $(INSTALL_DIR) $(1)/etc/config
68 $(INSTALL_CONF) ./files/rpcd.config $(1)/etc/config/rpcd
69 $(INSTALL_DIR) $(1)/etc/uci-defaults
70 $(INSTALL_BIN) ./files/50-migrate-rpcd-ubus-sock.sh $(1)/etc/uci-defaults
71 endef
72
73
74 # 1: plugin name
75 # 2: extra dependencies
76 # 3: plugin title/description
77 define BuildPlugin
78
79 PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_rpcd-mod-$(1)
80
81 define Package/rpcd-mod-$(1)
82 $(Package/rpcd/default)
83 TITLE+= ($(1) plugin)
84 DEPENDS+=rpcd $(2)
85 endef
86
87 define Package/rpcd-mod-$(1)/description
88 $(3)
89 endef
90
91 define Package/rpcd-mod-$(1)/postinst
92 #!/bin/sh
93 [ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/rpcd reload
94 endef
95
96 define Package/rpcd-mod-$(1)/install
97 $(INSTALL_DIR) $$(1)/usr/lib/rpcd
98 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1).so $$(1)/usr/lib/rpcd/
99 endef
100
101 $$(eval $$(call BuildPackage,rpcd-mod-$(1)))
102
103 endef
104
105 $(eval $(call BuildPackage,rpcd))
106 $(eval $(call BuildPlugin,file,,Provides ubus calls for file and directory operations.))
107 $(eval $(call BuildPlugin,rpcsys,,Provides ubus calls for sysupgrade and password changing.))
108 $(eval $(call BuildPlugin,iwinfo,+libiwinfo,Provides ubus calls for accessing iwinfo data.))
109 $(eval $(call BuildPlugin,ucode,+libucode,Allows implementing plugins using ucode scripts.))
110 $(eval $(call BuildPlugin,nl80211,+libnl-tiny,Provides ubus calls for accessing nl80211 data.))