Merge pull request #4662 from commodo/ovs-update
[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:=1
16 PKG_VERSION:=2.7.2
17 PKG_LICENSE:=Apache-2.0
18 PKG_LICENSE_FILES:=COPYING
19 PKG_USE_MIPS16:=0
20
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
22 PKG_SOURCE_URL:=http://openvswitch.org/releases/
23 PKG_HASH:=fe36c86ed52f6f7c17b01cdbb7ae37bf521cc5c2e50997b618f3f742485f655b
24
25 PKG_BUILD_DEPENDS:=python/host python-six/host
26 PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_openvswitch-python
27
28 PKG_BUILD_PARALLEL:=1
29 PKG_FIXUP:=autoreconf
30 PKG_INSTALL:=1
31
32 SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4||LINUX_4_9
33
34 include $(INCLUDE_DIR)/package.mk
35 $(call include_mk, python-package.mk)
36
37 define Package/openvswitch/Default
38 SECTION:=net
39 SUBMENU:=Open vSwitch
40 CATEGORY:=Network
41 URL:=http://openvswitch.org/
42 MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
43 endef
44
45 define Package/openvswitch/Default/description
46 Open vSwitch is a production quality, multilayer, software-based, Ethernet
47 virtual switch. It is designed to enable massive network automation through
48 programmatic extension, while still supporting standard management interfaces
49 and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
50 addition, it is designed to support distribution across multiple physical
51 servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
52 1000V.
53 endef
54
55 define Package/openvswitch-base
56 $(call Package/openvswitch/Default)
57 TITLE:=Open vSwitch Userspace Package (base)
58 DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
59 endef
60
61 define Package/openvswitch-base/description
62 Provides the main userspace components required for Open vSwitch to function.
63 The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
64 to conserve some room and allow more configurability.
65 endef
66
67 define Package/openvswitch-python
68 $(call Package/openvswitch/Default)
69 TITLE:=Open vSwitch Python Support
70 DEPENDS:=+openvswitch +PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
71 endef
72
73 define Package/openvswitch-python/description
74 Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
75 endef
76
77 OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
78 define Package/openvswitch
79 $(call Package/openvswitch/Default)
80 TITLE:=Open vSwitch Userspace Package
81 DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
82 endef
83
84 define Package/openvswitch/description
85 Provides the main userspace components required for Open vSwitch to function.
86 Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
87 endef
88
89 define KernelPackage/openvswitch
90 SECTION:=kernel
91 CATEGORY:=Kernel modules
92 SUBMENU:=Network Support
93 TITLE:=Open vSwitch Kernel Package
94 KCONFIG:= \
95 CONFIG_BRIDGE \
96 CONFIG_OPENVSWITCH \
97 CONFIG_OPENVSWITCH_GRE=n \
98 CONFIG_OPENVSWITCH_VXLAN=n \
99 CONFIG_OPENVSWITCH_GENEVE=n
100 DEPENDS:= \
101 @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-mpls \
102 +kmod-vxlan +kmod-nf-nat +kmod-nf-nat6 \
103 @($(SUPPORTED_KERNELS))
104 FILES:= $(LINUX_DIR)/net/openvswitch/openvswitch.ko
105 AUTOLOAD:=$(call AutoLoad,21,openvswitch)
106 endef
107
108 define KernelPackage/openvswitch/description
109 This package contains the Open vSwitch kernel moodule and bridge compat
110 module. Furthermore, it supports OpenFlow.
111 endef
112
113 CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
114 CONFIGURE_ARGS += --enable-ndebug
115 CONFIGURE_ARGS += --disable-ssl
116 CONFIGURE_ARGS += --enable-shared
117
118 TARGET_CFLAGS += -flto -std=gnu99
119
120 CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
121 MAKE_FLAGS += \
122 ARCH="$(LINUX_KARCH)" \
123 PYTHONPATH="$(HOST_PYTHONPATH)" \
124 PYTHON="$(HOST_PYTHON_BIN)"
125
126 define OvsBinUtility
127 define Package/openvswitch-$(1)
128 $(call Package/openvswitch/Default)
129 TITLE:=$(2)
130 DEPENDS:=+openvswitch-base
131 endef
132
133 define Package/openvswitch-$(1)/description
134 $(2)
135 endef
136
137 define Package/openvswitch-$(1)/install
138 $(INSTALL_DIR) $$(1)/usr/bin/ ;\
139 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
140 endef
141 endef
142
143 define Package/openvswitch-base/install
144 $(INSTALL_DIR) $(1)/etc/openvswitch
145
146 $(INSTALL_DIR) $(1)/etc/init.d
147 $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
148
149 $(INSTALL_DIR) $(1)/usr/lib/
150 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
151 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
152 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
153 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
154
155 $(INSTALL_DIR) $(1)/usr/bin/
156 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
157
158 $(INSTALL_DIR) $(1)/usr/sbin/
159 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
161
162 $(INSTALL_DIR) $(1)/usr/share/openvswitch/
163 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
164 endef
165
166 define Package/openvswitch-python/install
167 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
168 $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
169 endef
170
171 define Package/openvswitch/install
172 :
173 endef
174
175 $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
176 $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
177 $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
178 $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
179 $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
180
181 $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
182
183 $(eval $(call BuildPackage,openvswitch-base))
184 $(eval $(call BuildPackage,openvswitch-python))
185 $(eval $(call BuildPackage,openvswitch))
186 $(eval $(call KernelPackage,openvswitch))
187