cs: add strip on install for CS executables

This commit is contained in:
Matthew Flatt 2018-10-25 11:30:03 -06:00
parent c0f14373ab
commit 7d86fddbdc
8 changed files with 243 additions and 54 deletions

39
racket/src/ac/strip.m4 Normal file
View File

@ -0,0 +1,39 @@
if test "${enable_strip}" = "" ; then
if test "${enable_strip_by_default}" = "yes" ; then
enable_strip=yes
fi
fi
try_archive_conftest()
{
$AR $ARFLAGS conftest.a conftest.$OBJEXT > /dev/null 2>&1
}
if test "${enable_strip}" = "yes" ; then
AC_CHECK_TOOL([STRIP], [strip])
# Used to add -S flag, but not all `strip' variants support it:
STRIP_DEBUG="${STRIP}"
if test "${INSTALL_LIBS_ENABLE}" = "install" ; then
check_strip_dash_s=yes
fi
if test "${strip_needs_dash_s}" = "yes" ; then
check_strip_dash_s=yes
fi
if test "${check_strip_dash_s}" = "yes" ; then
# Can only support library stripping if something like "-S" is available:
[ msg="for strip -S" ]
AC_MSG_CHECKING($msg)
set_strip_lib=no
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int f() { return 0; }])], try_archive_conftest, set_strip_lib=no )
if test conftest.a ; then
if "${STRIP_DEBUG}" -S conftest.a > /dev/null 2>&1 ; then
STRIP_LIB_DEBUG="${STRIP_DEBUG} -S"
set_strip_lib=yes
fi
fi
AC_MSG_RESULT($set_strip_lib)
if test "${strip_needs_dash_s}" = "yes" ; then
STRIP_DEBUG="${STRIP_LIB_DEBUG}"
fi
fi
fi

View File

@ -0,0 +1,7 @@
AC_ARG_ENABLE(noopt, [ --enable-strip strip debug on install (usually enabled by default)])
STRIP_DEBUG=":"
STRIP_LIB_DEBUG=":"
strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no

View File

@ -0,0 +1,2 @@
show_explicitly_enabled "${enable_strip}" "Debug-symbol stripping"
show_explicitly_disabled "${enable_strip}" "Debug-symbol stripping"

View File

@ -2849,6 +2849,13 @@ if test "${enable_noopt+set}" = set; then :
enableval=$enable_noopt;
fi
STRIP_DEBUG=":"
STRIP_LIB_DEBUG=":"
strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no
# Check whether --enable-noopt was given.
if test "${enable_noopt+set}" = set; then :
enableval=$enable_noopt;
@ -3208,6 +3215,7 @@ show_explicitly_enabled "${enable_noopt}" "No-optimization" "Note that this mode
show_explicitly_enabled "${enable_strip}" "Debug-symbol stripping"
show_explicitly_disabled "${enable_strip}" "Debug-symbol stripping"
show_explicitly_enabled "${enable_libs}" "Installation of static libraries (if any)"
show_explicitly_disabled "${enable_libs}" "Installation of static libraries (if any)"
@ -3337,12 +3345,6 @@ INSTALL_SETUP_RACKET_FLAGS=
INSTALL_LIBS_ENABLE=no-install
STRIP_DEBUG=":"
STRIP_LIB_DEBUG=":"
strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no
use_flag_pthread=yes
use_flag_posix_pthread=no
mzrt_needs_pthread=yes
@ -5182,6 +5184,7 @@ $as_echo "$set_strip_lib" >&6; }
fi
fi
############## C flags ################
ac_ext=c

View File

@ -16,6 +16,9 @@ CFLAGS = $(BASE_CFLAGS) -I$(SCHEME_INC) -I$(srcdir)/../../rktio -Irktio -I.
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
STRIP_DEBUG = @STRIP_DEBUG@
STRIP_LIB_DEBUG = @STRIP_LIB_DEBUG@
DEFAULT_RACKET = ../racket/racket3m
RACKET = @RACKET@
@ -229,7 +232,9 @@ common-install:
rm -f "$(DESTDIR)$(libpltdir)/starter"
rm -f "$(DESTDIR)$(libpltdir)/starter-sh"
$(ICP) racketcs "$(DESTDIR)$(bindir)/racket$(CS_INSTALLED)"
$(STRIP_DEBUG) "$(DESTDIR)$(bindir)/racket$(CS_INSTALLED)"
$(ICP) starter "$(DESTDIR)$(libpltdir)/starter"
$(STRIP_DEBUG) "$(DESTDIR)$(libpltdir)/starter"
$(ICP) $(srcdir)/../../start/starter-sh "$(DESTDIR)$(libpltdir)/starter-sh"
$(RACKET) -cu "$(srcdir)/../../racket/collects-path.rkt" "$(DESTDIR)$(libpltdir)/starter" $(DESTDIR)@COLLECTS_PATH@ $(DESTDIR)@CONFIG_PATH@
@ -266,3 +271,4 @@ macos-install-gracket:
$(BOOTSTRAP_RACKET) "$(srcdir)/../../mac/rename-app.rkt" $(DESTDIR)"$(libpltdir)/GRacket$(CS_GR_INSTALLED).app" "GRacketCS" "GRacket$(CS_GR_INSTALLED)" no-up
/usr/bin/install_name_tool -change "@executable_path/../../../../racket/Racket.framework/Versions/$(FWVERSION)_CS/Racket" "@FRAMEWORK_PREFIX@Racket.framework/Versions/$(FWVERSION)_CS/Racket" $(DESTDIR)"$(libpltdir)/GRacket$(CS_GR_INSTALLED).app/Contents/MacOS/GRacket$(CS_GR_INSTALLED)"
$(RACKET) -cu "$(srcdir)/../../racket/collects-path.rkt" $(DESTDIR)"$(libpltdir)/GRacket$(CS_GR_INSTALLED).app/Contents/MacOS/GRacket$(CS_GR_INSTALLED)" ../../../../collects ../../../../etc
$(STRIP_DEBUG) $(DESTDIR)"$(libpltdir)/GRacket$(CS_GR_INSTALLED).app/Contents/MacOS/GRacket$(CS_GR_INSTALLED)"

View File

@ -639,6 +639,8 @@ SCHEME_DIR
RACKET
INCLUDEDEP
RKTLINKER
STRIP_LIB_DEBUG
STRIP_DEBUG
ICP
STATIC_AR
RANLIB
@ -647,6 +649,7 @@ AR
EGREP
GREP
CPP
STRIP
OBJEXT
EXEEXT
ac_ct_CC
@ -754,6 +757,7 @@ enable_macprefix
enable_libfw
enable_userfw
enable_mac64
enable_noopt
enable_csdefault
enable_csonly
enable_parent
@ -1392,6 +1396,7 @@ Optional Features:
--enable-libfw install Mac OS frameworks to /Library/Frameworks
--enable-userfw install Mac OS frameworks to ~/Library/Frameworks
--enable-mac64 allow 64-bit Mac OS build (enabled by default)
--enable-strip strip debug on install (usually enabled by default)
--enable-csdefault use CS as default build
--enable-csonly build CS only
--enable-parent Create "../Makefile" (internal use)
@ -2383,6 +2388,18 @@ else
fi
# Check whether --enable-noopt was given.
if test "${enable_noopt+set}" = set; then :
enableval=$enable_noopt;
fi
STRIP_DEBUG=":"
STRIP_LIB_DEBUG=":"
strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no
# Check whether --enable-csdefault was given.
if test "${enable_csdefault+set}" = set; then :
enableval=$enable_csdefault;
@ -2498,6 +2515,9 @@ if test "${enable_sysroot}" != "" ; then
echo "=== Using sysroot directory ${enable_sysroot}"
fi
show_explicitly_enabled "${enable_strip}" "Debug-symbol stripping"
show_explicitly_disabled "${enable_strip}" "Debug-symbol stripping"
if test "${enable_iconv}" = "" ; then
enable_iconv=yes
@ -3686,6 +3706,7 @@ case "$host_os" in
else
CONFIGURE_RACKET_SO_COMPILE="env PLT_CS_MAKE_UNIX_STYLE_MACOS=y"
CPPFLAGS="${CPPFLAGS} -DRACKET_XONX"
strip_needs_dash_s=yes
fi
if test "${enable_sdk}" != "" ; then
@ -3837,6 +3858,151 @@ if test "${enable_compress}" = "yes" ; then
COMPRESS_COMP="--compress"
fi
############## Strip tool ################
if test "${enable_strip}" = "" ; then
if test "${enable_strip_by_default}" = "yes" ; then
enable_strip=yes
fi
fi
try_archive_conftest()
{
$AR $ARFLAGS conftest.a conftest.$OBJEXT > /dev/null 2>&1
}
if test "${enable_strip}" = "yes" ; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
$as_echo "$STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
$as_echo "$ac_ct_STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
# Used to add -S flag, but not all `strip' variants support it:
STRIP_DEBUG="${STRIP}"
if test "${INSTALL_LIBS_ENABLE}" = "install" ; then
check_strip_dash_s=yes
fi
if test "${strip_needs_dash_s}" = "yes" ; then
check_strip_dash_s=yes
fi
if test "${check_strip_dash_s}" = "yes" ; then
# Can only support library stripping if something like "-S" is available:
msg="for strip -S"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $msg" >&5
$as_echo_n "checking $msg... " >&6; }
set_strip_lib=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int f() { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
try_archive_conftest
else
set_strip_lib=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test conftest.a ; then
if "${STRIP_DEBUG}" -S conftest.a > /dev/null 2>&1 ; then
STRIP_LIB_DEBUG="${STRIP_DEBUG} -S"
set_strip_lib=yes
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $set_strip_lib" >&5
$as_echo "$set_strip_lib" >&6; }
if test "${strip_needs_dash_s}" = "yes" ; then
STRIP_DEBUG="${STRIP_LIB_DEBUG}"
fi
fi
fi
############## C flags ################
ac_ext=c
@ -4457,6 +4623,8 @@ CPPFLAGS="$CPPFLAGS $PREFLAGS"

View File

@ -22,6 +22,7 @@ AC_ARG_ENABLE(racket, [ --enable-racket=<path> use <path> as Racket to bui
AC_ARG_ENABLE(scheme, [ --enable-scheme=<path> Chez Scheme build directory at <path>])
AC_ARG_ENABLE(mach, [ --enable-mach=<mac> Use Chez Scheme machine type <mach>])
m4_include(../ac/sdk_arg.m4)
m4_include(../ac/strip_arg.m4)
AC_ARG_ENABLE(csdefault, [ --enable-csdefault use CS as default build])
AC_ARG_ENABLE(csonly, [ --enable-csonly build CS only])
AC_ARG_ENABLE(parent, [ --enable-parent Create "../Makefile" (internal use)])
@ -61,6 +62,7 @@ show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
show_explicitly_set "${enable_mach}" "machine type"
m4_include(../ac/sdk_show.m4)
m4_include(../ac/strip_show.m4)
if test "${enable_iconv}" = "" ; then
enable_iconv=yes
@ -176,6 +178,7 @@ case "$host_os" in
else
CONFIGURE_RACKET_SO_COMPILE="env PLT_CS_MAKE_UNIX_STYLE_MACOS=y"
CPPFLAGS="${CPPFLAGS} -DRACKET_XONX"
strip_needs_dash_s=yes
fi
m4_include(../ac/sdk_mac.m4)
@ -273,6 +276,10 @@ if test "${enable_compress}" = "yes" ; then
COMPRESS_COMP="--compress"
fi
############## Strip tool ################
m4_include(../ac/strip.m4)
############## C flags ################
AC_LANG_C
@ -417,6 +424,8 @@ AC_SUBST(ARFLAGS)
AC_SUBST(RANLIB)
AC_SUBST(STATIC_AR)
AC_SUBST(ICP)
AC_SUBST(STRIP_DEBUG)
AC_SUBST(STRIP_LIB_DEBUG)
AC_SUBST(RKTLINKER)
AC_SUBST(INCLUDEDEP)
AC_SUBST(RACKET)

View File

@ -75,7 +75,7 @@ AC_ARG_ENABLE(ffipoll, [ --enable-ffipoll FFI calls only when embedding
AC_ARG_ENABLE(gprof, [ --enable-gprof compile for profiling with gprof (gcc only)])
AC_ARG_ENABLE(gcov, [ --enable-gcov compile to gather gcov statistics (gcc3 only)])
AC_ARG_ENABLE(noopt, [ --enable-strip strip debug on install (usually enabled by default)])
m4_include(../ac/strip_arg.m4)
AC_ARG_ENABLE(noopt, [ --enable-noopt drop -O C flags (useful for low-level debugging)])
AC_ARG_ENABLE(ubsan, [ --enable-ubsan compile with -fsanitize=undefined)])
AC_ARG_ENABLE(jitframe,[ --enable-jitframe x86_64: use frame pointer for internal calls])
@ -223,8 +223,7 @@ show_explicitly_enabled "${enable_gcov}" "gcov"
show_explicitly_enabled "${enable_jitframe}" "jitframe"
show_explicitly_enabled "${enable_noopt}" "No-optimization" "Note that this mode is intended only for debugging purposes"
show_explicitly_enabled "${enable_strip}" "Debug-symbol stripping"
show_explicitly_disabled "${enable_strip}" "Debug-symbol stripping"
m4_include(../ac/strip_show.m4)
show_explicitly_enabled "${enable_libs}" "Installation of static libraries (if any)"
show_explicitly_disabled "${enable_libs}" "Installation of static libraries (if any)"
@ -292,12 +291,6 @@ INSTALL_SETUP_RACKET_FLAGS=
INSTALL_LIBS_ENABLE=no-install
STRIP_DEBUG=":"
STRIP_LIB_DEBUG=":"
strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no
use_flag_pthread=yes
use_flag_posix_pthread=no
mzrt_needs_pthread=yes
@ -792,45 +785,7 @@ fi
############## Strip tool ################
if test "${enable_strip}" = "" ; then
if test "${enable_strip_by_default}" = "yes" ; then
enable_strip=yes
fi
fi
try_archive_conftest()
{
$AR $ARFLAGS conftest.a conftest.$OBJEXT > /dev/null 2>&1
}
if test "${enable_strip}" = "yes" ; then
AC_CHECK_TOOL([STRIP], [strip])
# Used to add -S flag, but not all `strip' variants support it:
STRIP_DEBUG="${STRIP}"
if test "${INSTALL_LIBS_ENABLE}" = "install" ; then
check_strip_dash_s=yes
fi
if test "${strip_needs_dash_s}" = "yes" ; then
check_strip_dash_s=yes
fi
if test "${check_strip_dash_s}" = "yes" ; then
# Can only support library stripping if something like "-S" is available:
[ msg="for strip -S" ]
AC_MSG_CHECKING($msg)
set_strip_lib=no
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int f() { return 0; }])], try_archive_conftest, set_strip_lib=no )
if test conftest.a ; then
if "${STRIP_DEBUG}" -S conftest.a > /dev/null 2>&1 ; then
STRIP_LIB_DEBUG="${STRIP_DEBUG} -S"
set_strip_lib=yes
fi
fi
AC_MSG_RESULT($set_strip_lib)
if test "${strip_needs_dash_s}" = "yes" ; then
STRIP_DEBUG="${STRIP_LIB_DEBUG}"
fi
fi
fi
m4_include(../ac/strip.m4)
############## C flags ################