Merge pull request #2126 from lynxis/libmicrohttpd
[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 include $(INCLUDE_DIR)/package.mk
39 $(call include_mk, python-package.mk)
40
41 define Package/openvswitch/Default
42 SECTION:=net
43 SUBMENU:=Open vSwitch
44 CATEGORY:=Network
45 URL:=http://openvswitch.org/
46 MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
47 endef
48
49 define Package/openvswitch/Default/description
50 Open vSwitch is a production quality, multilayer, software-based, Ethernet
51 virtual switch. It is designed to enable massive network automation through
52 programmatic extension, while still supporting standard management interfaces
53 and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
54 addition, it is designed to support distribution across multiple physical
55 servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
56 1000V.
57 endef
58
59 define Package/openvswitch-base
60 $(call Package/openvswitch/Default)
61 TITLE:=Open vSwitch Userspace Package (base)
62 DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
63 endef
64
65 define Package/openvswitch-base/description
66 Provides the main userspace components required for Open vSwitch to function.
67 The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
68 to conserve some room and allow more configurability.
69 endef
70
71 define Package/openvswitch-python
72 $(call Package/openvswitch/Default)
73 TITLE:=Open vSwitch Python Support
74 DEPENDS:=+openvswitch +python
75 endef
76
77 define Package/openvswitch-python/description
78 Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
79 endef
80
81 define Package/openvswitch-ipsec
82 $(call Package/openvswitch/Default)
83 TITLE:=Open vSwitch GRE through IPsec tool
84 DEPENDS:=+openvswitch-python
85 endef
86
87 define Package/openvswitch-ipsec/description
88 The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
89 IPsec.
90 endef
91
92 define Package/openvswitch-benchmark
93 $(call Package/openvswitch/Default)
94 TITLE:=Open vSwitch flow setup benchmark utility
95 DEPENDS:=+openvswitch
96 endef
97
98 define Package/openvswitch-benchmark/description
99 Utility for running OpenVSwitch benchmarking
100 endef
101
102 OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
103 define Package/openvswitch
104 $(call Package/openvswitch/Default)
105 TITLE:=Open vSwitch Userspace Package
106 DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
107 endef
108
109 define Package/openvswitch/description
110 Provides the main userspace components required for Open vSwitch to function.
111 Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
112 endef
113
114 define KernelPackage/openvswitch
115 SECTION:=kernel
116 CATEGORY:=Kernel modules
117 SUBMENU:=Network Support
118 TITLE:=Open vSwitch Kernel Package
119 KCONFIG:=CONFIG_BRIDGE
120 DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS))
121 FILES:= \
122 $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
123 AUTOLOAD:=$(call AutoLoad,21,openvswitch)
124 endef
125
126 define KernelPackage/openvswitch/description
127 This package contains the Open vSwitch kernel moodule and bridge compat
128 module. Furthermore, it supports OpenFlow.
129 endef
130
131 CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
132 CONFIGURE_ARGS += --enable-ndebug
133 CONFIGURE_ARGS += --disable-ssl
134 CONFIGURE_ARGS += --enable-shared
135
136 TARGET_CFLAGS += -flto -std=gnu99
137
138 CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
139 MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
140
141 define OvsBinUtility
142 define Package/openvswitch-$(1)
143 $(call Package/openvswitch/Default)
144 TITLE:=$(2)
145 DEPENDS:=+openvswitch-base
146 endef
147
148 define Package/openvswitch-$(1)/description
149 $(2)
150 endef
151
152 define Package/openvswitch-$(1)/install
153 $(INSTALL_DIR) $$(1)/usr/bin/ ;\
154 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
155 endef
156 endef
157
158 define Package/openvswitch-base/install
159 $(INSTALL_DIR) $(1)/etc/openvswitch
160
161 $(INSTALL_DIR) $(1)/etc/init.d
162 $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
163
164 $(INSTALL_DIR) $(1)/usr/lib/
165 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto.so* $(1)/usr/lib/
166 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch.so* $(1)/usr/lib/
167 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb.so* $(1)/usr/lib/
168 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow.so* $(1)/usr/lib/
169
170 $(INSTALL_DIR) $(1)/usr/bin/
171 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
172
173 $(INSTALL_DIR) $(1)/usr/sbin/
174 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
175 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
176
177 $(INSTALL_DIR) $(1)/usr/share/openvswitch/
178 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
179 endef
180
181 define Package/openvswitch-python/install
182 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
183 $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
184 endef
185
186 define Package/openvswitch-ipsec/install
187 $(INSTALL_DIR) $(1)/usr/sbin/
188 $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
189 endef
190
191 define Package/openvswitch-benchmark/install
192 $(INSTALL_DIR) $(1)/usr/bin/
193 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/
194 endef
195
196 define Package/openvswitch/install
197 :
198 endef
199
200 $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
201 $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
202 $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
203 $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
204 $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
205
206 $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
207
208 $(eval $(call BuildPackage,openvswitch-base))
209 $(eval $(call BuildPackage,openvswitch-python))
210 $(eval $(call BuildPackage,openvswitch-ipsec))
211 $(eval $(call BuildPackage,openvswitch-benchmark))
212 $(eval $(call BuildPackage,openvswitch))
213 $(eval $(call KernelPackage,openvswitch))
214