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.

411 lines
14 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:=38014
  10. PKG_VERSION:=0.10.1-svn$(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/svn/gnunet/
  17. PKG_SOURCE_PROTO:=svn
  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 dnsstub 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. DEPENDS_gns-flat:=+gnunet-gns
  225. PLUGIN_gns-flat:=namecache_flat namestore_flat
  226. DEPENDS_peerstore-flat:=+gnunet-peerstore
  227. PLUGIN_peerstore-flat:=peerstore_flat
  228. DEPENDS_fs-heap:=+gnunet-datastore
  229. PLUGIN_fs-heap:=datacache_heap datastore_heap
  230. CONFLICTS_fs-heap:=gnunet-fs-mysql gnunet-fs-pgsql gnunet-fs-sqlite
  231. DEPENDS_mysql:=+libmysqlclient
  232. LIB_mysql:=mysql my
  233. DEPENDS_social-mysql:=+gnunet-mysql +gnunet-social
  234. PLUGIN_social-mysql:=psycstore_mysql
  235. CONFLICTS_social-mysql:=gnunet-social-sqlite
  236. DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
  237. PLUGIN_fs-mysql:=datastore_mysql
  238. CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
  239. DEPENDS_pgsql:=+libpq
  240. LIB_pgsql:=postgres pq
  241. DEPENDS_fs-pgsql:=+gnunet-pgsql +gnunet-datastore
  242. PLUGIN_fs-pgsql:=datacache_postgres datastore_postgres
  243. CONFLICTS_fs-pgsql:=gnunet-fs-sqlite
  244. DEPENDS_gns-pgsql:=+gnunet-pgsql +gnunet-gns
  245. PLUGIN_gns-pgsql:=namecache_postgres namestore_postgres
  246. CONFLICTS_gns-pgsql:=gnunet-gns-sqlite gnunet-gns-flat
  247. DEPENDS_sqlite:=+libsqlite3
  248. DEPENDS_gns-sqlite:=+gnunet-sqlite +gnunet-gns
  249. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  250. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  251. DEPENDS_peerstore-sqlite:=+gnunet-sqlite +gnunet-peerstore
  252. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  253. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  254. DEPENDS_fs-sqlite:=+gnunet-sqlite +gnunet-datastore
  255. PLUGIN_fs-sqlite:=datacache_sqlite datastore_sqlite
  256. LIBEXEC_fs-sqlite:=daemon-latency-logger
  257. DEPENDS_social-sqlite:=+gnunet-sqlite +gnunet-social
  258. PLUGIN_social-sqlite:=psycstore_sqlite
  259. DEPENDS_transport-bluetooth:=+bluez-libs
  260. PLUGIN_transport-bluetooth:=transport_bluetooth
  261. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  262. DEPENDS_utils:=+certtool +openssl-util
  263. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  264. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  265. BIN_vpn:=vpn
  266. LIB_vpn:=tun vpn
  267. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  268. CONF_vpn:=exit pt vpn
  269. define Package/gnunet-gns/prerm
  270. #!/bin/sh
  271. uci -q batch <<EOF
  272. del network.gnunetdns
  273. del network.gndnsrtt
  274. del network.gndnsrl
  275. commit network
  276. del firewall.gnunetdns
  277. del firewall.gndnsrl
  278. del firewall.gndnsrl2
  279. commit firewall
  280. EOF
  281. endef
  282. define Package/gnunet-vpn/prerm
  283. #!/bin/sh
  284. uci -q batch <<EOF
  285. del network.gnunetvpn
  286. del network.gnunetexit
  287. commit network
  288. del firewall.gnunetvpn
  289. del firewall.gnunetexit
  290. del firewall.gnexitfwd
  291. commit firewall
  292. EOF
  293. endef
  294. define PostInstFixSUIDPerms
  295. define Package/$(1)/postinst
  296. #!/bin/sh
  297. [ -z "$IPKG_INSTROOT" ] || exit 0
  298. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix || exit 0
  299. endef
  300. endef
  301. $(eval $(call PostInstFixSUIDPerms,gnunet))
  302. $(eval $(call PostInstFixSUIDPerms,gnunet-gns))
  303. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  304. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  305. $(eval $(call PostInstFixSUIDPerms,gnunet-vpn))
  306. $(eval $(call BuildPackage,gnunet))
  307. $(eval $(call BuildComponent,conversation,conversation component,))
  308. $(eval $(call BuildComponent,datastore,data storage components,))
  309. $(eval $(call BuildComponent,dv,distance-vector routing component,))
  310. $(eval $(call BuildComponent,experiments,experimental components,))
  311. $(eval $(call BuildComponent,fs,file-sharing components,))
  312. $(eval $(call BuildComponent,gns,name resolution components,y))
  313. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  314. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,))
  315. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  316. $(eval $(call BuildComponent,rest,REST interface,))
  317. $(eval $(call BuildComponent,rps,RPS routing component,))
  318. $(eval $(call BuildComponent,social,social components,))
  319. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  320. $(eval $(call BuildComponent,fs-heap,heap-based filesharing plugins,))
  321. $(eval $(call BuildComponent,gns-flat,flat storage GNS plugins,))
  322. $(eval $(call BuildComponent,peerstore-flat,flat storage peerstore plugin,))
  323. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  324. $(eval $(call BuildComponent,fs-mysql,mySQL filesharing plugins,))
  325. $(eval $(call BuildComponent,social-mysql,mySQL social plugins,))
  326. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  327. $(eval $(call BuildComponent,fs-pgsql,PostgreSQL filesharing plugins,))
  328. $(eval $(call BuildComponent,gns-pgsql,PostgreSQL GNS plugins,))
  329. $(eval $(call BuildComponent,sqlite,libsqlite3 storage backends,))
  330. $(eval $(call BuildComponent,fs-sqlite,libsqlite3 filesharing plugins,))
  331. $(eval $(call BuildComponent,gns-sqlite,libsqlite3 gns plugins,))
  332. $(eval $(call BuildComponent,peerstore-sqlite,libsqlite3 peerstore plugin,))
  333. $(eval $(call BuildComponent,social-sqlite,libsqlite3 social plugins,))
  334. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  335. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  336. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  337. $(eval $(call BuildComponent,transport-wlan,WLAN transport,))
  338. $(eval $(call BuildComponent,utils,administration utililties,))
  339. $(eval $(call BuildComponent,vpn,vpn components,y))