diff options
Diffstat (limited to 'pkgs/development/compilers')
69 files changed, 2034 insertions, 1652 deletions
diff --git a/pkgs/development/compilers/dmd/generic.nix b/pkgs/development/compilers/dmd/generic.nix index c1fb9abf77d7e..3f8871df4f96d 100644 --- a/pkgs/development/compilers/dmd/generic.nix +++ b/pkgs/development/compilers/dmd/generic.nix @@ -151,13 +151,6 @@ stdenv.mkDerivation rec { git ]; - # Workaround cc-wrapper's --sysroot= value for `staging-next`: it - # breaks library lookup via RUNPATH: - # ld: warning: libm.so.6, needed by ./generated/linux/release/64/lib.so, not found (try using -rpath or -rpath-link) - # ld: /build/druntime/generated/linux/release/64/libdruntime.so: undefined reference to `log10@GLIBC_2.2.5' - # TODO(trofi): remove the workaround once cc-wrapper is fixed. - NIX_CFLAGS_COMPILE = [ "--sysroot=/" ]; - buildInputs = [ curl tzdata diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 6ce7779d566e2..4df0872688be2 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -24,7 +24,7 @@ , threadsCross ? null # for MinGW , crossStageStatic ? false , gnused ? null -, cloog # unused; just for compat with gcc4, as we override the parameter on some places +, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages , libxcrypt }: @@ -83,6 +83,67 @@ let majorVersion = "10"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc10.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnatboot + gnused + isl + langAda + langC + langCC + langD + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + libxcrypt + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -125,10 +186,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -146,8 +207,8 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else "") + )) + ) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( '-s' # workaround for hitting hydra log limit @@ -158,39 +219,12 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - langAda - libxcrypt - gnatboot - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = (import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib; - }) + '' + preConfigure = (callFile ../common/pre-configure.nix { }) + '' ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h ''; @@ -198,42 +232,15 @@ stdenv.mkDerivation ({ configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langD - langCC - langFortran - langAda - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -256,10 +263,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic langD libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -273,24 +277,17 @@ stdenv.mkDerivation ({ inherit enableMultilib enableShared; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; + } // optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index 482cc5f362e5f..4b91e05983046 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -82,13 +82,77 @@ let majorVersion = "11"; ++ optional (stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch; + ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + + # openjdk build fails without this on -march=opteron; is upstream in gcc12 + ++ [ ./gcc-issue-103910.patch ]; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc11.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnatboot + gnused + isl + langAda + langC + langCC + langD + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + libxcrypt + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -131,10 +195,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -152,8 +216,8 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else "") + )) + ) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( '-s' # workaround for hitting hydra log limit @@ -164,39 +228,12 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - langAda - libxcrypt - gnatboot - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = (import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib; - }) + '' + preConfigure = (callFile ../common/pre-configure.nix { }) + '' ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h ''; @@ -204,42 +241,15 @@ stdenv.mkDerivation ({ configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langD - langCC - langFortran - langAda - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -262,10 +272,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic langD libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -279,22 +286,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; }; } diff --git a/pkgs/development/compilers/gcc/11/gcc-issue-103910.patch b/pkgs/development/compilers/gcc/11/gcc-issue-103910.patch new file mode 100644 index 0000000000000..c3edd960f0973 --- /dev/null +++ b/pkgs/development/compilers/gcc/11/gcc-issue-103910.patch @@ -0,0 +1,41 @@ +From d243f4009d8071b734df16cd70f4c5d09a373769 Mon Sep 17 00:00:00 2001 +From: Andrew Pinski <apinski@marvell.com> +Date: Wed, 5 Jan 2022 22:00:07 +0000 +Subject: [PATCH] Fix target/103910: missing GTY on x86_mfence causing PCH + usage to ICE + +With -O3 -march=opteron, a mfence builtin is added after the loop +to say the nontemporal stores are no longer needed. This all good +without precompiled headers as the function decl that is referneced +by x86_mfence is referenced in another variable but with precompiled +headers, x86_mfence is all messed up and the decl was GC'ed away. +This fixes the problem by marking x86_mfence as GTY to save/restore +during precompiled headers just like most other variables in +the header file. + +Committed as obvious after a bootstrap/test on x86_64-linux-gnu. + +gcc/ChangeLog: + + PR target/103910 + * config/i386/i386.h (x86_mfence): Mark with GTY. +--- + gcc/config/i386/i386.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h +index f027608eefa..3ac0f698ae2 100644 +--- a/gcc/config/i386/i386.h ++++ b/gcc/config/i386/i386.h +@@ -486,7 +486,7 @@ extern unsigned char ix86_prefetch_sse; + + /* Fence to use after loop using storent. */ + +-extern tree x86_mfence; ++extern GTY(()) tree x86_mfence; + #define FENCE_FOLLOWING_MOVNT x86_mfence + + /* Once GDB has been enhanced to deal with functions without frame +-- +2.31.1 + diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index 5d8205a755195..63168968cd6be 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -123,6 +123,67 @@ let majorVersion = "12"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc12.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnatboot + gnused + isl + langAda + langC + langCC + langD + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + libxcrypt + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -165,10 +226,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -187,7 +248,7 @@ stdenv.mkDerivation ({ sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' ) - else "") + )) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( '-s' # workaround for hitting hydra log limit @@ -198,42 +259,12 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - langAda - langGo - libucontext - libxcrypt - gnatboot - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = (import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib; - }) + '' + preConfigure = (callFile ../common/pre-configure.nix { }) + '' ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h ''; @@ -241,42 +272,15 @@ stdenv.mkDerivation ({ configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langD - langCC - langFortran - langAda - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -299,10 +303,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic langD libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -316,22 +317,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; }; } diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index e2e9cb66d0a98..7e6d4eb12239e 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -111,6 +111,82 @@ let majorVersion = "4"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + javaEcj + javaAntlr + xlibs + javaAwtGtk + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc48.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + boehmgc + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnused + gtk2 + isl + langC + langCC + langFortran + langGo + langJava + langJit + langObjC + langObjCpp + lib + libICE + libSM + libX11 + libXi + libXrandr + libXrender + libXt + libXtst + libart_lgpl + libcCross threadsCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + pkg-config + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + unzip + which + x11Support + xorgproto + zip + zlib + ; + }; + in # We need all these X libraries when building AWT with GTK. @@ -158,84 +234,24 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - version - langJava - javaAwtGtk - texinfo - which - gettext - pkg-config - gnused - patchelf - gmp - mpfr - libmpc - cloog - isl - zlib - boehmgc - zip - unzip - gtk2 - libart_lgpl - perl - xlibs - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform langJava langGo crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - cloog - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langCC - langFortran - langJava javaAwtGtk javaAntlr javaEcj - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -273,10 +289,7 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] )); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -291,22 +304,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well - as libraries for these languages (libstdc++, libgcj, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = with lib.maintainers; [ veprbl ]; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = lib.platforms.darwin; }; } diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index eba68c39fd507..4ea63d7c12e1a 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -127,6 +127,82 @@ let majorVersion = "4"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + javaEcj + javaAntlr + xlibs + javaAwtGtk + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc49.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + boehmgc + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnused + gtk2 + isl + langC + langCC + langFortran + langGo + langJava + langJit + langObjC + langObjCpp + lib + libICE + libSM + libX11 + libXi + libXrandr + libXrender + libXt + libXtst + libart_lgpl + libcCross threadsCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + pkg-config + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + unzip + which + x11Support + xorgproto + zip + zlib + ; + }; + in # We need all these X libraries when building AWT with GTK. @@ -178,84 +254,24 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - version - langJava - javaAwtGtk - texinfo - which - gettext - pkg-config - gnused - patchelf - gmp - mpfr - libmpc - cloog - isl - zlib - boehmgc - zip - unzip - gtk2 - libart_lgpl - perl - xlibs - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform langJava langGo crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - cloog - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langCC - langFortran - langJava javaAwtGtk javaAntlr javaEcj - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -293,10 +309,7 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] )); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -310,22 +323,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well - as libraries for these languages (libstdc++, libgcj, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = with lib.maintainers; [ veprbl ]; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; } diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 27d57a509aaed..7e5e2c6b10b5b 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -31,7 +31,7 @@ , threadsCross ? null # for MinGW , crossStageStatic ? false , gnused ? null -, cloog # unused; just for compat with gcc4, as we override the parameter on some places +, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages }: @@ -115,6 +115,86 @@ let majorVersion = "6"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + javaEcj + javaAntlr + xlibs + javaAwtGtk + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc6.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + boehmgc + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchFromGitHub + fetchpatch + fetchurl + flex + gettext + gmp + gnatboot + gnused + gtk2 + isl + langAda + langC + langCC + langFortran + langGo + langJava + langJit + langObjC + langObjCpp + lib + libICE + libSM + libX11 + libXi + libXrandr + libXrender + libXt + libXtst + libart_lgpl + libcCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + pkg-config + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + unzip + which + x11Support + xorgproto + zip + zlib + ; + }; in # We need all these X libraries when building AWT with GTK. @@ -166,10 +246,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -187,94 +267,32 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else ""); + )) + ); inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - version - langAda - gnatboot - flex - langJava - javaAwtGtk - texinfo - which - gettext - pkg-config - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - boehmgc - zip - unzip - gtk2 - libart_lgpl - perl - xlibs - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform gnatboot langJava langAda langGo crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langCC - langFortran - langJava javaAwtGtk javaAntlr javaEcj - langAda - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -312,10 +330,7 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] )); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -329,20 +344,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well - as libraries for these languages (libstdc++, libgcj, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; } diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index d22e85c61adcf..75366c5b04dd1 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -21,7 +21,7 @@ , threadsCross ? null # for MinGW , crossStageStatic ? false , gnused ? null -, cloog # unused; just for compat with gcc4, as we override the parameter on some places +, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages }: @@ -91,6 +91,63 @@ let majorVersion = "7"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc7.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnused + isl + langC + langCC + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -133,10 +190,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -154,8 +211,8 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else "") + )) + ) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( 'LIMITS_H_TEST=false' @@ -165,78 +222,30 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform langGo crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langCC - langFortran - langGo - langObjC - langObjCpp - langJit - ; - } ++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419" + configureFlags = (callFile ../common/configure-flags.nix { }) + ++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419" ++ optional targetPlatform.isNetBSD "--disable-libcilkrts" ; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -261,10 +270,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -278,22 +284,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; } diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 2b43fc124bf02..e0b1a1e24ada0 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -21,7 +21,7 @@ , threadsCross ? null # for MinGW , crossStageStatic ? false , gnused ? null -, cloog # unused; just for compat with gcc4, as we override the parameter on some places +, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages }: @@ -73,6 +73,63 @@ let majorVersion = "8"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc8.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnused + isl + langC + langCC + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -115,10 +172,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -136,8 +193,8 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else "") + )) + ) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( 'LIMITS_H_TEST=false' @@ -147,75 +204,26 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform langGo crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langCC - langFortran - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -238,10 +246,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -255,22 +260,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; } diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index ebf0bf0563906..bcfd1c7dd38a8 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -84,6 +84,66 @@ let majorVersion = "9"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; + callFile = lib.callPackageWith { + # lets + inherit + majorVersion + version + buildPlatform + hostPlatform + targetPlatform + patches + crossMingw + stageNameAddon + crossNameAddon + ; + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc9.cc.override)" | jq '.[]' --raw-output' + inherit + binutils + buildPackages + cloog + crossStageStatic + enableLTO + enableMultilib + enablePlugin + enableShared + fetchpatch + fetchurl + gettext + gmp + gnatboot + gnused + isl + langAda + langC + langCC + langD + langFortran + langGo + langJit + langObjC + langObjCpp + lib + libcCross + libmpc + mpfr + name + noSysDirs + patchelf + perl + profiledCompiler + reproducibleBuild + staticCompiler + stdenv + targetPackages + texinfo + threadsCross + which + zip + zlib + ; + }; + in stdenv.mkDerivation ({ @@ -126,10 +186,10 @@ stdenv.mkDerivation ({ --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" '' + ( - if targetPlatform != hostPlatform || stdenv.cc.libc != null then + lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null) # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. - let + (let libc = if libcCross != null then libcCross else stdenv.cc.libc; in ( @@ -147,8 +207,8 @@ stdenv.mkDerivation ({ '' sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' - ) - else "") + )) + ) + lib.optionalString targetPlatform.isAvr '' makeFlagsArray+=( 'LIMITS_H_TEST=false' @@ -158,79 +218,26 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - inherit (import ../common/dependencies.nix { - inherit - lib - stdenv - buildPackages - targetPackages - crossStageStatic - threadsCross - langAda - gnatboot - version - texinfo - which - gettext - gnused - patchelf - gmp - mpfr - libmpc - isl - zlib - zip - perl - ; - }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; + inherit (callFile ../common/dependencies.nix { }) + depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; - NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm"; - preConfigure = import ../common/pre-configure.nix { - inherit lib; - inherit version targetPlatform hostPlatform buildPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib; - }; + preConfigure = callFile ../common/pre-configure.nix { }; dontDisableStatic = true; configurePlatforms = [ "build" "host" "target" ]; - configureFlags = import ../common/configure-flags.nix { - inherit - lib - stdenv - targetPackages - crossStageStatic libcCross threadsCross - version - - binutils gmp mpfr libmpc isl - - enableLTO - enableMultilib - enablePlugin - enableShared - - langC - langD - langCC - langFortran - langAda - langGo - langObjC - langObjCpp - langJit - ; - }; + configureFlags = callFile ../common/configure-flags.nix { }; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; - targetPlatformConfig = targetPlatform.config; buildFlags = optional (targetPlatform == hostPlatform && hostPlatform == buildPlatform) (if profiledCompiler then "profiledbootstrap" else "bootstrap"); - inherit - (import ../common/strip-attributes.nix { inherit lib stdenv langJit; }) + inherit (callFile ../common/strip-attributes.nix { }) stripDebugList stripDebugListTarget preFixup; @@ -253,10 +260,7 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - inherit - (import ../common/extra-target-flags.nix { - inherit lib stdenv crossStageStatic langD libcCross threadsCross; - }) + inherit (callFile ../common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET ; @@ -270,22 +274,14 @@ stdenv.mkDerivation ({ inherit enableShared enableMultilib; meta = { - homepage = "https://gcc.gnu.org/"; - license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ - description = "GNU Compiler Collection, version ${version}"; - - longDescription = '' - The GNU Compiler Collection includes compiler front ends for C, C++, - Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as - libraries for these languages (libstdc++, libgomp,...). - - GCC development is a part of the GNU Project, aiming to improve the - compiler used in the GNU system including the GNU/Linux variant. - ''; - - maintainers = lib.teams.gcc.members; - - platforms = lib.platforms.unix; + inherit (callFile ../common/meta.nix { }) + homepage + license + description + longDescription + platforms + maintainers + ; badPlatforms = [ "aarch64-darwin" ]; }; } diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index dd5a8de76e2a8..2d7a058fa015c 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -203,17 +203,6 @@ preInstall() { ln -s lib "$out/${targetConfig}/lib32" ln -s lib "${!outputLib}/${targetConfig}/lib32" fi - - # cc-wrappers uses --sysroot=/nix/store/does/not/exist as a way to - # drop default sysheaders search path. Unfortunately that switches - # clang++ into searching libraries in gcc in cross-compiler paths: - # from ${!outputLib}/lib (native) - # to ${!outputLib}/${targetPlatformConfig}/lib - # We create the symlink to make both native and cross paths - # available even if the toolchain is not the cross-compiler. - if [ ! -e ${!outputLib}/${targetPlatformConfig} ] ; then - ln -s . ${!outputLib}/${targetPlatformConfig} - fi } diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index 25e59148440a0..78d13cb941e3c 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -25,7 +25,6 @@ , langJit }: -assert cloog != null -> lib.versionOlder version "5"; assert langJava -> lib.versionOlder version "7"; # Note [Windows Exception Handling] @@ -188,7 +187,7 @@ let # Optional features ++ lib.optional (isl != null) "--with-isl=${isl}" - ++ lib.optionals (cloog != null) [ + ++ lib.optionals (lib.versionOlder version "5" && cloog != null) [ "--with-cloog=${cloog}" "--disable-cloog-version-check" "--enable-cloog-backend=isl" diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index a193ec887a0a7..d3ae3e33c46c5 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -79,7 +79,7 @@ in ++ [ targetPackages.stdenv.cc.bintools # For linking code at run-time ] - ++ optionals (cloog != null) [ cloog ] + ++ optionals (lib.versionOlder version "5" && cloog != null) [ cloog ] ++ optionals (isl != null) [ isl ] ++ optionals (zlib != null) [ zlib ] ++ optionals langJava [ boehmgc zip unzip ] diff --git a/pkgs/development/compilers/gcc/common/meta.nix b/pkgs/development/compilers/gcc/common/meta.nix new file mode 100644 index 0000000000000..84c3dc189b1fa --- /dev/null +++ b/pkgs/development/compilers/gcc/common/meta.nix @@ -0,0 +1,19 @@ +{ lib, version, }: + +with lib; { + homepage = "https://gcc.gnu.org/"; + license = licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ + description = "GNU Compiler Collection, version ${version}"; + longDescription = '' + The GNU Compiler Collection includes compiler front ends for C, C++, + Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as + libraries for these languages (libstdc++, libgomp,...). + + GCC development is a part of the GNU Project, aiming to improve the + compiler used in the GNU system including the GNU/Linux variant. + ''; + + platforms = platforms.unix; + maintainers = if versionOlder version "5" then [ maintainers.veprbl ] else teams.gcc.members; + +} diff --git a/pkgs/development/compilers/gnu-cim/default.nix b/pkgs/development/compilers/gnu-cim/default.nix new file mode 100644 index 0000000000000..b1cb9f08597e0 --- /dev/null +++ b/pkgs/development/compilers/gnu-cim/default.nix @@ -0,0 +1,45 @@ +{ lib +, stdenv +, fetchurl +}: + +stdenv.mkDerivation rec { + pname = "gnu-cim"; + version = "5.1"; + + outputs = ["out" "lib" "man" "info"]; + + src = fetchurl { + url = "mirror://gnu/cim/cim-${version}.tar.gz"; + hash = "sha256-uQcXtm7EAFA73WnlN+i38+ip0QbDupoIoErlc2mgaak="; + }; + + postPatch = '' + for fname in lib/{simulation,simset}.c; do + substituteInPlace "$fname" \ + --replace \ + '#include "../../lib/cim.h"' \ + '#include "../lib/cim.h"' + done + ''; + + CFLAGS = lib.optionalString stdenv.cc.isClang "-Wno-return-type"; + + doCheck = true; + + meta = with lib; { + description = "A GNU compiler for the programming language Simula"; + longDescription = '' + GNU Cim is a compiler for the programming language Simula. + It offers a class concept, separate compilation with full type checking, + interface to external C routines, an application package for process + simulation and a coroutine concept. Commonly used with the Demos for + discrete event modelling. + ''; + homepage = "https://www.gnu.org/software/cim/"; + license = licenses.gpl2; + platforms = platforms.all; + badPlatforms = [ "aarch64-darwin" ]; + maintainers = with maintainers; [ pbsds ]; + }; +} diff --git a/pkgs/development/compilers/go/1.18.nix b/pkgs/development/compilers/go/1.18.nix index 3c089f02920a1..a6ecf62bbcb76 100644 --- a/pkgs/development/compilers/go/1.18.nix +++ b/pkgs/development/compilers/go/1.18.nix @@ -1,5 +1,6 @@ { lib , stdenv +, fetchpatch , fetchurl , tzdata , substituteAll @@ -87,6 +88,12 @@ stdenv.mkDerivation rec { }) ./remove-tools-1.11.patch ./go_no_vendor_checks-1.16.patch + + # runtime: support riscv64 SV57 mode + (fetchpatch { + url = "https://github.com/golang/go/commit/1e3c19f3fee12e5e2b7802a54908a4d4d03960da.patch"; + sha256 = "sha256-mk/9gXwQEcAkiRemF6GiNU0c0fhDR29/YcKgQR7ONTA="; + }) ]; GOOS = stdenv.targetPlatform.parsed.kernel.name; @@ -148,12 +155,12 @@ stdenv.mkDerivation rec { ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} - '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' + '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) '' rm -rf bin/*_* ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} - '' else ""); + ''); installPhase = '' runHook preInstall @@ -173,6 +180,7 @@ stdenv.mkDerivation rec { }; meta = with lib; { + changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor version}"; description = "The Go Programming language"; homepage = "https://go.dev/"; license = licenses.bsd3; diff --git a/pkgs/development/compilers/go/1.19.nix b/pkgs/development/compilers/go/1.19.nix index 84a6059581e73..829772fa016e3 100644 --- a/pkgs/development/compilers/go/1.19.nix +++ b/pkgs/development/compilers/go/1.19.nix @@ -1,5 +1,6 @@ { lib , stdenv +, fetchpatch , fetchurl , tzdata , substituteAll @@ -87,6 +88,12 @@ stdenv.mkDerivation rec { }) ./remove-tools-1.11.patch ./go_no_vendor_checks-1.16.patch + + # runtime: support riscv64 SV57 mode + (fetchpatch { + url = "https://github.com/golang/go/commit/1e3c19f3fee12e5e2b7802a54908a4d4d03960da.patch"; + sha256 = "sha256-mk/9gXwQEcAkiRemF6GiNU0c0fhDR29/YcKgQR7ONTA="; + }) ]; GOOS = stdenv.targetPlatform.parsed.kernel.name; @@ -148,12 +155,12 @@ stdenv.mkDerivation rec { ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} - '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' + '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) '' rm -rf bin/*_* ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} - '' else ""); + ''); installPhase = '' runHook preInstall @@ -173,6 +180,7 @@ stdenv.mkDerivation rec { }; meta = with lib; { + changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor version}"; description = "The Go Programming language"; homepage = "https://go.dev/"; license = licenses.bsd3; diff --git a/pkgs/development/compilers/go/1.20.nix b/pkgs/development/compilers/go/1.20.nix index a8c441813f175..f432e5468779f 100644 --- a/pkgs/development/compilers/go/1.20.nix +++ b/pkgs/development/compilers/go/1.20.nix @@ -46,11 +46,11 @@ let in stdenv.mkDerivation rec { pname = "go"; - version = "1.20"; + version = "1.20.1"; src = fetchurl { url = "https://go.dev/dl/go${version}.src.tar.gz"; - sha256 = "sha256-Oin/BCG+r2MpKSuKRjEcn78GyAAHfO3e9ft/jVsazjM="; + hash = "sha256-tcGjr1LDhabRx2rtU2HPJkWQI5gNAyDedli645FYMaI="; }; strictDeps = true; @@ -147,12 +147,12 @@ stdenv.mkDerivation rec { ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} - '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' + '' else lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) '' rm -rf bin/*_* ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} - '' else ""); + ''); installPhase = '' runHook preInstall @@ -172,6 +172,7 @@ stdenv.mkDerivation rec { }; meta = with lib; { + changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor version}"; description = "The Go Programming language"; homepage = "https://go.dev/"; license = licenses.bsd3; diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix new file mode 100644 index 0000000000000..a3236c14a084f --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -0,0 +1,175 @@ +{ lib +, stdenv +, alsa-lib +, autoPatchelfHook +, cairo +, cups +, darwin +, fontconfig +, glib +, gtk3 +, makeWrapper +, setJavaClassPath +, unzip +, xorg +, zlib + # extra params +, javaVersion +, meta ? { } +, products ? [ ] +, gtkSupport ? stdenv.isLinux +, ... +} @ args: + +let + extraArgs = builtins.removeAttrs args [ + "lib" + "stdenv" + "alsa-lib" + "autoPatchelfHook" + "cairo" + "cups" + "darwin" + "fontconfig" + "glib" + "gtk3" + "makeWrapper" + "setJavaClassPath" + "unzip" + "xorg" + "zlib" + "javaVersion" + "meta" + "products" + "gtkSupport" + ]; + runtimeLibraryPath = lib.makeLibraryPath + ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); + mapProducts = key: default: (map (p: p.graalvmPhases.${key} or default) products); + concatProducts = key: lib.concatStringsSep "\n" (mapProducts key ""); + + graalvmXXX-ce = stdenv.mkDerivation ({ + pname = "graalvm${javaVersion}-ce"; + + unpackPhase = '' + runHook preUnpack + + mkdir -p "$out" + + # The tarball on Linux has the following directory structure: + # + # graalvm-ce-java11-20.3.0/* + # + # while on Darwin it looks like this: + # + # graalvm-ce-java11-20.3.0/Contents/Home/* + # + # We therefor use --strip-components=1 vs 3 depending on the platform. + tar xf "$src" -C "$out" --strip-components=${ + if stdenv.isLinux then "1" else "3" + } + + # Sanity check + if [ ! -d "$out/bin" ]; then + echo "The `bin` is directory missing after extracting the graalvm" + echo "tarball, please compare the directory structure of the" + echo "tarball with what happens in the unpackPhase (in particular" + echo "with regards to the `--strip-components` flag)." + exit 1 + fi + + runHook postUnpack + ''; + + postUnpack = '' + for product in ${toString products}; do + cp -Rv $product/* $out + done + ''; + + dontStrip = true; + + nativeBuildInputs = [ unzip makeWrapper ] + ++ lib.optional stdenv.isLinux autoPatchelfHook; + + propagatedBuildInputs = [ setJavaClassPath zlib ] + ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation; + + buildInputs = lib.optionals stdenv.isLinux [ + alsa-lib # libasound.so wanted by lib/libjsound.so + fontconfig + stdenv.cc.cc.lib # libstdc++.so.6 + xorg.libX11 + xorg.libXext + xorg.libXi + xorg.libXrender + xorg.libXtst + ]; + + preInstall = concatProducts "preInstall"; + postInstall = '' + # jni.h expects jni_md.h to be in the header search path. + ln -sf $out/include/linux/*_md.h $out/include/ + + # copy-paste openjdk's preFixup + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat > $out/nix-support/setup-hook << EOF + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi + EOF + '' + concatProducts "postInstall"; + + preFixup = lib.optionalString (stdenv.isLinux) '' + for bin in $(find "$out/bin" -executable -type f); do + wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" + done + '' + concatProducts "preFixup"; + postFixup = concatProducts "postFixup"; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + ${# broken in darwin + lib.optionalString stdenv.isLinux '' + echo "Testing Jshell" + echo '1 + 1' | $out/bin/jshell + ''} + + echo ${ + lib.escapeShellArg '' + public class HelloWorld { + public static void main(String[] args) { + System.out.println("Hello World"); + } + } + '' + } > HelloWorld.java + $out/bin/javac HelloWorld.java + + # run on JVM with Graal Compiler + echo "Testing GraalVM" + $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World' + + ${concatProducts "installCheckPhase"} + + runHook postInstallCheck + ''; + + passthru = { + inherit products; + home = graalvmXXX-ce; + updateScript = ./update.sh; + }; + + meta = with lib; ({ + homepage = "https://www.graalvm.org/"; + description = "High-Performance Polyglot VM"; + license = with licenses; [ upl gpl2Classpath bsd3 ]; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + mainProgram = "java"; + maintainers = with maintainers; teams.graalvm-ce.members ++ [ ]; + } // meta); + } // extraArgs); +in +graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix new file mode 100644 index 0000000000000..6037435d3aec4 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -0,0 +1,106 @@ +{ lib +, stdenv +, autoPatchelfHook +, graalvm-ce +, makeWrapper +, perl +, unzip +, zlib + # extra params +, product +, javaVersion +, extraBuildInputs ? [ ] +, extraNativeBuildInputs ? [ ] +, graalvmPhases ? { } +, meta ? { } +, passthru ? { } +, ... +} @ args: + +let + extraArgs = builtins.removeAttrs args [ + "lib" + "stdenv" + "autoPatchelfHook" + "graalvm-ce" + "makeWrapper" + "perl" + "unzip" + "zlib" + "product" + "javaVersion" + "extraBuildInputs" + "extraNativeBuildInputs" + "graalvmPhases" + "meta" + "passthru" + ]; +in +stdenv.mkDerivation ({ + pname = "${product}-java${javaVersion}"; + + nativeBuildInputs = [ perl unzip makeWrapper ] + ++ lib.optional stdenv.isLinux autoPatchelfHook + ++ extraNativeBuildInputs; + + buildInputs = [ + stdenv.cc.cc.lib # libstdc++.so.6 + zlib + ] ++ extraBuildInputs; + + unpackPhase = '' + runHook preUnpack + + unpack_jar() { + local jar="$1" + unzip -q -o "$jar" -d "$out" + perl -ne 'use File::Path qw(make_path); + use File::Basename qw(dirname); + if (/^(.+) = (.+)$/) { + make_path dirname("$ENV{out}/$1"); + symlink $2, "$ENV{out}/$1"; + }' "$out/META-INF/symlinks" + perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) { + my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4 eq 'x' ? 0100 : 0) + + ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7 eq 'x' ? 0010 : 0) + + ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0); + chmod $mode, "$ENV{out}/$1"; + }' "$out/META-INF/permissions" + rm -rf "$out/META-INF" + } + + unpack_jar "$src" + + runHook postUnpack + ''; + + # Allow autoPatchelf to automatically fix lib references between products + fixupPhase = '' + runHook preFixup + + mkdir -p $out/lib + shopt -s globstar + ln -s $out/languages/**/lib/*.so $out/lib + + runHook postFixup + ''; + + dontInstall = true; + dontBuild = true; + dontStrip = true; + + passthru = { + inherit product javaVersion; + # build phases that are going to run during GraalVM derivation build, + # since they depend in having the fully setup GraalVM environment + # e.g.: graalvmPhases.installCheckPhase will run the checks only after + # GraalVM+products is build + # see buildGraalvm.nix file for the available phases + inherit graalvmPhases; + } // passthru; + + meta = with lib; ({ + inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms; + description = "High-Performance Polyglot VM (Product: ${product})"; + } // meta); +} // extraArgs) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 17ecd5060ba29..a0d57b75faa2e 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -1,75 +1,168 @@ -{ callPackage, Foundation }: -/* - Add new graal versions and products here and then see update.nix on how to - generate the sources. -*/ +{ lib +, stdenv +, callPackage +, fetchurl +}: let - mkGraal = opts: callPackage (import ./mkGraal.nix opts) { - inherit Foundation; + buildGraalvm = callPackage ./buildGraalvm.nix; + buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix; + javaPlatform = { + "aarch64-linux" = "linux-aarch64"; + "x86_64-linux" = "linux-amd64"; + "aarch64-darwin" = "darwin-aarch64"; + "x86_64-darwin" = "darwin-amd64"; }; + javaPlatformVersion = javaVersion: + "${javaVersion}-${javaPlatform.${stdenv.system} or (throw "Unsupported platform: ${stdenv.system}")}"; + source = product: javaVersion: (import ./hashes.nix).${product}.${javaPlatformVersion javaVersion} + or (throw "Unsupported product combination: product=${product} java=${javaVersion} system=${stdenv.system}"); - /* - Looks a bit ugly but makes version update in the update script using sed - much easier +in +rec { + inherit buildGraalvm buildGraalvmProduct; - Don't change these values! They will be updated by the update script, see ./update.nix. - */ - graalvm11-ce-release-version = "22.3.0"; - graalvm17-ce-release-version = "22.3.0"; + ### Java 11 ### - products = [ - "graalvm-ce" - "native-image-installable-svm" - ]; + # Mostly available for build purposes, not to be exposed at the top level + graalvm11-ce-bare = buildGraalvm rec { + version = "22.3.1"; + javaVersion = "11"; + src = fetchurl (source "graalvm-ce" javaVersion); + meta.platforms = builtins.attrNames javaPlatform; + products = [ ]; + }; -in -{ - inherit mkGraal; - - graalvm11-ce = mkGraal rec { - config = { - x86_64-darwin = { - inherit products; - arch = "darwin-amd64"; - }; - x86_64-linux = { - inherit products; - arch = "linux-amd64"; - }; - aarch64-darwin = { - inherit products; - arch = "darwin-aarch64"; - }; - aarch64-linux = { - inherit products; - arch = "linux-aarch64"; - }; - }; - defaultVersion = graalvm11-ce-release-version; + graalvm11-ce = graalvm11-ce-bare.override { + products = [ native-image-installable-svm-java11 ]; + }; + + # Mostly available for testing, not to be exposed at the top level + graalvm11-ce-full = graalvm11-ce-bare.override { + products = [ + js-installable-svm-java11 + llvm-installable-svm-java11 + native-image-installable-svm-java11 + nodejs-installable-svm-java11 + python-installable-svm-java11 + ruby-installable-svm-java11 + wasm-installable-svm-java11 + ]; + }; + + js-installable-svm-java11 = callPackage ./js-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "js-installable-svm" javaVersion); + }; + + llvm-installable-svm-java11 = callPackage ./llvm-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "llvm-installable-svm" javaVersion); + }; + + native-image-installable-svm-java11 = callPackage ./native-image-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "native-image-installable-svm" javaVersion); + }; + + nodejs-installable-svm-java11 = callPackage ./nodejs-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "nodejs-installable-svm" javaVersion); + graalvm-ce = graalvm11-ce-bare; + }; + + python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + + ruby-installable-svm-java11 = callPackage ./ruby-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "ruby-installable-svm" javaVersion); + llvm-installable-svm = llvm-installable-svm-java11; + }; + + wasm-installable-svm-java11 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "wasm-installable-svm" javaVersion); + }; + + ### Java 17 ### + + # Mostly available for build purposes, not to be exposed at the top level + graalvm17-ce-bare = buildGraalvm rec { + version = "22.3.1"; + javaVersion = "17"; + src = fetchurl (source "graalvm-ce" javaVersion); + meta.platforms = builtins.attrNames javaPlatform; + products = [ ]; + }; + + graalvm17-ce = graalvm17-ce-bare.override { + products = [ native-image-installable-svm-java17 ]; + }; + + # Mostly available for testing, not to be exposed at the top level + graalvm17-ce-full = graalvm17-ce-bare.override { + products = [ + js-installable-svm-java17 + llvm-installable-svm-java17 + native-image-installable-svm-java17 + nodejs-installable-svm-java17 + python-installable-svm-java17 + ruby-installable-svm-java17 + wasm-installable-svm-java17 + ]; + }; + + js-installable-svm-java17 = callPackage ./js-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "js-installable-svm" javaVersion); + }; + + llvm-installable-svm-java17 = callPackage ./llvm-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "llvm-installable-svm" javaVersion); + }; + + native-image-installable-svm-java17 = callPackage ./native-image-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "native-image-installable-svm" javaVersion); + }; + + nodejs-installable-svm-java17 = callPackage ./nodejs-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "nodejs-installable-svm" javaVersion); + graalvm-ce = graalvm17-ce-bare; + }; + + python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + + ruby-installable-svm-java17 = callPackage ./ruby-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "ruby-installable-svm" javaVersion); + llvm-installable-svm = llvm-installable-svm-java17; }; - graalvm17-ce = mkGraal rec { - config = { - x86_64-darwin = { - inherit products; - arch = "darwin-amd64"; - }; - x86_64-linux = { - inherit products; - arch = "linux-amd64"; - }; - aarch64-darwin = { - inherit products; - arch = "darwin-aarch64"; - }; - aarch64-linux = { - inherit products; - arch = "linux-aarch64"; - }; - }; - defaultVersion = graalvm17-ce-release-version; + wasm-installable-svm-java17 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "wasm-installable-svm" javaVersion); }; } diff --git a/pkgs/development/compilers/graalvm/community-edition/graalvm11-ce-sources.json b/pkgs/development/compilers/graalvm/community-edition/graalvm11-ce-sources.json deleted file mode 100644 index c9145e9654f83..0000000000000 --- a/pkgs/development/compilers/graalvm/community-edition/graalvm11-ce-sources.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "darwin-aarch64": { - "graalvm-ce|java11|22.3.0": { - "sha256": "c9657e902c2ba674931c3cf233a38c4de3d5186ae5d70452f9df75ac0c4cacff", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-darwin-aarch64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java11|22.3.0": { - "sha256": "dd9f91a970c7270b3f7fe8e711ba1ae081d34ed433c75f2bb0459aaf19e0fbe7", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java11-darwin-aarch64-22.3.0.jar" - } - }, - "darwin-amd64": { - "graalvm-ce|java11|22.3.0": { - "sha256": "b8b39d6a3e3a9ed6348c2776ff071fc64ca90f98999ee846e6ca7e5fdc746a8b", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-darwin-amd64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java11|22.3.0": { - "sha256": "00fe13c42813f581955eb35370bb8409ba17c7fdc83971d000baf695be2a0cb5", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java11-darwin-amd64-22.3.0.jar" - } - }, - "linux-aarch64": { - "graalvm-ce|java11|22.3.0": { - "sha256": "c6646149dad486a0b02c5fc10649786240f275efda65aa14a25d01d2f5bafe15", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-linux-aarch64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java11|22.3.0": { - "sha256": "0886e214f03f8a44962ecab459a94afb5c6a0f20910cb128d9ff775f4a9e4162", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java11-linux-aarch64-22.3.0.jar" - } - }, - "linux-amd64": { - "graalvm-ce|java11|22.3.0": { - "sha256": "d4200bcc43e5ad4e6949c1b1edc1e59f63066e3a2280d5bd82d0c9b1d67c3f2c", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java11-linux-amd64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java11|22.3.0": { - "sha256": "17843f92dc9de74b161a63c52cc2a4597e5472cf3f6f6d71930fb655b35f9208", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java11-linux-amd64-22.3.0.jar" - } - } -} diff --git a/pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-sources.json b/pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-sources.json deleted file mode 100644 index dc2da450b6996..0000000000000 --- a/pkgs/development/compilers/graalvm/community-edition/graalvm17-ce-sources.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "darwin-aarch64": { - "graalvm-ce|java17|22.3.0": { - "sha256": "dfc0c8998b8d00fcca87ef1c866c6e4985fd20b0beba3021f9677f9b166dfaf8", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java17-darwin-aarch64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java17|22.3.0": { - "sha256": "b6e44cb03f560bb43db1fd0aa862af36ba1df6717765920d91c18519712adfe9", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java17-darwin-aarch64-22.3.0.jar" - } - }, - "darwin-amd64": { - "graalvm-ce|java17|22.3.0": { - "sha256": "422cd6abecfb8b40238460c09c42c5a018cb92fab4165de9691be2e3c3d0e8d1", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java17-darwin-amd64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java17|22.3.0": { - "sha256": "9ce13874e62877d3bbe3faa4a57fbbffc766fdc8191971e7b25de0226fe86598", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java17-darwin-amd64-22.3.0.jar" - } - }, - "linux-aarch64": { - "graalvm-ce|java17|22.3.0": { - "sha256": "e27249d9eef4504deb005cf14c6a028aad1adfa37209e12e9d7407710c08ed90", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java17-linux-aarch64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java17|22.3.0": { - "sha256": "d5b833c44d37fbe4df75906f73144e2db01e683bca3386fe185f4abbc8fbc798", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java17-linux-aarch64-22.3.0.jar" - } - }, - "linux-amd64": { - "graalvm-ce|java17|22.3.0": { - "sha256": "3473d8b3b1bc682e95adfb3ac1d9a59b51b0f43e2b752f2a5b550e4ebfa2fd17", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/graalvm-ce-java17-linux-amd64-22.3.0.tar.gz" - }, - "native-image-installable-svm|java17|22.3.0": { - "sha256": "d1f5c58b65c57ad8a0c7da0c4569ce815ebf1ae503b0741ba1facf27b816d398", - "url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.0/native-image-installable-svm-java17-linux-amd64-22.3.0.jar" - } - } -} diff --git a/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/pkgs/development/compilers/graalvm/community-edition/hashes.nix new file mode 100644 index 0000000000000..eb2f455abbe59 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/hashes.nix @@ -0,0 +1,267 @@ +# Generated by pkgs/development/compilers/graalvm/community-edition/update.sh script +{ + "llvm-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "0h8xkvsixcwak5dymkj3jgjv11w3ivnd6d45v5pdbymd0m2ifia8"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1zww45z7m3mvzg47fwc3jgqz3hkra220isf4ih8sv6kjg1jc4y14"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "133m9vg9rlp2xkndh3d6b8ybq8vwch99rj1b50xr6bz8r6306ara"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0nz09idp8wawm3yinsplzvxhld8yav06l1nqj02gxrc1kxd5nsr1"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "0ngcm3ara7g1xz4kh515igpyrjhr1k5z9nf4vsaw4lpa5sqljv7z"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "1lr8kk82c3l9hx7wc5hqmpqfgvpk72xg1h07b6cgibry1bm6baj6"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "058pzrd90xx4yi7mm2fvs2npqcdkb2nzhqfwfz5v202038igi61g"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "10rfz8ddq82zpf6cy2y0gx1bx0zhjzm3gwwdb1j7mll0hvwp84sg"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "nodejs-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "0slzvbmxwa4a6m9c0hbdp8ryh9crfq7mv6y2j4hik5m457jq98cp"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1ldivy5hmq2mxmzh40hglzngylahnzyqh9rav73nicl5mz8hk4l2"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "1p1y52b4lky2fbkml5vqy7dn9vqzj19jq5f3c90mgsfk4c7xhi66"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0j1gkpszklzm069bccm6wgq8iq0k41bcrca0kf8pbl2y11hwywpc"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "1fbqc3a7i91as1sbwg2yr1zx0wz4jsaxcz9pfqy8a0z88m8vivbs"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "1swzkp0imcv30fxfwblgad57fvpsvhfpv93s8zj1lwrbarggl2y3"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "0n3hm8dd0ya86hxbxv07sfp22y02vhhzahkxk2j2162n9hcdmkwk"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "0xkjqcch22bm32mczj6xs8rzsl2n6vy9hmzwfy9a71w1kpkbjn3a"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "wasm-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1d67jm41psypkhpy77cb2l00smhni3pgkybwx79z7dzcyid7p2l1"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1cg9zxyjirfl0afr9cppg2h17j8qdidi4llbal2g5w1p2v9zq78b"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "19v7jqhvijmzzb0i9q6hbvrmqnmmzbyvai3il9f357qvv6r6lylb"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0sfnsy0r4qf7ni9mh437dad1d8sidajcra2azsmy5qdmh091zhj5"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "0764d97mla5cii4iyvyb43v62dk8ff3plqjmdc69qqxx8mdzpwqv"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "1ip6ybm7p28bs2lifxqhq6fyvfm3wmacv6dqziyl2v7v7yl0iw4i"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "js-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1b8vnjjsa548c6j3dycxp57i9xmyvndiz2xhv7fm10izcplyspxq"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1kcy3mjk908zs7f3k95awp6294cwr06hand4cbw1lsnfvp0qwhk7"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "0sq80a4nnvik560whgv5vwlsszi8z02idvpd92p0caf03bra9x2b"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0fd160yxsi09m97z7vqh5kwf1g0p0hn4niy48glj9jhirfqzzw0c"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "18g0xixzk45yrxv3zfs7qrdyj0b3ksp59jhbcis0vwy9gx8094wq"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "0cf4iivkniilvbqyniqxcz1qf49cs4lxi0axjsk9sz1zmxcq0bnk"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "0ibcz6ivx068ndf45j9pghm8qwq287glqxf0xx08kjxnhms67p52"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "16q7whnvdrk8lb4fp96qr3p567kggyk9q5iqcn081qk8xjkbx0zv"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "python-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1yl36x5svld7qnm3m6vmacm2n4d6l9vhdxhaypvlv2bbfbnym3c5"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "0ggx5rwz3qnnxgz407r8yx12556pcbirhnc44972l77r320rdmqc"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "11c19a20v3ff83dxzs9hf1z89kh0qich41b03gx8mancf12jfwnl"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0pga44whhvm98d8j2v2bpl9rkbvr9bv947rc4imlbf01cyxjwl71"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "0qnh8i9nazrv25jhn13wp7qqm9wwhcz4kpp2ygvsdmf9s3d2f5lf"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "0j13xvy9d19glipz4wdma2y02g0cnksg1iij4247fjhpqh0axkdz"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "1ny5664h7pibvskmm51mlxrxkbbj2dvxsv2yqbq6v51a57wm1yzn"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "01jjncx8jm1yrps2nj217vgcmjaqclmpb27rdp3qn7k64w5wzipg"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "native-image-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "0z9rbmci6yz7f7mqd3xzsxc5ih4hq72lyzqfchan7fr6mh38d6gw"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "03v20fc9famlnbrznpasnd5gdl5k9nl4dlj3pp6bad4y6l7rqnx5"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "1yb7kpbs7hrzlysvrqjzgfz678p1hbg6237jzb35zmwdaczav51n"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "00fbyqsj4xj9ay8bki1190lf59bgrzvla8lzzq51p53a1bdrhhmv"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "1kaqvkbhj3iifq6asyrpy225a89y7klzbh7an1ycnvc2hvqkv4nz"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "09l7x4x8yanq55v6y6wpfx94mvsq1bpbnihknjc6dnq3vcrci77n"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "036w9dmdcs46kmjqr3086mg389fgr3h1zysavfq8cbh199x0ibia"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "1hvjfvcn878bzvi944v3x23sby72hbfvg5s3zzspyc37l5cdpqi3"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "graalvm-ce" = { + "11-linux-aarch64" = { + sha256 = "1g4a3z9993pq52j3jf25pbcq9rvl8jz1yar8c859jw5chaf3ysml"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-linux-aarch64-22.3.1.tar.gz"; + }; + "17-linux-aarch64" = { + sha256 = "06288dwbql943nii74i9mngzb38h2nzrxzzgs346mgk2965gwm59"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-linux-aarch64-22.3.1.tar.gz"; + }; + "11-linux-amd64" = { + sha256 = "1f6xkdnxn6xsm24sqw24rsca72wm7v6q96m23l5fng5ym0jpfm2m"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-linux-amd64-22.3.1.tar.gz"; + }; + "17-linux-amd64" = { + sha256 = "0aci9i28rq5nk2qya9dcg5hxr3sgsbv7f5x8679hrjrqmrclmkrs"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-linux-amd64-22.3.1.tar.gz"; + }; + "11-darwin-aarch64" = { + sha256 = "0cbcm9d211m4b6g1bkpfksma917lzqkl4kx38vm1nrwjkll357y5"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-darwin-aarch64-22.3.1.tar.gz"; + }; + "17-darwin-aarch64" = { + sha256 = "1qbw3hlmqcrmd70xk56463scdxr50n66z2n3c24h68qlwwlpqc73"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-darwin-aarch64-22.3.1.tar.gz"; + }; + "11-darwin-amd64" = { + sha256 = "0a12rzf99x5l29f6bwm6myk18dgnrx2c9rwmii2pm864y7azlnij"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-darwin-amd64-22.3.1.tar.gz"; + }; + "17-darwin-amd64" = { + sha256 = "02lclv2j3v850izh84wdvksi3d3xmgpfl7x85vzifhgsvagm6sz4"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-darwin-amd64-22.3.1.tar.gz"; + }; + }; + "ruby-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "10wm1sq7smywy63mzlsbn21kzd65yaqj8yismpq8bz19h9skas7w"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "0kh1w49yp3kpfvhqw19bbx51ay1wgzq80gsrfqax4zm5ixz4wsbz"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "0avsawgfkqbgqc2hm8zmz37qg9ag3ddni3my8g73kvzfkghsdabh"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "1ib00pqdhzl24y97j16mm86qwrijqjnmhjmk3g5vdhyhh099vjp1"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "1im75qad89xa2nbl80csnwn56k6n11zv5g91xlkqq4xk300v1saj"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "1pfzsisf4sgzxmk3r1p4apzqkwipjpf8naly3v94i5v3b5gbnczx"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "1jfls71y92hw09s869v2qw8pypgl1fciqz3m9zcd2602hikysq6c"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "03x2h4sw72l05xxg73xj9mzzkxffbjpv8hdi59rgxxljnz0ai6rx"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix new file mode 100644 index 0000000000000..45cf50e90feef --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix @@ -0,0 +1,17 @@ +{ lib +, stdenv +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "js-installable-svm"; + + graalvmPhases.installCheckPhase = '' + echo "Testing GraalJS" + echo '1 + 1' | $out/bin/js + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix new file mode 100644 index 0000000000000..9fc8fb3db95ed --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix @@ -0,0 +1,18 @@ +{ lib +, stdenv +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "llvm-installable-svm"; + + # TODO: improve this test + graalvmPhases.installCheckPhase = '' + echo "Testing llvm" + $out/bin/lli --help + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix deleted file mode 100644 index 023fc81474ef6..0000000000000 --- a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix +++ /dev/null @@ -1,346 +0,0 @@ -{ - # An attrset describing each platform configuration. All values are extract - # from the GraalVM releases available on - # https://github.com/graalvm/graalvm-ce-builds/releases - # Example: - # config = { - # x86_64-linux = { - # # List of products that will be included in the GraalVM derivation - # # See `with{NativeImage,Ruby,Python,WASM,*}Svm` variables for the - # # available values - # products = [ "graalvm-ce" "native-image-installable-svm" ]; - # # GraalVM arch, not to be confused with the nix platform - # arch = "linux-amd64"; - # # GraalVM version - # version = "22.0.0.2"; - # }; - # } - config - # GraalVM version that will be used unless overridden by `config.<platform>.version` -, defaultVersion - # Java version used by GraalVM -, javaVersion - # Platforms were GraalVM will be allowed to build (i.e. `meta.platforms`) -, platforms ? builtins.attrNames config - # If set to true, update script will (re-)generate the sources file even if - # there are no updates available -, forceUpdate ? false - # Path for the sources file that will be used - # See `update.nix` file for a description on how this file works -, sourcesPath ? ./. + "/graalvm${javaVersion}-ce-sources.json" -}: - -{ stdenv -, lib -, autoPatchelfHook -, fetchurl -, makeWrapper -, setJavaClassPath -, writeShellScriptBin - # minimum dependencies -, alsa-lib -, fontconfig -, Foundation -, freetype -, glibc -, openssl -, perl -, unzip -, xorg -, zlib - # runtime dependencies -, binutils -, cups -, gcc -, musl - # runtime dependencies for GTK+ Look and Feel -, gtkSupport ? stdenv.isLinux -, cairo -, glib - # updateScript deps -, gnused -, gtk3 -, jq -, writeShellScript - # Use musl instead of glibc to allow true static builds in GraalVM's - # Native Image (i.e.: `--static --libc=musl`). This will cause glibc static - # builds to fail, so it should be used with care -, useMusl ? false - # Extra libraries to be included in native-image using '-H:CLibraryPath' flag -, extraCLibs ? [ ] -}: - -assert useMusl -> stdenv.isLinux; - -let - platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - version = platform.version or defaultVersion; - name = "graalvm${javaVersion}-ce"; - sources = builtins.fromJSON (builtins.readFile sourcesPath); - - cLibs = [ glibc zlib.static ] - ++ lib.optionals (!useMusl) [ glibc.static ] - ++ lib.optionals useMusl [ musl ] - ++ extraCLibs; - - runtimeLibraryPath = lib.makeLibraryPath - ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); - - runtimeDependencies = lib.makeBinPath ([ - binutils - stdenv.cc - ] ++ lib.optionals useMusl [ - (lib.getDev musl) - # GraalVM 21.3.0+ expects musl-gcc as <system>-musl-gcc - (writeShellScriptBin "${stdenv.hostPlatform.system}-musl-gcc" ''${lib.getDev musl}/bin/musl-gcc "$@"'') - ]); - - withNativeImageSvm = builtins.elem "native-image-installable-svm" platform.products; - withRubySvm = builtins.elem "ruby-installable-svm" platform.products; - withPythonSvm = builtins.elem "python-installable-svm" platform.products; - withWasmSvm = builtins.elem "wasm-installable-svm" platform.products; - - graalvmXXX-ce = stdenv.mkDerivation rec { - inherit version; - pname = name; - - srcs = map fetchurl (builtins.attrValues sources.${platform.arch}); - - buildInputs = lib.optionals stdenv.isLinux [ - alsa-lib # libasound.so wanted by lib/libjsound.so - fontconfig - freetype - stdenv.cc.cc.lib # libstdc++.so.6 - xorg.libX11 - xorg.libXext - xorg.libXi - xorg.libXrender - xorg.libXtst - zlib - ] ++ lib.optionals withRubySvm [ - openssl # libssl.so wanted by languages/ruby/lib/mri/openssl.so - ]; - - nativeBuildInputs = [ unzip perl makeWrapper ] - ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; - - unpackPhase = '' - runHook preUnpack - - unpack_jar() { - jar=$1 - unzip -q -o $jar -d $out - perl -ne 'use File::Path qw(make_path); - use File::Basename qw(dirname); - if (/^(.+) = (.+)$/) { - make_path dirname("$ENV{out}/$1"); - system "ln -s $2 $ENV{out}/$1"; - }' $out/META-INF/symlinks - perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) { - my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4 eq 'x' ? 0100 : 0) + - ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7 eq 'x' ? 0010 : 0) + - ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0); - chmod $mode, "$ENV{out}/$1"; - }' $out/META-INF/permissions - rm -rf $out/META-INF - } - - mkdir -p $out - arr=($srcs) - - # The tarball on Linux has the following directory structure: - # - # graalvm-ce-java11-20.3.0/* - # - # while on Darwin it looks like this: - # - # graalvm-ce-java11-20.3.0/Contents/Home/* - # - # We therefor use --strip-components=1 vs 3 depending on the platform. - tar xf ''${arr[0]} -C $out --strip-components=${ - if stdenv.isLinux then "1" else "3" - } - - # Sanity check - if [ ! -d $out/bin ]; then - echo "The `bin` is directory missing after extracting the graalvm" - echo "tarball, please compare the directory structure of the" - echo "tarball with what happens in the unpackPhase (in particular" - echo "with regards to the `--strip-components` flag)." - exit 1 - fi - - for jar in "''${arr[@]:1}"; do - unpack_jar "$jar" - done - - runHook postUnpack - ''; - - installPhase = '' - runHook preInstall - - # jni.h expects jni_md.h to be in the header search path. - ln -s $out/include/linux/*_md.h $out/include/ - - # copy-paste openjdk's preFixup - # Set JAVA_HOME automatically. - mkdir -p $out/nix-support - cat > $out/nix-support/setup-hook << EOF - if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi - EOF - ${ - # Wrap native-image binary to pass -H:CLibraryPath flag and find glibc - lib.optionalString (withNativeImageSvm && stdenv.isLinux) '' - wrapProgram $out/bin/native-image \ - ${lib.concatStringsSep " " - (map (l: "--add-flags '-H:CLibraryPath=${l}/lib'") cLibs)} - '' - } - - runHook postInstall - ''; - - dontStrip = true; - - # Workaround for libssl.so.10 wanted by TruffleRuby - # Resulting TruffleRuby cannot use `openssl` library. - autoPatchelfIgnoreMissingDeps = withRubySvm && stdenv.isDarwin; - - preFixup = lib.optionalString (stdenv.isLinux) '' - # Find all executables in any directory that contains '/bin/' - for bin in $(find "$out" -executable -type f -wholename '*/bin/*'); do - wrapProgram "$bin" \ - --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" \ - --prefix PATH : "${runtimeDependencies}" - done - - find "$out" -name libfontmanager.so -exec \ - patchelf --add-needed libfontconfig.so {} \; - - ${ - lib.optionalString withRubySvm '' - # Workaround for libssl.so.10/libcrypto.so.10 wanted by TruffleRuby - patchelf $out/languages/ruby/lib/mri/openssl.so \ - --replace-needed libssl.so.10 libssl.so \ - --replace-needed libcrypto.so.10 libcrypto.so - '' - } - ''; - - # $out/bin/native-image needs zlib to build native executables. - propagatedBuildInputs = [ setJavaClassPath zlib ] ++ - # On Darwin native-image calls clang and it - # tries to include <Foundation/Foundation.h>, - # and Interactive Ruby (irb) requires OpenSSL - # headers. - lib.optionals stdenv.hostPlatform.isDarwin [ Foundation openssl ]; - - doInstallCheck = true; - installCheckPhase = '' - runHook preInstallCheck - - echo ${ - lib.escapeShellArg '' - public class HelloWorld { - public static void main(String[] args) { - System.out.println("Hello World"); - } - } - '' - } > HelloWorld.java - $out/bin/javac HelloWorld.java - - # run on JVM with Graal Compiler - echo "Testing GraalVM" - $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World' - - ${ - lib.optionalString withNativeImageSvm '' - echo "Ahead-Of-Time compilation" - $out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld - ./helloworld | fgrep 'Hello World' - '' - } - - ${# --static flag doesn't work for darwin - lib.optionalString (withNativeImageSvm && stdenv.isLinux && !useMusl) '' - echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC" - $out/bin/native-image -H:+StaticExecutableWithDynamicLibC HelloWorld - ./helloworld | fgrep 'Hello World' - - echo "Ahead-Of-Time compilation with --static" - $out/bin/native-image --static HelloWorld - ./helloworld | fgrep 'Hello World' - '' - } - - ${# --static flag doesn't work for darwin - lib.optionalString (withNativeImageSvm && stdenv.isLinux && useMusl) '' - echo "Ahead-Of-Time compilation with --static and --libc=musl" - $out/bin/native-image --libc=musl --static HelloWorld - ./helloworld | fgrep 'Hello World' - '' - } - - ${ - lib.optionalString withWasmSvm '' - echo "Testing Jshell" - echo '1 + 1' | $out/bin/jshell - '' - } - - ${ - lib.optionalString withPythonSvm '' - echo "Testing GraalPython" - $out/bin/graalpython -c 'print(1 + 1)' - echo '1 + 1' | $out/bin/graalpython - '' - } - - ${ - lib.optionalString withRubySvm '' - echo "Testing TruffleRuby" - # Hide warnings about wrong locale - export LANG=C - export LC_ALL=C - $out/bin/ruby -e 'puts(1 + 1)' - '' - # FIXME: irb is broken in all platforms - + lib.optionalString false '' - echo '1 + 1' | $out/bin/irb - '' - } - - runHook postInstallCheck - ''; - - passthru = { - inherit (platform) products; - home = graalvmXXX-ce; - updateScript = import ./update.nix { - inherit config defaultVersion forceUpdate gnused jq lib name sourcesPath writeShellScript; - graalVersion = version; - javaVersion = "java${javaVersion}"; - }; - }; - - meta = with lib; { - inherit platforms; - homepage = "https://www.graalvm.org/"; - description = "High-Performance Polyglot VM"; - license = with licenses; [ upl gpl2Classpath bsd3 ]; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - mainProgram = "java"; - maintainers = with maintainers; [ - bandresen - hlolli - glittershark - babariviere - ericdallo - thiagokokada - ]; - }; - }; -in -graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix new file mode 100644 index 0000000000000..427c5ffef5b5e --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix @@ -0,0 +1,60 @@ +{ lib +, stdenv +, graalvmCEPackages +, gcc +, glibc +, javaVersion +, musl +, src +, version +, writeShellScriptBin +, zlib +, useMusl ? false +, extraCLibs ? [ ] +}: + +assert useMusl -> stdenv.isLinux; +let + cLibs = [ glibc zlib.static ] + ++ lib.optionals (!useMusl) [ glibc.static ] + ++ lib.optionals useMusl [ musl ] + ++ extraCLibs; + # GraalVM 21.3.0+ expects musl-gcc as <system>-musl-gcc + musl-gcc = (writeShellScriptBin "${stdenv.hostPlatform.system}-musl-gcc" ''${lib.getDev musl}/bin/musl-gcc "$@"''); + binPath = lib.makeBinPath ([ gcc ] ++ lib.optionals useMusl [ musl-gcc ]); +in +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "native-image-installable-svm"; + + graalvmPhases.postInstall = lib.optionalString stdenv.isLinux '' + wrapProgram $out/bin/native-image \ + --prefix PATH : ${binPath} \ + ${lib.concatStringsSep " " + (map (l: "--add-flags '-H:CLibraryPath=${l}/lib'") cLibs)} + ''; + + graalvmPhases.installCheckPhase = '' + echo "Ahead-Of-Time compilation" + $out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld + ./helloworld | fgrep 'Hello World' + + ${# --static is only available in Linux + lib.optionalString (stdenv.isLinux && !useMusl) '' + echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC" + $out/bin/native-image -H:+StaticExecutableWithDynamicLibC HelloWorld + ./helloworld | fgrep 'Hello World' + + echo "Ahead-Of-Time compilation with --static" + $out/bin/native-image --static HelloWorld + ./helloworld | fgrep 'Hello World' + ''} + + ${# --static is only available in Linux + lib.optionalString (stdenv.isLinux && useMusl) '' + echo "Ahead-Of-Time compilation with --static and --libc=musl" + $out/bin/native-image --static HelloWorld --libc=musl + ./helloworld | fgrep 'Hello World' + ''} + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/nodejs-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/nodejs-installable-svm.nix new file mode 100644 index 0000000000000..022ac0a44fe18 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/nodejs-installable-svm.nix @@ -0,0 +1,21 @@ +{ lib +, stdenv +, graalvmCEPackages +, graalvm-ce +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "nodejs-installable-svm"; + + extraNativeBuildInputs = [ graalvm-ce ]; + + # TODO: improve test + graalvmPhases.installCheckPhase = '' + echo "Testing NodeJS" + $out/bin/npx --help + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix new file mode 100644 index 0000000000000..43d6e85ef5603 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix @@ -0,0 +1,18 @@ +{ lib +, stdenv +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "python-installable-svm"; + + graalvmPhases.installCheckPhase = '' + echo "Testing GraalPython" + $out/bin/graalpy -c 'print(1 + 1)' + echo '1 + 1' | $out/bin/graalpy + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix new file mode 100644 index 0000000000000..30d0739b4b1d7 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -0,0 +1,37 @@ +{ lib +, stdenv +, graalvmCEPackages +, llvm-installable-svm +, openssl +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "ruby-installable-svm"; + + extraBuildInputs = [ + llvm-installable-svm + openssl + ]; + + preFixup = lib.optionalString stdenv.isLinux '' + patchelf $out/languages/ruby/lib/mri/openssl.so \ + --replace-needed libssl.so.10 libssl.so \ + --replace-needed libcrypto.so.10 libcrypto.so + ''; + + graalvmPhases.installCheckPhase = '' + echo "Testing TruffleRuby" + # Fixup/silence warnings about wrong locale + export LANG=C + export LC_ALL=C + $out/bin/ruby -e 'puts(1 + 1)' + ${# broken in darwin with sandbox enabled + lib.optionalString stdenv.isLinux '' + echo '1 + 1' | $out/bin/irb + ''} + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/update.nix b/pkgs/development/compilers/graalvm/community-edition/update.nix deleted file mode 100644 index 8bb31c792ddae..0000000000000 --- a/pkgs/development/compilers/graalvm/community-edition/update.nix +++ /dev/null @@ -1,227 +0,0 @@ -{ config -, defaultVersion -, forceUpdate -, gnused -, graalVersion -, javaVersion -, jq -, lib -, name -, sourcesPath -, writeShellScript -}: - -/* - How to use: - run `nix-shell maintainers/scripts/update.nix --argstr package graalvmXX-ce` - to update the graalvmXX-ce-sources.json file. - E.g: nix-shell maintainers/scripts/update.nix --argstr package graalvm17-ce - - Basic idea: - If we know the platform, product, javaVersion and graalVersion - we can create the url. This leads to the following json structure: - { - "platform/arch1": { - "product1|javaVersion|graalVersion": { "sha256": "...", "url": "..."}, - "product2|javaVersion|graalVersion": { "sha256": "...", "url": "..."}, - ... - }, - "platform/arch2": { - ... - } - } -*/ - -let - separator = "|"; - - # isDev :: String -> Boolean - isDev = version: - lib.hasInfix "dev" version; - - # getLatestVersion :: String -> String - getLatestVersion = currentVersion: - let - dev = if isDev currentVersion then "dev-" else ""; - url = "https://api.github.com/repos/graalvm/graalvm-ce-${dev}builds/releases/latest"; - file = builtins.fetchurl url; - json = builtins.fromJSON (builtins.readFile file); - in - lib.removePrefix "vm-" json.tag_name; - - # getArchString :: String -> String - getArchString = nixArchString: - { - "aarch64-linux" = "linux-aarch64"; - "aarch64-darwin" = "darwin-aarch64"; - "x86_64-linux" = "linux-amd64"; - "x86_64-darwin" = "darwin-amd64"; - }.${nixArchString}; - - - # getProductSuffix :: String -> String - getProductSuffix = productName: - { - "graalvm-ce" = ".tar.gz"; - "native-image-installable-svm" = ".jar"; - "ruby-installable-svm" = ".jar"; - "wasm-installable-svm" = ".jar"; - "python-installable-svm" = ".jar"; - "js-installable-svm" = ".jar"; - }.${productName}; - - # getProductSuffix :: String -> String - getProductBaseUrl = productName: - { - "graalvm-ce" = "https://github.com/graalvm/graalvm-ce-builds/releases/download"; - "native-image-installable-svm" = "https://github.com/graalvm/graalvm-ce-builds/releases/download"; - "ruby-installable-svm" = "https://github.com/oracle/truffleruby/releases/download"; - "wasm-installable-svm" = "https://github.com/graalvm/graalvm-ce-builds/releases/download"; - "python-installable-svm" = "https://github.com/graalvm/graalpython/releases/download"; - "js-installable-svm" = "https://github.com/oracle/graaljs/releases/download"; - }.${productName}; - - # getDevUrl :: String - getDevUrl = { arch, graalVersion, product, javaVersion }: - let - baseUrl = https://github.com/graalvm/graalvm-ce-dev-builds/releases/download; - in - "${baseUrl}/${graalVersion}/${product}-${javaVersion}-${arch}-dev${getProductSuffix product}"; - - # getReleaseUrl :: AttrSet -> String - getReleaseUrl = { arch, graalVersion, product, javaVersion }: - let baseUrl = getProductBaseUrl product; - in - "${baseUrl}/vm-${graalVersion}/${product}-${javaVersion}-${arch}-${graalVersion}${getProductSuffix product}"; - - # getUrl :: AttrSet -> String - getUrl = args@{ arch, graalVersion, product, javaVersion }: - if isDev graalVersion - then getDevUrl args - else getReleaseUrl args; - - # computeSha256 :: String -> String - computeSha256 = url: - builtins.hashFile "sha256" (builtins.fetchurl url); - - # downloadSha256 :: String -> String - downloadSha256 = url: - let sha256Url = url + ".sha256"; - in - builtins.readFile (builtins.fetchurl sha256Url); - - # getSha256 :: String -> String -> String - getSha256 = graalVersion: url: - if isDev graalVersion - then computeSha256 url - else downloadSha256 url; - - # cartesianZipListsWith :: (a -> b -> c) -> [a] -> [b] -> [c] - cartesianZipListsWith = f: fst: snd: - let - cartesianProduct = lib.cartesianProductOfSets { a = fst; b = snd; }; - fst' = builtins.catAttrs "a" cartesianProduct; - snd' = builtins.catAttrs "b" cartesianProduct; - in - lib.zipListsWith f fst' snd'; - - # zipListsToAttrs :: [a] -> [b] -> AttrSet - zipListsToAttrs = names: values: - lib.listToAttrs ( - lib.zipListsWith (name: value: { inherit name value; }) names values - ); - - # genProductJavaVersionGraalVersionAttrSet :: String -> AttrSet - genProductJavaVersionGraalVersionAttrSet = product_javaVersion_graalVersion: - let - attrNames = [ "product" "javaVersion" "graalVersion" ]; - attrValues = lib.splitString separator product_javaVersion_graalVersion; - in - zipListsToAttrs attrNames attrValues; - - # genUrlAndSha256 :: String -> String -> AttrSet - genUrlAndSha256 = arch: product_javaVersion_graalVersion: - let - productJavaVersionGraalVersion = - (genProductJavaVersionGraalVersionAttrSet product_javaVersion_graalVersion) - // { inherit arch; }; - url = getUrl productJavaVersionGraalVersion; - sha256 = getSha256 productJavaVersionGraalVersion.graalVersion url; - in - { - ${arch} = { - ${product_javaVersion_graalVersion} = { - inherit sha256 url; - }; - }; - }; - - # genArchProductVersionPairs :: String -> -> String -> AttrSet -> [AttrSet] - genArchProductVersionList = javaVersion: graalVersion: archProducts: - let - arch = archProducts.arch; - products = archProducts.products; - javaGraalVersion = javaVersion + separator + (getLatestVersion (archProducts.version or graalVersion)); - productJavaGraalVersionList = - cartesianZipListsWith (a: b: a + separator + b) - products [ javaGraalVersion ]; - in - cartesianZipListsWith (genUrlAndSha256) [ arch ] productJavaGraalVersionList; - - - # genSources :: String -> String -> AttrSet -> Path String - genSources = javaVersion: defaultVersion: config: - let - archProducts = builtins.attrValues config; - sourcesList = builtins.concatMap (genArchProductVersionList javaVersion defaultVersion) archProducts; - sourcesAttr = builtins.foldl' (lib.recursiveUpdate) { } sourcesList; - in - builtins.toFile "sources.json" (builtins.toJSON sourcesAttr); - - # isNew :: String -> String -> Boolean - isNew = newVersion: currentVersion: - { - "-1" = false; - "0" = false; - "1" = true; - }.${builtins.toString (builtins.compareVersions newVersion currentVersion)}; - - newVersion = getLatestVersion graalVersion; - sourcesJson = genSources javaVersion defaultVersion config; - sourcesJsonPath = lib.strings.escapeShellArg sourcesPath; - - # versionKeyInDefaultNix String -> String - versionKeyInDefaultNix = graalVersion: - if isDev graalVersion - then "${name}-dev-version" - else "${name}-release-version"; - - /* - updateScriptText :: String -> String -> String - Writes the json file and updates the version in default.nix using sed - because update-source-version does not work srcs. - */ - updateScriptText = newVersion: currentVersion: - - if (forceUpdate || (isNew newVersion currentVersion)) - then - let - versionKey = versionKeyInDefaultNix currentVersion; - in - '' - echo "New version found. Updating ${currentVersion} -> ${newVersion}". - export PATH="${lib.makeBinPath [ jq gnused ]}:$PATH" - jq . ${sourcesJson} > ${sourcesJsonPath} - sed -i 's|${versionKey} = "${currentVersion}";|${versionKey} = "${newVersion}";|' \ - ${lib.strings.escapeShellArg ./default.nix} - '' - else ''echo "No new version found. Skip updating."''; - -in -writeShellScript "update-graal.sh" '' - set -o errexit - set -o nounset - set -o pipefail - - ${updateScriptText newVersion graalVersion} -'' diff --git a/pkgs/development/compilers/graalvm/community-edition/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh new file mode 100755 index 0000000000000..6cafb0f0d1186 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p coreutils curl.out nix jq gnused -i bash + +set -eou pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")" +tmpfile="$(mktemp --suffix=.nix)" + +trap 'rm -rf "$tmpfile"' EXIT + +info() { echo "[INFO] $*"; } + +echo_file() { echo "$@" >> "$tmpfile"; } + +verlte() { + [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] +} + +readonly hashes_nix="hashes.nix" +readonly nixpkgs=../../../../.. + +readonly current_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm-ce.version --json | jq -r)" + +if [[ -z "${1:-}" ]]; then + readonly gh_version="$(curl \ + ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \ + -s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | \ + jq --raw-output .tag_name)" + readonly new_version="${gh_version//vm-/}" +else + readonly new_version="$1" +fi + +info "Current version: $current_version" +info "New version: $new_version" +if verlte "$new_version" "$current_version"; then + info "graalvm-ce $current_version is up-to-date." + [[ -z "${FORCE:-}" ]] && exit 0 +else + info "graalvm-ce $current_version is out-of-date. Updating..." +fi + +declare -r -A products_urls=( + [graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz" + [js-installable-svm]="https://github.com/graalvm/graaljs/releases/download/vm-${new_version}/js-installable-svm-java@platform@-${new_version}.jar" + [llvm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/llvm-installable-svm-java@platform@-${new_version}.jar" + [native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar" + [nodejs-installable-svm]="https://github.com/graalvm/graaljs/releases/download/vm-${new_version}/nodejs-installable-svm-java@platform@-${new_version}.jar" + [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" + [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar" + [wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar" +) + +readonly platforms=( + "11-linux-aarch64" + "17-linux-aarch64" + "11-linux-amd64" + "17-linux-amd64" + "11-darwin-aarch64" + "17-darwin-aarch64" + "11-darwin-amd64" + "17-darwin-amd64" +) + +info "Generating '$hashes_nix' file for 'graalvm-ce' $new_version. This will take a while..." + +# Indentation of `echo_file` function is on purpose to make it easier to visualize the output +echo_file "# Generated by $0 script" +echo_file "{" +for product in "${!products_urls[@]}"; do + url="${products_urls["${product}"]}" +echo_file " \"$product\" = {" + for platform in "${platforms[@]}"; do + args=("${url//@platform@/$platform}") + # Get current hashes to skip derivations already in /nix/store to reuse cache when the version is the same + # e.g.: when adding a new product and running this script with FORCE=1 + if [[ "$current_version" == "$new_version" ]] && \ + previous_hash="$(nix-instantiate --eval "$hashes_nix" -A "$product.$platform.sha256" --json | jq -r)"; then + args+=("$previous_hash" "--type" "sha256") + else + info "Hash in '$product' for '$platform' not found. Re-downloading it..." + fi + if hash="$(nix-prefetch-url "${args[@]}")"; then +echo_file " \"$platform\" = {" +echo_file " sha256 = \"$hash\";" +echo_file " url = \"${url//@platform@/${platform}}\";" +echo_file " };" + else + info "Error while downloading '$product' for '$platform'. Skipping it..." + fi + done +echo_file " };" +done +echo_file "}" + +info "Updating graalvm-ce version..." +# update-source-version does not work here since it expects src attribute +sed "s|$current_version|$new_version|" -i default.nix + +info "Moving the temporary file to hashes.nix" +mv "$tmpfile" "$hashes_nix" + +info "Done!" diff --git a/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix new file mode 100644 index 0000000000000..9a5bef7c1e35c --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix @@ -0,0 +1,22 @@ +{ lib +, stdenv +, graalvm-ce +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "wasm-installable-svm"; + + # TODO: improve this test + graalvmPhases.installCheckPhase = '' + echo "Testing wasm" + $out/bin/wasm --help + ''; + + # Not supported in aarch64-darwin yet as GraalVM 22.3.1 release + meta.platforms = builtins.filter (p: p != "aarch64-darwin") graalvm-ce.meta.platforms; +} diff --git a/pkgs/development/compilers/jetbrains-jdk/default.nix b/pkgs/development/compilers/jetbrains-jdk/default.nix index 5702ba2a2e6cd..143feeb98e16f 100644 --- a/pkgs/development/compilers/jetbrains-jdk/default.nix +++ b/pkgs/development/compilers/jetbrains-jdk/default.nix @@ -79,8 +79,8 @@ openjdk17.overrideAttrs (oldAttrs: rec { installPhase = let buildType = if debugBuild then "fastdebug" else "release"; - debugSuffix = if debugBuild then "-fastdebug" else ""; - jcefSuffix = if debugBuild then "" else "_jcef"; + debugSuffix = lib.optionalString debugBuild "-fastdebug"; + jcefSuffix = lib.optionalString (!debugBuild) "_jcef"; in '' runHook preInstall diff --git a/pkgs/development/compilers/llvm/10/bintools/default.nix b/pkgs/development/compilers/llvm/10/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/10/bintools/default.nix +++ b/pkgs/development/compilers/llvm/10/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/10/llvm/default.nix b/pkgs/development/compilers/llvm/10/llvm/default.nix index 95eba5d7fb36e..41c20ac47ebfd 100644 --- a/pkgs/development/compilers/llvm/10/llvm/default.nix +++ b/pkgs/development/compilers/llvm/10/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -191,7 +192,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/11/bintools/default.nix b/pkgs/development/compilers/llvm/11/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/11/bintools/default.nix +++ b/pkgs/development/compilers/llvm/11/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/11/llvm/default.nix b/pkgs/development/compilers/llvm/11/llvm/default.nix index 2123efdf23519..93cf2757c6522 100644 --- a/pkgs/development/compilers/llvm/11/llvm/default.nix +++ b/pkgs/development/compilers/llvm/11/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -203,7 +204,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/12/bintools/default.nix b/pkgs/development/compilers/llvm/12/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/12/bintools/default.nix +++ b/pkgs/development/compilers/llvm/12/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/12/llvm/default.nix b/pkgs/development/compilers/llvm/12/llvm/default.nix index b04eeb3c72693..3d5592e19ee59 100644 --- a/pkgs/development/compilers/llvm/12/llvm/default.nix +++ b/pkgs/development/compilers/llvm/12/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -191,7 +192,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index b6ee7b4dc25cf..b69f4bd129175 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/13/llvm/default.nix b/pkgs/development/compilers/llvm/13/llvm/default.nix index 32e96212fa575..e2d6da816f32c 100644 --- a/pkgs/development/compilers/llvm/13/llvm/default.nix +++ b/pkgs/development/compilers/llvm/13/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -153,7 +154,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index b6ee7b4dc25cf..b69f4bd129175 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/14/llvm/default.nix b/pkgs/development/compilers/llvm/14/llvm/default.nix index 5437735f78fed..d8010ecf893d2 100644 --- a/pkgs/development/compilers/llvm/14/llvm/default.nix +++ b/pkgs/development/compilers/llvm/14/llvm/default.nix @@ -6,6 +6,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -165,7 +166,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/15/bintools/default.nix b/pkgs/development/compilers/llvm/15/bintools/default.nix index 303faf7bbb61b..c7b20dd28e234 100644 --- a/pkgs/development/compilers/llvm/15/bintools/default.nix +++ b/pkgs/development/compilers/llvm/15/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/15/llvm/default.nix b/pkgs/development/compilers/llvm/15/llvm/default.nix index e0b79a9acfefc..de98c43615314 100644 --- a/pkgs/development/compilers/llvm/15/llvm/default.nix +++ b/pkgs/development/compilers/llvm/15/llvm/default.nix @@ -9,6 +9,7 @@ , python3 , python3Packages , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -327,7 +328,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/5/llvm/default.nix b/pkgs/development/compilers/llvm/5/llvm/default.nix index a4d04f0618c7e..31b88098c83a8 100644 --- a/pkgs/development/compilers/llvm/5/llvm/default.nix +++ b/pkgs/development/compilers/llvm/5/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libxml2 , ncurses @@ -168,10 +169,9 @@ stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] - ++ lib.optional (!isDarwin) + ] ++ lib.optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" - ++ lib.optionals (isDarwin) [ + ] ++ lib.optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ diff --git a/pkgs/development/compilers/llvm/6/llvm/default.nix b/pkgs/development/compilers/llvm/6/llvm/default.nix index d18bf2149e1d7..954887cd23680 100644 --- a/pkgs/development/compilers/llvm/6/llvm/default.nix +++ b/pkgs/development/compilers/llvm/6/llvm/default.nix @@ -4,6 +4,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libxml2 , ncurses @@ -162,7 +163,7 @@ stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/7/bintools/default.nix b/pkgs/development/compilers/llvm/7/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/7/bintools/default.nix +++ b/pkgs/development/compilers/llvm/7/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/7/llvm/default.nix b/pkgs/development/compilers/llvm/7/llvm/default.nix index da72bb8b35ae3..eaeef3c2ef505 100644 --- a/pkgs/development/compilers/llvm/7/llvm/default.nix +++ b/pkgs/development/compilers/llvm/7/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -180,7 +181,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/8/bintools/default.nix b/pkgs/development/compilers/llvm/8/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/8/bintools/default.nix +++ b/pkgs/development/compilers/llvm/8/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/8/llvm/default.nix b/pkgs/development/compilers/llvm/8/llvm/default.nix index 5c381a896e152..aa76fc0c3cf7e 100644 --- a/pkgs/development/compilers/llvm/8/llvm/default.nix +++ b/pkgs/development/compilers/llvm/8/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -173,7 +174,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/9/bintools/default.nix b/pkgs/development/compilers/llvm/9/bintools/default.nix index 1eb7215c00856..38002439c205d 100644 --- a/pkgs/development/compilers/llvm/9/bintools/default.nix +++ b/pkgs/development/compilers/llvm/9/bintools/default.nix @@ -1,10 +1,7 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ lib, runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/9/llvm/default.nix b/pkgs/development/compilers/llvm/9/llvm/default.nix index f8b6a8170f85a..89bc014f5c65a 100644 --- a/pkgs/development/compilers/llvm/9/llvm/default.nix +++ b/pkgs/development/compilers/llvm/9/llvm/default.nix @@ -5,6 +5,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? libbfd.hasPluginAPI , libbfd , libpfm , libxml2 @@ -188,7 +189,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index 303faf7bbb61b..3162b0d41e02c 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -1,10 +1,7 @@ { runCommand, stdenv, llvm, lld, version }: let - prefix = - if stdenv.hostPlatform != stdenv.targetPlatform - then "${stdenv.targetPlatform.config}-" - else ""; + prefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru = { diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix index b4e2757f20ca1..9a0d375df9c37 100644 --- a/pkgs/development/compilers/llvm/git/llvm/default.nix +++ b/pkgs/development/compilers/llvm/git/llvm/default.nix @@ -6,6 +6,7 @@ , cmake , python3 , libffi +, enableGoldPlugin ? (!stdenv.isDarwin && !stdenv.targetPlatform.isWasi) , libbfd , libpfm , libxml2 @@ -151,7 +152,7 @@ in stdenv.mkDerivation (rec { "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (!isDarwin) [ + ] ++ optionals (enableGoldPlugin) [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/mit-scheme/default.nix b/pkgs/development/compilers/mit-scheme/default.nix index 5a96242da7b13..da668b51e2785 100644 --- a/pkgs/development/compilers/mit-scheme/default.nix +++ b/pkgs/development/compilers/mit-scheme/default.nix @@ -49,6 +49,12 @@ stdenv.mkDerivation { runHook postConfigure ''; + NIX_CFLAGS_COMPILE = [ + # Needed with GCC 12 + "-Wno-error=array-parameter" + "-Wno-error=use-after-free" + ]; + buildPhase = '' runHook preBuild cd src diff --git a/pkgs/development/compilers/rust/1_66.nix b/pkgs/development/compilers/rust/1_66.nix deleted file mode 100644 index 6aee98bdba063..0000000000000 --- a/pkgs/development/compilers/rust/1_66.nix +++ /dev/null @@ -1,64 +0,0 @@ -# New rust versions should first go to staging. -# Things to check after updating: -# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin: -# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github -# This testing can be also done by other volunteers as part of the pull -# request review, in case platforms cannot be covered. -# 2. The LLVM version used for building should match with rust upstream. -# Check the version number in the src/llvm-project git submodule in: -# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules -# 3. Firefox and Thunderbird should still build on x86_64-linux. - -{ stdenv, lib -, buildPackages -, newScope, callPackage -, CoreFoundation, Security, SystemConfiguration -, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost -, makeRustPlatform -, llvmPackages_11 -, llvmPackages_14, llvm_14 -} @ args: - -import ./default.nix { - rustcVersion = "1.66.1"; - rustcSha256 = "sha256-WzyTOpTHIYdwXU7ikxmLq/3QlEL1k3+9aF2zqB9JWbo="; - - llvmSharedForBuild = pkgsBuildBuild.llvmPackages_14.libllvm.override { enableSharedLibraries = true; }; - llvmSharedForHost = pkgsBuildHost.llvmPackages_14.libllvm.override { enableSharedLibraries = true; }; - llvmSharedForTarget = pkgsBuildTarget.llvmPackages_14.libllvm.override { enableSharedLibraries = true; }; - - llvmBootstrapForDarwin = llvmPackages_11; - - # For use at runtime - llvmShared = llvm_14.override { enableSharedLibraries = true; }; - - # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox - llvmPackages = llvmPackages_14; - - # Note: the version MUST be one version prior to the version we're - # building - bootstrapVersion = "1.65.0"; - - # fetch hashes by running `print-hashes.sh ${bootstrapVersion}` - bootstrapHashes = { - i686-unknown-linux-gnu = "b29869f8e2c7029150a929b2c4e26843f363846ad99253a25be6abcfa8e84f46"; - x86_64-unknown-linux-gnu = "8f754fdd5af783fe9020978c64e414cb45f3ad0a6f44d045219bbf2210ca3cb9"; - x86_64-unknown-linux-musl = "716984def5509a844c2dde1c7be42bfadeb179f751d5c1a30c9c7198c8c089cd"; - arm-unknown-linux-gnueabihf = "e27f835c16bfcb66ad022a17d5c4602899e021e483a432ca4cc2cb4ecd39e938"; - armv7-unknown-linux-gnueabihf = "5376d467a29b32cacb771e0c76dc280bd623852709e7ffd92caabab076d5475f"; - aarch64-unknown-linux-gnu = "f406136010e6a1cdce3fb6573506f00d23858af49dd20a46723c3fa5257b7796"; - aarch64-unknown-linux-musl = "4b701dc3cbac04ebf0e336cff2f4ce5fc1a1984c183226863c9ed911eb00b07e"; - x86_64-apple-darwin = "139087a3937799415fd829e5a88162a69a32c23725a44457f9c96b98e4d64a7c"; - aarch64-apple-darwin = "7ddc335bd10fc32d3039ef36248a5d0c4865db2437c8aad20a2428a6cf41df09"; - powerpc64le-unknown-linux-gnu = "3f1d0d5bb13213348dc65e373f8c412fc0a12ee55abc1c864f7e0300932fc687"; - riscv64gc-unknown-linux-gnu = "aac7067348d218faa452b4bdc735778a51570a310ad645313ec767b5d7c88492"; - mips64el-unknown-linux-gnuabi64 = "d91ed3857c5256720da890f6533684b684e880bf9006dc4e4f4181213a5c4a09"; - }; - - selectRustPackage = pkgs: pkgs.rust_1_66; - - rustcPatches = [ - ]; -} - -(builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_11" "llvmPackages_14" "llvm_14"]) diff --git a/pkgs/development/compilers/rust/1_67.nix b/pkgs/development/compilers/rust/1_67.nix new file mode 100644 index 0000000000000..a0a43f31386db --- /dev/null +++ b/pkgs/development/compilers/rust/1_67.nix @@ -0,0 +1,81 @@ +# New rust versions should first go to staging. +# Things to check after updating: +# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin: +# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github +# This testing can be also done by other volunteers as part of the pull +# request review, in case platforms cannot be covered. +# 2. The LLVM version used for building should match with rust upstream. +# Check the version number in the src/llvm-project git submodule in: +# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules +# 3. Firefox and Thunderbird should still build on x86_64-linux. + +{ stdenv, lib +, buildPackages +, newScope, callPackage +, CoreFoundation, Security, SystemConfiguration +, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost +, makeRustPlatform +, llvmPackages_11 +, llvmPackages_15, llvm_15 +, fetchpatch +} @ args: + +import ./default.nix { + rustcVersion = "1.67.0"; + rustcSha256 = "sha256-0CnxT85Foux6mmBdKgpAquRznLL9rinun3pukCWn/eQ="; + + llvmSharedForBuild = pkgsBuildBuild.llvmPackages_15.libllvm.override { enableSharedLibraries = true; }; + llvmSharedForHost = pkgsBuildHost.llvmPackages_15.libllvm.override { enableSharedLibraries = true; }; + llvmSharedForTarget = pkgsBuildTarget.llvmPackages_15.libllvm.override { enableSharedLibraries = true; }; + + llvmBootstrapForDarwin = llvmPackages_11; + + # For use at runtime + llvmShared = llvm_15.override { enableSharedLibraries = true; }; + + # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox + llvmPackages = llvmPackages_15; + + # Note: the version MUST be one version prior to the version we're + # building + bootstrapVersion = "1.66.1"; + + # fetch hashes by running `print-hashes.sh ${bootstrapVersion}` + bootstrapHashes = { + i686-unknown-linux-gnu = "823128f64e902ee8aff61488c552c983e17ccca10c3f46dd93fde924d5100eb3"; + x86_64-unknown-linux-gnu = "7ecf79e9ea23d05917b0172f9f81fb1e47011d261a719998f8d5620a1e835023"; + x86_64-unknown-linux-musl = "70b660148238b8a137c6f165b0bc7bdcb50204c22a314bed6174ecd672f02e57"; + arm-unknown-linux-gnueabihf = "12c93efe71f3334ef6e718786f6a60b9566f097d23a7f1e8f38ed9add209126f"; + armv7-unknown-linux-gnueabihf = "f43c8cd3fd7d1c1e08bd6317220b2ec9b25891f464604f80bb17985b09bbf62a"; + aarch64-unknown-linux-gnu = "84b8a79803c1b91386460fe6a7d04c54002344452ff8e5c5631d5fa275ed0c9c"; + aarch64-unknown-linux-musl = "b2665da33efd328cff192a67ad026ea84f9deab8d1971892f4bbc22647606163"; + x86_64-apple-darwin = "0fcf341db2579aa6eb61a3430cd1dbc79b042dfe89686b93cc887d818d086c30"; + aarch64-apple-darwin = "03469fcaa0d8c505e6db03c18ded73cfbb6a2ce159292f8cf06c042bfc9f7cf9"; + powerpc64le-unknown-linux-gnu = "ccf915a0137bb83a9d9b133a234ae53cc099f2ba26e3cb09d209b47bbee2ade7"; + riscv64gc-unknown-linux-gnu = "525cb05edaf3ed0560753b413c72dd1b06492df28bf3c427a66fda683fdca3fc"; + mips64el-unknown-linux-gnuabi64 = "3c241cc80410fe389e8b04beda62c42496c225fe8776db9d55a498c53244f7a6"; + }; + + selectRustPackage = pkgs: pkgs.rust_1_67; + + rustcPatches = [ + # fix thin archive reading + # https://github.com/rust-lang/rust/pull/107360 + (fetchpatch { + name = "revert-back-to-llvmarchivebuilder-on-all-platforms.patch"; + url = "https://github.com/rust-lang/rust/commit/de363d54c40a378717881240e719f5f7223ba376.patch"; + hash = "sha256-3Xb803LZUZ1dldxGJ65Iw6gg1V1K827OB/0b32GqilU="; + }) + + # Fixes ICE. + # https://github.com/rust-lang/rust/pull/107688 + (fetchpatch { + name = "re-erased-regions-are-local.patch"; + url = "https://github.com/rust-lang/rust/commit/9d110847ab7f6aef56a8cd20cb6cea4fbcc51cd9.patch"; + excludes = [ "*tests/*" ]; + hash = "sha256-EZH5K1BEOOfi97xZr1xEHFP4jjvJ1+xqtRMvxBoL8pU="; + }) + ]; +} + +(builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_11" "llvmPackages_15" "llvm_15"]) diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix index d04eebe7eadf4..481b4195891ca 100644 --- a/pkgs/development/compilers/rust/cargo.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -1,6 +1,6 @@ { lib, stdenv, pkgsHostHost , file, curl, pkg-config, python3, openssl, cmake, zlib -, installShellFiles, makeWrapper, cacert, rustPlatform, rustc +, installShellFiles, makeWrapper, rustPlatform, rustc , CoreFoundation, Security , auditable ? false # TODO: change to true when this is the default }: @@ -28,7 +28,7 @@ rustPlatform.buildRustPackage { (lib.getDev pkgsHostHost.curl) zlib ]; - buildInputs = [ cacert file curl python3 openssl zlib ] + buildInputs = [ file curl python3 openssl zlib ] ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ]; # cargo uses git-rs which is made for a version of libgit2 from recent master that @@ -39,14 +39,7 @@ rustPlatform.buildRustPackage { RUSTC_BOOTSTRAP = 1; postInstall = '' - # NOTE: We override the `http.cainfo` option usually specified in - # `.cargo/config`. This is an issue when users want to specify - # their own certificate chain as environment variables take - # precedence - wrapProgram "$out/bin/cargo" \ - --suffix PATH : "${rustc}/bin" \ - --set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \ - --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" + wrapProgram "$out/bin/cargo" --suffix PATH : "${rustc}/bin" installManPage src/tools/cargo/src/etc/man/* diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 426f137788389..60f07a64299ab 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -165,7 +165,6 @@ in stdenv.mkDerivation rec { ]; buildInputs = [ openssl ] - # TODO: remove libiconv once 1.66 is used to bootstrap ++ optionals stdenv.isDarwin [ libiconv Security ] ++ optional (!withBundledLLVM) llvmShared; diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index c9aa4a962ffa6..f7bcd8e5b4947 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -188,7 +188,7 @@ stdenv.mkDerivation rec { lib.concatStringsSep " " (builtins.map (x: "--with-${x}") enableFeatures ++ builtins.map (x: "--without-${x}") disableFeatures) - } ${if stdenv.hostPlatform.system == "aarch64-darwin" then "--arch=arm64" else ""} + } ${lib.optionalString (stdenv.hostPlatform.system == "aarch64-darwin") "--arch=arm64"} (cd doc/manual ; make info) runHook postBuild diff --git a/pkgs/development/compilers/solc/default.nix b/pkgs/development/compilers/solc/default.nix index 55bf5237e6180..9a3e68a1b73b3 100644 --- a/pkgs/development/compilers/solc/default.nix +++ b/pkgs/development/compilers/solc/default.nix @@ -96,7 +96,7 @@ let for i in ./scripts/*.sh ./scripts/*.py ./test/*.sh ./test/*.py; do patchShebangs "$i" done - TERM=xterm ./scripts/tests.sh ${if z3Support then "--no-smt" else ""} + TERM=xterm ./scripts/tests.sh ${lib.optionalString z3Support "--no-smt"} popd ''; diff --git a/pkgs/development/compilers/swift/wrapper/default.nix b/pkgs/development/compilers/swift/wrapper/default.nix index a7d16cc2471af..0c7e0f8cbcf87 100644 --- a/pkgs/development/compilers/swift/wrapper/default.nix +++ b/pkgs/development/compilers/swift/wrapper/default.nix @@ -16,8 +16,7 @@ stdenv.mkDerivation (swift._wrapperParams // { swiftOs swiftArch swiftModuleSubdir swiftLibSubdir swiftStaticModuleSubdir swiftStaticLibSubdir; - swiftDriver = if useSwiftDriver - then "${swift-driver}/bin/swift-driver" else ""; + swiftDriver = lib.optionalString useSwiftDriver "${swift-driver}/bin/swift-driver"; passAsFile = [ "buildCommand" ]; buildCommand = '' diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix index 159b1827fc8fd..ed1d7fc57a64f 100644 --- a/pkgs/development/compilers/tinycc/default.nix +++ b/pkgs/development/compilers/tinycc/default.nix @@ -38,7 +38,6 @@ stdenv.mkDerivation rec { "-L${variables.libdir}" "-Wl,--rpath ${variables.libdir}" "-ltcc" - "-ldl" ]; variables = rec { prefix = "${placeholder "out"}"; diff --git a/pkgs/development/compilers/urweb/default.nix b/pkgs/development/compilers/urweb/default.nix index 67ebaa04699e3..a881b2f1badb1 100644 --- a/pkgs/development/compilers/urweb/default.nix +++ b/pkgs/development/compilers/urweb/default.nix @@ -33,6 +33,11 @@ stdenv.mkDerivation rec { -L${sqlite.out}/lib"; ''; + NIX_CFLAGS_COMPILE = [ + # Needed with GCC 12 + "-Wno-error=use-after-free" + ]; + # Be sure to keep the statically linked libraries dontDisableStatic = true; diff --git a/pkgs/development/compilers/zig/0.10.nix b/pkgs/development/compilers/zig/0.10.nix index 89f23b9ca25d5..6d41b63f03b2e 100644 --- a/pkgs/development/compilers/zig/0.10.nix +++ b/pkgs/development/compilers/zig/0.10.nix @@ -47,6 +47,7 @@ stdenv.mkDerivation rec { cmakeFlags = [ # file RPATH_CHANGE could not write new RPATH "-DCMAKE_SKIP_BUILD_RPATH=ON" + "-DZIG_TARGET_MCPU=baseline" ]; doCheck = true; |