This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: make install-strip with binutils
- From: Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org, gdb-patches at sourceware dot org, NightStrike <nightstrike at gmail dot com>
- Date: Sat, 20 Nov 2010 20:38:29 +0100
- Subject: Re: make install-strip with binutils
- References: <AANLkTim3U0h2Orq0k=35f1EH4UDrVuY1aeQMy7V1o9E6@mail.gmail.com> <20101023095951.GN2183@gmx.de> <AANLkTiksfrMeF7=U3ie6-vom6arKdc8O0qNkABvYuZAm@mail.gmail.com> <mcrhbgcub27.fsf@google.com> <alpine.LFD.2.00.1010240455210.15889@eddie.linux-mips.org> <20101027182939.GI15343@gmx.de> <AANLkTikDnZA17jMXbEEX6oLezYKHDm-LZxuXifxdbQCo@mail.gmail.com> <20101102200841.GG4123@gmx.de> <20101117190145.GE12746@gmx.de> <alpine.LNX.2.00.1011200121060.10295@acrux.dbai.tuwien.ac.at>
* Gerald Pfeifer wrote on Sat, Nov 20, 2010 at 01:24:13AM CET:
> On Wed, 17 Nov 2010, Ralf Wildenhues wrote:
> > Now, as GCC build maintainer, it seems most of this patch is free to
> > proceed on (still, I'd welcome any review!), and the src bits are
> > trivial. The web update has been OKed off-list by Gerald, so the only
> > remaining bits are in gcc/doc/install.texi. Is that part of the build
> > maintainer role too, or OK to go ahead with?
>
> I can approve that one, too. :-)
>
> There is one thing there that may confuse our users a bit and that is
> the following:
Fixed according to your suggestion. Thanks for the review!
I noticed one more problem: target-specific exports are supported since
GNU make 3.81 only, but GCC only requires 3.80. Luckily nothing besides
install-sh uses STRIPPROG, and install-sh tests for non-empty rather
than unset variable for its semantics, so we can export the variable
from gcc/Makefile.in. The gcc/ part of the final patch is shown below,
the rest as in <http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00192.html>.
I've committed the whole patch to GCC and src now.
Cheers,
Ralf
PR other/46202: implement install-strip.
gcc/:
PR other/46202
* Makefile.in (install_sh, INSTALL_STRIP_PROGRAM): New
variables.
(AR_FOR_TARGET, RANLIB_FOR_TARGET, STRIP_FOR_TARGET): Fix
shell quoting.
(STRIP_FOR_TARGET): Look for in-tree strip under name strip-new.
(install-strip): New target.
(STRIPPROG): New variable, exported if STRIP is set.
* doc/install.texi (Final install): Minor markup and code style
fixes. Document install-strip target.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 5491aeaf..98f06e9 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -22,7 +22,7 @@
#<http://www.gnu.org/licenses/>.
# The targets for external use include:
-# all, doc, install, install-cross, install-cross-rest,
+# all, doc, install, install-cross, install-cross-rest, install-strip,
# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean.
# This is the default target.
@@ -255,6 +255,8 @@ LN_S=@LN_S@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL@
+install_sh = $(SHELL) $(srcdir)/../install-sh
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
MAKEINFO = @MAKEINFO@
MAKEINFOFLAGS = --no-split
TEXI2DVI = texi2dvi
@@ -387,7 +389,7 @@ AR_FOR_TARGET := $(shell \
if [ "$(host)" = "$(target)" ] ; then \
echo $(AR); \
else \
- t='$(program_transform_name)'; echo ar | sed -e $$t ; \
+ t='$(program_transform_name)'; echo ar | sed -e "$$t" ; \
fi; \
fi)
AR_FLAGS_FOR_TARGET =
@@ -402,20 +404,20 @@ RANLIB_FOR_TARGET := $(shell \
if [ "$(host)" = "$(target)" ] ; then \
echo $(RANLIB); \
else \
- t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
+ t='$(program_transform_name)'; echo ranlib | sed -e "$$t" ; \
fi; \
fi)
ORIGINAL_LD_FOR_TARGET = @ORIGINAL_LD_FOR_TARGET@
ORIGINAL_NM_FOR_TARGET = @ORIGINAL_NM_FOR_TARGET@
NM_FOR_TARGET = ./nm
STRIP_FOR_TARGET := $(shell \
- if [ -f $(objdir)/../binutils/strip ] ; then \
- echo $(objdir)/../binutils/strip ; \
+ if [ -f $(objdir)/../binutils/strip-new ] ; then \
+ echo $(objdir)/../binutils/strip-new ; \
else \
if [ "$(host)" = "$(target)" ] ; then \
echo strip; \
else \
- t='$(program_transform_name)'; echo strip | sed -e $$t ; \
+ t='$(program_transform_name)'; echo strip | sed -e "$$t" ; \
fi; \
fi)
@@ -4488,7 +4490,7 @@ maintainer-clean:
-rm -f gcc.??s gcc.*aux
-rm -f $(gcc_docdir)/*.info $(gcc_docdir)/*.1 $(gcc_docdir)/*.7 $(gcc_docdir)/*.dvi $(gcc_docdir)/*.pdf
#
-# Entry points `install' and `uninstall'.
+# Entry points `install', `install-strip', and `uninstall'.
# Also use `install-collect2' to install collect2 when the config files don't.
# Copy the compiler files into directories where they will be run.
@@ -4502,6 +4504,13 @@ ifeq ($(enable_plugin),yes)
install: install-plugin
endif
+install-strip: override INSTALL_PROGRAM = $(INSTALL_STRIP_PROGRAM)
+ifneq ($(STRIP),)
+install-strip: STRIPPROG = $(STRIP)
+export STRIPPROG
+endif
+install-strip: install
+
# Handle cpp installation.
install-cpp: installdirs cpp$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index 183e545..6395ff9 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -92,7 +92,7 @@ SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
# libgcc.mk. We want this delayed until actual install time.
SHLIB_INSTALL = \
$$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL_PROGRAM) $(SHLIB_DIR)/$(SHLIB_SONAME) \
+ $(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
$$(DESTDIR)$$(bindir)/$(SHLIB_SONAME); \
$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1c9d463..e67793a 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2617,7 +2617,7 @@ messages may be automatically processed.
Now that GCC has been built (and optionally tested), you can install it with
@smallexample
-cd @var{objdir}; make install
+cd @var{objdir} && make install
@end smallexample
We strongly recommend to install into a target directory where there is
@@ -2653,7 +2653,8 @@ jail can be achieved with the command
make DESTDIR=@var{path-to-rootdir} install
@end smallexample
-@noindent where @var{path-to-rootdir} is the absolute path of
+@noindent
+where @var{path-to-rootdir} is the absolute path of
a directory relative to which all installation paths will be
interpreted. Note that the directory specified by @code{DESTDIR}
need not exist yet; it will be created if necessary.
@@ -2667,6 +2668,12 @@ it will not be created otherwise. This is regarded as a feature,
not as a bug, because it gives slightly more control to the packagers
using the @code{DESTDIR} feature.
+You can install stripped programs and libraries with
+
+@smallexample
+make install-strip
+@end smallexample
+
If you are bootstrapping a released version of GCC then please
quickly review the build status page for your release, available from
@uref{http://gcc.gnu.org/buildstat.html}.