eb37696da12603be20637b113a488d5c4b01ad96
[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
12 PKG_NAME:=openvswitch
13
14 PKG_RELEASE:=1
15 PKG_VERSION:=2.3.90
16 PKG_RELEASE=$(PKG_SOURCE_VERSION)
17 PKG_LICENSE:=Apache-2.0
18 PKG_LICENSE_FILES:=COPYING
19 PKG_USE_MIPS16:=0
20
21 PKG_SOURCE_PROTO:=git
22 PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
23 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
24 PKG_SOURCE_VERSION:=58be9c9fd732b5bdd3d4c2e9b8cc2313f570094d
25 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
26
27 SUPPORTED_KERNELS:=LINUX_3_8||LINUX_3_10||LINUX_3_13||LINUX_3_14||LINUX_3_18||LINUX_4_0
28
29 include $(INCLUDE_DIR)/package.mk
30 include $(INCLUDE_DIR)/kernel.mk
31 $(call include_mk, python-package.mk)
32
33 PKG_FIXUP=libtool
34
35 define Package/openvswitch/Default
36 SECTION:=net
37 CATEGORY:=Network
38 URL:=http://openvswitch.org/
39 MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
40 endef
41
42 define Package/openvswitch/Default/description
43 Open vSwitch is a production quality, multilayer, software-based, Ethernet
44 virtual switch. It is designed to enable massive network automation through
45 programmatic extension, while still supporting standard management interfaces
46 and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
47 addition, it is designed to support distribution across multiple physical
48 servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
49 1000V.
50 endef
51
52 define Package/openvswitch
53 $(call Package/openvswitch/Default)
54 TITLE:=Open vSwitch Userspace Package
55 DEPENDS:=+libpcap +libopenssl +librt +libatomic +kmod-openvswitch @($(SUPPORTED_KERNELS))
56 endef
57
58 define Package/openvswitch/description
59 Provides the main userspace components required for Open vSwitch to function.
60 endef
61
62 define Package/openvswitch-python
63 $(call Package/openvswitch/Default)
64 TITLE:=Open vSwitch Python Support
65 DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch +python
66 endef
67
68 define Package/openvswitch-python/description
69 Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
70 endef
71
72 define Package/openvswitch-ipsec
73 $(call Package/openvswitch/Default)
74 TITLE:=Open vSwitch Userspace Package
75 DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch-python
76 endef
77
78 define Package/openvswitch-ipsec/description
79 The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
80 IPsec.
81 endef
82
83 define Package/openvswitch-benchmark
84 $(call Package/openvswitch/Default)
85 TITLE:=Open vSwitch Userspace Package
86 DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch
87 endef
88
89 define Package/openvswitch-benchmark/description
90 Utility for running OpenVSwitch benchmarking
91 endef
92
93 define KernelPackage/openvswitch
94 SECTION:=kernel
95 CATEGORY:=Kernel modules
96 SUBMENU:=Network Support
97 TITLE:=Open vSwitch Kernel Package
98 KCONFIG:=CONFIG_BRIDGE
99 DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan @($(SUPPORTED_KERNELS))
100 FILES:= \
101 $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
102 AUTOLOAD:=$(call AutoLoad,21,openvswitch)
103 endef
104
105 define KernelPackage/openvswitch/description
106 This package contains the Open vSwitch kernel moodule and bridge compat
107 module. Furthermore, it supports OpenFlow.
108 endef
109
110 CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
111 CONFIGURE_ARGS += --enable-ndebug
112 CONFIGURE_ARGS += --disable-ssl
113 CONFIGURE_ARGS += --enable-shared
114
115 TARGET_CFLAGS += -flto
116
117 define Build/Configure
118 (cd $(PKG_BUILD_DIR); \
119 autoreconf -v --install --force || exit 1 \
120 );
121 $(call Build/Configure/Default,$(CONFIGURE_ARGS))
122 endef
123
124 KCFLAGS=
125 ifeq ($(CONFIG_GCC_VERSION_4_9),y)
126 KCFLAGS:=-Wno-error=date-time
127 endif
128
129 define Build/Compile
130 $(MAKE) -C $(PKG_BUILD_DIR) \
131 $(TARGET_CONFIGURE_OPTS) \
132 CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
133 LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
134 LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
135 STAGING_DIR="$(STAGING_DIR)" \
136 DESTDIR="$(PKG_INSTALL_DIR)/usr" \
137 CROSS_COMPILE="$(TARGET_CROSS)" \
138 ARCH="$(LINUX_KARCH)" \
139 SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
140 PATH="$(TARGET_PATH)" \
141 EXTRA_CFLAGS="$(KCFLAGS)" \
142 KCC="$(KERNEL_CC)"
143 endef
144
145 define Package/openvswitch/install
146 $(INSTALL_DIR) $(1)/etc/openvswitch
147
148 $(INSTALL_DIR) $(1)/etc/init.d
149 $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
150
151 $(INSTALL_DIR) $(1)/usr/lib/
152 $(CP) $(PKG_BUILD_DIR)/lib/.libs/libsflow.so* $(1)/usr/lib/
153 $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch.so* $(1)/usr/lib/
154 $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto.so* $(1)/usr/lib/
155 $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb.so* $(1)/usr/lib/
156
157 $(INSTALL_DIR) $(1)/usr/bin/
158 $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
159 $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
161
162 $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
163 $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
164 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
165
166 $(INSTALL_DIR) $(1)/usr/sbin/
167 $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
168 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
169
170 $(INSTALL_DIR) $(1)/usr/share/openvswitch/
171 $(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
172 endef
173
174 define Package/openvswitch-python/install
175 $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
176 $(CP) $(PKG_BUILD_DIR)/python/ovs/ $(1)/usr/lib/python$(PYTHON_VERSION)/
177 endef
178
179 define Package/openvswitch-ipsec/install
180 $(INSTALL_DIR) $(1)/usr/sbin/
181 $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
182 endef
183
184 define Package/openvswitch-benchmark/install
185 $(INSTALL_DIR) $(1)/usr/bin/
186 $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
187 endef
188
189 define Package/openvswitch/postinst
190 #!/bin/sh
191 [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
192 endef
193
194 $(eval $(call BuildPackage,openvswitch))
195 $(eval $(call BuildPackage,openvswitch-python))
196 $(eval $(call BuildPackage,openvswitch-ipsec))
197 $(eval $(call BuildPackage,openvswitch-benchmark))
198 $(eval $(call KernelPackage,openvswitch))
199