Makefile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 2 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along
  13. # with this program; if not, write to the Free Software Foundation, Inc.,
  14. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. #
  16. # The full GNU General Public License is included in this distribution in
  17. # the file called "COPYING".
  18. #
  19. # Contibutors:
  20. # Axel Neumann, Simó Albert i Beltran, Pau Escrich
  21. #
  22. include $(TOPDIR)/rules.mk
  23. PKG_NAME:=bmx7
  24. PKG_SOURCE_PROTO:=git
  25. PKG_SOURCE_URL:=https://github.com/bmx-routing/bmx7.git
  26. PKG_REV:=9883383dc26df16da67b9ef7ba99efe62f79c4e7
  27. PKG_MIRROR_HASH:=012178aba42016d3e0961715f99bf1e322c2c6c22b1cc6635375468360cb4d68
  28. PKG_VERSION:=r2018042501
  29. PKG_RELEASE:=2
  30. PKG_LICENSE:=GPL-2.0
  31. PKG_SOURCE_VERSION:=$(PKG_REV)
  32. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  33. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
  34. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  35. include $(INCLUDE_DIR)/package.mk
  36. TARGET_CFLAGS += $(FPIC)
  37. MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=MBEDTLS_2_4_0 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO"
  38. MAKE_ARGS += \
  39. EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -liwinfo" \
  40. GIT_REV="$(PKG_REV)" \
  41. CC="$(TARGET_CC)" \
  42. INSTALL_DIR="$(PKG_INSTALL_DIR)" \
  43. build_all
  44. define Package/bmx7/Default
  45. SECTION:=net
  46. CATEGORY:=Network
  47. SUBMENU:=Routing and Redirection
  48. TITLE:=BMX7 layer 3 routing daemon
  49. URL:=http://github.com/bmx-routing/bmx7
  50. MAINTAINER:=Axel Neumann <neumann@cgws.de>
  51. DEPENDS:=+zlib +libmbedtls +libiwinfo
  52. endef
  53. define Package/bmx7/description
  54. BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
  55. endef
  56. define Package/bmx7
  57. $(call Package/bmx7/Default)
  58. MENU:=1
  59. endef
  60. define Package/bmx7-uci-config
  61. $(call Package/bmx7/Default)
  62. DEPENDS:=bmx7 +libuci
  63. TITLE:=configuration plugin based on uci (recommended!)
  64. endef
  65. define Package/bmx7-iwinfo
  66. $(call Package/bmx7/Default)
  67. DEPENDS:=bmx7 +libiwinfo
  68. TITLE:=link characteristics plugin based on libiwinfo (recommended!)
  69. endef
  70. define Package/bmx7-topology
  71. $(call Package/bmx7/Default)
  72. DEPENDS:=bmx7
  73. TITLE:=topology plugin
  74. endef
  75. define Package/bmx7-json
  76. $(call Package/bmx7/Default)
  77. DEPENDS:=bmx7 +libjson-c
  78. TITLE:=json plugin based on json-c
  79. endef
  80. define Package/bmx7-sms
  81. $(call Package/bmx7/Default)
  82. DEPENDS:=bmx7
  83. TITLE:=sms plugin
  84. endef
  85. define Package/bmx7-tun
  86. $(call Package/bmx7/Default)
  87. DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
  88. TITLE:=ipip-based tunnel plugin (recommended!)
  89. endef
  90. define Package/bmx7-table
  91. $(call Package/bmx7/Default)
  92. DEPENDS:=bmx7 +bmx7-tun
  93. TITLE:=plugin to announce routes from tables via tunnels
  94. endef
  95. define Build/Configure
  96. mkdir -p $(PKG_INSTALL_DIR)
  97. endef
  98. define Build/Compile
  99. $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
  100. endef
  101. define Package/bmx7/install
  102. $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
  103. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx7 $(1)/usr/sbin/bmx7
  104. endef
  105. define Package/bmx7/postinst
  106. #!/bin/sh
  107. # # check if we are on real system
  108. if [ -z "$${IPKG_INSTROOT}" ]; then
  109. if [ -f /etc/sysupgrade.conf ] && ! grep bmx7 /etc/sysupgrade.conf; then
  110. echo /etc/bmx7 >> /etc/sysupgrade.conf
  111. fi
  112. fi
  113. endef
  114. define Package/bmx7-uci-config/conffiles
  115. /etc/config/bmx7
  116. /etc/bmx7
  117. endef
  118. define Package/bmx7-uci-config/install
  119. $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
  120. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_uci_config/bmx7_config.so $(1)/usr/lib/bmx7_config.so
  121. $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7
  122. $(INSTALL_DATA) ./files/etc/config/bmx7 $(1)/etc/config/bmx7
  123. endef
  124. define Package/bmx7-iwinfo/install
  125. $(INSTALL_DIR) $(1)/usr/lib
  126. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_iwinfo/bmx7_iwinfo.so $(1)/usr/lib/bmx7_iwinfo.so
  127. endef
  128. define Package/bmx7-topology/install
  129. $(INSTALL_DIR) $(1)/usr/lib
  130. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_topology/bmx7_topology.so $(1)/usr/lib/bmx7_topology.so
  131. endef
  132. define Package/bmx7-json/install
  133. $(INSTALL_DIR) $(1)/usr/lib
  134. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_json/bmx7_json.so $(1)/usr/lib/bmx7_json.so
  135. endef
  136. define Package/bmx7-sms/install
  137. $(INSTALL_DIR) $(1)/usr/lib
  138. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_sms/bmx7_sms.so $(1)/usr/lib/bmx7_sms.so
  139. endef
  140. define Package/bmx7-tun/install
  141. $(INSTALL_DIR) $(1)/usr/lib
  142. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_tun/bmx7_tun.so $(1)/usr/lib/bmx7_tun.so
  143. endef
  144. define Package/bmx7-table/install
  145. $(INSTALL_DIR) $(1)/usr/lib
  146. $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_table/bmx7_table.so $(1)/usr/lib/bmx7_table.so
  147. endef
  148. $(eval $(call BuildPackage,bmx7))
  149. $(eval $(call BuildPackage,bmx7-uci-config))
  150. $(eval $(call BuildPackage,bmx7-iwinfo))
  151. $(eval $(call BuildPackage,bmx7-topology))
  152. $(eval $(call BuildPackage,bmx7-json))
  153. $(eval $(call BuildPackage,bmx7-sms))
  154. $(eval $(call BuildPackage,bmx7-table))
  155. $(eval $(call BuildPackage,bmx7-tun))