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.

435 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:=37051
  10. PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
  11. PKG_RELEASE:=2
  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:=+ca-certificates +libgnurl +libgnutls +libidn +libltdl \
  52. +libmicrohttpd +libunistring +librt $(ICONV_DEPENDS) $(INTL_DEPENDS)
  53. USERID:=gnunet=400:gnunet=400
  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. endef
  107. $$(eval $$(call BuildPackage,gnunet-$(1)))
  108. endef
  109. define Package/gnunet/install
  110. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
  111. $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
  112. ( for bin in arm ats cadet core config ecc identity nat nat-server nse \
  113. peerinfo revocation scalarproduct statistics transport uri; do \
  114. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
  115. done )
  116. ( for lib in arm ats block cadet core datacache dht \
  117. dns dnsparser dnsstub fragmentation friends hello identity nat nse \
  118. peerinfo regexblock regex revocation scalarproduct set \
  119. statistics transport util; do \
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
  121. done )
  122. ( for plug in ats_proportional block_dht block_regex datacache_heap \
  123. transport_tcp transport_udp transport_unix; do \
  124. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
  125. done )
  126. ( for lex in daemon-hostlist daemon-topology helper-nat-client \
  127. helper-nat-server service-arm service-ats service-cadet \
  128. service-core service-dht service-identity service-nse \
  129. service-peerinfo service-regex \
  130. service-revocation service-scalarproduct-alice \
  131. service-scalarproduct-bob service-scalarproduct-ecc-alice \
  132. service-scalarproduct-ecc-bob service-set service-statistics \
  133. service-transport; do \
  134. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
  135. done )
  136. ( for conf in arm ats cadet core datacache dht hostlist identity \
  137. nat nse peerinfo regex revocation scalarproduct \
  138. set statistics topology transport util; do \
  139. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
  140. done )
  141. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos
  142. $(INSTALL_DIR) $(1)/etc/init.d
  143. $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
  144. $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
  145. $(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
  146. $(INSTALL_DIR) $(1)/etc/uci-defaults
  147. $(INSTALL_BIN) ./files/gnunet.defaults $(1)/etc/uci-defaults/gnunet
  148. $(INSTALL_BIN) ./files/gnunet-dns.fw $(1)/usr/lib/gnunet/libexec/gnunet-dns.fw
  149. $(INSTALL_DIR) $(1)/lib/netifd/proto
  150. $(INSTALL_BIN) ./files/gnunet-proto.sh $(1)/lib/netifd/proto
  151. endef
  152. define Package/gnunet/conffiles
  153. /etc/config/gnunet
  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_transport-http_client:=+libgnurl
  168. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  169. DEPENDS_transport-http_server:=+libmicrohttpd
  170. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  171. PLUGIN_transport-wlan:=transport_wlan
  172. LIBEXEC_transport-wlan:=helper-transport-wlan
  173. DEPENDS_experiments:=+libglpk
  174. PLUGIN_experiments:=ats_mlp ats_ril
  175. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  176. # BIN_dv:=dv
  177. LIB_dv:=dv
  178. PLUGIN_dv:=transport_dv
  179. LIBEXEC_dv:=service-dv
  180. CONF_dv:=dv
  181. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  182. BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
  183. LIB_fs:=fs
  184. PLUGIN_fs:=block_fs
  185. LIBEXEC_fs:=helper-fs-publish service-fs
  186. CONF_fs:=fs
  187. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  188. USERID_gns:=gnunet=400:gnunetdns=401
  189. BIN_gns:=gns gns-import.sh namecache namestore resolver
  190. LIB_gns:=gns gnsrecord namecache namestore
  191. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
  192. LIBEXEC_gns:=dns2gns gns-proxy helper-dns namestore-fcfsd service-dns service-gns service-namecache service-namestore service-resolver
  193. CONF_gns:=dns gns namecache namestore resolver
  194. DEPENDS_datastore:=+gnunet-gns +libsqlite3
  195. BIN_datastore:=datastore
  196. LIB_datastore:=datastore
  197. PLUGIN_datastore:=datastore_heap
  198. LIBEXEC_datastore:=daemon-latency-logger service-datastore
  199. CONF_datastore:=datastore
  200. BIN_peerstore:=peerstore
  201. LIB_peerstore:=peerstore
  202. LIBEXEC_peerstore:=service-peerstore
  203. CONF_peerstore:=peerstore
  204. DEPENDS_flat:=+gnunet-gns
  205. PLUGIN_flat:=namecache_flat namestore_flat
  206. DEPENDS_mysql:=+gnunet-gns +gnunet-datastore +libmysqlclient
  207. LIB_mysql:=mysql
  208. PLUGIN_mysql:=datastore_mysql
  209. DEPENDS_pgsql:=+gnunet-gns +gnunet-datastore +libpq
  210. LIB_pgsql:=postgres pq
  211. PLUGIN_pgsql:=datacache_postgres datastore_postgres namecache_postgres namestore_postgres
  212. DEPENDS_rest:=+gnunet-gns +gnunet-social +jansson
  213. LIB_rest:=rest
  214. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  215. LIBEXEC_rest:=rest-server
  216. CONF_rest:=rest
  217. BIN_rps:=rps
  218. LIB_rps:=rps
  219. LIBEXEC_rps:=service-rps
  220. CONF_rps:=rps
  221. DEPENDS_social:=+gnunet-sqlite +jansson
  222. BIN_social:=identity-token multicast
  223. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  224. PLUGIN_social:=psycstore_sqlite
  225. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  226. CONF_social:=consensus multicast psyc psycstore secretsharing social
  227. DEPENDS_sqlite:=+gnunet-gns +gnunet-datastore +gnunet-peerstore +libsqlite3
  228. PLUGIN_sqlite:=datacache_sqlite datastore_sqlite namecache_sqlite namestore_sqlite peerstore_sqlite
  229. DEPENDS_transport-bluetooth:=+bluez-libs
  230. PLUGIN_transport-bluetooth:=transport_bluetooth
  231. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  232. DEPENDS_utils:=+certtool +openssl-util
  233. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  234. DEPENDS_vpn:=+kmod-tun +iptables
  235. BIN_vpn:=vpn
  236. LIB_vpn:=tun vpn
  237. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  238. CONF_vpn:=exit pt vpn
  239. define PostInstFixSUIDPerms
  240. define Package/$(1)/postinst
  241. #!/bin/sh
  242. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix
  243. endef
  244. endef
  245. define Package/gnunet-gns/postinst
  246. #!/bin/sh
  247. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix
  248. uci -q batch <<EOF
  249. del network.gnunetdns
  250. set network.gnunetdns=interface
  251. set network.gnunetdns.ifname='gnunet-dns'
  252. set network.gnunetdns.proto='gnunet'
  253. del network.gndnsrtt
  254. set network.gndnsrtt=route
  255. set network.gndnsrtt.interface='gnunetdns'
  256. set network.gndnsrtt.table='53'
  257. set network.gndnsrtt.target='0.0.0.0/0'
  258. del network.gndnsrl
  259. set network.gndnsrl=rule
  260. set network.gndnsrl.mark='0x8260035'
  261. set network.gndnsrl.lookup='53'
  262. commit network
  263. del firewall.gnunetdns
  264. set firewall.gnunetdns=zone
  265. set firewall.gnunetdns.name='gnunetdns'
  266. set firewall.gnunetdns.network='gnunetdns'
  267. set firewall.gnunetdns.input='ACCEPT'
  268. set firewall.gnunetdns.output='ACCEPT'
  269. set firewall.gnunetdns.forward='ACCEPT'
  270. del firewall.gndnsinc
  271. set firewall.gndnsinc=include
  272. set firewall.gndnsinc.path='/usr/lib/gnunet/libexec/gnunet-dns.fw'
  273. commit firewall
  274. EOF
  275. endef
  276. define Package/gnunet-gns/prerm
  277. #!/bin/sh
  278. uci -q batch <<EOF
  279. del network.gnunetdns
  280. del network.gndnsrtt
  281. del network.gndnsrl
  282. commit network
  283. del firewall.gnunetdns
  284. del firewall.gndnsinc
  285. commit firewall
  286. EOF
  287. endef
  288. define Package/gnunet-vpn/postinst
  289. #!/bin/sh
  290. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix
  291. uci -q batch <<EOF
  292. del network.gnunetvpn
  293. set network.gnunetvpn=interface
  294. set network.gnunetvpn.ifname='vpn-gnunet'
  295. set network.gnunetvpn.proto='gnunet'
  296. del network.gnunetexit
  297. set network.gnunetexit=interface
  298. set network.gnunetexit.ifname='exit-gnunet'
  299. set network.gnunetexit.proto='gnunet'
  300. commit network
  301. del firewall.gnunetvpn
  302. set firewall.gnunetvpn=zone
  303. set firewall.gnunetvpn.name='gnunetvpn'
  304. set firewall.gnunetvpn.network='gnunetvpn'
  305. set firewall.gnunetvpn.input='ACCEPT'
  306. set firewall.gnunetvpn.output='ACCEPT'
  307. set firewall.gnunetvpn.forward='REJECT'
  308. del firewall.gnunetexit
  309. set firewall.gnunetexit=zone
  310. set firewall.gnunetexit.name='gnunetexit'
  311. set firewall.gnunetexit.network='gnunetexit'
  312. set firewall.gnunetexit.input='ACCEPT'
  313. set firewall.gnunetexit.output='ACCEPT'
  314. set firewall.gnunetexit.forward='REJECT'
  315. del firewall.gnexitfwd
  316. set firewall.gnexitfwd=forwarding
  317. set firewall.gnexitfwd.src='gnunetexit'
  318. set firewall.gnexitfwd.dest='wan'
  319. commit firewall
  320. EOF
  321. endef
  322. define Package/gnunet-vpn/prerm
  323. #!/bin/sh
  324. uci -q batch <<EOF
  325. del network.gnunetvpn
  326. del network.gnunetexit
  327. del firewall.gnunetvpn
  328. del firewall.gnunetexit
  329. del firewall.gnexitfwd
  330. EOF
  331. endef
  332. $(eval $(call BuildPackage,gnunet))
  333. $(eval $(call PostInstFixSUIDPerms,gnunet))
  334. $(eval $(call BuildComponent,conversation,conversation component,))
  335. $(eval $(call BuildComponent,datastore,data storage components,))
  336. $(eval $(call BuildComponent,dv,distance-vector routing component,))
  337. $(eval $(call BuildComponent,experiments,experimental components,))
  338. $(eval $(call BuildComponent,flat,flat storage backends,))
  339. $(eval $(call BuildComponent,fs,file-sharing components,))
  340. $(eval $(call BuildComponent,gns,name resolution components,y))
  341. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  342. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  343. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  344. $(eval $(call BuildComponent,rest,REST interface,))
  345. $(eval $(call BuildComponent,rps,RPS routing component,))
  346. $(eval $(call BuildComponent,social,social components,))
  347. $(eval $(call BuildComponent,sqlite,libsqlite3 storage backends,y))
  348. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  349. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  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,))
  353. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  354. $(eval $(call BuildComponent,utils,administration utililties,))
  355. $(eval $(call BuildComponent,vpn,vpn components,y))