make install reports missing directories

Erich Eckner mandos at eckner.net
Tue Nov 28 22:38:11 CET 2023


On Mon, 27 Nov 2023, Teddy Hogeborn wrote:

> Erich Eckner <mandos at eckner.net> writes:
>
>> I'm trying to package mandos for arch linux. I successfully ran
>> `make`, but the `make install-server` afterwards complains about a lot
>> of missing directories. I fixed it by replaying all `install`s by
>> `install -D` in the Makefile - but now the compression of man pages
>> fails with a similar issue: usr/share/man/man8/ does not exist. I had
>> a look at the Makefile and I fail to see the target, that would create
>> these directories. Does `debuild` really do this much magic and create
>> all those directories? Or am I missing some preliminary step?
>
> I think that those directories always exist on the systems we use.
> What do other Arch packages do for similar man page files?  Do they
> all create those directories?  Do they all use the same permissions
> and ownership when creating them, and if they don't, won't an Arch
> system have inconsistent permissions and ownership depending on which
> packages they installed in what order?

Arch installs into an empty "pkgdir". This is then wrapped in a tar and 
the package manager extracts the tar into the real root file system. Thus, 
all parent directories need to be created and the default is to create 
them for the root user - which is also, what `install -D` does.

I only packaged very few things for debian, but I thought to remember, 
that debuild worked similar: It runs `make install DESTDIR=$somedir` for 
installation with an empty $somedir. But maybe, my memories are wrong 
about this. You _do_ build debian packages with debuild, right?

>
>> If I made a patch for the Makefile to include directory creation,
>> would this be considered for inclusion?
>
> Certainly.  But I wonder about always using -D; if a directory does
> not exist, is it really the correct directory to use?  Which
> directories, except /usr/share/man/man8, did not exist?

My assumption always was, that whatever destination the Makefile decides, 
is the right one. I.e. if one wants a different destination, one should 
use environments variables to change prefixes and alike. See for example 
mdadm's makefile, that prominently uses `install -D` everywhere:

https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/Makefile#n278

regarding the missing dirs: I added `-D` to all `install`s and then I 
"only" needed to create $(MANDIR)/man8 and $(MANDIR)/man5. (And I needed 
to make /sbin configurable, because arch uses /bin for all executables and 
symlinks /sbin to /bin.) I'll try to wrap my hack into a nice patch and 
send it your way :-)

>
> /Teddy Hogeborn

regards,
Erich


More information about the Mandos-Dev mailing list