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.

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