Brak opisu

Makefile 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. $(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
  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. define Build/Compile
  101. $(MAKE) -C $(PKG_BUILD_DIR) \
  102. $(TARGET_CONFIGURE_OPTS) \
  103. CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
  104. LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
  105. LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
  106. STAGING_DIR="$(STAGING_DIR)" \
  107. DESTDIR="$(PKG_INSTALL_DIR)/usr" \
  108. CROSS_COMPILE="$(TARGET_CROSS)" \
  109. ARCH="$(LINUX_KARCH)" \
  110. SUBDIRS="$(PKG_BUILD_DIR)/datapath/linux" \
  111. PATH="$(TARGET_PATH)" \
  112. KCC="$(KERNEL_CC)"
  113. endef
  114. define Package/openvswitch/install
  115. $(INSTALL_DIR) $(1)/etc/openvswitch
  116. $(INSTALL_DIR) $(1)/etc/init.d
  117. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  118. $(INSTALL_DIR) $(1)/usr/lib/
  119. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libsflow-$(PKG_VERSION).so $(1)/usr/lib/
  120. $(CP) $(PKG_BUILD_DIR)/lib/.libs/libopenvswitch-$(PKG_VERSION).so $(1)/usr/lib/
  121. $(CP) $(PKG_BUILD_DIR)/ofproto/.libs/libofproto-$(PKG_VERSION).so $(1)/usr/lib/
  122. $(CP) $(PKG_BUILD_DIR)/ovsdb/.libs/libovsdb-$(PKG_VERSION).so $(1)/usr/lib/
  123. $(INSTALL_DIR) $(1)/usr/bin/
  124. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-appctl $(1)/usr/bin/
  125. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-ofctl $(1)/usr/bin/
  126. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-client $(1)/usr/bin/
  127. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-dpctl $(1)/usr/bin/
  128. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-vsctl $(1)/usr/bin/
  129. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-tool $(1)/usr/bin/
  130. $(INSTALL_DIR) $(1)/usr/sbin/
  131. $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/.libs/ovs-vswitchd $(1)/usr/sbin/
  132. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/.libs/ovsdb-server $(1)/usr/sbin/
  133. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  134. $(INSTALL_CONF) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema $(1)/usr/share/openvswitch/
  135. endef
  136. define Package/openvswitch-python/install
  137. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
  138. $(CP) $(PKG_BUILD_DIR)/python/ovs/ $(1)/usr/lib/python$(PYTHON_VERSION)/
  139. endef
  140. define Package/openvswitch-ipsec/install
  141. $(INSTALL_DIR) $(1)/usr/sbin/
  142. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  143. endef
  144. define Package/openvswitch-benchmark/install
  145. $(INSTALL_DIR) $(1)/usr/bin/
  146. $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/.libs/ovs-benchmark $(1)/usr/bin/
  147. endef
  148. define Package/openvswitch/postinst
  149. #!/bin/sh
  150. [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
  151. endef
  152. $(eval $(call BuildPackage,openvswitch))
  153. $(eval $(call BuildPackage,openvswitch-python))
  154. $(eval $(call BuildPackage,openvswitch-ipsec))
  155. $(eval $(call BuildPackage,openvswitch-benchmark))
  156. $(eval $(call KernelPackage,openvswitch))