bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Werner LEMBERG <wl@gnu.org>
To: bug-gnulib@gnu.org
Subject: inflexible non-recursive support
Date: Tue, 22 Jun 2021 16:33:26 +0000 (UTC)	[thread overview]
Message-ID: <20210622.183326.255236285487180571.wl@gnu.org> (raw)


[c7b1e060d17023065c776757da406d728310cc38]

Dear gnulib maintainers,


Currently, the script `prefix-gnulib-mk` replaces variables like
`libbison_a_SOURCES` with `lib_libbison_a_SOURCES`.  However, this
works only if the directory is indeed `lib/', which is not the general
case.  For example, in my project I would like to call the script as

  prefix-gnulib-mk --lib-name=libgnu gnulib/src/$gnulib_mk

I suggest a patch as below (which needs further polishing to properly
canonicalize the directory path, I guess).

A similar problem exists with
`modules/non-recursive-gnulib-prefix-hack`, which has the directory
name `lib` hard-coded.  Isn't it possible to modify `gnulib-tool` so
that it patches `non-resursive-gnulib-prefix-hack.m4` based on the
value of option `--source-base`?

Right now I have to manually patch `gnulib-comp.m4` (using function
`bootstrap_post_import_hook`) for changing `lib` to `gnulib/src`...


    Werner


======================================================================


diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk
index 347ddcd64..4eea8b738 100755
--- a/build-aux/prefix-gnulib-mk
+++ b/build-aux/prefix-gnulib-mk
@@ -40,6 +40,7 @@ use File::Basename; # for dirname
 (my $ME = $0) =~ s|.*/||;
 
 my $prefix;
+my $varprefix;
 my $lib_name;
 
 sub usage ($)
@@ -162,7 +163,7 @@ sub prefix_assignment ($$)
 
   # Variables whose name depend on the location: libbison_a_SOURCES =>
   # lib_libbison_a_SOURCES.
-  $lhs_and_assign_op =~ s/($lib_name)/lib_$1/g;
+  $lhs_and_assign_op =~ s/($lib_name)/${varprefix}$1/g;
 
   $lhs_and_assign_op . $rhs;
 }
@@ -243,6 +244,8 @@ sub process ($)
 
   my $file = $ARGV[0];
   $prefix = (dirname $file) . '/';
+  $varprefix = $prefix;
+  $varprefix =~ s{/}{_}g;
   warn "prefix=$prefix\n";
 
   process $file;


             reply	other threads:[~2021-06-22 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 16:33 Werner LEMBERG [this message]
2021-06-22 19:06 ` inflexible non-recursive support Paul Eggert
2021-06-23  9:16 ` Werner LEMBERG

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622.183326.255236285487180571.wl@gnu.org \
    --to=wl@gnu.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).