Commit 261bd78d by Iain Buclaw

libphobos: Add --with-libphobos-druntime-only option.

The intended purpose of the option is both for targets that don't
support phobos yet, and for gdc itself to support bootstrapping itself
as a self-hosted D compiler.

The libphobos testsuite has been updated to only add libphobos to the
search paths if it's being built.  A new D2 testsuite directive
RUNNABLE_PHOBOS_TEST has also been patched in to disable some runnable
tests that have phobos dependencies, of which is a temporary measure
until upstream DMD fixes or removes these tests entirely.

gcc/testsuite/ChangeLog:

	* lib/gdc-utils.exp (gdc-convert-test): Add dg-skip-if for tests that
	depending on the phobos standard library.

libphobos/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Add --with-libphobos-druntime-only option and the
	conditional ENABLE_LIBDRUNTIME_ONLY.
	* configure.tgt: Define LIBDRUNTIME_ONLY.
	* src/Makefile.am: Add phobos sources if not ENABLE_LIBDRUNTIME_ONLY.
	* src/Makefile.in: Regenerate.
	* testsuite/testsuite_flags.in: Add phobos path if compiling phobos.
parent baf3b9b2
......@@ -116,3 +116,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -460,3 +460,4 @@ int main(char[][] args)
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -672,3 +672,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -928,3 +928,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -118,3 +118,4 @@ void main() {
}
}
// RUNNABLE_PHOBOS_TEST
......@@ -479,3 +479,4 @@ void main()
writefln("Success");
}
// RUNNABLE_PHOBOS_TEST
......@@ -916,3 +916,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -3609,3 +3609,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -3,3 +3,4 @@ void main()
{
double t = 1.0 - uniform(0.0, 1.0);
}
// RUNNABLE_PHOBOS_TEST
......@@ -308,3 +308,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1723,3 +1723,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1468,3 +1468,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -361,3 +361,4 @@ void main()
writeln("Success");
}
// RUNNABLE_PHOBOS_TEST
......@@ -95,3 +95,4 @@ int main()
writefln("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -725,3 +725,4 @@ void CLASS()
}
}
}
// RUNNABLE_PHOBOS_TEST
......@@ -1164,3 +1164,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -4965,3 +4965,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -24,3 +24,4 @@ mixin(getEnum(1087));
void main() { }
// RUNNABLE_PHOBOS_TEST
......@@ -1390,3 +1390,4 @@ int main(string[] argv)
}
// RUNNABLE_PHOBOS_TEST
......@@ -1250,3 +1250,4 @@ int main(string[] argv)
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -10,3 +10,4 @@ void main()
foo(a);
assert(a[0] == 10000);
}
// RUNNABLE_PHOBOS_TEST
......@@ -1439,3 +1439,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1306,3 +1306,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1566,3 +1566,4 @@ void main()
printf("Success\n");
}
// RUNNABLE_PHOBOS_TEST
......@@ -8,3 +8,4 @@ void main()
{
string hi = std.string.format("%s", 3);
}
// RUNNABLE_PHOBOS_TEST
......@@ -11,3 +11,4 @@ int main()
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1318,3 +1318,4 @@ void main()
printf("Success\n");
}
// RUNNABLE_PHOBOS_TEST
......@@ -1292,3 +1292,4 @@ void main()
}
// RUNNABLE_PHOBOS_TEST
......@@ -11,3 +11,4 @@ void main()
// imports in a subdirectory of the -J path
writefln(import("std14198/uni.d"));
}
// RUNNABLE_PHOBOS_TEST
......@@ -6438,3 +6438,4 @@ int main()
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -5,3 +5,4 @@ void map(real function(real) f) { }
int main() { map(&sqrt); return 0; }
// RUNNABLE_PHOBOS_TEST
......@@ -20,3 +20,4 @@ void main()
writeln("Success");
}
// RUNNABLE_PHOBOS_TEST
......@@ -1383,3 +1383,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -14,3 +14,4 @@ void main() {
}
// RUNNABLE_PHOBOS_TEST
......@@ -930,3 +930,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -22,3 +22,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -123,3 +123,4 @@ int main()
std.stdio.writefln("Success");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -41,3 +41,4 @@ void checkFileSpec(Object o){
writeln(str);
assert(str[start .. start+3]=="(1)");
}
// RUNNABLE_PHOBOS_TEST
......@@ -117,3 +117,4 @@ int main()
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -246,3 +246,4 @@ void main()
printf("Success\n");
}
// RUNNABLE_PHOBOS_TEST
......@@ -111,3 +111,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -48,3 +48,4 @@ int main ()
}
// RUNNABLE_PHOBOS_TEST
......@@ -31,3 +31,4 @@ void main()
} while (!feof(fp));
//fclose(fp);
}
// RUNNABLE_PHOBOS_TEST
......@@ -106,3 +106,4 @@ void main() {
}
}
// RUNNABLE_PHOBOS_TEST
......@@ -684,3 +684,4 @@ int main()
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -1606,3 +1606,4 @@ int main()
writeln("Success");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -48,3 +48,4 @@ int main (string[] args)
}
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -72,3 +72,4 @@ int main (string[] args)
}
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -70,3 +70,4 @@ int main (string[] args)
}
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -8283,3 +8283,4 @@ int main()
printf("Success\n");
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -22,3 +22,4 @@ int main()
return 0;
}
// RUNNABLE_PHOBOS_TEST
......@@ -208,6 +208,7 @@ proc gdc-convert-test { base test } {
set extra_sources ""
set extra_files ""
set needs_phobos 0
upvar 1 compilable_do_what compilable_do_what
set compilable_output_file_ext ""
......@@ -296,6 +297,11 @@ proc gdc-convert-test { base test } {
}
regsub -- {COMPILED_IMPORTS.*$} $copy_line "" out_line
} elseif [regexp -- {RUNNABLE_PHOBOS_TEST} $copy_line match sources] {
# RUNNABLE_PHOBOS_TEST annotates tests that import the std module.
# It will need skipping if phobos is not available on the target.
regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line
set needs_phobos 1
}
puts $fdout $out_line
......@@ -331,6 +337,9 @@ proc gdc-convert-test { base test } {
if ![isnative] {
puts $fdout "// { dg-final { output-exists } }"
}
if $needs_phobos {
puts $fdout "// { dg-skip-if \"imports phobos\" { ! d_runtime_has_std_library } }"
}
}
compilable {
......
......@@ -638,6 +638,8 @@ GDCFLAGSX
libtool_VERSION
SPEC_PHOBOS_DEPS
CHECKING_DFLAGS
ENABLE_LIBDRUNTIME_ONLY_FALSE
ENABLE_LIBDRUNTIME_ONLY_TRUE
ENABLE_LIBPHOBOS_FALSE
ENABLE_LIBPHOBOS_TRUE
gdc_include_dir
......@@ -840,6 +842,7 @@ with_cross_host
enable_version_specific_runtime_libs
with_toolexeclibdir
enable_libphobos
with_libdruntime_only
enable_libphobos_checking
'
ac_precious_vars='build_alias
......@@ -1509,6 +1512,8 @@ Optional Packages:
--with-toolexeclibdir=DIR
install libraries built with a cross compiler within
DIR
--with-libphobos-druntime-only={yes,no,auto}
build only the druntime library (default: auto)
Some influential environment variables:
CC C compiler command
......@@ -11645,7 +11650,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11648 "configure"
#line 11653 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -11751,7 +11756,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11754 "configure"
#line 11759 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -15230,8 +15235,27 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libphobos" >&5
$as_echo "$enable_libphobos" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-libphobos-druntime-only" >&5
$as_echo_n "checking for --with-libphobos-druntime-only... " >&6; }
# Check whether --with-libdruntime-only was given.
if test "${with_libdruntime_only+set}" = set; then :
withval=$with_libdruntime_only;
else
with_libdruntime_only=auto
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libdruntime_only" >&5
$as_echo "$with_libdruntime_only" >&6; }
case "$with_libdruntime_only" in
yes|no|auto) ;;
*) as_fn_error $? "Invalid argument for --with-libphobos-druntime-only" "$LINENO" 5 ;;
esac
# See if supported.
unset LIBPHOBOS_SUPPORTED
unset LIBDRUNTIME_ONLY
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for host support for libphobos" >&5
$as_echo_n "checking for host support for libphobos... " >&6; }
. ${srcdir}/configure.tgt
......@@ -15274,6 +15298,22 @@ else
fi
# Decide if only libdruntime should be built.
case $LIBDRUNTIME_ONLY:$with_libdruntime_only in
*:no) only_libdruntime=no ;;
*:yes) only_libdruntime=yes ;;
yes:*) only_libdruntime=yes ;;
*:*) only_libdruntime=no ;;
esac
if test x$only_libdruntime = xyes; then
ENABLE_LIBDRUNTIME_ONLY_TRUE=
ENABLE_LIBDRUNTIME_ONLY_FALSE='#'
else
ENABLE_LIBDRUNTIME_ONLY_TRUE='#'
ENABLE_LIBDRUNTIME_ONLY_FALSE=
fi
# Enable expensive internal checks
# Check whether --enable-libphobos-checking was given.
if test "${enable_libphobos_checking+set}" = set; then :
......@@ -15577,6 +15617,10 @@ if test -z "${ENABLE_LIBPHOBOS_TRUE}" && test -z "${ENABLE_LIBPHOBOS_FALSE}"; th
as_fn_error $? "conditional \"ENABLE_LIBPHOBOS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_LIBDRUNTIME_ONLY_TRUE}" && test -z "${ENABLE_LIBDRUNTIME_ONLY_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_LIBDRUNTIME_ONLY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
......
......@@ -152,8 +152,21 @@ AC_ARG_ENABLE(libphobos,
[AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
AC_MSG_RESULT($enable_libphobos)
AC_MSG_CHECKING([for --with-libphobos-druntime-only])
AC_ARG_WITH(libdruntime-only,
AS_HELP_STRING([--with-libphobos-druntime-only={yes,no,auto}],
[build only the druntime library (default: auto)]),,
[with_libdruntime_only=auto])
AC_MSG_RESULT($with_libdruntime_only)
case "$with_libdruntime_only" in
yes|no|auto) ;;
*) AC_MSG_ERROR([Invalid argument for --with-libphobos-druntime-only]) ;;
esac
# See if supported.
unset LIBPHOBOS_SUPPORTED
unset LIBDRUNTIME_ONLY
AC_MSG_CHECKING([for host support for libphobos])
. ${srcdir}/configure.tgt
case ${host} in
......@@ -187,6 +200,15 @@ yes:*) use_libphobos=yes ;;
esac
AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
# Decide if only libdruntime should be built.
case $LIBDRUNTIME_ONLY:$with_libdruntime_only in
*:no) only_libdruntime=no ;;
*:yes) only_libdruntime=yes ;;
yes:*) only_libdruntime=yes ;;
*:*) only_libdruntime=no ;;
esac
AM_CONDITIONAL(ENABLE_LIBDRUNTIME_ONLY, test x$only_libdruntime = xyes)
# Enable expensive internal checks
AC_ARG_ENABLE(libphobos-checking,
[AS_HELP_STRING([[--enable-libphobos-checking[=LIST]]],
......
......@@ -22,6 +22,7 @@
# Disable the libphobos or libdruntime components on untested or known
# broken systems. More targets shall be added after testing.
LIBPHOBOS_SUPPORTED=no
LIBDRUNTIME_ONLY=auto
case "${target}" in
aarch64*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
......
......@@ -70,6 +70,12 @@ install-data-local:
# https://gist.github.com/jpf91/8744acebc9dcf1e9d1a35cdff20afbb2
# Can't use wildcards here:
# https://www.gnu.org/software/automake/manual/html_node/Wildcards.html
if ENABLE_LIBDRUNTIME_ONLY
PHOBOS_DSOURCES =
else
PHOBOS_DSOURCES = etc/c/curl.d etc/c/sqlite3.d etc/c/zlib.d \
std/algorithm/comparison.d std/algorithm/internal.d \
std/algorithm/iteration.d std/algorithm/mutation.d \
......@@ -132,3 +138,5 @@ PHOBOS_DSOURCES = etc/c/curl.d etc/c/sqlite3.d etc/c/zlib.d \
std/utf.d std/uuid.d std/variant.d std/windows/charset.d \
std/windows/registry.d std/windows/syserror.d std/xml.d std/zip.d \
std/zlib.d
endif
......@@ -35,8 +35,11 @@ case ${query} in
GDCPATHS_default="-nostdinc"
GDCPATHS_config="-B${BUILD_DIR}/src
-I${BUILD_DIR}/libdruntime
-I${SRC_DIR}/libdruntime
-I${SRC_DIR}/src"
-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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment