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.

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