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.

428 lines
15 KiB

  1. #
  2. # Copyright (C) 2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=gnunet
  9. PKG_SOURCE_VERSION:=71c1409cfbe726f7e8b4e33fed784c8896bc0fcd
  10. PKG_VERSION:=0.10.2-git-20170109-$(PKG_SOURCE_VERSION)
  11. PKG_RELEASE:=1
  12. # ToDo:
  13. # - package testing stuff
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_SOURCE_URL:=https://gnunet.org/git/gnunet.git
  17. PKG_SOURCE_PROTO:=git
  18. PKG_LICENSE:=GPL-3.0
  19. PKG_LICENSE_FILES:=COPYING
  20. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_FIXUP:=gettext-version
  23. PKG_INSTALL:=1
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/nls.mk
  26. CONFIGURE_ARGS+= \
  27. --with-libiconv-prefix="$(ICONV_PREFIX)" \
  28. --with-libintl-prefix="$(INTL_PREFIX)" \
  29. --with-ltdl \
  30. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
  31. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
  32. $(if $(CONFIG_PACKAGE_libsqlite3),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
  33. --enable-experimental \
  34. --with-extractor=$(STAGING_DIR)/usr \
  35. --with-gnutls=$(STAGING_DIR)/usr \
  36. --with-libgnurl=$(STAGING_DIR)/usr \
  37. --with-libunistring-prefix=$(STAGING_DIR)/usr \
  38. --with-microhttpd=$(STAGING_DIR)/usr
  39. # ToDo: request upstream to provide --with-pulseaudio=...
  40. TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
  41. define Package/gnunet/Default
  42. SECTION:=net
  43. CATEGORY:=Network
  44. TITLE:=GNUnet
  45. URL:=https://www.gnunet.org/
  46. endef
  47. define Package/gnunet
  48. $(call Package/gnunet/Default)
  49. TITLE+= - a peer-to-peer framework focusing on security
  50. DEPENDS:=+libgcrypt +libgpg-error +libidn +libltdl +libunistring +librt +zlib \
  51. $(ICONV_DEPENDS) $(INTL_DEPENDS)
  52. USERID:=gnunet=958:gnunet=958
  53. MENU:=1
  54. endef
  55. define Package/gnunet/description
  56. GNUnet is a peer-to-peer framework focusing on security. The first and
  57. primary application for GNUnet is anonymous file-sharing. GNUnet is
  58. currently developed by a worldwide group of independent free software
  59. developers. GNUnet is a GNU package (http://www.gnu.org/).
  60. This is an ALPHA release. There are known and significant bugs as
  61. well as many missing features in this release.
  62. This package provides the core components of GNUnet including the
  63. CADET routing engine, a DHT implementation and basic transports as
  64. well as their helpers.
  65. endef
  66. define BuildComponent
  67. PKG_CONFIG_DEPENDS+=CONFIG_PACKAGE_$(PKG_NAME)-$(1)
  68. define Package/gnunet-$(1)
  69. $$(call Package/gnunet/Default)
  70. TITLE+= $(2)
  71. DEPENDS:=gnunet $(DEPENDS_$(1))
  72. $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
  73. $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
  74. $(if $(CONFLICTS_$(1)),CONFLICTS:=$(CONFLICTS_$(1)))
  75. endef
  76. define Package/gnunet-$(1)/install
  77. ( if [ "$(BIN_$(1))" ]; then \
  78. $(INSTALL_DIR) $$(1)/usr/bin ; \
  79. for bin in $(BIN_$(1)); do \
  80. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
  81. done \
  82. fi )
  83. ( if [ "$(LIB_$(1))" ]; then \
  84. $(INSTALL_DIR) $$(1)/usr/lib ; \
  85. for lib in $(LIB_$(1)); do \
  86. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
  87. done \
  88. fi )
  89. ( if [ "$(PLUGIN_$(1))" ]; then \
  90. $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
  91. for plug in $(PLUGIN_$(1)); do \
  92. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
  93. done \
  94. fi )
  95. ( if [ "$(LIBEXEC_$(1))" ]; then \
  96. $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
  97. for lex in $(LIBEXEC_$(1)); do \
  98. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
  99. done \
  100. fi )
  101. ( if [ "$(CONF_$(1))" ]; then \
  102. $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
  103. for conf in $(CONF_$(1)); do \
  104. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
  105. done \
  106. fi )
  107. ( if [ -e ./files/gnunet-$(1).defaults ]; then \
  108. $(INSTALL_DIR) $$(1)/etc/uci-defaults ; \
  109. $(INSTALL_BIN) ./files/gnunet-$(1).defaults $$(1)/etc/uci-defaults/gnunet-$(1) ; \
  110. fi )
  111. endef
  112. $$(eval $$(call BuildPackage,gnunet-$(1)))
  113. endef
  114. define Package/gnunet/install
  115. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
  116. $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
  117. ( for bin in arm ats cadet core config ecc identity nat nat-auto nat-server nse \
  118. peerinfo revocation scalarproduct statistics transport uri; do \
  119. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
  120. done )
  121. ( for lib in arm ats block cadet core datacache dht \
  122. dns dnsparser fragmentation friends hello identity natauto natnew nse \
  123. peerinfo regexblock regex revocation scalarproduct set \
  124. statistics transport util; do \
  125. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
  126. done )
  127. ( for plug in ats_proportional block_dht block_regex \
  128. transport_tcp transport_udp transport_unix; do \
  129. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
  130. done )
  131. ( for lex in daemon-topology helper-nat-client \
  132. helper-nat-server service-arm service-ats service-cadet \
  133. service-core service-dht service-identity service-nat service-nat-auto \
  134. service-nse service-peerinfo service-regex \
  135. service-revocation service-scalarproduct-alice \
  136. service-scalarproduct-bob service-scalarproduct-ecc-alice \
  137. service-scalarproduct-ecc-bob service-set service-statistics \
  138. service-transport; do \
  139. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
  140. done )
  141. ( for conf in arm ats cadet core datacache dht identity identity-provider \
  142. nat nat-auto nse peerinfo regex revocation scalarproduct \
  143. set statistics topology transport util; do \
  144. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
  145. done )
  146. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos
  147. $(INSTALL_DIR) $(1)/etc/init.d
  148. $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
  149. $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
  150. $(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
  151. $(INSTALL_DIR) $(1)/etc/uci-defaults
  152. $(INSTALL_BIN) ./files/gnunet.defaults $(1)/etc/uci-defaults/gnunet
  153. $(INSTALL_DIR) $(1)/lib/netifd/proto
  154. $(INSTALL_BIN) ./files/gnunet-proto.sh $(1)/lib/netifd/proto/gnunet.sh
  155. endef
  156. define Build/InstallDev
  157. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  158. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  159. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  160. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  161. endef
  162. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  163. BIN_conversation:=conversation conversation-test
  164. LIB_conversation:=conversation microphone speaker
  165. PLUGIN_conversation:=gnsrecord_conversation
  166. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  167. CONF_conversation:=conversation
  168. DEPENDS_hostlist:=+libmicrohttpd +libgnurl +ca-certificates
  169. LIBEXEC_hostlist:=daemon-hostlist
  170. CONF_hostlist:=hostlist
  171. DEPENDS_transport-http_client:=+libgnurl +ca-certificates
  172. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  173. DEPENDS_transport-http_server:=+libmicrohttpd
  174. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  175. PLUGIN_transport-wlan:=transport_wlan
  176. LIBEXEC_transport-wlan:=helper-transport-wlan
  177. DEPENDS_experiments:=+libglpk
  178. PLUGIN_experiments:=ats_mlp ats_ril
  179. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  180. # BIN_dv:=dv
  181. LIB_dv:=dv
  182. PLUGIN_dv:=transport_dv
  183. LIBEXEC_dv:=service-dv
  184. CONF_dv:=dv
  185. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  186. BIN_fs:=auto-share directory download fs publish unindex search
  187. LIB_fs:=fs
  188. PLUGIN_fs:=block_fs
  189. LIBEXEC_fs:=helper-fs-publish service-fs
  190. CONF_fs:=fs
  191. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  192. USERID_gns:=gnunet=958:gnunetdns=452
  193. BIN_gns:=gns gns-import.sh namecache namestore resolver
  194. LIB_gns:=gns gnsrecord namecache namestore
  195. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns gnsrecord_identity
  196. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver service-zonemaster
  197. CONF_gns:=dns gns namecache namestore resolver zonemaster
  198. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd
  199. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  200. DEPENDS_gns-proxy:=+gnunet-gns +libgnurl +libmicrohttpd
  201. LIBEXEC_gns-proxy:=gns-proxy
  202. DEPENDS_datastore:=+gnunet-gns
  203. BIN_datastore:=datastore
  204. LIB_datastore:=datastore
  205. LIBEXEC_datastore:=service-datastore
  206. CONF_datastore:=datastore
  207. BIN_peerstore:=peerstore
  208. LIB_peerstore:=peerstore
  209. LIBEXEC_peerstore:=service-peerstore
  210. CONF_peerstore:=peerstore
  211. DEPENDS_rest:=+gnunet-gns +gnunet-social +libmicrohttpd +jansson
  212. LIB_rest:=rest json jsonapi jsonapiutils
  213. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  214. LIBEXEC_rest:=rest-server
  215. CONF_rest:=rest
  216. BIN_rps:=rps
  217. LIB_rps:=rps
  218. LIBEXEC_rps:=service-rps
  219. CONF_rps:=rps
  220. DEPENDS_social:=+gnunet-gns +libmicrohttpd +jansson
  221. BIN_social:=identity-token multicast social
  222. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  223. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  224. CONF_social:=consensus multicast psyc psycstore secretsharing social
  225. PLUGIN_dhtcache-heap:=datacache_heap
  226. CONFLICTS_dhtcache-heap:=gnunet-dhtcache-pgsql gnunet-dhtcache-sqlite
  227. DEPENDS_gns-flat:=+gnunet-gns
  228. PLUGIN_gns-flat:=namecache_flat namestore_flat
  229. DEPENDS_peerstore-flat:=+gnunet-peerstore
  230. PLUGIN_peerstore-flat:=peerstore_flat
  231. DEPENDS_fs-heap:=+gnunet-datastore
  232. PLUGIN_fs-heap:=datastore_heap
  233. CONFLICTS_fs-heap:=gnunet-fs-mysql gnunet-fs-pgsql gnunet-fs-sqlite
  234. DEPENDS_mysql:=+libmysqlclient
  235. LIB_mysql:=mysql my
  236. DEPENDS_social-mysql:=+gnunet-mysql +gnunet-social
  237. PLUGIN_social-mysql:=psycstore_mysql
  238. CONFLICTS_social-mysql:=gnunet-social-sqlite
  239. DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
  240. PLUGIN_fs-mysql:=datastore_mysql
  241. CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
  242. DEPENDS_pgsql:=+libpq
  243. LIB_pgsql:=postgres pq
  244. DEPENDS_dhtcache-pgsql:=+gnunet-pgsql
  245. PLUGIN_dhtcache-pgsql:=datacache_postgres
  246. CONFLICTS_dhtcache-pgsql:=gnunet-dhtcache-sqlite
  247. DEPENDS_fs-pgsql:=+gnunet-pgsql +gnunet-datastore
  248. PLUGIN_fs-pgsql:=datastore_postgres
  249. CONFLICTS_fs-pgsql:=gnunet-fs-sqlite
  250. DEPENDS_gns-pgsql:=+gnunet-pgsql +gnunet-gns
  251. PLUGIN_gns-pgsql:=namecache_postgres namestore_postgres
  252. CONFLICTS_gns-pgsql:=gnunet-gns-sqlite gnunet-gns-flat
  253. DEPENDS_social-pgsql:=+gnunet-pgsql +gnunet-social
  254. PLUGIN_social-pgsql:=psycstore_postgres
  255. CONFLICTS_social-pgsql:=gnunet-social-sqlite gnunet-social-mysql
  256. DEPENDS_gns-sqlite:=+libsqlite3 +gnunet-gns
  257. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  258. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  259. DEPENDS_peerstore-sqlite:=+libsqlite3 +gnunet-peerstore
  260. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  261. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  262. DEPENDS_dhtcache-sqlite:=+libsqlite3
  263. PLUGIN_dhtcache-sqlite:=datacache_sqlite
  264. DEPENDS_fs-sqlite:=+libsqlite3 +gnunet-datastore
  265. PLUGIN_fs-sqlite:=datastore_sqlite
  266. LIBEXEC_fs-sqlite:=daemon-latency-logger
  267. DEPENDS_social-sqlite:=+libsqlite3 +gnunet-social
  268. PLUGIN_social-sqlite:=psycstore_sqlite
  269. DEPENDS_transport-bluetooth:=+bluez-libs
  270. PLUGIN_transport-bluetooth:=transport_bluetooth
  271. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  272. DEPENDS_utils:=+certtool +openssl-util
  273. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  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,conversation,conversation component,))
  318. $(eval $(call BuildComponent,datastore,data storage components,))
  319. $(eval $(call BuildComponent,dv,distance-vector routing component,y))
  320. $(eval $(call BuildComponent,experiments,experimental components,))
  321. $(eval $(call BuildComponent,fs,file-sharing components,))
  322. $(eval $(call BuildComponent,gns,name resolution components,y))
  323. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  324. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,y))
  325. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  326. $(eval $(call BuildComponent,rest,REST interface,))
  327. $(eval $(call BuildComponent,rps,RPS routing component,y))
  328. $(eval $(call BuildComponent,social,social components,))
  329. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  330. $(eval $(call BuildComponent,dhtcache-heap,heap-based dhtcache plugin,y))
  331. $(eval $(call BuildComponent,fs-heap,heap-based filesharing plugin,))
  332. $(eval $(call BuildComponent,gns-flat,flat storage GNS plugins,y))
  333. $(eval $(call BuildComponent,peerstore-flat,flat storage peerstore plugin,))
  334. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  335. $(eval $(call BuildComponent,fs-mysql,mySQL filesharing plugins,))
  336. $(eval $(call BuildComponent,social-mysql,mySQL social plugins,))
  337. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  338. $(eval $(call BuildComponent,dhtcache-pgsql,PostgreSQL dhtcache plugin,))
  339. $(eval $(call BuildComponent,fs-pgsql,PostgreSQL filesharing plugin,))
  340. $(eval $(call BuildComponent,gns-pgsql,PostgreSQL GNS plugins,))
  341. $(eval $(call BuildComponent,social-pgsql,PostgreSQL social plugin,))
  342. $(eval $(call BuildComponent,dhtcache-sqlite,libsqlite3 dhtcache plugin,))
  343. $(eval $(call BuildComponent,fs-sqlite,libsqlite3 filesharing plugin,))
  344. $(eval $(call BuildComponent,gns-sqlite,libsqlite3 gns plugins,))
  345. $(eval $(call BuildComponent,peerstore-sqlite,libsqlite3 peerstore plugin,))
  346. $(eval $(call BuildComponent,social-sqlite,libsqlite3 social plugins,))
  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-wlan,WLAN transport,y))
  351. $(eval $(call BuildComponent,utils,administration utililties,))
  352. $(eval $(call BuildComponent,vpn,vpn components,y))