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.

370 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:=37051
  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:=+ca-certificates +libgcrypt +libgpg-error +libgnurl \
  52. +libgnutls +libidn +libltdl +libunistring +librt \
  53. $(ICONV_DEPENDS) $(INTL_DEPENDS)
  54. USERID:=gnunet=400:gnunet=400
  55. MENU:=1
  56. endef
  57. define Package/gnunet/description
  58. GNUnet is a peer-to-peer framework focusing on security. The first and
  59. primary application for GNUnet is anonymous file-sharing. GNUnet is
  60. currently developed by a worldwide group of independent free software
  61. developers. GNUnet is a GNU package (http://www.gnu.org/).
  62. This is an ALPHA release. There are known and significant bugs as
  63. well as many missing features in this release.
  64. This package provides the core components of GNUnet including the
  65. CADET routing engine, a DHT implementation and basic transports as
  66. well as their helpers.
  67. endef
  68. define BuildComponent
  69. define Package/gnunet-$(1)
  70. $$(call Package/gnunet/Default)
  71. TITLE+= $(2)
  72. DEPENDS:=gnunet $(DEPENDS_$(1))
  73. $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
  74. $(if $(USERID_$(1)),USERID:=$(USERID_$(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 dnsstub 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 datacache_heap \
  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
  155. endef
  156. define Package/gnunet/conffiles
  157. /etc/config/gnunet
  158. endef
  159. define Build/InstallDev
  160. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  161. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  163. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  164. endef
  165. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  166. BIN_conversation:=conversation conversation-test
  167. LIB_conversation:=conversation microphone speaker
  168. PLUGIN_conversation:=gnsrecord_conversation
  169. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  170. CONF_conversation:=conversation
  171. DEPENDS_hostlist:=+libmicrohttpd
  172. LIBEXEC_hostlist:=daemon-hostlist
  173. CONF_hostlist:=hostlist
  174. DEPENDS_transport-http_client:=+libgnurl
  175. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  176. DEPENDS_transport-http_server:=+libmicrohttpd
  177. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  178. PLUGIN_transport-wlan:=transport_wlan
  179. LIBEXEC_transport-wlan:=helper-transport-wlan
  180. DEPENDS_experiments:=+libglpk
  181. PLUGIN_experiments:=ats_mlp ats_ril
  182. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  183. # BIN_dv:=dv
  184. LIB_dv:=dv
  185. PLUGIN_dv:=transport_dv
  186. LIBEXEC_dv:=service-dv
  187. CONF_dv:=dv
  188. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  189. BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
  190. LIB_fs:=fs
  191. PLUGIN_fs:=block_fs
  192. LIBEXEC_fs:=helper-fs-publish service-fs
  193. CONF_fs:=fs
  194. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  195. USERID_gns:=gnunet=400:gnunetdns=401
  196. BIN_gns:=gns gns-import.sh namecache namestore resolver
  197. LIB_gns:=gns gnsrecord namecache namestore
  198. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
  199. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver
  200. CONF_gns:=dns gns namecache namestore resolver
  201. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd
  202. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  203. DEPENDS_gns-proxy:=+gnunet-gns +libmicrohttpd
  204. LIBEXEC_gns-proxy:=gns-proxy
  205. DEPENDS_datastore:=+gnunet-gns +libsqlite3
  206. BIN_datastore:=datastore
  207. LIB_datastore:=datastore
  208. PLUGIN_datastore:=datastore_heap
  209. LIBEXEC_datastore:=daemon-latency-logger service-datastore
  210. CONF_datastore:=datastore
  211. BIN_peerstore:=peerstore
  212. LIB_peerstore:=peerstore
  213. LIBEXEC_peerstore:=service-peerstore
  214. CONF_peerstore:=peerstore
  215. DEPENDS_flat:=+gnunet-gns
  216. PLUGIN_flat:=namecache_flat namestore_flat
  217. DEPENDS_mysql:=+gnunet-gns +gnunet-datastore +libmysqlclient
  218. LIB_mysql:=mysql
  219. PLUGIN_mysql:=datastore_mysql
  220. DEPENDS_pgsql:=+gnunet-gns +gnunet-datastore +libpq
  221. LIB_pgsql:=postgres pq
  222. PLUGIN_pgsql:=datacache_postgres datastore_postgres namecache_postgres namestore_postgres
  223. DEPENDS_rest:=+gnunet-gns +gnunet-social +libmicrohttpd +jansson
  224. LIB_rest:=rest
  225. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  226. LIBEXEC_rest:=rest-server
  227. CONF_rest:=rest
  228. BIN_rps:=rps
  229. LIB_rps:=rps
  230. LIBEXEC_rps:=service-rps
  231. CONF_rps:=rps
  232. DEPENDS_social:=+gnunet-sqlite +libmicrohttpd +jansson
  233. BIN_social:=identity-token multicast
  234. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  235. PLUGIN_social:=psycstore_sqlite
  236. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  237. CONF_social:=consensus multicast psyc psycstore secretsharing social
  238. DEPENDS_sqlite:=+gnunet-gns +gnunet-datastore +gnunet-peerstore +libsqlite3
  239. PLUGIN_sqlite:=datacache_sqlite datastore_sqlite namecache_sqlite namestore_sqlite peerstore_sqlite
  240. DEPENDS_transport-bluetooth:=+bluez-libs
  241. PLUGIN_transport-bluetooth:=transport_bluetooth
  242. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  243. DEPENDS_utils:=+certtool +openssl-util
  244. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation scrypt
  245. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  246. BIN_vpn:=vpn
  247. LIB_vpn:=tun vpn
  248. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  249. CONF_vpn:=exit pt vpn
  250. define Package/gnunet-gns/prerm
  251. #!/bin/sh
  252. uci -q batch <<EOF
  253. del network.gnunetdns
  254. del network.gndnsrtt
  255. del network.gndnsrl
  256. commit network
  257. del firewall.gnunetdns
  258. del firewall.gndnsinc
  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,mysql,mySQL datastore backend,))
  295. $(eval $(call BuildComponent,namestore-fcfsd,fist-come-first-serve registration server,))
  296. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  297. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  298. $(eval $(call BuildComponent,rest,REST interface,))
  299. $(eval $(call BuildComponent,rps,RPS routing component,))
  300. $(eval $(call BuildComponent,social,social components,))
  301. $(eval $(call BuildComponent,sqlite,libsqlite3 storage backends,y))
  302. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  303. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  304. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  305. $(eval $(call BuildComponent,transport-wlan,WLAN transport,))
  306. $(eval $(call BuildComponent,utils,administration utililties,))
  307. $(eval $(call BuildComponent,vpn,vpn components,y))