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.

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