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.4 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.1
  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:=0dfed4ba9c8a16a1f316d709b7831a4e139472d4
  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. @(LINUX_3_8||LINUX_3_10||LINUX_3_13||LINUX_3_14)
  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 \
  82. @(LINUX_3_8||LINUX_3_10||LINUX_3_13||LINUX_3_14)
  83. FILES:= \
  84. $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
  85. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  86. endef
  87. define KernelPackage/openvswitch/description
  88. This package contains the Open vSwitch kernel moodule and bridge compat
  89. module. Furthermore, it supports OpenFlow.
  90. endef
  91. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  92. CONFIGURE_ARGS += --enable-ndebug
  93. CONFIGURE_ARGS += --disable-ssl
  94. CONFIGURE_ARGS += --enable-shared
  95. TARGET_CFLAGS += -flto
  96. define Build/Configure
  97. (cd $(PKG_BUILD_DIR); \
  98. autoreconf -v --install --force || exit 1 \
  99. );
  100. $(call Build/Configure/Default,$(CONFIGURE_ARGS))
  101. endef
  102. KCFLAGS=
  103. ifeq ($(CONFIG_GCC_VERSION_4_9),y)
  104. KCFLAGS:=-Wno-error=date-time
  105. endif
  106. define Build/Compile
  107. $(MAKE) -C $(PKG_BUILD_DIR) \
  108. $(TARGET_CONFIGURE_OPTS) \
  109. CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
  110. LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
  111. LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
  112. STAGING_DIR="$(STAGING_DIR)" \
  113. DESTDIR="$(PKG_INSTALL_DIR)/usr" \
  114. CROSS_COMPILE="$(TARGET_CROSS)" \
  115. ARCH="$(LINUX_KARCH)" \
  116. SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
  117. PATH="$(TARGET_PATH)" \
  118. EXTRA_CFLAGS="$(KCFLAGS)" \
  119. KCC="$(KERNEL_CC)"
  120. endef
  121. define Package/openvswitch/install
  122. $(INSTALL_DIR) $(1)/etc/openvswitch
  123. $(INSTALL_DIR) $(1)/etc/init.d
  124. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  125. $(INSTALL_DIR) $(1)/usr/lib/
  126. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libsflow-$(PKG_VERSION).so $(1)/usr/lib/
  127. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
  128. $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
  129. $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).so $(1)/usr/lib/
  130. $(INSTALL_DIR) $(1)/usr/bin/
  131. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
  132. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
  133. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
  134. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
  135. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
  136. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
  137. $(INSTALL_DIR) $(1)/usr/sbin/
  138. $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
  139. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
  140. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  141. $(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
  142. endef
  143. define Package/openvswitch-python/install
  144. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
  145. $(CP) $(PKG_BUILD_DIR)/python/ovs/ $(1)/usr/lib/python$(PYTHON_VERSION)/
  146. endef
  147. define Package/openvswitch-ipsec/install
  148. $(INSTALL_DIR) $(1)/usr/sbin/
  149. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  150. endef
  151. define Package/openvswitch-benchmark/install
  152. $(INSTALL_DIR) $(1)/usr/bin/
  153. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
  154. endef
  155. define Package/openvswitch/postinst
  156. #!/bin/sh
  157. [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
  158. endef
  159. $(eval $(call BuildPackage,openvswitch))
  160. $(eval $(call BuildPackage,openvswitch-python))
  161. $(eval $(call BuildPackage,openvswitch-ipsec))
  162. $(eval $(call BuildPackage,openvswitch-benchmark))
  163. $(eval $(call KernelPackage,openvswitch))