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