[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;