Bugzilla: 51465. strip binaries on optimized builds
authorlarryh%netscape.com
Thu, 28 Sep 2000 17:47:22 +0000
changeset 1567 e84a9ad4c2de22e7947c05bb6ad5588260733dcd
parent 1558 47a8cb6704386936557896444b990c359efc4582
child 1568 b057efb1e0eafa57bce27c448fbc88a2802a08da
push idunknown
push userunknown
push dateunknown
bugs51465
Bugzilla: 51465. strip binaries on optimized builds
config/Linux.mk
config/UNIX.mk
config/autoconf.mk.in
config/rules.mk
configure.in
--- a/config/Linux.mk
+++ b/config/Linux.mk
@@ -110,16 +110,18 @@ endif
 
 #
 # Linux 2.x has shared libraries.
 #
 
 MKSHLIB			= $(LD) $(DSO_LDOPTS) -soname $(notdir $@)
 ifdef BUILD_OPT
 OPTIMIZER		= -O2
+#   invoke 'strip' on *.so files in optimized builds
+STRIP = strip
 endif
 
 ######################################################################
 # Overrides for defaults in config.mk (or wherever)
 ######################################################################
 
 ######################################################################
 # Other
--- a/config/UNIX.mk
+++ b/config/UNIX.mk
@@ -32,16 +32,17 @@
 # 
 
 PR_UNIXOS	= 1
 XP_DEFINE	= -DXP_UNIX
 OBJ_SUFFIX	= o
 LIB_SUFFIX	= a
 DLL_SUFFIX	= so
 AR		= ar cr $@
+STRIP		= true
 
 ifdef BUILD_OPT
 OPTIMIZER	= -O
 DEFINES		= -UDEBUG -DNDEBUG
 OBJDIR_TAG	= _OPT
 else
 OPTIMIZER	= -g
 DEFINES		= -DDEBUG -UNDEBUG -DDEBUG_$(shell whoami)
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -5,16 +5,18 @@ DIST		= @prefix@
 OBJDIR_NAME	= .
 OBJDIR		= .
 OBJ_SUFFIX	= @OBJ_SUFFIX@
 LIB_SUFFIX	= @LIB_SUFFIX@
 DLL_SUFFIX	= @DLL_SUFFIX@
 MOD_VERSION	= @NSPR_VERSION@
 MOD_NAME	= @NSPR_MODNAME@
 
+BUILD_OPT	= @MOZ_OPTIMIZE@
+
 USE_CPLUS	= @USE_CPLUS@
 USE_IPV6	= @USE_IPV6@
 USE_N32		= @USE_N32@
 USE_64		= @USE_64@
 
 USE_PTHREADS	= @USE_PTHREADS@
 USE_BTHREADS	= @USE_BTHREADS@
 PTHREADS_USER	= @USE_USER_PTHREADS@
@@ -27,16 +29,17 @@ CCC		= @CXX@
 AR		= @AR@
 AR_FLAGS	= @AR_FLAGS@
 LD		= @LD@
 RANLIB		= @RANLIB@
 PERL		= @PERL@
 DLLTOOL		= @DLLTOOL@
 WINDRES		= @WINDRES@
 RC		= $(WINDRES)
+STRIP		= @STRIP@
 
 OS_CFLAGS	= @CFLAGS@ $(DSO_CFLAGS)
 OS_CXXFLAGS	= @CXXFLAGS@ $(DSO_CFLAGS)
 OS_LIBS         = @OS_LIBS@
 OS_LDFLAGS	= @LDFLAGS@
 
 MKSHLIB		= @MKSHLIB@
 DSO_CFLAGS	= @DSO_CFLAGS@
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -280,29 +280,35 @@ ifeq ($(OS_ARCH),WINNT)
 	$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
 else
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
 else
 	$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
 endif
 endif
+ifdef BUILD_OPT
+	$(STRIP) $@
+endif
 
 $(LIBRARY): $(OBJS)
 	@$(MAKE_OBJDIR)
 	rm -f $@
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(AR) $(subst /,\\,$(OBJS)) $(AR_EXTRA_ARGS)
 else
 ifdef USE_AUTOCONF
 	$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
 else
 	$(AR) $(OBJS) $(AR_EXTRA_ARGS)
 endif # USE_AUTOCONF
 endif
+ifdef BUILD_OPT
+	$(STRIP) $@
+endif
 	$(RANLIB) $@
 
 ifeq ($(OS_TARGET), WIN16)
 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
 	wlib $(OS_LIB_FLAGS) $@ +$(SHARED_LIBRARY)
 endif
 
 ifeq ($(OS_TARGET), OS2)
@@ -366,16 +372,19 @@ ifeq ($(OS_TARGET), OpenVMS)
 	@echo "`translate $@`" > $(@:.$(DLL_SUFFIX)=.vms)
 else	# OpenVMS
 	$(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS)
 endif	# OpenVMS
 endif   # OS2
 endif	# WINNT
 endif	# AIX 4.1
 endif   # USE_AUTOCONF
+ifdef BUILD_OPT
+	$(STRIP) $@
+endif
 
 
 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 $(RES): $(RESNAME)
 	@$(MAKE_OBJDIR)
 ifeq ($(OS_TARGET),OS2)
 	$(RC) -DOS2 -r $(RESNAME) $(RES)
 else
--- a/configure.in
+++ b/configure.in
@@ -245,16 +245,17 @@ fi
 rm -f a.out
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PATH_PROGS(PERL, perl5 perl, :)
+AC_PATH_PROGS(STRIP, strip, :)
 
 dnl ========================================================
 dnl Default platform specific options
 dnl ========================================================
 OBJ_SUFFIX=o
 LIB_SUFFIX=a
 DLL_SUFFIX=so
 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
@@ -1042,16 +1043,18 @@ AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
 AC_SUBST(HOST_CC)
 AC_SUBST(HOST_CFLAGS)
 AC_SUBST(LDFLAGS)
 AC_SUBST(GNU_CC)
 
+AC_SUBST(MOZ_OPTIMIZE)
+
 AC_SUBST(USE_CPLUS)
 AC_SUBST(USE_IPV6)
 AC_SUBST(USE_N32)
 AC_SUBST(USE_64)
 
 AC_SUBST(USE_PTHREADS)
 AC_SUBST(USE_BTHREADS)
 AC_SUBST(USE_USER_PTHREADS)