You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
7.5 KiB

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