Makefile 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=gnunet
  3. PKG_SOURCE_VERSION:=a4295da3df82817ff2fe1fa547374a96a2e0280b
  4. PKG_VERSION:=0.10.2-git-20170111-$(PKG_SOURCE_VERSION)
  5. PKG_RELEASE:=1
  6. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  7. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  8. PKG_SOURCE_URL:=https://gnunet.org/git/gnunet.git
  9. PKG_SOURCE_PROTO:=git
  10. PKG_LICENSE:=GPL-3.0
  11. PKG_LICENSE_FILES:=COPYING
  12. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  13. PKG_BUILD_PARALLEL:=1
  14. PKG_FIXUP:=gettext-version
  15. PKG_INSTALL:=1
  16. include $(INCLUDE_DIR)/package.mk
  17. include $(INCLUDE_DIR)/nls.mk
  18. CONFIGURE_ARGS+= \
  19. --with-libiconv-prefix="$(ICONV_PREFIX)" \
  20. --with-libintl-prefix="$(INTL_PREFIX)" \
  21. --with-ltdl \
  22. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
  23. $(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
  24. $(if $(CONFIG_PACKAGE_libsqlite3),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
  25. --disable-testing \
  26. --disable-testruns \
  27. --disable-wachs \
  28. --enable-experimental \
  29. --with-extractor=$(STAGING_DIR)/usr \
  30. --with-gnutls=$(STAGING_DIR)/usr \
  31. --with-libgnurl=$(STAGING_DIR)/usr \
  32. --with-libunistring-prefix=$(STAGING_DIR)/usr \
  33. --with-microhttpd=$(STAGING_DIR)/usr
  34. # ToDo: request upstream to provide --with-pulseaudio=...
  35. TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
  36. define Package/gnunet/Default
  37. SECTION:=net
  38. CATEGORY:=Network
  39. TITLE:=GNUnet
  40. URL:=https://www.gnunet.org/
  41. endef
  42. define Package/gnunet
  43. $(call Package/gnunet/Default)
  44. TITLE+= - a peer-to-peer framework focusing on security
  45. DEPENDS:=+libgcrypt +libgpg-error +libidn +libltdl +libunistring +librt +zlib \
  46. $(ICONV_DEPENDS) $(INTL_DEPENDS)
  47. USERID:=gnunet=958:gnunet=958
  48. MENU:=1
  49. endef
  50. define Package/gnunet/description
  51. GNUnet is a peer-to-peer framework focusing on security. The first and
  52. primary application for GNUnet is anonymous file-sharing. GNUnet is
  53. currently developed by a worldwide group of independent free software
  54. developers. GNUnet is a GNU package (http://www.gnu.org/).
  55. This is an ALPHA release. There are known and significant bugs as
  56. well as many missing features in this release.
  57. This package provides the core components of GNUnet including the
  58. CADET routing engine, a DHT implementation and basic transports as
  59. well as their helpers.
  60. endef
  61. define BuildComponent
  62. PKG_CONFIG_DEPENDS+=CONFIG_PACKAGE_$(PKG_NAME)-$(1)
  63. define Package/gnunet-$(1)
  64. $$(call Package/gnunet/Default)
  65. TITLE+= $(2)
  66. DEPENDS:=gnunet $(DEPENDS_$(1))
  67. $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
  68. $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
  69. $(if $(CONFLICTS_$(1)),CONFLICTS:=$(CONFLICTS_$(1)))
  70. endef
  71. define Package/gnunet-$(1)/install
  72. ( if [ "$(BIN_$(1))" ]; then \
  73. $(INSTALL_DIR) $$(1)/usr/bin ; \
  74. for bin in $(BIN_$(1)); do \
  75. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
  76. done \
  77. fi )
  78. ( if [ "$(LIB_$(1))" ]; then \
  79. $(INSTALL_DIR) $$(1)/usr/lib ; \
  80. for lib in $(LIB_$(1)); do \
  81. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
  82. done \
  83. fi )
  84. ( if [ "$(PLUGIN_$(1))" ]; then \
  85. $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
  86. for plug in $(PLUGIN_$(1)); do \
  87. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
  88. done \
  89. fi )
  90. ( if [ "$(LIBEXEC_$(1))" ]; then \
  91. $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
  92. for lex in $(LIBEXEC_$(1)); do \
  93. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
  94. done \
  95. fi )
  96. ( if [ "$(CONF_$(1))" ]; then \
  97. $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
  98. for conf in $(CONF_$(1)); do \
  99. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
  100. done \
  101. fi )
  102. ( if [ -e ./files/gnunet-$(1).defaults ]; then \
  103. $(INSTALL_DIR) $$(1)/etc/uci-defaults ; \
  104. $(INSTALL_BIN) ./files/gnunet-$(1).defaults $$(1)/etc/uci-defaults/gnunet-$(1) ; \
  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-auto 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 fragmentation friends hello identity natauto natnew 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 \
  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-topology helper-nat-client \
  127. helper-nat-server service-arm service-ats service-cadet \
  128. service-core service-dht service-identity service-nat service-nat-auto \
  129. service-nse 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 identity identity-provider \
  137. nat nat-auto 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_DIR) $(1)/lib/netifd/proto
  149. $(INSTALL_BIN) ./files/gnunet-proto.sh $(1)/lib/netifd/proto/gnunet.sh
  150. endef
  151. define Build/InstallDev
  152. $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
  153. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
  154. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
  155. $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
  156. endef
  157. DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
  158. BIN_conversation:=conversation conversation-test
  159. LIB_conversation:=conversation microphone speaker
  160. PLUGIN_conversation:=gnsrecord_conversation
  161. LIBEXEC_conversation:=helper-audio-playback helper-audio-record service-conversation
  162. CONF_conversation:=conversation
  163. DEPENDS_hostlist:=+libmicrohttpd +libgnurl +ca-certificates
  164. LIBEXEC_hostlist:=daemon-hostlist
  165. CONF_hostlist:=hostlist
  166. DEPENDS_transport-http_client:=+libgnurl +ca-certificates
  167. PLUGIN_transport-http_client:=transport_http_client transport_https_client
  168. DEPENDS_transport-http_server:=+libmicrohttpd
  169. PLUGIN_transport-http_server:=transport_http_server transport_https_server
  170. PLUGIN_transport-wlan:=transport_wlan
  171. LIBEXEC_transport-wlan:=helper-transport-wlan
  172. DEPENDS_experiments:=+libglpk
  173. PLUGIN_experiments:=ats_mlp ats_ril
  174. LIBEXEC_experiments:=service-dht-whanau service-dht-xvine
  175. # BIN_dv:=dv
  176. LIB_dv:=dv
  177. PLUGIN_dv:=transport_dv
  178. LIBEXEC_dv:=service-dv
  179. CONF_dv:=dv
  180. DEPENDS_fs:=+gnunet-datastore +gnunet-peerstore +libextractor
  181. BIN_fs:=auto-share directory download fs publish unindex search
  182. LIB_fs:=fs
  183. PLUGIN_fs:=block_fs
  184. LIBEXEC_fs:=helper-fs-publish service-fs
  185. CONF_fs:=fs
  186. DEPENDS_gns:=+gnunet-vpn +iptables-mod-extra
  187. USERID_gns:=gnunet=958:gnunetdns=452
  188. BIN_gns:=gns gns-import.sh namecache namestore resolver
  189. LIB_gns:=gns gnsrecord namecache namestore
  190. PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns gnsrecord_identity
  191. LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver service-zonemaster
  192. CONF_gns:=dns gns namecache namestore resolver zonemaster
  193. DEPENDS_namestore-fcfsd:=+gnunet-gns +libmicrohttpd
  194. LIBEXEC_namestore-fcfsd:=namestore-fcfsd
  195. DEPENDS_gns-proxy:=+gnunet-gns +libgnurl +libmicrohttpd
  196. LIBEXEC_gns-proxy:=gns-proxy
  197. DEPENDS_datastore:=+gnunet-gns
  198. BIN_datastore:=datastore
  199. LIB_datastore:=datastore
  200. LIBEXEC_datastore:=service-datastore
  201. CONF_datastore:=datastore
  202. BIN_peerstore:=peerstore
  203. LIB_peerstore:=peerstore
  204. LIBEXEC_peerstore:=service-peerstore
  205. CONF_peerstore:=peerstore
  206. DEPENDS_rest:=+gnunet-gns +gnunet-social +libmicrohttpd +jansson
  207. LIB_rest:=rest json jsonapi jsonapiutils
  208. PLUGIN_rest:=rest_gns rest_identity rest_identity_provider rest_namestore
  209. LIBEXEC_rest:=rest-server
  210. CONF_rest:=rest
  211. BIN_rps:=rps
  212. LIB_rps:=rps
  213. LIBEXEC_rps:=service-rps
  214. CONF_rps:=rps
  215. DEPENDS_social:=+gnunet-gns +libmicrohttpd +jansson
  216. BIN_social:=identity-token multicast social
  217. LIB_social:=consensus identityprovider multicast psyc psycstore psycutil secretsharing social
  218. LIBEXEC_social:=service-consensus service-evil-consensus service-identity-provider service-multicast service-psyc service-psycstore service-secretsharing service-social
  219. CONF_social:=consensus multicast psyc psycstore secretsharing social
  220. PLUGIN_dhtcache-heap:=datacache_heap
  221. CONFLICTS_dhtcache-heap:=gnunet-dhtcache-pgsql gnunet-dhtcache-sqlite
  222. DEPENDS_gns-flat:=+gnunet-gns
  223. PLUGIN_gns-flat:=namecache_flat namestore_flat
  224. DEPENDS_peerstore-flat:=+gnunet-peerstore
  225. PLUGIN_peerstore-flat:=peerstore_flat
  226. DEPENDS_fs-heap:=+gnunet-datastore
  227. PLUGIN_fs-heap:=datastore_heap
  228. CONFLICTS_fs-heap:=gnunet-fs-mysql gnunet-fs-pgsql gnunet-fs-sqlite
  229. DEPENDS_mysql:=+libmysqlclient
  230. LIB_mysql:=mysql my
  231. DEPENDS_social-mysql:=+gnunet-mysql +gnunet-social
  232. PLUGIN_social-mysql:=psycstore_mysql
  233. CONFLICTS_social-mysql:=gnunet-social-sqlite
  234. DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
  235. PLUGIN_fs-mysql:=datastore_mysql
  236. CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
  237. DEPENDS_pgsql:=+libpq
  238. LIB_pgsql:=postgres pq
  239. DEPENDS_dhtcache-pgsql:=+gnunet-pgsql
  240. PLUGIN_dhtcache-pgsql:=datacache_postgres
  241. CONFLICTS_dhtcache-pgsql:=gnunet-dhtcache-sqlite
  242. DEPENDS_fs-pgsql:=+gnunet-pgsql +gnunet-datastore
  243. PLUGIN_fs-pgsql:=datastore_postgres
  244. CONFLICTS_fs-pgsql:=gnunet-fs-sqlite
  245. DEPENDS_gns-pgsql:=+gnunet-pgsql +gnunet-gns
  246. PLUGIN_gns-pgsql:=namecache_postgres namestore_postgres
  247. CONFLICTS_gns-pgsql:=gnunet-gns-sqlite gnunet-gns-flat
  248. DEPENDS_social-pgsql:=+gnunet-pgsql +gnunet-social
  249. PLUGIN_social-pgsql:=psycstore_postgres
  250. CONFLICTS_social-pgsql:=gnunet-social-sqlite gnunet-social-mysql
  251. DEPENDS_gns-sqlite:=+libsqlite3 +gnunet-gns
  252. PLUGIN_gns-sqlite:=namecache_sqlite namestore_sqlite
  253. CONFLICTS_gns-sqlite:=gnunet-gns-flat
  254. DEPENDS_peerstore-sqlite:=+libsqlite3 +gnunet-peerstore
  255. PLUGIN_peerstore-sqlite:=peerstore_sqlite
  256. CONFLICTS_peerstore-sqlite:=gnunet-peerstore-flat
  257. DEPENDS_dhtcache-sqlite:=+libsqlite3
  258. PLUGIN_dhtcache-sqlite:=datacache_sqlite
  259. DEPENDS_fs-sqlite:=+libsqlite3 +gnunet-datastore
  260. PLUGIN_fs-sqlite:=datastore_sqlite
  261. DEPENDS_social-sqlite:=+libsqlite3 +gnunet-social
  262. PLUGIN_social-sqlite:=psycstore_sqlite
  263. DEPENDS_transport-bluetooth:=+bluez-libs
  264. PLUGIN_transport-bluetooth:=transport_bluetooth
  265. LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
  266. DEPENDS_utils:=+certtool +openssl-util
  267. BIN_utils:=gns-proxy-setup-ca transport-certificate-creation
  268. DEPENDS_vpn:=+kmod-tun +iptables +firewall
  269. BIN_vpn:=vpn
  270. LIB_vpn:=dnsstub tun vpn
  271. LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
  272. CONF_vpn:=exit pt vpn
  273. define Package/gnunet-gns/prerm
  274. #!/bin/sh
  275. uci -q batch <<EOF
  276. del network.gnunetdns
  277. del network.gndnsrtt
  278. del network.gndnsrl
  279. commit network
  280. del firewall.gnunetdns
  281. del firewall.gndnsrl
  282. del firewall.gndnsrl2
  283. commit firewall
  284. EOF
  285. endef
  286. define Package/gnunet-vpn/prerm
  287. #!/bin/sh
  288. uci -q batch <<EOF
  289. del network.gnunetvpn
  290. del network.gnunetexit
  291. commit network
  292. del firewall.gnunetvpn
  293. del firewall.gnunetexit
  294. del firewall.gnexitfwd
  295. commit firewall
  296. EOF
  297. endef
  298. define PostInstFixSUIDPerms
  299. define Package/$(1)/postinst
  300. #!/bin/sh
  301. [ -z "$IPKG_INSTROOT" ] || exit 0
  302. [ -e /usr/share/gnunet/.permfix ] && rm /usr/share/gnunet/.permfix || exit 0
  303. endef
  304. endef
  305. $(eval $(call PostInstFixSUIDPerms,gnunet))
  306. $(eval $(call PostInstFixSUIDPerms,gnunet-gns))
  307. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-bluetooth))
  308. $(eval $(call PostInstFixSUIDPerms,gnunet-transport-wlan))
  309. $(eval $(call PostInstFixSUIDPerms,gnunet-vpn))
  310. $(eval $(call BuildPackage,gnunet))
  311. $(eval $(call BuildComponent,conversation,conversation component,))
  312. $(eval $(call BuildComponent,datastore,data storage components,))
  313. $(eval $(call BuildComponent,dv,distance-vector routing component,y))
  314. $(eval $(call BuildComponent,experiments,experimental components,))
  315. $(eval $(call BuildComponent,fs,file-sharing components,))
  316. $(eval $(call BuildComponent,gns,name resolution components,y))
  317. $(eval $(call BuildComponent,gns-proxy,gns-proxy component,))
  318. $(eval $(call BuildComponent,hostlist,HTTP bootstrap hostlist client and server,y))
  319. $(eval $(call BuildComponent,peerstore,peerstore local persistency component,))
  320. $(eval $(call BuildComponent,rest,REST interface,))
  321. $(eval $(call BuildComponent,rps,RPS routing component,y))
  322. $(eval $(call BuildComponent,social,social components,))
  323. $(eval $(call BuildComponent,namestore-fcfsd,first-come-first-serve registration server,))
  324. $(eval $(call BuildComponent,dhtcache-heap,heap-based dhtcache plugin,y))
  325. $(eval $(call BuildComponent,fs-heap,heap-based filesharing plugin,))
  326. $(eval $(call BuildComponent,gns-flat,flat storage GNS plugins,y))
  327. $(eval $(call BuildComponent,peerstore-flat,flat storage peerstore plugin,))
  328. $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
  329. $(eval $(call BuildComponent,fs-mysql,mySQL filesharing plugins,))
  330. $(eval $(call BuildComponent,social-mysql,mySQL social plugins,))
  331. $(eval $(call BuildComponent,pgsql,PostgreSQL storage backends,))
  332. $(eval $(call BuildComponent,dhtcache-pgsql,PostgreSQL dhtcache plugin,))
  333. $(eval $(call BuildComponent,fs-pgsql,PostgreSQL filesharing plugin,))
  334. $(eval $(call BuildComponent,gns-pgsql,PostgreSQL GNS plugins,))
  335. $(eval $(call BuildComponent,social-pgsql,PostgreSQL social plugin,))
  336. $(eval $(call BuildComponent,dhtcache-sqlite,libsqlite3 dhtcache plugin,))
  337. $(eval $(call BuildComponent,fs-sqlite,libsqlite3 filesharing plugin,))
  338. $(eval $(call BuildComponent,gns-sqlite,libsqlite3 gns plugins,))
  339. $(eval $(call BuildComponent,peerstore-sqlite,libsqlite3 peerstore plugin,))
  340. $(eval $(call BuildComponent,social-sqlite,libsqlite3 social plugins,))
  341. $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
  342. $(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
  343. $(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
  344. $(eval $(call BuildComponent,transport-wlan,WLAN transport,y))
  345. $(eval $(call BuildComponent,utils,administration utililties,))
  346. $(eval $(call BuildComponent,vpn,vpn components,y))