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.

157 lines
5.0 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_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. PKG_FIXUP=libtool
  25. define Package/openvswitch/Default
  26. SECTION:=net
  27. CATEGORY:=Network
  28. URL:=http://openvswitch.org/
  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
  41. $(call Package/openvswitch/Default)
  42. TITLE:=Open vSwitch Userspace Package
  43. DEPENDS:=+libpcap +libopenssl +librt +libatomic +kmod-openvswitch
  44. endef
  45. define Package/openvswitch/description
  46. Provides the main userspace components required for Open vSwitch to function.
  47. endef
  48. define Package/openvswitch-benchmark
  49. $(call Package/openvswitch/Default)
  50. TITLE:=Open vSwitch Userspace Package
  51. DEPENDS:=@PACKAGE_openvswitch +PACKAGE_openvswitch:openvswitch
  52. endef
  53. define Package/openvswitch-benchmark/description
  54. Utility for running OpenVSwitch benchmarking
  55. endef
  56. define KernelPackage/openvswitch
  57. SECTION:=kernel
  58. CATEGORY:=Kernel modules
  59. SUBMENU:=Network Support
  60. TITLE:=Open vSwitch Kernel Package
  61. KCONFIG:=CONFIG_BRIDGE
  62. DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c
  63. FILES:= \
  64. $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
  65. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  66. endef
  67. define KernelPackage/openvswitch/description
  68. This package contains the Open vSwitch kernel moodule and bridge compat
  69. module. Furthermore, it supports OpenFlow.
  70. endef
  71. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  72. CONFIGURE_ARGS += --enable-ndebug
  73. CONFIGURE_ARGS += --disable-ssl
  74. CONFIGURE_ARGS += --enable-shared
  75. TARGET_CFLAGS += -flto
  76. define Build/Configure
  77. (cd $(PKG_BUILD_DIR); \
  78. autoreconf -v --install --force || exit 1 \
  79. );
  80. $(call Build/Configure/Default,$(CONFIGURE_ARGS))
  81. endef
  82. define Build/Compile
  83. $(MAKE) -C $(PKG_BUILD_DIR) \
  84. $(TARGET_CONFIGURE_OPTS) \
  85. CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
  86. LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
  87. LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
  88. STAGING_DIR="$(STAGING_DIR)" \
  89. DESTDIR="$(PKG_INSTALL_DIR)/usr" \
  90. CROSS_COMPILE="$(TARGET_CROSS)" \
  91. ARCH="$(LINUX_KARCH)" \
  92. SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
  93. PATH="$(TARGET_PATH)" \
  94. KCC="$(KERNEL_CC)"
  95. endef
  96. define Package/openvswitch/install
  97. $(INSTALL_DIR) $(1)/etc/openvswitch
  98. $(INSTALL_DIR) $(1)/etc/init.d
  99. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  100. $(INSTALL_DIR) $(1)/usr/lib/
  101. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libsflow-$(PKG_VERSION).so $(1)/usr/lib/
  102. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
  103. $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
  104. $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).so $(1)/usr/lib/
  105. $(INSTALL_DIR) $(1)/usr/bin/
  106. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
  107. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
  108. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
  109. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
  110. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
  111. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
  112. $(INSTALL_DIR) $(1)/usr/sbin/
  113. $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
  114. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
  115. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  116. $(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
  117. endef
  118. define Package/openvswitch-benchmark/install
  119. $(INSTALL_DIR) $(1)/usr/bin/
  120. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
  121. endef
  122. define Package/openvswitch/postinst
  123. #!/bin/sh
  124. [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
  125. endef
  126. $(eval $(call BuildPackage,openvswitch))
  127. $(eval $(call BuildPackage,openvswitch-benchmark))
  128. $(eval $(call KernelPackage,openvswitch))