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.

371 lines
13 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:=37179
  10. PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
  11. PKG_RELEASE:=3
  12. # ToDo:
  13. # - break-out {peer,name,data}store for each backend
  14. # - package testing stuff
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  16. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_SOURCE_URL:=https://gnunet.org/svn/gnunet/
  18. PKG_SOURCE_PROTO:=svn
  19. PKG_LICENSE:=GPL-3.0
  20. PKG_LICENSE_FILES:=COPYING
  21. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  22. # PKG_BUILD_PARALLEL:=1
  23. PKG_FIXUP:=gettext-version
  24. PKG_INSTALL:=1
  25. include $(INCLUDE_DIR)/package.mk
  26. include $(INCLUDE_DIR)/nls.mk
  27. CONFIGURE_ARGS+= \
  28. --with-libiconv-prefix="$(ICONV_PREFIX)" \
  29. --with-libintl-prefix="$(INTL_PREFIX)" \
  30. --with-ltdl \
  31. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
  32. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
  33. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-sqlite),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
  34. --enable-experimental \
  35. --with-extractor=$(STAGING_DIR)/usr \
  36. --with-gnutls=$(STAGING_DIR)/usr \
  37. --with-libgnurl=$(STAGING_DIR)/usr \
  38. --with-libunistring-prefix=$(STAGING_DIR)/usr \
  39. --with-microhttpd=$(STAGING_DIR)/usr
  40. # ToDo: request upstream to provide --with-pulseaudio=...
  41. TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
  42. define Package/gnunet/Default
  43. SECTION:=net
  44. CATEGORY:=Network
  45. TITLE:=GNUnet
  46. URL:=https://www.gnunet.org/
  47. endef
  48. define Package/gnunet
  49. $(call Package/gnunet/Default)
  50. TITLE+= - a peer-to-peer framework focusing on security
  51. DEPENDS:=+libgcrypt +libgpg-error +libidn +libltdl +libunistring +librt +zlib \
  52. $(ICONV_DEPENDS) $(INTL_DEPENDS)
  53. USERID:=gnunet=958:gnunet=958
  54. MENU:=1
  55. endef
  56. define Package/gnunet/description
  57. GNUnet is a peer-to-peer framework focusing on security. The first and
  58. primary application for GNUnet is anonymous file-sharing. GNUnet is
  59. currently developed by a worldwide group of independent free software
  60. developers. GNUnet is a GNU package (http://www.gnu.org/).
  61. This is an ALPHA release. There are known and significant bugs as
  62. well as many missing features in this release.
  63. This package provides the core components of GNUnet including the
  64. CADET routing engine, a DHT implementation and basic transports as
  65. well as their helpers.
  66. endef
  67. define BuildComponent
  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. 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 datacache_heap \
  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 Package/gnunet/conffiles
  156. /etc/config/gnunet
  157. endef
  158. define Build/InstallDev
  159. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  160. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  161. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  162. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  163. endef
  164. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  165. BIN_conversation:=conversation conversation-test
  166. LIB_conversation:=conversation microphone speaker
  167. PLUGIN_conversation:=gnsrecord_conversation
  168. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  169. CONF_conversation:=conversation
  170. DEPENDS_hostlist:=+libmicrohttpd +libgnurl +ca-certificates
  171. LIBEXEC_hostlist:=daemon-hostlist
  172. CONF_hostlist:=hostlist
  173. DEPENDS_transport-http_client:=+libgnurl +ca-certificates
  174. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  175. DEPENDS_transport-http_server:=+libmicrohttpd
  176. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  177. PLUGIN_transport-wlan:=transport_wlan
  178. LIBEXEC_transport-wlan:=helper-transport-wlan
  179. DEPENDS_experiments:=+libglpk
  180. PLUGIN_experiments:=ats_mlp ats_ril
  181. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  182. # BIN_dv:=dv
  183. LIB_dv:=dv
  184. PLUGIN_dv:=transport_dv
  185. LIBEXEC_dv:=service-dv
  186. CONF_dv:=dv
  187. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  188. BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
  189. LIB_fs:=fs
  190. PLUGIN_fs:=block_fs
  191. LIBEXEC_fs:=helper-fs-publish service-fs
  192. CONF_fs:=fs
  193. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  194. USERID_gns:=gnunet=958:gnunetdns=452
  195. BIN_gns:=gns gns-import.sh namecache namestore resolver
  196. LIB_gns:=gns gnsrecord namecache namestore
  197. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
  198. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver
  199. CONF_gns:=dns gns namecache namestore resolver
  200. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd
  201. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  202. DEPENDS_gns-proxy:=+gnunet-gns +libgnurl +libmicrohttpd
  203. LIBEXEC_gns-proxy:=gns-proxy
  204. DEPENDS_datastore:=+gnunet-gns +libsqlite3
  205. BIN_datastore:=datastore
  206. LIB_datastore:=datastore
  207. PLUGIN_datastore:=datastore_heap
  208. LIBEXEC_datastore:=daemon-latency-logger service-datastore
  209. CONF_datastore:=datastore
  210. BIN_peerstore:=peerstore
  211. LIB_peerstore:=peerstore
  212. LIBEXEC_peerstore:=service-peerstore
  213. CONF_peerstore:=peerstore
  214. DEPENDS_flat:=+gnunet-gns
  215. PLUGIN_flat:=namecache_flat namestore_flat
  216. DEPENDS_mysql:=+gnunet-gns +gnunet-datastore +libmysqlclient
  217. LIB_mysql:=mysql
  218. PLUGIN_mysql:=datastore_mysql
  219. DEPENDS_pgsql:=+gnunet-gns +gnunet-datastore +libpq
  220. LIB_pgsql:=postgres pq
  221. PLUGIN_pgsql:=datacache_postgres datastore_postgres namecache_postgres namestore_postgres
  222. DEPENDS_rest:=+gnunet-gns +gnunet-social +libmicrohttpd +jansson
  223. LIB_rest:=rest json jsonapi jsonapiutils
  224. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  225. LIBEXEC_rest:=rest-server
  226. CONF_rest:=rest
  227. BIN_rps:=rps
  228. LIB_rps:=rps
  229. LIBEXEC_rps:=service-rps
  230. CONF_rps:=rps
  231. DEPENDS_social:=+gnunet-sqlite +libmicrohttpd +jansson
  232. BIN_social:=identity-token multicast social
  233. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  234. PLUGIN_social:=psycstore_sqlite
  235. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  236. CONF_social:=consensus multicast psyc psycstore secretsharing social
  237. DEPENDS_sqlite:=+gnunet-gns +gnunet-datastore +gnunet-peerstore +libsqlite3
  238. PLUGIN_sqlite:=datacache_sqlite datastore_sqlite namecache_sqlite namestore_sqlite peerstore_sqlite
  239. DEPENDS_transport-bluetooth:=+bluez-libs
  240. PLUGIN_transport-bluetooth:=transport_bluetooth
  241. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  242. DEPENDS_utils:=+certtool +openssl-util
  243. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  244. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  245. BIN_vpn:=vpn
  246. LIB_vpn:=tun vpn
  247. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  248. CONF_vpn:=exit pt vpn
  249. define Package/gnunet-gns/prerm
  250. #!/bin/sh
  251. uci -q batch <<EOF
  252. del network.gnunetdns
  253. del network.gndnsrtt
  254. del network.gndnsrl
  255. commit network
  256. del firewall.gnunetdns
  257. del firewall.gndnsrl
  258. del firewall.gndnsrl2
  259. commit firewall
  260. EOF
  261. endef
  262. define Package/gnunet-vpn/prerm
  263. #!/bin/sh
  264. uci -q batch <<EOF
  265. del network.gnunetvpn
  266. del network.gnunetexit
  267. commit network
  268. del firewall.gnunetvpn
  269. del firewall.gnunetexit
  270. del firewall.gnexitfwd
  271. commit firewall
  272. EOF
  273. endef
  274. define PostInstFixSUIDPerms
  275. define Package/$(1)/postinst
  276. #!/bin/sh
  277. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix
  278. endef
  279. endef
  280. $(eval $(call PostInstFixSUIDPerms,gnunet))
  281. $(eval $(call PostInstFixSUIDPerms,gnunet-gns))
  282. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  283. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  284. $(eval $(call PostInstFixSUIDPerms,gnunet-vpn))
  285. $(eval $(call BuildPackage,gnunet))
  286. $(eval $(call BuildComponent,conversation,conversation component,))
  287. $(eval $(call BuildComponent,datastore,data storage components,))
  288. $(eval $(call BuildComponent,dv,distance-vector routing component,))
  289. $(eval $(call BuildComponent,experiments,experimental components,))
  290. $(eval $(call BuildComponent,flat,flat storage backends,))
  291. $(eval $(call BuildComponent,fs,file-sharing components,))
  292. $(eval $(call BuildComponent,gns,name resolution components,y))
  293. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  294. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,))
  295. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  296. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  297. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  298. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  299. $(eval $(call BuildComponent,rest,REST interface,))
  300. $(eval $(call BuildComponent,rps,RPS routing component,))
  301. $(eval $(call BuildComponent,social,social components,))
  302. $(eval $(call BuildComponent,sqlite,libsqlite3 storage backends,y))
  303. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  304. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  305. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  306. $(eval $(call BuildComponent,transport-wlan,WLAN transport,))
  307. $(eval $(call BuildComponent,utils,administration utililties,))
  308. $(eval $(call BuildComponent,vpn,vpn components,y))