643f61c7a5981d64abf8e7bd6ec22ba26cba1368
[oweals/openwrt.git] / package / network / services / odhcpd / Makefile
1 #
2 # Copyright (C) 2013-2015 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:=odhcpd
11 PKG_RELEASE:=3
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git
15 PKG_SOURCE_DATE:=2018-12-12
16 PKG_SOURCE_VERSION:=2d2a3b840421cfc6328aee8cc52e5a5a51444fda
17 PKG_MIRROR_HASH:=277363aed1db2583f78632fa57a8ac9fff44b0eb716d05fa5d423b028af63eba
18
19 PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
20 PKG_LICENSE:=GPL-2.0
21
22 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 PKG_INSTALL:=1
25 PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_odhcpd_$(BUILD_VARIANT)_ext_cer_id
26
27 include $(INCLUDE_DIR)/package.mk
28 include $(INCLUDE_DIR)/cmake.mk
29
30 define Package/odhcpd/default
31   SECTION:=net
32   CATEGORY:=Network
33   TITLE:=OpenWrt DHCPv6(-PD)/RA Server & Relay
34   DEPENDS:=+libubox +libuci +libubus +libnl-tiny
35 endef
36
37 define Package/odhcpd/default/description
38  odhcpd is a daemon for serving and relaying IP management protocols to
39  configure clients and downstream routers. It tries to follow the RFC 6204
40  requirements for IPv6 home routers.
41 endef
42
43 define Package/odhcpd/default/config
44 menu "Configuration"
45         depends on PACKAGE_$(1)
46
47 config PACKAGE_odhcpd_$(2)_ext_cer_id
48         int
49         default 0
50         prompt "CER-ID Extension ID (0 = disabled)"
51 endmenu
52 endef
53
54 define Package/odhcpd
55   $(call Package/odhcpd/default)
56   TITLE += and DHCPv4 server
57   VARIANT:=full
58 endef
59
60 Package/odhcpd/config=$(call Package/odhcpd/default/config,odhcpd,full)
61
62 define Package/odhcpd/description
63  $(call Package/odhcpd/default/description)
64
65  This is a variant providing server services for DHCPv4, RA, stateless and
66  stateful DHCPv6,  prefix delegation and can be used to relay RA, DHCPv6 and
67  NDP between routed (non-bridged) interfaces in case no delegated prefixes
68  are available.
69 endef
70
71 define Package/odhcpd-ipv6only
72   $(call Package/odhcpd/default)
73   VARIANT:=ipv6only
74   DEPENDS+= @IPV6
75 endef
76
77 Package/odhcpd-ipv6only/config=$(call Package/odhcpd/default/config,odhcpd-ipv6only,ipv6only)
78
79 define Package/odhcpd-ipv6only/description
80  $(call Package/odhcpd/default/description)
81
82  This is a variant providing server services for RA, stateless and stateful
83  DHCPv6,  prefix delegation and can be used to relay RA, DHCPv6 and NDP between
84  routed (non-bridged) interfaces in case no delegated prefixes are available.
85 endef
86
87 CMAKE_OPTIONS += -DUBUS=1
88
89 ifeq ($(BUILD_VARIANT),full)
90   CMAKE_OPTIONS += -DDHCPV4_SUPPORT=1
91 endif
92
93 ifneq ($(CONFIG_PACKAGE_odhcpd_$(BUILD_VARIANT)_ext_cer_id),0)
94   CMAKE_OPTIONS += -DEXT_CER_ID=$(CONFIG_PACKAGE_odhcpd_$(BUILD_VARIANT)_ext_cer_id)
95 endif
96
97 define Package/odhcpd/install
98         $(INSTALL_DIR) $(1)/usr/sbin/
99         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/odhcpd $(1)/usr/sbin/
100         $(INSTALL_BIN) ./files/odhcpd-update $(1)/usr/sbin/
101         $(INSTALL_DIR) $(1)/etc/init.d
102         $(INSTALL_BIN) ./files/odhcpd.init $(1)/etc/init.d/odhcpd
103         $(INSTALL_DIR) $(1)/etc/uci-defaults
104         $(INSTALL_BIN) ./files/odhcpd.defaults $(1)/etc/uci-defaults
105 endef
106
107 Package/odhcpd-ipv6only/install = $(Package/odhcpd/install)
108
109 $(eval $(call BuildPackage,odhcpd))
110 $(eval $(call BuildPackage,odhcpd-ipv6only))