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.

433 lines
15 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=gnunet
  3. PKG_VERSION:=0.13.1
  4. PKG_RELEASE:=1
  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=@GNU/gnunet
  7. PKG_HASH:=03d76a852e7fd2fc87b7145cb6abd900f73e4ea6097f3caac9e7d9fe8b625696
  8. PKG_LICENSE:=AGPL-3.0
  9. PKG_LICENSE_FILES:=COPYING
  10. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  11. PKG_CPE_ID:=cpe:/a:gnunet:gnunet
  12. PKG_BUILD_PARALLEL:=1
  13. PKG_FIXUP:=gettext-version
  14. PKG_INSTALL:=1
  15. include $(INCLUDE_DIR)/package.mk
  16. include $(INCLUDE_DIR)/nls.mk
  17. CONFIGURE_ARGS+= \
  18. --with-libiconv-prefix="$(ICONV_PREFIX)" \
  19. --with-libintl-prefix="$(INTL_PREFIX)" \
  20. --with-ltdl \
  21. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
  22. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
  23. $(if $(CONFIG_PACKAGE_libsqlite3),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
  24. --enable-testing \
  25. --disable-testruns \
  26. --disable-documentation \
  27. --enable-experimental \
  28. --with-extractor=$(STAGING_DIR)/usr \
  29. --with-gnutls=$(STAGING_DIR)/usr \
  30. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-transport-bluetooth),--with-libbluetooth="$(STAGING_DIR)/usr",--without-libbluetooth) \
  31. --with-libgnurl=$(STAGING_DIR)/usr \
  32. --with-libogg=$(STAGING_DIR)/usr \
  33. --with-libopus=$(STAGING_DIR)/usr \
  34. --with-libpulse=$(STAGING_DIR)/usr \
  35. --with-libunistring-prefix=$(STAGING_DIR)/usr \
  36. --with-microhttpd=$(STAGING_DIR)/usr
  37. # upstream now provides --with-pulseaudio but doesn't detect rpath
  38. TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
  39. define Package/gnunet/Default
  40. SECTION:=net
  41. CATEGORY:=Network
  42. TITLE:=GNUnet
  43. URL:=https://www.gnunet.org/
  44. endef
  45. define Package/gnunet
  46. $(call Package/gnunet/Default)
  47. TITLE+= - a peer-to-peer framework focusing on security
  48. DEPENDS:=+libatomic +libgcrypt +libgpg-error +libidn2 +libltdl +libsodium \
  49. +libunistring +librt +zlib $(ICONV_DEPENDS) $(INTL_DEPENDS)
  50. USERID:=gnunet=958:gnunet=958
  51. MENU:=1
  52. endef
  53. define Package/gnunet/description
  54. GNUnet is a peer-to-peer framework focusing on security. The first and
  55. primary application for GNUnet is anonymous file-sharing. GNUnet is
  56. currently developed by a worldwide group of independent free software
  57. developers. GNUnet is a GNU package (http://www.gnu.org/).
  58. This is an ALPHA release. There are known and significant bugs as
  59. well as many missing features in this release.
  60. This package provides the core components of GNUnet including the
  61. CADET routing engine, a DHT implementation and basic transports as
  62. well as their helpers.
  63. endef
  64. define BuildComponent
  65. PKG_CONFIG_DEPENDS+=CONFIG_PACKAGE_$(PKG_NAME)-$(1)
  66. define Package/gnunet-$(1)
  67. $$(call Package/gnunet/Default)
  68. TITLE+= $(2)
  69. DEPENDS:=gnunet $(DEPENDS_$(1))
  70. $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
  71. $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
  72. $(if $(CONFLICTS_$(1)),CONFLICTS:=$(CONFLICTS_$(1)))
  73. endef
  74. define Package/gnunet-$(1)/install
  75. ( if [ "$(BIN_$(1))" ]; then \
  76. $(INSTALL_DIR) $$(1)/usr/bin ; \
  77. for bin in $(BIN_$(1)); do \
  78. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
  79. done \
  80. fi )
  81. ( if [ "$(LIB_$(1))" ]; then \
  82. $(INSTALL_DIR) $$(1)/usr/lib ; \
  83. for lib in $(LIB_$(1)); do \
  84. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
  85. done \
  86. fi )
  87. ( if [ "$(PLUGIN_$(1))" ]; then \
  88. $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
  89. for plug in $(PLUGIN_$(1)); do \
  90. $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
  91. done \
  92. fi )
  93. ( if [ "$(LIBEXEC_$(1))" ]; then \
  94. $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
  95. for lex in $(LIBEXEC_$(1)); do \
  96. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
  97. done \
  98. fi )
  99. ( if [ "$(CONF_$(1))" ]; then \
  100. $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
  101. for conf in $(CONF_$(1)); do \
  102. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
  103. done \
  104. fi )
  105. ( if [ -e ./files/gnunet-$(1).defaults ]; then \
  106. $(INSTALL_DIR) $$(1)/etc/uci-defaults ; \
  107. $(INSTALL_BIN) ./files/gnunet-$(1).defaults $$(1)/etc/uci-defaults/gnunet-$(1) ; \
  108. fi )
  109. endef
  110. $$(eval $$(call BuildPackage,gnunet-$(1)))
  111. endef
  112. define Package/gnunet/install
  113. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
  114. $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
  115. ( for bin in arm ats ats-new cadet core config ecc identity nat nat-auto nat-server nse \
  116. peerinfo peerstore revocation scalarproduct scrypt statistics transport uri; do \
  117. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
  118. done )
  119. ( for lib in arm ats atsapplication atstransport block blockgroup cadet \
  120. core datacache dht dns dnsparser fragmentation friends hello \
  121. identity natauto natnew nse nt peerinfo peerstore regexblock regex revocation \
  122. scalarproduct set statistics transport transportaddress transportapplication \
  123. transportcommunicator transportcore transportmonitor util; do \
  124. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
  125. done )
  126. ( for plug in ats_proportional ats2_simple block_dht block_regex block_revocation transport_unix; do \
  127. $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
  128. done )
  129. ( for lex in daemon-topology helper-nat-client \
  130. helper-nat-server service-arm service-ats service-ats-new service-cadet \
  131. service-core service-dht service-identity service-nat service-nat-auto \
  132. service-nse service-peerinfo service-peerstore service-regex \
  133. service-revocation service-scalarproduct-alice \
  134. service-scalarproduct-bob service-scalarproduct-ecc-alice \
  135. service-scalarproduct-ecc-bob service-set service-statistics \
  136. service-transport timeout; do \
  137. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
  138. done )
  139. ( for conf in arm ats cadet communicator-unix core datacache dht identity \
  140. identity-provider nat nat-auto nse peerinfo peerstore regex revocation \
  141. scalarproduct set statistics topology transport util; do \
  142. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
  143. done )
  144. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos
  145. $(INSTALL_DIR) $(1)/etc/init.d
  146. $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
  147. $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
  148. $(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
  149. $(INSTALL_DIR) $(1)/etc/uci-defaults
  150. $(INSTALL_BIN) ./files/gnunet.defaults $(1)/etc/uci-defaults/gnunet
  151. $(INSTALL_DIR) $(1)/lib/netifd/proto
  152. $(INSTALL_BIN) ./files/gnunet-proto.sh $(1)/lib/netifd/proto/gnunet.sh
  153. endef
  154. define Build/InstallDev
  155. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  156. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  157. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  158. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  159. endef
  160. BIN_abd:=abd
  161. LIB_abd:=abd
  162. PLUGIN_abd:=gnsrecord_abd
  163. LIBEXEC_abd:=service-abd
  164. CONF_abd:=abd
  165. DEPENDS_abd:=+gnunet-gns
  166. BIN_auction:=auction-create auction-info auction-join
  167. LIBEXEC_auction:=service-auction
  168. CONF_auction:=auction
  169. DEPENDS_auction:=+gnunet-reclaim +jansson
  170. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  171. BIN_conversation:=conversation conversation-test
  172. LIB_conversation:=conversation microphone speaker
  173. PLUGIN_conversation:=gnsrecord_conversation
  174. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  175. CONF_conversation:=conversation
  176. BIN_dht-cli:=dht-get dht-put dht-monitor
  177. PLUGIN_dht-cli:=block_test
  178. DEPENDS_curl:=+libgnurl +jansson
  179. LIB_curl:=curl
  180. DEPENDS_hostlist:=+libmicrohttpd-ssl +gnunet-curl +ca-certificates
  181. LIBEXEC_hostlist:=daemon-hostlist
  182. CONF_hostlist:=hostlist
  183. DEPENDS_transport-bluetooth:=+bluez-libs
  184. PLUGIN_transport-bluetooth:=transport_bluetooth
  185. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  186. DEPENDS_transport-http_client:=+gnunet-curl +ca-certificates
  187. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  188. DEPENDS_transport-http_server:=+libmicrohttpd-ssl
  189. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  190. PLUGIN_transport-tcp:=transport_tcp
  191. PLUGIN_transport-udp:=transport_udp
  192. PLUGIN_transport-wlan:=transport_wlan
  193. LIBEXEC_transport-wlan:=helper-transport-wlan
  194. # BIN_dv:=dv
  195. LIB_dv:=dv
  196. PLUGIN_dv:=transport_dv
  197. LIBEXEC_dv:=service-dv
  198. CONF_dv:=dv
  199. DEPENDS_fs:=+gnunet-datastore +libextractor
  200. BIN_fs:=auto-share directory download fs publish unindex search
  201. LIB_fs:=fs
  202. PLUGIN_fs:=block_fs
  203. LIBEXEC_fs:=helper-fs-publish service-fs
  204. CONF_fs:=fs
  205. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  206. USERID_gns:=gnunet=958:gnunetdns=452
  207. BIN_gns:=gns gns-import.sh namecache namestore resolver zoneimport
  208. LIB_gns:=gns gnsrecord namecache namestore
  209. PLUGIN_gns:=block_dns block_gns gnsrecord_conversation gnsrecord_dns gnsrecord_gns
  210. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver service-zonemaster
  211. CONF_gns:=dns gns namecache namestore resolver zonemaster
  212. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd-ssl
  213. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  214. DEPENDS_gns-proxy:=+gnunet-gns +gnunet-curl +libmicrohttpd-ssl
  215. LIBEXEC_gns-proxy:=gns-proxy
  216. DEPENDS_datastore:=+gnunet-gns
  217. BIN_datastore:=datastore
  218. LIB_datastore:=datastore
  219. LIBEXEC_datastore:=service-datastore
  220. CONF_datastore:=datastore
  221. DEPENDS_reclaim:=+gnunet-gns +gnunet-sqlite +libpbc +libgabe +jansson
  222. BIN_reclaim:=reclaim
  223. LIB_reclaim:=consensus abe reclaim reclaimattribute secretsharing
  224. LIBEXEC_reclaim:=service-consensus service-reclaim service-secretsharing
  225. CONF_reclaim:=consensus reclaim secretsharing
  226. PLUGIN_reclaim:=block_consensus gnsrecord_reclaim reclaim_attestation_jwt reclaim_attribute_basic
  227. DEPENDS_rest:=+gnunet-gns +gnunet-reclaim +libmicrohttpd-ssl +jansson
  228. LIB_rest:=rest json
  229. PLUGIN_rest:=rest_copying rest_gns rest_identity rest_namestore rest_peerinfo rest_openid_connect rest_reclaim
  230. LIBEXEC_rest:=rest-server
  231. CONF_rest:=rest
  232. BIN_rps:=rps
  233. LIB_rps:=rps
  234. LIBEXEC_rps:=service-rps
  235. CONF_rps:=rps
  236. PLUGIN_dhtcache-heap:=datacache_heap
  237. CONFLICTS_dhtcache-heap:=gnunet-dhtcache-pgsql gnunet-dhtcache-sqlite
  238. DEPENDS_gns-flat:=+gnunet-gns
  239. PLUGIN_gns-flat:=namecache_flat namestore_flat
  240. PLUGIN_peerstore-flat:=peerstore_flat
  241. DEPENDS_fs-heap:=+gnunet-datastore
  242. PLUGIN_fs-heap:=datastore_heap
  243. CONFLICTS_fs-heap:=gnunet-fs-mysql gnunet-fs-pgsql gnunet-fs-sqlite
  244. DEPENDS_mysql:=+libmysqlclient
  245. LIB_mysql:=mysql my
  246. DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
  247. PLUGIN_fs-mysql:=datastore_mysql
  248. CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
  249. DEPENDS_pgsql:=+libpq
  250. LIB_pgsql:=pq
  251. DEPENDS_dhtcache-pgsql:=+gnunet-pgsql
  252. PLUGIN_dhtcache-pgsql:=datacache_postgres
  253. CONFLICTS_dhtcache-pgsql:=gnunet-dhtcache-sqlite
  254. DEPENDS_fs-pgsql:=+gnunet-pgsql +gnunet-datastore
  255. PLUGIN_fs-pgsql:=datastore_postgres
  256. CONFLICTS_fs-pgsql:=gnunet-fs-sqlite
  257. DEPENDS_gns-pgsql:=+gnunet-pgsql +gnunet-gns
  258. PLUGIN_gns-pgsql:=namecache_postgres namestore_postgres
  259. CONFLICTS_gns-pgsql:=gnunet-gns-sqlite gnunet-gns-flat
  260. DEPENDS_sqlite:=+libsqlite3
  261. LIB_sqlite:=sq
  262. DEPENDS_gns-sqlite:=+gnunet-gns +gnunet-sqlite
  263. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  264. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  265. DEPENDS_peerstore-sqlite:=+gnunet-sqlite
  266. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  267. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  268. DEPENDS_dhtcache-sqlite:=+gnunet-sqlite
  269. PLUGIN_dhtcache-sqlite:=datacache_sqlite
  270. DEPENDS_fs-sqlite:=+gnunet-datastore +gnunet-sqlite
  271. PLUGIN_fs-sqlite:=datastore_sqlite
  272. DEPENDS_utils:=+certtool +openssl-util
  273. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation
  274. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  275. BIN_vpn:=vpn
  276. LIB_vpn:=dnsstub tun vpn
  277. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  278. CONF_vpn:=exit pt vpn
  279. define Package/gnunet-gns/prerm
  280. #!/bin/sh
  281. uci -q batch <<EOF
  282. del network.gnunetdns
  283. del network.gndnsrtt
  284. del network.gndnsrl
  285. commit network
  286. del firewall.gnunetdns
  287. del firewall.gndnsrl
  288. del firewall.gndnsrl2
  289. commit firewall
  290. EOF
  291. endef
  292. define Package/gnunet-vpn/prerm
  293. #!/bin/sh
  294. uci -q batch <<EOF
  295. del network.gnunetvpn
  296. del network.gnunetexit
  297. commit network
  298. del firewall.gnunetvpn
  299. del firewall.gnunetexit
  300. del firewall.gnexitfwd
  301. commit firewall
  302. EOF
  303. endef
  304. define PostInstFixSUIDPerms
  305. define Package/$(1)/postinst
  306. #!/bin/sh
  307. [ -z "$IPKG_INSTROOT" ] || exit 0
  308. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix || exit 0
  309. endef
  310. endef
  311. $(eval $(call PostInstFixSUIDPerms,gnunet))
  312. $(eval $(call PostInstFixSUIDPerms,gnunet-gns))
  313. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  314. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  315. $(eval $(call PostInstFixSUIDPerms,gnunet-vpn))
  316. $(eval $(call BuildPackage,gnunet))
  317. $(eval $(call BuildComponent,abd,credential service components,))
  318. $(eval $(call BuildComponent,auction,auction components,))
  319. $(eval $(call BuildComponent,conversation,conversation component,))
  320. $(eval $(call BuildComponent,curl,cURL wrapper component,))
  321. $(eval $(call BuildComponent,datastore,data storage components,))
  322. $(eval $(call BuildComponent,dht-cli,DHT command line clients,))
  323. # $(eval $(call BuildComponent,dv,distance-vector routing component,y))
  324. $(eval $(call BuildComponent,fs,file-sharing components,))
  325. $(eval $(call BuildComponent,gns,name resolution components,y))
  326. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  327. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,y))
  328. $(eval $(call BuildComponent,reclaim,reclaim identity-provider subsystem,))
  329. $(eval $(call BuildComponent,rest,REST interface,))
  330. $(eval $(call BuildComponent,rps,RPS routing component,y))
  331. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  332. $(eval $(call BuildComponent,dhtcache-heap,heap-based dhtcache plugin,y))
  333. $(eval $(call BuildComponent,fs-heap,heap-based filesharing plugin,))
  334. $(eval $(call BuildComponent,gns-flat,flat storage GNS plugins,y))
  335. $(eval $(call BuildComponent,peerstore-flat,flat storage peerstore plugin,))
  336. $(eval $(call BuildComponent,mysql,mySQL backend,))
  337. $(eval $(call BuildComponent,fs-mysql,mySQL filesharing plugins,))
  338. $(eval $(call BuildComponent,pgsql,PostgreSQL backend,))
  339. $(eval $(call BuildComponent,dhtcache-pgsql,PostgreSQL dhtcache plugin,))
  340. $(eval $(call BuildComponent,fs-pgsql,PostgreSQL filesharing plugin,))
  341. $(eval $(call BuildComponent,gns-pgsql,PostgreSQL GNS plugins,))
  342. $(eval $(call BuildComponent,sqlite,libsqlite3 backend,))
  343. $(eval $(call BuildComponent,dhtcache-sqlite,libsqlite3 dhtcache plugin,))
  344. $(eval $(call BuildComponent,fs-sqlite,libsqlite3 filesharing plugin,))
  345. $(eval $(call BuildComponent,gns-sqlite,libsqlite3 gns plugins,))
  346. $(eval $(call BuildComponent,peerstore-sqlite,libsqlite3 peerstore plugin,))
  347. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  348. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  349. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  350. $(eval $(call BuildComponent,transport-tcp,TCP transport,y))
  351. $(eval $(call BuildComponent,transport-udp,UDP transport,y))
  352. $(eval $(call BuildComponent,transport-wlan,WLAN transport,y))
  353. $(eval $(call BuildComponent,utils,administration utililties,))
  354. $(eval $(call BuildComponent,vpn,vpn components,y))