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.

198 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.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. 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-$(PKG_VERSION).so $(1)/usr/lib/
  126. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
  127. $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
  128. $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).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))