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.

197 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:=1
  12. PKG_VERSION:=2.3.0
  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:=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-ipsec
  58. $(call Package/openvswitch/Default)
  59. TITLE:=Open vSwitch Userspace Package
  60. DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch-python
  61. endef
  62. define Package/openvswitch-ipsec/description
  63. The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
  64. IPsec.
  65. endef
  66. define Package/openvswitch-benchmark
  67. $(call Package/openvswitch/Default)
  68. TITLE:=Open vSwitch Userspace Package
  69. DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch
  70. endef
  71. define Package/openvswitch-benchmark/description
  72. Utility for running OpenVSwitch benchmarking
  73. endef
  74. define KernelPackage/openvswitch
  75. SECTION:=kernel
  76. CATEGORY:=Kernel modules
  77. SUBMENU:=Network Support
  78. TITLE:=Open vSwitch Kernel Package
  79. KCONFIG:=CONFIG_BRIDGE
  80. DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan
  81. FILES:= \
  82. $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
  83. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  84. endef
  85. define KernelPackage/openvswitch/description
  86. This package contains the Open vSwitch kernel moodule and bridge compat
  87. module. Furthermore, it supports OpenFlow.
  88. endef
  89. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  90. CONFIGURE_ARGS += --enable-ndebug
  91. CONFIGURE_ARGS += --disable-ssl
  92. CONFIGURE_ARGS += --enable-shared
  93. TARGET_CFLAGS += -flto
  94. define Build/Configure
  95. (cd $(PKG_BUILD_DIR); \
  96. autoreconf -v --install --force || exit 1 \
  97. );
  98. $(call Build/Configure/Default,$(CONFIGURE_ARGS))
  99. endef
  100. KCFLAGS=
  101. ifeq ($(CONFIG_GCC_VERSION_4_9),y)
  102. KCFLAGS:=-Wno-error=date-time
  103. endif
  104. define Build/Compile
  105. $(MAKE) -C $(PKG_BUILD_DIR) \
  106. $(TARGET_CONFIGURE_OPTS) \
  107. CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
  108. LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
  109. LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
  110. STAGING_DIR="$(STAGING_DIR)" \
  111. DESTDIR="$(PKG_INSTALL_DIR)/usr" \
  112. CROSS_COMPILE="$(TARGET_CROSS)" \
  113. ARCH="$(LINUX_KARCH)" \
  114. SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
  115. PATH="$(TARGET_PATH)" \
  116. KCFLAGS="$(KCFLAGS)" \
  117. KCC="$(KERNEL_CC)"
  118. endef
  119. define Package/openvswitch/install
  120. $(INSTALL_DIR) $(1)/etc/openvswitch
  121. $(INSTALL_DIR) $(1)/etc/init.d
  122. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  123. $(INSTALL_DIR) $(1)/usr/lib/
  124. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libsflow-$(PKG_VERSION).so $(1)/usr/lib/
  125. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
  126. $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
  127. $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).so $(1)/usr/lib/
  128. $(INSTALL_DIR) $(1)/usr/bin/
  129. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
  130. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
  131. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
  132. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
  133. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
  134. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
  135. $(INSTALL_DIR) $(1)/usr/sbin/
  136. $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
  137. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
  138. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  139. $(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
  140. endef
  141. define Package/openvswitch-python/install
  142. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
  143. $(CP) $(PKG_BUILD_DIR)/python/ovs/ $(1)/usr/lib/python$(PYTHON_VERSION)/
  144. endef
  145. define Package/openvswitch-ipsec/install
  146. $(INSTALL_DIR) $(1)/usr/sbin/
  147. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  148. endef
  149. define Package/openvswitch-benchmark/install
  150. $(INSTALL_DIR) $(1)/usr/bin/
  151. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
  152. endef
  153. define Package/openvswitch/postinst
  154. #!/bin/sh
  155. [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
  156. endef
  157. $(eval $(call BuildPackage,openvswitch))
  158. $(eval $(call BuildPackage,openvswitch-python))
  159. $(eval $(call BuildPackage,openvswitch-ipsec))
  160. $(eval $(call BuildPackage,openvswitch-benchmark))
  161. $(eval $(call KernelPackage,openvswitch))