Eli Zaretskii eliz@gnu.org writes:
When handling libraries, I imagine one need to be a little careful to use the right one of
strip strip -s strip --strip-debug strip --strip-unneded
Shared libraries need --strip-unneded, static libraries need --strip-debug followed by ranlib.
Makes sense. Are you saying that for static libraries, one has to redo ranlib after strip?
and I'm not sure which is implied by install -s.
It's a synonym for --strip-all, so it's only pertinent to executable programs.
And you're also saying that a "default strip", invoking strip without any options, is the same as strip --strip-all?
I wonder if one can persuade the install program to do the right thing. It should be straightforward to use separate variables INSTALL_STATIC_LIB and INSTALL_SHARED_LIB, to override in the install-strip target. But it seems overriding the strip command, e.g., to use strip --strip-unneeded, is going to be messy.
For install-sh, is one can set STRIPPROG="strip --strip-unneeded". For GNU /usr/bin/install, one can set STRIPPROG="strip --strip-unneeded" in the environment (untested, not sure if it is passed to the shell to split into command and arguments). But that won't work with BSD install. Checking on freebsd, it seems it checks an environment named STRIPBIN, (not sure if there's also a BSD strip not accepting GNU options; on my closest freebsd system, /usr/bin/strip is an ancient GNU binutils).
Since install-strip is an optional thing, I think I'd be happy to support only the most mainstream cases here.
The alternative to using install -s would be to produce additional files in the build directory, e.g., libnettle.a.stripped and install that. But having that done as part of make install-strip breaks the expectation that install targets shouldn't create or modify any files in the build tree, and producing them in make all doesn't seem quite right either.
A third alternative is to have the install-strip target do things like
$(INSTALL_DATA) libnettle.a $(DESTDIR)$(libdir) strip --strip-debug $(DESTDIR)$(libdir)/libnettle.a ranlib $(DESTDIR)$(libdir)/libnettle.a # Rebuild index
and use install -s *only* for (non-script) executables.
Regards, /Niels