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.

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