gnulib

How to modify gnulib-tool megatestdir and add additional gnulib module there?


Ok, so from some folder, I do:

/path/to/gnulib-tool --create-megatestdir --without-tests --dir=gnulib fts argp fstatat obstack

After quite a bit of waiting, I eventually get this (possibly without the .o files):

$ ls gnulib/
ALL/   build-aux/  fts/      aclocal.m4  configure.ac   Makefile.am
argp/  fstatat/    obstack/  configure*  do-autobuild*  Makefile.in

$ ls gnulib/ALL/gllib/*{argp,fts,fstatat,obstack}*
gnulib/ALL/gllib/argp.h            gnulib/ALL/gllib/argp-help.o      gnulib/ALL/gllib/argp-xinl.o
...
gnulib/ALL/gllib/argp-fmtstream.h  gnulib/ALL/gllib/argp-pv.c        gnulib/ALL/gllib/fts-cycle.c
gnulib/ALL/gllib/argp-fmtstream.o  gnulib/ALL/gllib/argp-pv.o        gnulib/ALL/gllib/obstack.c

Building against this ALL folder usually works for me, so I'd like to continue using it.

Now, let's say I want to add byteswap module to this; if I repeat the same command with that module added:

$ /path/to/gnulib-tool --create-megatestdir --without-tests --dir=gnulib fts argp fstatat obstack byteswap

mkdir: cannot create directory ‘gnulib’: File exists
/path/to/gnulib-tool: *** could not create destination directory
/path/to/gnulib-tool: *** Stop.

Of course I can delete the gnulib directory and start anew - but that is like an extra half an hour on my environment, so I'd like to avoid that.

So, I want to try something else there is gnulib-tool --add-import [module1 ... moduleN], let's try that in the same directory (the parent of gnulib directory created with the command above):

$ /path/to/gnulib-tool --add-import byteswap
...
  - invoke gl_INIT in ./configure.ac.

So, apparently the command succeds - however:

$ ls gnulib/ALL/gllib/*{byteswap}*
ls: cannot access 'gnulib/ALL/gllib/*{byteswap}*': No such file or directory

$ ls gnulib/byteswap*
ls: cannot access 'gnulib/byteswap*': No such file or directory

... so, unfortunately, this module was NOT added to the previously created gnulib folder ?! So I tried looking:

$ find . -name 'byteswap*'
./lib/byteswap.in.h
./m4/byteswap.m4

... so this ended up in a local lib/m4 subfolder, and not at the right location, so my build fails.

What is the right way to add a module to a gnulib "megatestdir" folder?


Solution

  • When you are saying "Building against this ALL folder usually works for me", you are implying that you want to use the .o and .a files from this directory in the build of some package.

    The way to use Gnulib in the context of some package is described in detail in chapter 3 "Invoking gnulib-tool" of the documentation.

    The gnulib-tool option --create-megatestdir and its smaller counterpart --create-testdir are not useful for using Gnulib in some package. That is simply not their purpose. Instead, their purpose is portability testing of the specified Gnulib modules, and is most often used by the Gnulib maintainers.