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.

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