Merge pull request #3349 from marcin1j/pr/mini_snmpd/fix-init-script
[feed/packages.git] / net / openvswitch / Makefile
1 #
2 # Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
3 # Copyright (C) 2014 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8 # $Id: Makefile $
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/kernel.mk
12
13 PKG_NAME:=openvswitch
14
15 PKG_RELEASE:=7
16 PKG_VERSION:=2.5.0
17 PKG_RELEASE=$(PKG_SOURCE_VERSION)
18 PKG_LICENSE:=Apache-2.0
19 PKG_LICENSE_FILES:=COPYING
20 PKG_USE_MIPS16:=0
21
22 PKG_SOURCE_PROTO:=git
23 PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
24 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
25 PKG_SOURCE_VERSION:=22d4614ddf83988a3771fb379ea029e663b4455a
26 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
27
28 PKG_BUILD_PARALLEL:=1
29 PKG_FIXUP:=autoreconf
30 PKG_INSTALL:=1
31
32 # Upstream package supports kernels between 2.6.32 and 4.3
33 # see https://github.com/openvswitch/ovs/blob/master/FAQ.md
34 # This list is pruned to only those kernels used in OpenWRT
35 # Support for kernel 4.4 is backported
36 SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4
37
38 # If only kmod-openvswitch is enabled, then override default make path to only
39 # build and install the datapath/linux subdirectory which cuts down compilation
40 # time dramatically.
41 ifeq ($(CONFIG_PACKAGE_openvswitch-base),)
42 ifneq ($(CONFIG_PACKAGE_kmod-openvswitch),)
43 MAKE_PATH := datapath/linux
44 endif
45 endif
46
47 # Additionally register PKG_CONFIG_DEPENDS to trigger a rebuild of the code
48 # base if the package selection changes.
49 PKG_CONFIG_DEPENDS := \
50 CONFIG_PACKAGE_openvswitch-base \
51 CONFIG_PACKAGE_kmod-openvswitch
52
53 include $(INCLUDE_DIR)/package.mk
54 $(call include_mk, python-package.mk)
55
56 define Package/openvswitch/Default
57 SECTION:=net
58 SUBMENU:=Open vSwitch
59 CATEGORY:=Network
60 URL:=http://openvswitch.org/
61 MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
62 endef
63
64 define Package/openvswitch/Default/description
65 Open vSwitch is a production quality, multilayer, software-based, Ethernet
66 virtual switch. It is designed to enable massive network automation through
67 programmatic extension, while still supporting standard management interfaces
68 and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
69 addition, it is designed to support distribution across multiple physical
70 servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
71 1000V.
72 endef
73
74 define Package/openvswitch-base
75 $(call Package/openvswitch/Default)
76 TITLE:=Open vSwitch Userspace Package (base)
77 DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
78 endef
79
80 define Package/openvswitch-base/description
81 Provides the main userspace components required for Open vSwitch to function.
82 The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
83 to conserve some room and allow more configurability.
84 endef
85
86 define Package/openvswitch-python
87 $(call Package/openvswitch/Default)
88 TITLE:=Open vSwitch Python Support
89 DEPENDS:=+openvswitch +PACKAGE_openvswitch-python:python
90 endef
91
92 define Package/openvswitch-python/description
93 Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
94 endef
95
96 define Package/openvswitch-ipsec
97 $(call Package/openvswitch/Default)
98 TITLE:=Open vSwitch GRE through IPsec tool
99 DEPENDS:=+openvswitch-python
100 endef
101
102 define Package/openvswitch-ipsec/description
103 The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
104 IPsec.
105 endef
106
107 define Package/openvswitch-benchmark
108 $(call Package/openvswitch/Default)
109 TITLE:=Open vSwitch flow setup benchmark utility
110 DEPENDS:=+openvswitch
111 endef
112
113 define Package/openvswitch-benchmark/description
114 Utility for running OpenVSwitch benchmarking
115 endef
116
117 OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
118 define Package/openvswitch
119 $(call Package/openvswitch/Default)
120 TITLE:=Open vSwitch Userspace Package
121 DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
122 endef
123
124 define Package/openvswitch/description
125 Provides the main userspace components required for Open vSwitch to function.
126 Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
127 endef
128
129 define KernelPackage/openvswitch
130 SECTION:=kernel
131 CATEGORY:=Kernel modules
132 SUBMENU:=Network Support
133 TITLE:=Open vSwitch Kernel Package
134 KCONFIG:=CONFIG_BRIDGE
135 DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS))
136 FILES:= \
137 $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
138 AUTOLOAD:=$(call AutoLoad,21,openvswitch)
139 endef
140
141 define KernelPackage/openvswitch/description
142 This package contains the Open vSwitch kernel moodule and bridge compat
143 module. Furthermore, it supports OpenFlow.
144 endef
145
146 CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
147 CONFIGURE_ARGS += --enable-ndebug
148 CONFIGURE_ARGS += --disable-ssl
149 CONFIGURE_ARGS += --enable-shared
150
151 TARGET_CFLAGS += -flto -std=gnu99
152
153 CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
154 MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
155
156 define OvsBinUtility
157 define Package/openvswitch-$(1)
158 $(call Package/openvswitch/Default)
159 TITLE:=$(2)
160 DEPENDS:=+openvswitch-base
161 endef
162
163 define Package/openvswitch-$(1)/description
164 $(2)
165 endef
166
167 define Package/openvswitch-$(1)/install
168 $(INSTALL_DIR) $$(1)/usr/bin/ ;\
169 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
170 endef
171 endef
172
173 define Package/openvswitch-base/install
174 $(INSTALL_DIR) $(1)/etc/openvswitch
175
176 $(INSTALL_DIR) $(1)/etc/init.d
177 $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
178
179 $(INSTALL_DIR) $(1)/usr/lib/
180 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto.so* $(1)/usr/lib/
181 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch.so* $(1)/usr/lib/
182 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb.so* $(1)/usr/lib/
183 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow.so* $(1)/usr/lib/
184
185 $(INSTALL_DIR) $(1)/usr/bin/
186 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
187
188 $(INSTALL_DIR) $(1)/usr/sbin/
189 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
190 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
191
192 $(INSTALL_DIR) $(1)/usr/share/openvswitch/
193 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
194 endef
195
196 define Package/openvswitch-python/install
197 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
198 $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
199 endef
200
201 define Package/openvswitch-ipsec/install
202 $(INSTALL_DIR) $(1)/usr/sbin/
203 $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
204 endef
205
206 define Package/openvswitch-benchmark/install
207 $(INSTALL_DIR) $(1)/usr/bin/
208 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/
209 endef
210
211 define Package/openvswitch/install
212 :
213 endef
214
215 $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
216 $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
217 $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
218 $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
219 $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
220
221 $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
222
223 $(eval $(call BuildPackage,openvswitch-base))
224 $(eval $(call BuildPackage,openvswitch-python))
225 $(eval $(call BuildPackage,openvswitch-ipsec))
226 $(eval $(call BuildPackage,openvswitch-benchmark))
227 $(eval $(call BuildPackage,openvswitch))
228 $(eval $(call KernelPackage,openvswitch))
229