gdc: init at 9.3.0

This commit is contained in:
Stefan Frijters 2019-09-20 12:05:57 +02:00
parent 2c37314aaf
commit fc9b93d2fc
6 changed files with 160 additions and 16 deletions

View file

@ -8,6 +8,7 @@
{ name ? "" { name ? ""
, stdenvNoCC , stdenvNoCC
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, zlib ? null
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, propagateDoc ? cc != null && cc ? man , propagateDoc ? cc != null && cc ? man
, extraTools ? [], extraPackages ? [], extraBuildCommands ? "" , extraTools ? [], extraPackages ? [], extraBuildCommands ? ""
@ -205,6 +206,10 @@ stdenv.mkDerivation {
wrap ${targetPrefix}gnatlink ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatlink wrap ${targetPrefix}gnatlink ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatlink
'' ''
+ optionalString cc.langD or false ''
wrap ${targetPrefix}gdc $wrapper $ccPath/${targetPrefix}gdc
''
+ optionalString cc.langFortran or false '' + optionalString cc.langFortran or false ''
wrap ${targetPrefix}gfortran $wrapper $ccPath/${targetPrefix}gfortran wrap ${targetPrefix}gfortran $wrapper $ccPath/${targetPrefix}gfortran
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}g77 ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}g77
@ -220,7 +225,7 @@ stdenv.mkDerivation {
''; '';
strictDeps = true; strictDeps = true;
propagatedBuildInputs = [ bintools ] ++ extraTools; propagatedBuildInputs = [ bintools ] ++ extraTools ++ optionals cc.langD or false [ zlib ];
depsTargetTargetPropagated = extraPackages; depsTargetTargetPropagated = extraPackages;
wrapperName = "CC_WRAPPER"; wrapperName = "CC_WRAPPER";
@ -262,8 +267,9 @@ stdenv.mkDerivation {
# limits.h file in ../includes-fixed. To remedy the problem, # limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again. # another -idirafter is necessary to add that directory again.
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
'' + optionalString (!(cc.langD or false)) ''
echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
'' + optionalString isGNU '' '' + optionalString (isGNU && (!(cc.langD or false))) ''
for dir in "${cc}"/lib/gcc/*/*/include-fixed; do for dir in "${cc}"/lib/gcc/*/*/include-fixed; do
echo '-idirafter' ''${dir} >> $out/nix-support/libc-cflags echo '-idirafter' ''${dir} >> $out/nix-support/libc-cflags
done done
@ -307,6 +313,8 @@ stdenv.mkDerivation {
ln -s ${cc.man} $man ln -s ${cc.man} $man
ln -s ${cc.info} $info ln -s ${cc.info} $info
'' + optionalString (cc.langD or false) ''
echo "-B${zlib}${zlib.libdir or "/lib/"}" >> $out/nix-support/libc-cflags
'' ''
+ '' + ''
@ -366,9 +374,9 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" stackprotector fortify" hardening_unsupported_flags+=" stackprotector fortify"
'' + optionalString cc.langAda or false '' '' + optionalString cc.langAda or false ''
hardening_unsupported_flags+=" stackprotector strictoverflow" hardening_unsupported_flags+=" stackprotector strictoverflow"
'' '' + optionalString cc.langD or false ''
hardening_unsupported_flags+=" format"
+ optionalString targetPlatform.isWasm '' '' + optionalString targetPlatform.isWasm ''
hardening_unsupported_flags+=" stackprotector fortify pie pic" hardening_unsupported_flags+=" stackprotector fortify pie pic"
'' ''

View file

@ -3,6 +3,7 @@
, langAda ? false , langAda ? false
, langObjC ? stdenv.targetPlatform.isDarwin , langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin , langObjCpp ? stdenv.targetPlatform.isDarwin
, langD ? false
, langGo ? false , langGo ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
@ -58,6 +59,7 @@ let majorVersion = "9";
sha256 = ""; # TODO: uncomment and check hash when available. sha256 = ""; # TODO: uncomment and check hash when available.
}) */ }) */
++ optional langAda ../gnat-cflags.patch ++ optional langAda ../gnat-cflags.patch
++ optional langD ../libphobos.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch { ++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
@ -136,10 +138,10 @@ stdenv.mkDerivation ({
) )
else "") else "")
+ stdenv.lib.optionalString targetPlatform.isAvr '' + stdenv.lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=( makeFlagsArray+=(
'LIMITS_H_TEST=false' 'LIMITS_H_TEST=false'
) )
''; '';
inherit noSysDirs staticCompiler crossStageStatic inherit noSysDirs staticCompiler crossStageStatic
libcCross crossMingw; libcCross crossMingw;
@ -196,6 +198,7 @@ stdenv.mkDerivation ({
enableShared enableShared
langC langC
langD
langCC langCC
langFortran langFortran
langAda langAda
@ -235,14 +238,14 @@ stdenv.mkDerivation ({
inherit inherit
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic langD libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS EXTRA_TARGET_LDFLAGS
; ;
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langAda langFortran langGo version; inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
isGNU = true; isGNU = true;
}; };

View file

@ -14,6 +14,7 @@
, langC , langC
, langCC , langCC
, langD ? false
, langFortran , langFortran
, langJava ? false, javaAwtGtk ? false, javaAntlr ? null, javaEcj ? null , langJava ? false, javaAwtGtk ? false, javaAntlr ? null, javaEcj ? null
, langAda ? false , langAda ? false
@ -114,6 +115,7 @@ let
lib.concatStrings (lib.intersperse "," lib.concatStrings (lib.intersperse ","
( lib.optional langC "c" ( lib.optional langC "c"
++ lib.optional langCC "c++" ++ lib.optional langCC "c++"
++ lib.optional langD "d"
++ lib.optional langFortran "fortran" ++ lib.optional langFortran "fortran"
++ lib.optional langJava "java" ++ lib.optional langJava "java"
++ lib.optional langAda "ada" ++ lib.optional langAda "ada"
@ -174,6 +176,9 @@ let
"libat_cv_have_ifunc=no" "libat_cv_have_ifunc=no"
"--disable-gnu-indirect-function" "--disable-gnu-indirect-function"
] ]
++ lib.optionals (langD) [
"--with-target-system-zlib=yes"
]
; ;
in configureFlags in configureFlags

View file

@ -1,4 +1,4 @@
{ stdenv, crossStageStatic, libcCross, threadsCross }: { stdenv, crossStageStatic, langD ? false, libcCross, threadsCross }:
let let
inherit (stdenv) lib hostPlatform targetPlatform; inherit (stdenv) lib hostPlatform targetPlatform;
@ -6,13 +6,13 @@ in
{ {
EXTRA_TARGET_FLAGS = let EXTRA_TARGET_FLAGS = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ mkFlags = dep: langD: lib.optionals (targetPlatform != hostPlatform && dep != null && !langD) ([
"-idirafter ${lib.getDev dep}${dep.incdir or "/include"}" "-idirafter ${lib.getDev dep}${dep.incdir or "/include"}"
] ++ stdenv.lib.optionals (! crossStageStatic) [ ] ++ stdenv.lib.optionals (! crossStageStatic) [
"-B${lib.getLib dep}${dep.libdir or "/lib"}" "-B${lib.getLib dep}${dep.libdir or "/lib"}"
]); ]);
in mkFlags libcCross in mkFlags libcCross langD
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross) ++ lib.optionals (!crossStageStatic) (mkFlags threadsCross langD)
; ;
EXTRA_TARGET_LDFLAGS = let EXTRA_TARGET_LDFLAGS = let

View file

@ -0,0 +1,119 @@
diff --git a/Makefile.in b/Makefile.in
index a375471..83c5ecb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -804,7 +804,7 @@ BASE_FLAGS_TO_PASS = \
"STAGE1_LANGUAGES=$(STAGE1_LANGUAGES)" \
"GNATBIND=$(GNATBIND)" \
"GNATMAKE=$(GNATMAKE)" \
- "GDC=$(GDC)" \
+ "`echo 'GDC=$(GDC)' | sed -e 's/-idirafter [^ ]*//g'`" \
"GDCFLAGS=$(GDCFLAGS)" \
"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
"AS_FOR_TARGET=$(AS_FOR_TARGET)" \
@@ -817,7 +817,7 @@ BASE_FLAGS_TO_PASS = \
"GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \
"GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
- "GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
+ "`echo 'GDC_FOR_TARGET=$(GDC_FOR_TARGET)' | sed -e 's/-idirafter [^ ]*//g'`" \
"GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
@@ -890,7 +890,7 @@ EXTRA_HOST_FLAGS = \
'DLLTOOL=$(DLLTOOL)' \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
- 'GDC=$(GDC)' \
+ "`echo 'GDC=$(GDC)' | sed -e 's/-idirafter [^ ]*//g'`" \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@@ -966,8 +966,11 @@ EXTRA_TARGET_FLAGS = \
'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
"TFLAGS=$$TFLAGS"
+EXTRA_TARGET_FLAGS_D = \
+ "`echo $(EXTRA_TARGET_FLAGS) | sed -e 's/-idirafter [^ ]*//g'`"
TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+TARGET_FLAGS_TO_PASS_D = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS_D)
# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
# unfortunately needs the native compiler and the target ar and
@@ -47285,7 +47288,7 @@ check-target-libphobos:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) check)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) check)
@endif target-libphobos
@@ -47300,7 +47303,7 @@ install-target-libphobos: installdirs
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) install)
@endif target-libphobos
@@ -47315,7 +47318,7 @@ install-strip-target-libphobos: installdirs
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libphobos && \
- $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+ $(MAKE) $(TARGET_FLAGS_TO_PASS_D) install-strip)
@endif target-libphobos
diff --git a/Makefile.tpl b/Makefile.tpl
index 41cae58..b3d32e7 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -721,8 +721,11 @@ EXTRA_TARGET_FLAGS = \
'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
"TFLAGS=$$TFLAGS"
+EXTRA_TARGET_FLAGS_D = \
+ "`echo $(EXTRA_TARGET_FLAGS) | sed -e 's/-idirafter [^ ]*//g'`"
TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+TARGET_FLAGS_TO_PASS_D = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS_D)
# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
# unfortunately needs the native compiler and the target ar and
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index e894417..2d18dcb 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -365,6 +365,7 @@ AM_MAKEFLAGS = \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
+ "`echo 'MAKEFLAGS=$(MAKEFLAGS)' | sed -e 's/-j[0-9]+/-j1/'`" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
@@ -694,6 +695,8 @@ uninstall-am:
.PRECIOUS: Makefile
+.NOTPARALLEL:
+
# GNU Make needs to see an explicit $(MAKE) variable in the command it
# runs to enable its job server during parallel builds. Hence the
# comments below.
diff --git a/libphobos/configure b/libphobos/configure
index b3cb5f3..25adf2b 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -5122,6 +5122,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+GDC=`$as_echo "$GDC" | sed -e 's/-idirafter [^ ]*//g'`
ac_ext=d
ac_compile='$GDC -c $GDCFLAGS conftest.$ac_ext >&5'

View file

@ -8545,6 +8545,15 @@ in
gcc-arm-embedded-9 = callPackage ../development/compilers/gcc-arm-embedded/9 {}; gcc-arm-embedded-9 = callPackage ../development/compilers/gcc-arm-embedded/9 {};
gcc-arm-embedded = gcc-arm-embedded-9; gcc-arm-embedded = gcc-arm-embedded-9;
gdc = gdc9;
gdc9 = wrapCC (gcc9.cc.override {
name = "gdc";
langCC = false;
langC = false;
langD = true;
profiledCompiler = false;
});
gforth = callPackage ../development/compilers/gforth {}; gforth = callPackage ../development/compilers/gforth {};
gleam = callPackage ../development/compilers/gleam { gleam = callPackage ../development/compilers/gleam {
@ -9324,7 +9333,7 @@ in
isGNU = cc.isGNU or false; isGNU = cc.isGNU or false;
isClang = cc.isClang or false; isClang = cc.isClang or false;
inherit cc bintools libc extraPackages; inherit cc bintools libc extraPackages zlib;
} // extraArgs; in self); } // extraArgs; in self);
wrapCC = cc: wrapCCWith { wrapCC = cc: wrapCCWith {