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.

431 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:=d8e2905c74e63975af5ffe79d7fb1247328def94
  10. PKG_VERSION:=0.10.2-git-20161108-$(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_$(PKG_NAME)-sqlite),--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-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 nat 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-nse \
  134. 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 \
  142. nat 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
  196. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver
  197. CONF_gns:=dns gns namecache namestore resolver
  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_sqlite:=+libsqlite3
  257. DEPENDS_gns-sqlite:=+gnunet-sqlite +gnunet-gns
  258. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  259. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  260. DEPENDS_peerstore-sqlite:=+gnunet-sqlite +gnunet-peerstore
  261. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  262. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  263. DEPENDS_dhtcache-sqlite:=+gnunet-sqlite
  264. PLUGIN_dhtcache-sqlite:=datacache_sqlite
  265. DEPENDS_fs-sqlite:=+gnunet-sqlite +gnunet-datastore
  266. PLUGIN_fs-sqlite:=datastore_sqlite
  267. LIBEXEC_fs-sqlite:=daemon-latency-logger
  268. DEPENDS_social-sqlite:=+gnunet-sqlite +gnunet-social
  269. PLUGIN_social-sqlite:=psycstore_sqlite
  270. DEPENDS_transport-bluetooth:=+bluez-libs
  271. PLUGIN_transport-bluetooth:=transport_bluetooth
  272. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  273. DEPENDS_utils:=+certtool +openssl-util
  274. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  275. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  276. BIN_vpn:=vpn
  277. LIB_vpn:=dnsstub tun vpn
  278. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  279. CONF_vpn:=exit pt vpn
  280. define Package/gnunet-gns/prerm
  281. #!/bin/sh
  282. uci -q batch <<EOF
  283. del network.gnunetdns
  284. del network.gndnsrtt
  285. del network.gndnsrl
  286. commit network
  287. del firewall.gnunetdns
  288. del firewall.gndnsrl
  289. del firewall.gndnsrl2
  290. commit firewall
  291. EOF
  292. endef
  293. define Package/gnunet-vpn/prerm
  294. #!/bin/sh
  295. uci -q batch <<EOF
  296. del network.gnunetvpn
  297. del network.gnunetexit
  298. commit network
  299. del firewall.gnunetvpn
  300. del firewall.gnunetexit
  301. del firewall.gnexitfwd
  302. commit firewall
  303. EOF
  304. endef
  305. define PostInstFixSUIDPerms
  306. define Package/$(1)/postinst
  307. #!/bin/sh
  308. [ -z "$IPKG_INSTROOT" ] || exit 0
  309. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix || exit 0
  310. endef
  311. endef
  312. $(eval $(call PostInstFixSUIDPerms,gnunet))
  313. $(eval $(call PostInstFixSUIDPerms,gnunet-gns))
  314. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  315. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  316. $(eval $(call PostInstFixSUIDPerms,gnunet-vpn))
  317. $(eval $(call BuildPackage,gnunet))
  318. $(eval $(call BuildComponent,conversation,conversation component,))
  319. $(eval $(call BuildComponent,datastore,data storage components,))
  320. $(eval $(call BuildComponent,dv,distance-vector routing component,y))
  321. $(eval $(call BuildComponent,experiments,experimental components,))
  322. $(eval $(call BuildComponent,fs,file-sharing components,))
  323. $(eval $(call BuildComponent,gns,name resolution components,y))
  324. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  325. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,y))
  326. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  327. $(eval $(call BuildComponent,rest,REST interface,))
  328. $(eval $(call BuildComponent,rps,RPS routing component,y))
  329. $(eval $(call BuildComponent,social,social components,))
  330. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  331. $(eval $(call BuildComponent,dhtcache-heap,heap-based dhtcache plugin,y))
  332. $(eval $(call BuildComponent,fs-heap,heap-based filesharing plugin,))
  333. $(eval $(call BuildComponent,gns-flat,flat storage GNS plugins,y))
  334. $(eval $(call BuildComponent,peerstore-flat,flat storage peerstore plugin,))
  335. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  336. $(eval $(call BuildComponent,fs-mysql,mySQL filesharing plugins,))
  337. $(eval $(call BuildComponent,social-mysql,mySQL social plugins,))
  338. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  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,social-pgsql,PostgreSQL social plugin,))
  343. $(eval $(call BuildComponent,sqlite,libsqlite3 storage backends,))
  344. $(eval $(call BuildComponent,dhtcache-sqlite,libsqlite3 dhtcache plugin,))
  345. $(eval $(call BuildComponent,fs-sqlite,libsqlite3 filesharing plugin,))
  346. $(eval $(call BuildComponent,gns-sqlite,libsqlite3 gns plugins,))
  347. $(eval $(call BuildComponent,peerstore-sqlite,libsqlite3 peerstore plugin,))
  348. $(eval $(call BuildComponent,social-sqlite,libsqlite3 social plugins,))
  349. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  350. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  351. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  352. $(eval $(call BuildComponent,transport-wlan,WLAN transport,y))
  353. $(eval $(call BuildComponent,utils,administration utililties,))
  354. $(eval $(call BuildComponent,vpn,vpn components,y))