From c8e5e28048dd9605f7958ef95f2a6dd626658069 Mon Sep 17 00:00:00 2001 From: ng0 Date: Mon, 2 Dec 2019 15:30:56 +0000 Subject: rewrite sed logic used in Makefiles and move into dosubst awk script. include 'bin' and its files in dist files, this is where dosubst is located. While the invocation (passing of the variables) is not optimal (yet, will be changed), this will in the end allow sharing code between Makefiles better, and maybe drop sed usage in the future. --- src/gns/Makefile.am | 9 ++------- src/gns/gnunet-gns-proxy-setup-ca.in | 20 ++++++++++---------- src/gns/test_gnunet_gns.sh.in | 6 +++--- 3 files changed, 15 insertions(+), 20 deletions(-) (limited to 'src/gns') diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 9f0e0bbb6..abd5d5b48 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am @@ -103,17 +103,12 @@ plugin_LTLIBRARIES = \ bin_SCRIPTS = \ gnunet-gns-proxy-setup-ca -# See: https://www.gnu.org/software/automake/manual/html_node/Scripts.html#Scripts -do_subst = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' - gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in Makefile - $(do_subst) < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca + $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca @chmod +x gnunet-gns-proxy-setup-ca -do_subst_pkgdatadir = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' - test_gnunet_gns.sh: test_gnunet_gns.sh.in Makefile - $(do_subst_pkgdatadir) < $(srcdir)/test_gnunet_gns.sh.in > test_gnunet_gns.sh + $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_gns.sh.in > test_gnunet_gns.sh @chmod +x test_gnunet_gns.sh CLEANFILES = test_gnunet_gns.sh diff --git a/src/gns/gnunet-gns-proxy-setup-ca.in b/src/gns/gnunet-gns-proxy-setup-ca.in index 7a79c7994..602aadb2a 100644 --- a/src/gns/gnunet-gns-proxy-setup-ca.in +++ b/src/gns/gnunet-gns-proxy-setup-ca.in @@ -48,30 +48,30 @@ dir=$(dirname "$0") -if test -e @pkgdatadir@/progname.sh +if test -e @PKGDATADIRECTORY@/progname.sh then - . @pkgdatadir@/progname.sh + . @PKGDATADIRECTORY@/progname.sh else . $dir/../../contrib/build-common/sh/lib.sh/progname.sh fi -if test -e @pkgdatadir@/existence.sh +if test -e @PKGDATADIRECTORY@/existence.sh then - . @pkgdatadir@/existence.sh + . @PKGDATADIRECTORY@/existence.sh else . $dir/../../contrib/build-common/sh/lib.sh/existence.sh fi -if test -e @pkgdatadir@/msg.sh +if test -e @PKGDATADIRECTORY@/msg.sh then - . @pkgdatadir@/msg.sh + . @PKGDATADIRECTORY@/msg.sh else . $dir/../../contrib/build-common/sh/lib.sh/msg.sh fi -if test -e @pkgdatadir@/version_gnunet.sh +if test -e @PKGDATADIRECTORY@/version_gnunet.sh then - . @pkgdatadir@/version_gnunet.sh + . @PKGDATADIRECTORY@/version_gnunet.sh else . $dir/../../contrib/build-common/sh/lib.sh/version_gnunet.sh fi @@ -143,8 +143,8 @@ generate_ca() # ------------- openssl - GNUTLS_CA_TEMPLATE=@pkgdatadir@/gnunet-gns-proxy-ca.template - OPENSSLCFG=@pkgdatadir@/openssl.cnf + GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template + OPENSSLCFG=@PKGDATADIRECTORY@/openssl.cnf CERTTOOL="" OPENSSL=0 if test -x $(existence gnunet-certtool) diff --git a/src/gns/test_gnunet_gns.sh.in b/src/gns/test_gnunet_gns.sh.in index 66bed0516..8cdd062c7 100755 --- a/src/gns/test_gnunet_gns.sh.in +++ b/src/gns/test_gnunet_gns.sh.in @@ -8,9 +8,9 @@ # but this works for now. dir=$(dirname "$0") -if test -e @pkgdatadir@/existence.sh +if test -e @PKGDATADIRECTORY@/existence.sh then - . @pkgdatadir@/existence.sh + . @PKGDATADIRECTORY@/existence.sh else . $dir/../../contrib/build-common/sh/lib.sh/existence.sh fi @@ -22,7 +22,7 @@ fi $LOCATION --version if test $? != 0 then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" exit 77 fi -- cgit v1.2.3