gcc/libphobos/testsuite/testsuite_flags.in
Iain Buclaw 185b307b03 darwin, d: Support outfile substitution for libphobos
In the gdc driver, this takes the previous fix for the Darwin D
bootstrap, and extends it to the -static-libphobos option as well.
Rather than pushing the -static-libphobos option back onto the command
line, the setting of SKIPOPT is instead conditionally removed.  The same
change has been repeated for -static-libstdc++ so there is now no need
to call generate_option to re-add it.

In the gcc driver, -static-libphobos has been added as a common option,
validated, and a new outfile substition added to config/darwin.h to
correctly replace -lgphobos with libgphobos.a.

gcc/ChangeLog:

	* common.opt (static-libphobos): Add option.
	* config/darwin.h (LINK_SPEC): Substitute -lgphobos with libgphobos.a
	when linking statically.
	* gcc.c (driver_handle_option): Set -static-libphobos as always valid.

gcc/d/ChangeLog:

	* d-spec.cc (lang_specific_driver): Set SKIPOPT on -static-libstdc++
	and -static-libphobos only when target supports LD_STATIC_DYNAMIC.
	Remove generate_option to re-add -static-libstdc++.

libphobos/ChangeLog:

	* testsuite/testsuite_flags.in: Add libphobos library directory as
	search path to --gdcldflags.
2021-12-01 19:49:44 +01:00

58 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
#
# This script computes the various flags needed to run D Phobos unittests.
#
# Print a message saying how this script is intended to be invoked
print_usage() {
cat <<EOF
Usage:
testsuite_flags --gdc
--gdcflags
--gdcpaths
--gdcldflags
EOF
}
# Establish configure-generated directory structure.
BUILD_DIR=@libphobos_builddir@
SRC_DIR=@libphobos_srcdir@
query=$1
case ${query} in
--gdc)
GDC="@GDC@"
echo ${GDC}
;;
--gdcflags)
GDCFLAGS_default="-fmessage-length=0 -fno-show-column"
GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@
@phobos_compiler_shared_flag@ -fpreview=dip1000 -fno-release -funittest"
echo ${GDCFLAGS_default} ${GDCFLAGS_config}
;;
--gdcpaths)
GDCPATHS_default="-nostdinc"
GDCPATHS_config="-B${BUILD_DIR}/src
-I${BUILD_DIR}/libdruntime
-I${SRC_DIR}/libdruntime"
# Include phobos in search path if compiling in library.
if [ "x@ENABLE_LIBDRUNTIME_ONLY_FALSE@" = "x" ]; then
GDCPATHS_config="${GDCPATHS_config} -I${SRC_DIR}/src"
fi
echo ${GDCPATHS_default} ${GDCPATHS_config}
;;
--gdcldflags)
GDCLDFLAGS="-B${BUILD_DIR}/src
-B${BUILD_DIR}/libdruntime/gcc
-B${BUILD_DIR}/src/.libs
-L${BUILD_DIR}/src/.libs"
echo ${GDCLDFLAGS}
;;
*)
print_usage
;;
esac
exit 0