gnunet: use templates to package components
authorDaniel Golle <redacted>
Thu, 4 Jun 2015 00:37:03 +0000 (02:37 +0200)
committerDaniel Golle <redacted>
Thu, 4 Jun 2015 00:37:03 +0000 (02:37 +0200)
Signed-off-by: Daniel Golle <redacted>
net/gnunet/Makefile

index 72bdf2260e32990ee2a7af99f5ce47a8547dc24a..455f792b274e13ed790fcfd43804de5943d78968 100644 (file)
@@ -10,10 +10,9 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=gnunet
 PKG_SOURCE_VERSION:=35856
 PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 # ToDo:
-#  - build packages using templates and lists
 #  - break-out transports
 #    -> get rid of microhttpd and gnurl dependency for gns and vpn
 #       requires upstream to split config files
@@ -50,19 +49,24 @@ CONFIGURE_ARGS+= \
 # ToDo: request upstream to provide --with-pulseaudio=...
 TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
 
-define Package/gnunet
+define Package/gnunet/Default
   SECTION:=net
   CATEGORY:=Network
-  TITLE:=GNUnet is peer-to-peer framework focusing on security
+  TITLE:=GNUnet
+  URL:=https://www.gnunet.org/
+endef
+
+define Package/gnunet
+$(call Package/gnunet/Default)
+  TITLE+= - a peer-to-peer framework focusing on security
   DEPENDS:=+ca-certificates +libgnurl +libgnutls +libidn +libltdl \
            +libmicrohttpd +libunistring +librt
-  URL:=https://www.gnunet.org/
   USERID:=gnunet=400:gnunet=400
   MENU:=1
 endef
 
 define Package/gnunet/description
- GNUnet is peer-to-peer framework focusing on security.  The first and
+ GNUnet is a peer-to-peer framework focusing on security. The first and
  primary application for GNUnet is anonymous file-sharing.  GNUnet is
  currently developed by a worldwide group of independent free software
  developers.  GNUnet is a GNU package (http://www.gnu.org/).
@@ -75,64 +79,52 @@ define Package/gnunet/description
  as their helpers.
 endef
 
-define Package/gnunet-conversation
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet conversation components
-  DEPENDS:=gnunet +gnunet-gns +libgst1app +libgst1audio \
-           +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
-endef
-
-define Package/gnunet-experiments
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet experimental components
-  DEPENDS:=gnunet +libglpk
-endef
-
-define Package/gnunet-fs
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet file-sharing components
-  DEPENDS:=gnunet +gnunet-storage +libextractor
-endef
-
-define Package/gnunet-gns
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet GNS components
-  USERID:=gnunetdns=401:gnunetdns=401
-  DEPENDS:=gnunet +gnunet-vpn
-  DEFAULT:=y
-endef
-
-define Package/gnunet-storage
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet storage components
-  DEPENDS:=gnunet +gnunet-gns +libsqlite3
-endef
-
-define Package/gnunet-transport-bluetooth
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet bluetooth transport
-  DEPENDS:=gnunet +bluez-libs
-endef
-
-define Package/gnunet-utils
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet administration utilities
-  DEPENDS:=gnunet +certtool +openssl-util
-endef
-
-define Package/gnunet-vpn
-  SECTION:=net
-  CATEGORY:=Network
-  TITLE:=GNUnet VPN components
-  DEPENDS:=gnunet +kmod-tun
-  DEFAULT:=y
+define BuildComponent
+  define Package/gnunet-$(1)
+    $$(call Package/gnunet/Default)
+    TITLE+= $(2)
+    DEPENDS:=gnunet $(DEPENDS_$(1))
+    DEFAULT:=$(3)
+  endef
+
+  define Package/gnunet-$(1)/install
+       ( if [ "$(BIN_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/bin ; \
+               for bin in $(BIN_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
+               done \
+       fi )
+
+       ( if [ "$(LIB_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib ; \
+               for lib in $(LIB_$(1)); do \
+                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
+               done \
+       fi )
+
+       ( if [ "$(PLUGIN_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
+               for plug in $(PLUGIN_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
+               done \
+       fi )
+
+       ( if [ "$(LIBEXEC_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
+               for lex in $(LIBEXEC_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
+               done \
+       fi )
+
+       ( if [ "$(CONF_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
+               for conf in $(CONF_$(1)); do \
+               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
+               done \
+       fi )
+  endef
+
+  $$(eval $$(call BuildPackage,gnunet-$(1)))
 endef
 
 define Package/gnunet/install
@@ -178,122 +170,6 @@ define Package/gnunet/install
        $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
 endef
 
-define Package/gnunet-conversation/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d
-       ( for bin in conversation conversation-test; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
-       done )
-       ( for lib in conversation microphone speaker; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
-       done )
-       ( for plug in gnsrecord_conversation; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
-       done )
-       ( for lex in helper-audio-playback helper-audio-record; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
-       done )
-       ( for conf in conversation; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
-       done )
-endef
-
-define Package/gnunet-experiments/install
-       $(INSTALL_DIR) $(1)/usr/lib/gnunet/libexec
-       ( for plug in ats_mlp ats_ril; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
-       done )
-endef
-
-define Package/gnunet-fs/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d
-       ( for bin in auto-share directory download download-manager.scm fs publish unindex search; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
-       done )
-       ( for lib in fs; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
-       done )
-       ( for plug in block_fs ; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
-       done )
-       ( for lex in helper-fs-publish service-fs; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
-       done )
-       ( for conf in fs; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
-       done )
-endef
-
-define Package/gnunet-gns/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d
-       ( for bin in gns namecache resolver; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
-       done )
-       ( for lib in gns gnsrecord namecache namestore; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
-       done )
-       ( for plug in block_dns block_gns gnsrecord_dns gnsrecord_gns; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
-       done )
-       ( for lex in dns2gns gns-proxy helper-dns service-dns \
-           service-gns service-namecache service-resolver; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
-       done )
-       ( for conf in dns gns namecache resolver; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
-       done )
-endef
-
-define Package/gnunet-storage/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d
-       ( for bin in datastore peerstore; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
-       done )
-       ( for lib in datastore peerstore; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
-       done )
-       ( for plug in datacache_sqlite datastore_heap datastore_sqlite namecache_sqlite namestore_sqlite; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
-       done )
-       ( for lex in daemon-latency-logger namestore-fcfsd service-datastore service-peerstore; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
-       done )
-       ( for conf in datastore peerstore; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
-       done )
-endef
-
-define Package/gnunet-transport-bluetooth/install
-       $(INSTALL_DIR) $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_transport_bluetooth.so $(1)/usr/lib/gnunet
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth $(1)/usr/lib/gnunet/libexec
-endef
-
-define Package/gnunet-utils/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       ( for bin in config gns-import.sh gns-proxy-setup-ca \
-           transport-certificate-creation; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
-       done )
-endef
-
-define Package/gnunet-vpn/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
-       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-vpn $(1)/usr/bin/
-       ( for lib in tun vpn; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
-       done )
-       ( for lex in daemon-exit daemon-pt helper-exit  helper-vpn service-vpn; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
-       done )
-       ( for conf in exit pt vpn; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
-       done )
-endef
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
@@ -302,12 +178,55 @@ define Build/InstallDev
        $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
 endef
 
+DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
+BIN_conversation:=conversation conversation-test
+LIB_conversation:=conversation microphone speaker
+PLUGIN_conversation:=gnsrecord_conversation
+LIBEXEC_conversation:=helper-audio-playback helper-audio-record
+CONF_conversation:=conversation
+
+DEPENDS_experiments:=+libglpk
+PLUGIN_experiments:=ats_mlp ats_ril
+
+DEPENDS_fs:=+gnunet-storage +libextractor
+BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
+LIB_fs:=fs
+PLUGIN_fs:=block_fs
+LIB_EXEC_fs:=helper-fs-publish service-fs
+CONF_fs:=fs
+
+DEPENDS_gns:=+gnunet-vpn
+BIN_gns:=gns namecache resolver
+LIB_gns:=gns gnsrecord namecache namestore
+PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
+LIBEXEC_gns:=dns2gns gns-proxy helper-dns service-dns service-gns service-namecache service-resolver
+CONF_gns:=dns gns namecache resolver
+
+DEPENDS_storage:=+gnunet-gns +libsqlite3
+BIN_storage:=datastore peerstore
+LIB_storage:=datastore peerstore
+PLUGIN_storage:=datacache_sqlite datastore_heap datastore_sqlite namecache_sqlite namestore_sqlite
+LIBEXEC_storage:=daemon-latency-logger namestore-fcfsd service-datastore service-peerstore
+CONF_storage:=datastore peerstore
+
+DEPENDS_transport-bluetooth:=+bluez-libs
+PLUGIN_transport-bluetooth:=transport_bluetooth
+LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
+
+DEPENDS_utils:=+certtool +openssl-util
+BIN_utils:=config gns-import.sh gns-proxy-setup-ca transport-certificate-creation
+
+DEPENDS_vpn:=+kmod-tun
+LIB_vpn:=tun vpn
+LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit  helper-vpn service-vpn
+CONF_vpn:=exit pt vpn
+
 $(eval $(call BuildPackage,gnunet))
-$(eval $(call BuildPackage,gnunet-conversation))
-$(eval $(call BuildPackage,gnunet-experiments))
-$(eval $(call BuildPackage,gnunet-fs))
-$(eval $(call BuildPackage,gnunet-gns))
-$(eval $(call BuildPackage,gnunet-storage))
-$(eval $(call BuildPackage,gnunet-transport-bluetooth))
-$(eval $(call BuildPackage,gnunet-utils))
-$(eval $(call BuildPackage,gnunet-vpn))
+$(eval $(call BuildComponent,conversation,conversation component,n))
+$(eval $(call BuildComponent,experiments,experimental components,n))
+$(eval $(call BuildComponent,fs,file-sharing components,n))
+$(eval $(call BuildComponent,gns,name resolving components,y))
+$(eval $(call BuildComponent,storage,storage components,n))
+$(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,n))
+$(eval $(call BuildComponent,utils,administration utililties,n))
+$(eval $(call BuildComponent,vpn,vpn components,y))
git clone https://git.99rst.org/PROJECT