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.

429 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. define Package/gnunet-$(1)
  68. $$(call Package/gnunet/Default)
  69. TITLE+= $(2)
  70. DEPENDS:=gnunet $(DEPENDS_$(1))
  71. $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
  72. $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
  73. $(if $(CONFLICTS_$(1)),CONFLICTS:=$(CONFLICTS_$(1)))
  74. endef
  75. define Package/gnunet-$(1)/install
  76. ( if [ "$(BIN_$(1))" ]; then \
  77. $(INSTALL_DIR) $$(1)/usr/bin ; \
  78. for bin in $(BIN_$(1)); do \
  79. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
  80. done \
  81. fi )
  82. ( if [ "$(LIB_$(1))" ]; then \
  83. $(INSTALL_DIR) $$(1)/usr/lib ; \
  84. for lib in $(LIB_$(1)); do \
  85. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
  86. done \
  87. fi )
  88. ( if [ "$(PLUGIN_$(1))" ]; then \
  89. $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
  90. for plug in $(PLUGIN_$(1)); do \
  91. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
  92. done \
  93. fi )
  94. ( if [ "$(LIBEXEC_$(1))" ]; then \
  95. $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
  96. for lex in $(LIBEXEC_$(1)); do \
  97. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
  98. done \
  99. fi )
  100. ( if [ "$(CONF_$(1))" ]; then \
  101. $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
  102. for conf in $(CONF_$(1)); do \
  103. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
  104. done \
  105. fi )
  106. ( if [ -e ./files/gnunet-$(1).defaults ]; then \
  107. $(INSTALL_DIR) $$(1)/etc/uci-defaults ; \
  108. $(INSTALL_BIN) ./files/gnunet-$(1).defaults $$(1)/etc/uci-defaults/gnunet-$(1) ; \
  109. fi )
  110. endef
  111. $$(eval $$(call BuildPackage,gnunet-$(1)))
  112. endef
  113. define Package/gnunet/install
  114. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
  115. $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
  116. ( for bin in arm ats cadet core config ecc identity nat nat-server nse \
  117. peerinfo revocation scalarproduct statistics transport uri; do \
  118. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
  119. done )
  120. ( for lib in arm ats block cadet core datacache dht \
  121. dns dnsparser fragmentation friends hello identity nat nse \
  122. peerinfo regexblock regex revocation scalarproduct set \
  123. statistics transport util; do \
  124. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
  125. done )
  126. ( for plug in ats_proportional block_dht block_regex \
  127. transport_tcp transport_udp transport_unix; do \
  128. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
  129. done )
  130. ( for lex in daemon-topology helper-nat-client \
  131. helper-nat-server service-arm service-ats service-cadet \
  132. service-core service-dht service-identity service-nse \
  133. service-peerinfo service-regex \
  134. service-revocation service-scalarproduct-alice \
  135. service-scalarproduct-bob service-scalarproduct-ecc-alice \
  136. service-scalarproduct-ecc-bob service-set service-statistics \
  137. service-transport; do \
  138. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
  139. done )
  140. ( for conf in arm ats cadet core datacache dht identity \
  141. nat nse peerinfo regex revocation scalarproduct \
  142. set statistics topology transport util; do \
  143. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
  144. done )
  145. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos
  146. $(INSTALL_DIR) $(1)/etc/init.d
  147. $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
  148. $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
  149. $(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
  150. $(INSTALL_DIR) $(1)/etc/uci-defaults
  151. $(INSTALL_BIN) ./files/gnunet.defaults $(1)/etc/uci-defaults/gnunet
  152. $(INSTALL_DIR) $(1)/lib/netifd/proto
  153. $(INSTALL_BIN) ./files/gnunet-proto.sh $(1)/lib/netifd/proto/gnunet.sh
  154. endef
  155. define Build/InstallDev
  156. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  157. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  158. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  159. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  160. endef
  161. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  162. BIN_conversation:=conversation conversation-test
  163. LIB_conversation:=conversation microphone speaker
  164. PLUGIN_conversation:=gnsrecord_conversation
  165. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  166. CONF_conversation:=conversation
  167. DEPENDS_hostlist:=+libmicrohttpd +libgnurl +ca-certificates
  168. LIBEXEC_hostlist:=daemon-hostlist
  169. CONF_hostlist:=hostlist
  170. DEPENDS_transport-http_client:=+libgnurl +ca-certificates
  171. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  172. DEPENDS_transport-http_server:=+libmicrohttpd
  173. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  174. PLUGIN_transport-wlan:=transport_wlan
  175. LIBEXEC_transport-wlan:=helper-transport-wlan
  176. DEPENDS_experiments:=+libglpk
  177. PLUGIN_experiments:=ats_mlp ats_ril
  178. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  179. # BIN_dv:=dv
  180. LIB_dv:=dv
  181. PLUGIN_dv:=transport_dv
  182. LIBEXEC_dv:=service-dv
  183. CONF_dv:=dv
  184. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  185. BIN_fs:=auto-share directory download fs publish unindex search
  186. LIB_fs:=fs
  187. PLUGIN_fs:=block_fs
  188. LIBEXEC_fs:=helper-fs-publish service-fs
  189. CONF_fs:=fs
  190. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  191. USERID_gns:=gnunet=958:gnunetdns=452
  192. BIN_gns:=gns gns-import.sh namecache namestore resolver
  193. LIB_gns:=gns gnsrecord namecache namestore
  194. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
  195. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver
  196. CONF_gns:=dns gns namecache namestore resolver
  197. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd
  198. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  199. DEPENDS_gns-proxy:=+gnunet-gns +libgnurl +libmicrohttpd
  200. LIBEXEC_gns-proxy:=gns-proxy
  201. DEPENDS_datastore:=+gnunet-gns
  202. BIN_datastore:=datastore
  203. LIB_datastore:=datastore
  204. LIBEXEC_datastore:=service-datastore
  205. CONF_datastore:=datastore
  206. BIN_peerstore:=peerstore
  207. LIB_peerstore:=peerstore
  208. LIBEXEC_peerstore:=service-peerstore
  209. CONF_peerstore:=peerstore
  210. DEPENDS_rest:=+gnunet-gns +gnunet-social +libmicrohttpd +jansson
  211. LIB_rest:=rest json jsonapi jsonapiutils
  212. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  213. LIBEXEC_rest:=rest-server
  214. CONF_rest:=rest
  215. BIN_rps:=rps
  216. LIB_rps:=rps
  217. LIBEXEC_rps:=service-rps
  218. CONF_rps:=rps
  219. DEPENDS_social:=+gnunet-gns +libmicrohttpd +jansson
  220. BIN_social:=identity-token multicast social
  221. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  222. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  223. CONF_social:=consensus multicast psyc psycstore secretsharing social
  224. PLUGIN_dhtcache-heap:=datacache_heap
  225. CONFLICTS_dhtcache-heap:=gnunet-dhtcache-pgsql gnunet-dhtcache-sqlite
  226. DEPENDS_gns-flat:=+gnunet-gns
  227. PLUGIN_gns-flat:=namecache_flat namestore_flat
  228. DEPENDS_peerstore-flat:=+gnunet-peerstore
  229. PLUGIN_peerstore-flat:=peerstore_flat
  230. DEPENDS_fs-heap:=+gnunet-datastore
  231. PLUGIN_fs-heap:=datastore_heap
  232. CONFLICTS_fs-heap:=gnunet-fs-mysql gnunet-fs-pgsql gnunet-fs-sqlite
  233. DEPENDS_mysql:=+libmysqlclient
  234. LIB_mysql:=mysql my
  235. DEPENDS_social-mysql:=+gnunet-mysql +gnunet-social
  236. PLUGIN_social-mysql:=psycstore_mysql
  237. CONFLICTS_social-mysql:=gnunet-social-sqlite
  238. DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
  239. PLUGIN_fs-mysql:=datastore_mysql
  240. CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
  241. DEPENDS_pgsql:=+libpq
  242. LIB_pgsql:=postgres pq
  243. DEPENDS_dhtcache-pgsql:=+gnunet-pgsql
  244. PLUGIN_dhtcache-pgsql:=datacache_postgres
  245. CONFLICTS_dhtcache-pgsql:=gnunet-dhtcache-sqlite
  246. DEPENDS_fs-pgsql:=+gnunet-pgsql +gnunet-datastore
  247. PLUGIN_fs-pgsql:=datastore_postgres
  248. CONFLICTS_fs-pgsql:=gnunet-fs-sqlite
  249. DEPENDS_gns-pgsql:=+gnunet-pgsql +gnunet-gns
  250. PLUGIN_gns-pgsql:=namecache_postgres namestore_postgres
  251. CONFLICTS_gns-pgsql:=gnunet-gns-sqlite gnunet-gns-flat
  252. DEPENDS_social-pgsql:=+gnunet-pgsql +gnunet-social
  253. PLUGIN_social-pgsql:=psycstore_postgres
  254. CONFLICTS_social-pgsql:=gnunet-social-sqlite gnunet-social-mysql
  255. DEPENDS_sqlite:=+libsqlite3
  256. DEPENDS_gns-sqlite:=+gnunet-sqlite +gnunet-gns
  257. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  258. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  259. DEPENDS_peerstore-sqlite:=+gnunet-sqlite +gnunet-peerstore
  260. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  261. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  262. DEPENDS_dhtcache-sqlite:=+gnunet-sqlite
  263. PLUGIN_dhtcache-sqlite:=datacache_sqlite
  264. DEPENDS_fs-sqlite:=+gnunet-sqlite +gnunet-datastore
  265. PLUGIN_fs-sqlite:=datastore_sqlite
  266. LIBEXEC_fs-sqlite:=daemon-latency-logger
  267. DEPENDS_social-sqlite:=+gnunet-sqlite +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,sqlite,libsqlite3 storage backends,))
  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,social-sqlite,libsqlite3 social plugins,))
  348. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  349. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  350. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  351. $(eval $(call BuildComponent,transport-wlan,WLAN transport,y))
  352. $(eval $(call BuildComponent,utils,administration utililties,))
  353. $(eval $(call BuildComponent,vpn,vpn components,y))