diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2019-10-03 01:47:08 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2019-10-03 01:47:08 +0200 |
commit | b3fcd9375d89060979ce67d13c6714ebc3e1c002 (patch) | |
tree | e5120c8684e77b7b579c5fd348915cecdca66c57 /pkgs/development/compilers | |
parent | 3a4658ea04d66e849aa29c1f747ab8becc14949c (diff) | |
parent | 3dc58eda52ef935313cd0418264abd1d30d6b4d3 (diff) | |
download | nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar.gz nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar.bz2 nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar.lz nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar.xz nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.tar.zst nixlib-b3fcd9375d89060979ce67d13c6714ebc3e1c002.zip |
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/development/compilers')
42 files changed, 1843 insertions, 694 deletions
diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix b/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix deleted file mode 100644 index efba0dc8634f..000000000000 --- a/pkgs/development/compilers/ghcjs-ng/8.4/dep-overrides.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ haskellLib }: - -let inherit (haskellLib) dontCheck doJailbreak; -in self: super: { - haddock-library-ghcjs = doJailbreak (dontCheck super.haddock-library-ghcjs); - haddock-api-ghcjs = doJailbreak super.haddock-api-ghcjs; - - template-haskell-ghcjs = doJailbreak super.template-haskell-ghcjs; -} diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/git.json b/pkgs/development/compilers/ghcjs-ng/8.4/git.json deleted file mode 100644 index cfa6cf1d7d26..000000000000 --- a/pkgs/development/compilers/ghcjs-ng/8.4/git.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "url": "https://github.com/ghcjs/ghcjs", - "rev": "81bf5f31dabaa711aab234cb119eb9c998ccb129", - "sha256": "1bgnc71kjqicqv2xq8p70nck600yi2p7g4k9r1jclv21ib7i5hmx", - "fetchSubmodules": true -} diff --git a/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix b/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix deleted file mode 100644 index 3b89db144979..000000000000 --- a/pkgs/development/compilers/ghcjs-ng/8.4/stage0.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ callPackage, configuredSrc }: - -{ - - ghcjs = callPackage - ({ mkDerivation, aeson, array, attoparsec, base, base16-bytestring - , base64-bytestring, binary, bytestring, Cabal, containers - , cryptohash, data-default, deepseq, directory, executable-path - , filepath, ghc-api-ghcjs, ghc-boot, ghc-paths, ghci-ghcjs - , ghcjs-th, haddock-api-ghcjs, hashable, haskell-src-exts - , haskell-src-meta, http-types, HUnit, lens, lifted-base, mtl - , network, optparse-applicative, parallel, parsec, process, random - , regex-posix, safe, shelly, split, stdenv, stringsearch, syb - , system-fileio, system-filepath, tar, template-haskell - , template-haskell-ghcjs, terminfo, test-framework - , test-framework-hunit, text, time, transformers - , transformers-compat, unix, unix-compat, unordered-containers - , vector, wai, wai-app-static, wai-extra, wai-websockets, warp - , webdriver, websockets, wl-pprint-text, yaml - }: - mkDerivation { - pname = "ghcjs"; - version = "8.4.0.1"; - src = configuredSrc + /.; - isLibrary = true; - isExecutable = true; - enableSeparateDataOutput = true; - setupHaskellDepends = [ - base Cabal containers directory filepath process template-haskell - transformers - ]; - libraryHaskellDepends = [ - aeson array attoparsec base base16-bytestring base64-bytestring - binary bytestring Cabal containers cryptohash data-default deepseq - directory filepath ghc-api-ghcjs ghc-boot ghc-paths ghci-ghcjs - ghcjs-th hashable haskell-src-exts haskell-src-meta lens mtl - optparse-applicative parallel parsec process regex-posix safe split - stringsearch syb template-haskell template-haskell-ghcjs text time - transformers unordered-containers vector wl-pprint-text yaml - ]; - executableHaskellDepends = [ - aeson base binary bytestring Cabal containers directory - executable-path filepath ghc-api-ghcjs ghc-boot haddock-api-ghcjs - lens mtl optparse-applicative process shelly system-fileio - system-filepath tar terminfo text time transformers - transformers-compat unix unix-compat unordered-containers vector - yaml - ]; - testHaskellDepends = [ - aeson base bytestring data-default deepseq directory http-types - HUnit lens lifted-base network optparse-applicative process random - shelly system-fileio system-filepath test-framework - test-framework-hunit text time transformers unordered-containers - wai wai-app-static wai-extra wai-websockets warp webdriver - websockets yaml - ]; - description = "Haskell to JavaScript compiler"; - license = stdenv.lib.licenses.mit; - }) {}; - - ghc-api-ghcjs = callPackage - ({ mkDerivation, array, base, binary, bytestring, containers - , deepseq, directory, filepath, ghc-boot, ghc-boot-th, ghci-ghcjs - , hpc, process, stdenv, template-haskell-ghcjs, terminfo, time - , transformers, unix - }: - mkDerivation { - pname = "ghc-api-ghcjs"; - version = "8.4.0"; - src = configuredSrc + /lib/ghc-api-ghcjs; - libraryHaskellDepends = [ - array base binary bytestring containers deepseq directory filepath - ghc-boot ghc-boot-th ghci-ghcjs hpc process template-haskell-ghcjs - terminfo time transformers unix - ]; - homepage = "http://www.haskell.org/ghc/"; - description = "The GHC API (customized for GHCJS)"; - license = stdenv.lib.licenses.bsd3; - }) {}; - - ghci-ghcjs = callPackage - ({ mkDerivation, array, base, binary, bytestring, containers - , deepseq, filepath, ghc-boot, ghc-boot-th, stdenv - , template-haskell-ghcjs, transformers, unix - }: - mkDerivation { - pname = "ghci-ghcjs"; - version = "8.4.0"; - src = configuredSrc + /lib/ghci-ghcjs; - libraryHaskellDepends = [ - array base binary bytestring containers deepseq filepath ghc-boot - ghc-boot-th template-haskell-ghcjs transformers unix - ]; - description = "The library supporting GHC's interactive interpreter (customized for GHCJS)"; - license = stdenv.lib.licenses.bsd3; - }) {}; - - ghcjs-th = callPackage - ({ mkDerivation, base, binary, bytestring, containers, ghc-prim - , ghci-ghcjs, stdenv, template-haskell-ghcjs - }: - mkDerivation { - pname = "ghcjs-th"; - version = "0.1.0.0"; - src = configuredSrc + /lib/ghcjs-th; - libraryHaskellDepends = [ - base binary bytestring containers ghc-prim ghci-ghcjs - template-haskell-ghcjs - ]; - homepage = "https://github.com/ghcjs"; - license = stdenv.lib.licenses.mit; - }) {}; - - haddock-api-ghcjs = callPackage - ({ mkDerivation, array, base, bytestring, Cabal, containers, deepseq - , directory, filepath, ghc-api-ghcjs, ghc-boot, ghc-paths - , haddock-library-ghcjs, hspec, hspec-discover, QuickCheck, stdenv - , transformers, xhtml - }: - mkDerivation { - pname = "haddock-api-ghcjs"; - version = "2.20.0"; - src = configuredSrc + /lib/haddock-api-ghcjs; - enableSeparateDataOutput = true; - libraryHaskellDepends = [ - array base bytestring Cabal containers deepseq directory filepath - ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs transformers - xhtml - ]; - testHaskellDepends = [ - array base bytestring Cabal containers deepseq directory filepath - ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs hspec - QuickCheck transformers xhtml - ]; - testToolDepends = [ hspec-discover ]; - homepage = "http://www.haskell.org/haddock/"; - description = "A documentation-generation tool for Haskell libraries"; - license = stdenv.lib.licenses.bsd3; - }) {}; - - haddock-library-ghcjs = callPackage - ({ mkDerivation, base, base-compat, bytestring, containers, deepseq - , directory, filepath, haddock-library, hspec, hspec-discover - , optparse-applicative, QuickCheck, stdenv, transformers, tree-diff - }: - mkDerivation { - pname = "haddock-library-ghcjs"; - version = "1.6.0"; - src = configuredSrc + /lib/haddock-library-ghcjs; - libraryHaskellDepends = [ - base bytestring containers deepseq transformers - ]; - testHaskellDepends = [ - base base-compat bytestring containers deepseq directory filepath - haddock-library hspec optparse-applicative QuickCheck transformers - tree-diff - ]; - testToolDepends = [ hspec-discover ]; - doHaddock = false; - homepage = "http://www.haskell.org/haddock/"; - description = "Library exposing some functionality of Haddock"; - license = stdenv.lib.licenses.bsd3; - }) {}; - - template-haskell-ghcjs = callPackage - ({ mkDerivation, base, ghc-boot-th, pretty, stdenv }: - mkDerivation { - pname = "template-haskell-ghcjs"; - version = "2.13.0.0"; - src = configuredSrc + /lib/template-haskell-ghcjs; - libraryHaskellDepends = [ base ghc-boot-th pretty ]; - description = "Support library for Template Haskell (customized for GHCJS)"; - license = stdenv.lib.licenses.bsd3; - }) {}; - -} diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index e668be8e0740..747ea5cf77f4 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -104,5 +104,4 @@ in stdenv.mkDerivation { meta.platforms = passthru.bootPkgs.ghc.meta.platforms; meta.maintainers = [lib.maintainers.elvishjerricco]; - meta.hydraPlatforms = []; } diff --git a/pkgs/development/compilers/ghcjs/base.nix b/pkgs/development/compilers/ghcjs/base.nix deleted file mode 100644 index ba0bbb1962b8..000000000000 --- a/pkgs/development/compilers/ghcjs/base.nix +++ /dev/null @@ -1,161 +0,0 @@ -{ mkDerivation -, lib -, broken ? false -, test-framework -, test-framework-hunit -, data-default -, ghc-paths -, haskell-src-exts -, haskell-src-meta -, optparse-applicative -, system-fileio -, system-filepath -, text-binary -, unordered-containers -, cabal-install -, wl-pprint-text -, base16-bytestring -, executable-path -, transformers-compat -, haddock-api -, regex-posix - -, bootPkgs, gmp - -, runCommand -, nodejs, stdenv, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm -, time -, zlib, aeson, attoparsec, bzlib, hashable -, lens -, parallel, safe, shelly, split, stringsearch, syb -, tar, terminfo -, vector, yaml -, alex, happy, git, gnumake, autoconf, patch -, automake, libtool -, cryptohash -, haddock, hspec, xhtml, pkgs -, coreutils -, libiconv - -, version -, ghcjsSrc -, ghcjsBootSrc -, ghcjsBoot ? import ./ghcjs-boot.nix { - inherit runCommand; - src = ghcjsBootSrc; - } -, shims - -# This is the list of the Stage 1 packages that are built into a booted ghcjs installation -# It can be generated with the command: -# nix-shell -p haskell.packages.ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/^\([^_]*\)\(.*\)$/ \"\1\"/'" -, stage1Packages - -, stage2 ? import ./stage2.nix - -, patches - -# used for resolving compiler plugins -, ghcLibdir ? null -}: -let - inherit (bootPkgs) ghc; - -in mkDerivation ({ - pname = "ghcjs"; - inherit version; - src = ghcjsSrc; - isLibrary = true; - isExecutable = true; - jailbreak = true; - doHaddock = false; - doCheck = false; - buildDepends = [ - filepath HTTP mtl network random stm time zlib aeson attoparsec - bzlib data-default ghc-paths hashable haskell-src-exts haskell-src-meta - lens optparse-applicative parallel safe shelly split - stringsearch syb system-fileio system-filepath tar terminfo text-binary - unordered-containers vector wl-pprint-text yaml - alex happy git gnumake autoconf automake libtool patch gmp - base16-bytestring cryptohash executable-path haddock-api - transformers-compat QuickCheck haddock hspec xhtml - regex-posix libiconv - ]; - buildTools = [ nodejs git ]; - testDepends = [ - HUnit test-framework test-framework-hunit - ]; - inherit patches; - postPatch = '' - substituteInPlace Setup.hs \ - --replace "/usr/bin/env" "${coreutils}/bin/env" - - substituteInPlace src/Compiler/Info.hs \ - --replace "@PREFIX@" "$out" \ - --replace "@VERSION@" "${version}" - - substituteInPlace src-bin/Boot.hs \ - --replace "@PREFIX@" "$out" \ - --replace "@CC@" "${stdenv.cc}/bin/cc" - ''; - preBuild = '' - export HOME="$TMP" - - local topDir=$out/lib/ghcjs-${version} - mkdir -p $topDir - - cp -r ${ghcjsBoot} $topDir/ghcjs-boot - chmod -R u+w $topDir/ghcjs-boot - - cp -r ${shims} $topDir/shims - chmod -R u+w $topDir/shims - - # Make the patches be relative their corresponding package's directory. - # See: https://github.com/ghcjs/ghcjs-boot/pull/12 - for patch in "$topDir/ghcjs-boot/patches/"*.patch; do - echo "fixing patch: $patch" - sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch - done - ''; - # We build with --quick so we can build stage 2 packages separately. - # This is necessary due to: https://github.com/haskell/cabal/commit/af19fb2c2d231d8deff1cb24164a2bf7efb8905a - # Cabal otherwise fails to build: http://hydra.nixos.org/build/31824079/nixlog/1/raw - postInstall = '' - PATH=$out/bin:$PATH LD_LIBRARY_PATH=${gmp.out}/lib:${stdenv.cc}/lib64:$LD_LIBRARY_PATH \ - env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \ - --dev \ - --quick \ - --with-cabal ${cabal-install}/bin/cabal \ - --with-gmp-includes ${gmp.dev}/include \ - --with-gmp-libraries ${gmp.out}/lib - '' + lib.optionalString (ghcLibdir != null) '' - printf '%s' '${ghcLibdir}' > "$out/lib/ghcjs-${version}/ghc_libdir" - ''; - passthru = { - inherit bootPkgs; - ghcVersion = ghc.version; - isCross = true; - isGhcjs = true; - inherit nodejs ghcjsBoot; - socket-io = pkgs.nodePackages."socket.io"; - haskellCompilerName = "ghcjs-${version}"; - - # let us assume ghcjs is never actually cross compiled - targetPrefix = ""; - - enableShared = true; - - inherit stage1Packages; - mkStage2 = stage2 { - inherit ghcjsBoot; - }; - }; - - homepage = https://github.com/ghcjs/ghcjs; - description = "A Haskell to JavaScript compiler that uses the GHC API"; - license = stdenv.lib.licenses.bsd3; - platforms = ghc.meta.platforms; - maintainers = with stdenv.lib.maintainers; [ jwiegley cstrahan dmjio elvishjerricco ]; - hydraPlatforms = if broken then [] else ghc.meta.platforms; - inherit broken; -}) diff --git a/pkgs/development/compilers/ghcjs/gen-stage2.rb b/pkgs/development/compilers/ghcjs/gen-stage2.rb deleted file mode 100755 index 709e635db55c..000000000000 --- a/pkgs/development/compilers/ghcjs/gen-stage2.rb +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env ruby - -require 'pathname' - -# from boot.yaml in ghcjs/ghcjs -stage2_packages = [ - "boot/async", - "boot/aeson", - "boot/attoparsec", - "boot/case-insensitive", - "boot/dlist", - "boot/extensible-exceptions", - "boot/hashable", - "boot/mtl", - "boot/old-time", - "boot/parallel", - "boot/scientific", - "boot/stm", - "boot/syb", - "boot/text", - "boot/unordered-containers", - "boot/vector", - "ghcjs/ghcjs-base", - # not listed under stage2, but needed when "quick booting". - "boot/cabal/Cabal" -] - -nixpkgs = File.expand_path("../../../../..", __FILE__) -boot = ARGV[0] || `nix-build #{nixpkgs} -A haskell.packages.ghcjs.ghc.ghcjsBoot`.chomp - -out = "".dup -out << "{ ghcjsBoot }: { callPackage }:\n" -out << "\n" -out << "{\n" - -stage2_packages.each do |package| - name = Pathname.new(package).basename - nix = `cabal2nix file://#{boot}/#{package} --jailbreak` - nix.sub!(/src =.*?$/, "src = \"${ghcjsBoot}/#{package}\";") - nix.sub!(" doCheck = false;\n", "") - nix.sub!("libraryHaskellDepends", "doCheck = false;\n libraryHaskellDepends") - # cabal2nix somehow generates the deps for 'text' as if it had selected flag - # 'integer-simple' (despite not passing the flag within the generated - # expression). We want integer-gmp instead. - nix.gsub!(/integer-simple/, "integer-gmp") - nix = nix.split("\n").join("\n ") - - out << " #{name} = callPackage\n" - out << " (#{nix}) {};\n" -end - -out << "}" - -puts out diff --git a/pkgs/development/compilers/ghcjs/ghcjs-boot.nix b/pkgs/development/compilers/ghcjs/ghcjs-boot.nix deleted file mode 100644 index c00e13a92404..000000000000 --- a/pkgs/development/compilers/ghcjs/ghcjs-boot.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ runCommand, src }: - -# we remove the patches so ghcjs-boot doesn't try to apply them again. -runCommand "${src.name}-patched" {} '' - cp -r ${src} $out - chmod -R +w $out - - # Make the patches be relative their corresponding package's directory. - # See: https://github.com/ghcjs/ghcjs-boot/pull/12 - for patch in $out/patches/*.patch; do - echo ">> fixing patch: $patch" - sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch - done - - for package in $(cd $out/boot; echo *); do - patch=$out/patches/$package.patch - if [[ -e $patch ]]; then - echo ">> patching package: $package" - pushd $out/boot/$package - patch -p1 < $patch - rm $patch - popd - fi - done -'' diff --git a/pkgs/development/compilers/halide/default.nix b/pkgs/development/compilers/halide/default.nix index 683f8d7ace09..0b28b61a27b2 100644 --- a/pkgs/development/compilers/halide/default.nix +++ b/pkgs/development/compilers/halide/default.nix @@ -3,7 +3,7 @@ }: let - version = "2018_02_15"; + version = "2019_08_27"; in llvmPackages.stdenv.mkDerivation { @@ -13,7 +13,7 @@ in llvmPackages.stdenv.mkDerivation { owner = "halide"; repo = "Halide"; rev = "release_${version}"; - sha256 = "14lmpbxydx7ii0pxds6rgq5vw4i6yfjsq0bai1l5wwpv1rnwmbxd"; + sha256 = "09xf8v9zyxx2fn6s1yzjkyzcf9zyzrg3x5vivgd2ljzbfhm8wh7n"; }; patches = [ ./nix.patch ]; @@ -58,7 +58,7 @@ in llvmPackages.stdenv.mkDerivation { description = "C++ based language for image processing and computational photography"; homepage = "https://halide-lang.org"; license = licenses.mit; - platforms = platforms.linux; + platforms = [ "i686-linux" "x86_64-linux" ]; maintainers = [ maintainers.ck3d ]; }; } diff --git a/pkgs/development/compilers/halide/nix.patch b/pkgs/development/compilers/halide/nix.patch index 2ab1e31adeb4..fb9bbf1a4cf7 100644 --- a/pkgs/development/compilers/halide/nix.patch +++ b/pkgs/development/compilers/halide/nix.patch @@ -1,11 +1,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 40a685b7e..c452efd09 100644 +index 4ba384324..7e23038f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -49,10 +49,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - +@@ -75,10 +75,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + set(LLVM_VERSION "${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}") - + -file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-as${CMAKE_EXECUTABLE_SUFFIX}" LLVM_AS) -file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-nm${CMAKE_EXECUTABLE_SUFFIX}" LLVM_NM) -file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}" CLANG) @@ -14,7 +14,7 @@ index 40a685b7e..c452efd09 100644 +find_program(LLVM_NM llvm-nm HINTS ${LLVM_TOOLS_BINARY_DIR}) +find_program(CLANG clang HINTS ${LLVM_TOOLS_BINARY_DIR}) +find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_TOOLS_BINARY_DIR}) - + # LLVM doesn't appear to expose --system-libs via its CMake interface, # so we must shell out to llvm-config to find this info diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt @@ -27,7 +27,7 @@ index 132c80e6a..36ce865f2 100644 set(OpenBLAS_EXTRA_LIBS) - set(BLAS_VENDORS OpenBLAS ATLAS) + set(BLAS_VENDORS OpenBLAS) - + # TODO # there are more vendors we could add here that support the cblas interface @@ -41,6 +41,7 @@ if (CBLAS_FOUND) @@ -39,17 +39,18 @@ index 132c80e6a..36ce865f2 100644 endif() endforeach() diff --git a/apps/linear_algebra/tests/CMakeLists.txt b/apps/linear_algebra/tests/CMakeLists.txt -index 4b95eb3bb..1daa97437 100644 +index cc02eb0a4..c20419a0d 100644 --- a/apps/linear_algebra/tests/CMakeLists.txt +++ b/apps/linear_algebra/tests/CMakeLists.txt -@@ -19,6 +19,6 @@ target_compile_options(test_halide_blas PRIVATE -Wno-unused-variable) +@@ -19,7 +19,7 @@ target_compile_options(test_halide_blas PRIVATE -Wno-unused-variable) target_link_libraries(test_halide_blas PRIVATE halide_blas - cblas # XXX fragile + ${BLAS_LIBRARIES} - Halide + ${HALIDE_COMPILER_LIB} ) --- -2.15.0 + +-- +2.23.0 diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix index 0912435327ce..5d7266f39ecd 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -7,11 +7,11 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake python llvm ]; buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; - cmakeFlags = [ + cmakeFlags = stdenv.lib.optionals (stdenv.hostPlatform.useLLVM or false || stdenv.isDarwin) [ "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" - ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DCMAKE_C_FLAGS=-nodefaultlibs" "-DCMAKE_CXX_COMPILER_WORKS=ON" "-DCOMPILER_RT_BUILD_BUILTINS=ON" @@ -26,7 +26,7 @@ stdenv.mkDerivation { patches = [ ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory - ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch + ] ++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) ./crtbegin-and-end.patch ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch; # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks @@ -37,7 +37,7 @@ stdenv.mkDerivation { postPatch = stdenv.lib.optionalString stdenv.isDarwin '' substituteInPlace cmake/config-ix.cmake \ --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' - '' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + '' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) '' substituteInPlace lib/builtins/int_util.c \ --replace "#include <stdlib.h>" "" substituteInPlace lib/builtins/clear_cache.c \ @@ -49,7 +49,7 @@ stdenv.mkDerivation { # Hack around weird upsream RPATH bug postInstall = stdenv.lib.optionalString stdenv.isDarwin '' ln -s "$out/lib"/*/* "$out/lib" - '' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + '' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) '' ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o diff --git a/pkgs/development/compilers/llvm/8/compiler-rt.nix b/pkgs/development/compilers/llvm/8/compiler-rt.nix index 936c877d58c9..88788852862f 100644 --- a/pkgs/development/compilers/llvm/8/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/8/compiler-rt.nix @@ -7,11 +7,10 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake python llvm ]; buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; - cmakeFlags = [ + cmakeFlags = stdenv.lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" - ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "-DCMAKE_C_FLAGS=-nodefaultlibs" "-DCMAKE_CXX_COMPILER_WORKS=ON" "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" @@ -37,7 +36,7 @@ stdenv.mkDerivation { patches = [ ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ]# ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch; + ++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) ./crtbegin-and-end.patch; # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra @@ -47,7 +46,7 @@ stdenv.mkDerivation { postPatch = stdenv.lib.optionalString stdenv.isDarwin '' substituteInPlace cmake/config-ix.cmake \ --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' - '' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + '' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) '' substituteInPlace lib/builtins/int_util.c \ --replace "#include <stdlib.h>" "" substituteInPlace lib/builtins/clear_cache.c \ diff --git a/pkgs/development/compilers/llvm/9/bintools.nix b/pkgs/development/compilers/llvm/9/bintools.nix new file mode 100644 index 000000000000..72a2a7331930 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/bintools.nix @@ -0,0 +1,19 @@ +{ runCommand, stdenv, llvm, lld, version }: + +let + prefix = + if stdenv.hostPlatform != stdenv.targetPlatform + then "${stdenv.targetPlatform.config}-" + else ""; +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' + mkdir -p $out/bin + for prog in ${lld}/bin/*; do + ln -s $prog $out/bin/${prefix}$(basename $prog) + done + for prog in ${llvm}/bin/*; do + ln -s $prog $out/bin/${prefix}$(echo $(basename $prog) | sed -e "s|llvm-||") + ln -sf $prog $out/bin/${prefix}$(basename $prog) + done + rm -f $out/bin/${prefix}cat + ln -s ${lld}/bin/lld $out/bin/${prefix}ld +'' diff --git a/pkgs/development/compilers/llvm/9/clang/compiler-rt-baremetal.patch b/pkgs/development/compilers/llvm/9/clang/compiler-rt-baremetal.patch new file mode 100644 index 000000000000..a4a0f21b0fcd --- /dev/null +++ b/pkgs/development/compilers/llvm/9/clang/compiler-rt-baremetal.patch @@ -0,0 +1,53 @@ +Index: lib/Driver/ToolChains/BareMetal.cpp +=================================================================== +--- a/lib/Driver/ToolChains/BareMetal.cpp ++++ b/lib/Driver/ToolChains/BareMetal.cpp +@@ -157,7 +157,7 @@ + void BareMetal::AddLinkRuntimeLib(const ArgList &Args, + ArgStringList &CmdArgs) const { + CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" + +- getTriple().getArchName() + ".a")); ++ getTriple().getArchName())); + } + + void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, +Index: test/Driver/baremetal.cpp +=================================================================== +--- a/test/Driver/baremetal.cpp ++++ b/test/Driver/baremetal.cpp +@@ -13,7 +13,7 @@ + // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" + // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal" + // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for" +-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" ++// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" + // CHECK-V6M-C-SAME: "-o" "{{.*}}.o" + + // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +@@ -35,7 +35,7 @@ + // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" + // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" + // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind" +-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" ++// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" + // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o" + + // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +@@ -48,7 +48,7 @@ + // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" + // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" + // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind" +-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" ++// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" + // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o" + + // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +@@ -61,7 +61,7 @@ + // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" + // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" + // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind" +-// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" ++// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" + // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o" + + // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ diff --git a/pkgs/development/compilers/llvm/9/clang/default.nix b/pkgs/development/compilers/llvm/9/clang/default.nix new file mode 100644 index 000000000000..df6b916e87f0 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/clang/default.nix @@ -0,0 +1,120 @@ +{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python +, fixDarwinDylibNames +, enableManpages ? false +, enablePolly ? false # TODO: get this info from llvm (passthru?) +}: + +let + self = stdenv.mkDerivation ({ + pname = "clang"; + inherit version; + + src = fetch "cfe" "0426ma80i41qsgzm1qdz81mjskck426diygxi2k5vji2gkpixa3v"; + + unpackPhase = '' + unpackFile $src + mv cfe-${version}* clang + sourceRoot=$PWD/clang + unpackFile ${clang-tools-extra_src} + mv clang-tools-extra-* $sourceRoot/tools/extra + ''; + + nativeBuildInputs = [ cmake python ] + ++ stdenv.lib.optional enableManpages python.pkgs.sphinx; + + buildInputs = [ libxml2 llvm ] + ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + + cmakeFlags = [ + "-DCMAKE_CXX_FLAGS=-std=c++11" + "-DCLANGD_BUILD_XPC=OFF" + ] ++ stdenv.lib.optionals enableManpages [ + "-DCLANG_INCLUDE_DOCS=ON" + "-DLLVM_ENABLE_SPHINX=ON" + "-DSPHINX_OUTPUT_MAN=ON" + "-DSPHINX_OUTPUT_HTML=OFF" + "-DSPHINX_WARNINGS_AS_ERRORS=OFF" + ] ++ stdenv.lib.optionals enablePolly [ + "-DWITH_POLLY=ON" + "-DLINK_POLLY_INTO_TOOLS=ON" + ]; + + patches = [ + ./purity.patch + # https://reviews.llvm.org/D51899 + ./compiler-rt-baremetal.patch + ]; + + postPatch = '' + sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ + -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ + lib/Driver/ToolChains/*.cpp + + # Patch for standalone doc building + sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt + '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' + sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp + '' + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace tools/extra/clangd/CMakeLists.txt \ + --replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE + ''; + + outputs = [ "out" "lib" "python" ]; + + # Clang expects to find LLVMgold in its own prefix + postInstall = '' + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + + ln -sv $out/bin/clang $out/bin/cpp + + # Move libclang to 'lib' output + moveToOutput "lib/libclang.*" "$lib" + substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \ + --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." + + mkdir -p $python/bin $python/share/clang/ + mv $out/bin/{git-clang-format,scan-view} $python/bin + if [ -e $out/bin/set-xcode-analyzer ]; then + mv $out/bin/set-xcode-analyzer $python/bin + fi + mv $out/share/clang/*.py $python/share/clang + rm $out/bin/c-index-test + ''; + + enableParallelBuilding = true; + + passthru = { + isClang = true; + inherit llvm; + } // stdenv.lib.optionalAttrs (stdenv.targetPlatform.isLinux || (stdenv.cc.isGNU && stdenv.cc.cc ? gcc)) { + gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc; + }; + + meta = { + description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler"; + homepage = http://llvm.org/; + license = stdenv.lib.licenses.ncsa; + platforms = stdenv.lib.platforms.all; + }; + } // stdenv.lib.optionalAttrs enableManpages { + pname = "clang-manpages"; + + buildPhase = '' + make docs-clang-man + ''; + + installPhase = '' + mkdir -p $out/share/man/man1 + # Manually install clang manpage + cp docs/man/*.1 $out/share/man/man1/ + ''; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man page for Clang ${version}"; + }); +in self diff --git a/pkgs/development/compilers/llvm/9/clang/purity.patch b/pkgs/development/compilers/llvm/9/clang/purity.patch new file mode 100644 index 000000000000..a6729a9b004e --- /dev/null +++ b/pkgs/development/compilers/llvm/9/clang/purity.patch @@ -0,0 +1,30 @@ +From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001 +From: Will Dietz <w@wdtz.org> +Date: Thu, 18 May 2017 11:56:12 -0500 +Subject: [PATCH] "purity" patch for 5.0 + +--- + lib/Driver/ToolChains/Gnu.cpp | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index fe3c0191bb..c6a482bece 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, + if (!IsStatic) { + if (Args.hasArg(options::OPT_rdynamic)) + CmdArgs.push_back("-export-dynamic"); +- +- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) { +- const std::string Loader = +- D.DyldPrefix + ToolChain.getDynamicLinker(Args); +- CmdArgs.push_back("-dynamic-linker"); +- CmdArgs.push_back(Args.MakeArgString(Loader)); +- } + } + + CmdArgs.push_back("-o"); +-- +2.11.0 + diff --git a/pkgs/development/compilers/llvm/9/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/9/compiler-rt-codesign.patch new file mode 100644 index 000000000000..3cc12b94b200 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/compiler-rt-codesign.patch @@ -0,0 +1,33 @@ +From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 +From: Will Dietz <w@wdtz.org> +Date: Tue, 19 Sep 2017 13:13:06 -0500 +Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that + needs it + +--- + cmake/Modules/AddCompilerRT.cmake | 8 ------ + test/asan/CMakeLists.txt | 52 --------------------------------------- + test/tsan/CMakeLists.txt | 47 ----------------------------------- + 3 files changed, 107 deletions(-) + +diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake +index bc5fb9ff7..b64eb4246 100644 +--- a/cmake/Modules/AddCompilerRT.cmake ++++ b/cmake/Modules/AddCompilerRT.cmake +@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) + set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") + set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") + endif() +- if(APPLE) +- # Ad-hoc sign the dylibs +- add_custom_command(TARGET ${libname} +- POST_BUILD +- COMMAND codesign --sign - $<TARGET_FILE:${libname}> +- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} +- ) +- endif() + endif() + install(TARGETS ${libname} + ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} +2.14.1 + diff --git a/pkgs/development/compilers/llvm/9/compiler-rt.nix b/pkgs/development/compilers/llvm/9/compiler-rt.nix new file mode 100644 index 000000000000..9a333ad7c115 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/compiler-rt.nix @@ -0,0 +1,68 @@ +{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }: +stdenv.mkDerivation rec { + pname = "compiler-rt"; + inherit version; + src = fetch pname "03ni43lbkp63lr3p6sc94dphqmvnz5av5mml0xmk930xvnbcvr2n"; + + nativeBuildInputs = [ cmake python llvm ]; + buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi; + + cmakeFlags = stdenv.lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" + "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" + "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" + "-DCMAKE_C_FLAGS=-nodefaultlibs" + "-DCMAKE_CXX_COMPILER_WORKS=ON" + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" + "-DCOMPILER_RT_BUILD_PROFILE=OFF" + "-DCOMPILER_RT_BAREMETAL_BUILD=ON" + #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program + "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" + "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" + ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" + "-DCOMPILER_RT_BUILD_XRAY=OFF" + "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" + "-DCOMPILER_RT_BUILD_PROFILE=OFF" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.parsed.kernel.name == "none") [ + "-DCOMPILER_RT_BAREMETAL_BUILD=ON" + "-DCOMPILER_RT_OS_DIR=baremetal" + ]; + + outputs = [ "out" "dev" ]; + + patches = [ + ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory + ];# ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch + + # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks + # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra + # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd + # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by + # a flag and turn the flag off during the stdenv build. + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace cmake/config-ix.cmake \ + --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' + '' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) '' + substituteInPlace lib/builtins/int_util.c \ + --replace "#include <stdlib.h>" "" + substituteInPlace lib/builtins/clear_cache.c \ + --replace "#include <assert.h>" "" + substituteInPlace lib/builtins/cpu_model.c \ + --replace "#include <assert.h>" "" + ''; + + # Hack around weird upsream RPATH bug + postInstall = stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) '' + ln -s "$out/lib"/*/* "$out/lib" + '' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) '' + ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o + ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o + ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o + ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + ''; + + enableParallelBuilding = true; +} diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix new file mode 100644 index 000000000000..1590d180c3fd --- /dev/null +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -0,0 +1,197 @@ +{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook +, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith +, buildLlvmTools # tools, but from the previous stage, for cross +, targetLlvmLibraries # libraries, but from the next stage, for cross +}: + +let + release_version = "9.0.0"; + version = release_version; # differentiating these is important for rc's + + fetch = name: sha256: fetchurl { + url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz"; + inherit sha256; + }; + + clang-tools-extra_src = fetch "clang-tools-extra" "045cldmcfd8s33wyjlviifgpnw52yqicd6v4ysvdg4i96p78c77a"; + + tools = stdenv.lib.makeExtensible (tools: let + callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; }); + mkExtraBuildCommands = cc: '' + rsrc="$out/resource-root" + mkdir "$rsrc" + ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" + ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" + echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags + '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && tools.clang-unwrapped ? gcc && !(stdenv.targetPlatform.useLLVM or false)) '' + echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags + ''; + in { + + llvm = callPackage ./llvm.nix { }; + llvm-polly = callPackage ./llvm.nix { enablePolly = true; }; + + clang-unwrapped = callPackage ./clang { + inherit clang-tools-extra_src; + }; + clang-polly-unwrapped = callPackage ./clang { + inherit clang-tools-extra_src; + llvm = tools.llvm-polly; + enablePolly = true; + }; + + llvm-manpages = lowPrio (tools.llvm.override { + enableManpages = true; + python = pkgs.python; # don't use python-boot + }); + + clang-manpages = lowPrio (tools.clang-unwrapped.override { + enableManpages = true; + python = pkgs.python; # don't use python-boot + }); + + libclang = tools.clang-unwrapped.lib; + + clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; + + libstdcxxClang = wrapCCWith rec { + cc = tools.clang-unwrapped; + extraPackages = [ + libstdcxxHook + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + + libcxxClang = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = targetLlvmLibraries.libcxx; + extraPackages = [ + targetLlvmLibraries.libcxx + targetLlvmLibraries.libcxxabi + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = mkExtraBuildCommands cc; + }; + + lld = callPackage ./lld.nix {}; + + lldb = callPackage ./lldb.nix {}; + + # Below, is the LLVM bootstrapping logic. It handles building a + # fully LLVM toolchain from scratch. No GCC toolchain should be + # pulled in. As a consequence, it is very quick to build different + # targets provided by LLVM and we can also build for what GCC + # doesn’t support like LLVM. Probably we should move to some other + # file. + + bintools = callPackage ./bintools.nix {}; + + lldClang = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = targetLlvmLibraries.libcxx; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + }; + extraPackages = [ + targetLlvmLibraries.libcxx + targetLlvmLibraries.libcxxabi + targetLlvmLibraries.compiler-rt + ] ++ stdenv.lib.optionals (!stdenv.targetPlatform.isWasm) [ + targetLlvmLibraries.libunwind + ]; + extraBuildCommands = '' + echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags + echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags + '' + stdenv.lib.optionalString (!stdenv.targetPlatform.isWasm) '' + echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags + '' + stdenv.lib.optionalString stdenv.targetPlatform.isWasm '' + echo "-fno-exceptions" >> $out/nix-support/cc-cflags + '' + mkExtraBuildCommands cc; + }; + + lldClangNoLibcxx = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = null; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + }; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = '' + echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags + echo "-nostdlib++" >> $out/nix-support/cc-cflags + '' + mkExtraBuildCommands cc; + }; + + lldClangNoLibc = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = null; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + libc = null; + }; + extraPackages = [ + targetLlvmLibraries.compiler-rt + ]; + extraBuildCommands = '' + echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags + '' + mkExtraBuildCommands cc; + }; + + lldClangNoCompilerRt = wrapCCWith { + cc = tools.clang-unwrapped; + libcxx = null; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + libc = null; + }; + extraPackages = [ ]; + extraBuildCommands = '' + echo "-nostartfiles" >> $out/nix-support/cc-cflags + echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags + ''; + }; + + }); + + libraries = stdenv.lib.makeExtensible (libraries: let + callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; }); + in { + + compiler-rt = callPackage ./compiler-rt.nix ({} // + (stdenv.lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; + })); + + stdenv = overrideCC stdenv buildLlvmTools.clang; + + libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; + + libcxx = callPackage ./libc++ ({} // + (stdenv.lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; + })); + + libcxxabi = callPackage ./libc++abi.nix ({} // + (stdenv.lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; + libunwind = libraries.libunwind; + })); + + openmp = callPackage ./openmp.nix {}; + + libunwind = callPackage ./libunwind.nix ({} // + (stdenv.lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; + })); + + }); + +in { inherit tools libraries; } // libraries // tools diff --git a/pkgs/development/compilers/llvm/9/fix-test-on-non-x86-like-others.patch b/pkgs/development/compilers/llvm/9/fix-test-on-non-x86-like-others.patch new file mode 100644 index 000000000000..e6c2f0406844 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/fix-test-on-non-x86-like-others.patch @@ -0,0 +1,23 @@ +Index: test/tools/gold/X86/linkonce_odr_unnamed_addr.ll +=================================================================== +diff --git a/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll b/llvm/trunk/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll +--- a/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll (revision 372333) ++++ b/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll (working copy) +@@ -3,7 +3,7 @@ + + ; RUN: opt -module-summary %s -o %t.o + ; RUN: opt -module-summary %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2.o +-; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ ++; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ + ; RUN: --plugin-opt=save-temps \ + ; RUN: %t.o %t2.o -o %t3.o + ; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s +@@ -11,7 +11,7 @@ + ; Now test when one module is a native object. In that case we must be + ; conservative and not auto hide. + ; RUN: llc %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2native.o -filetype=obj +-; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ ++; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ + ; RUN: --plugin-opt=save-temps \ + ; RUN: %t.o %t2native.o -o %t3.o + ; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s --check-prefix=NOSUMMARY diff --git a/pkgs/development/compilers/llvm/9/libc++/default.nix b/pkgs/development/compilers/llvm/9/libc++/default.nix new file mode 100644 index 000000000000..daf8ed5a9ae5 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libc++/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version +, enableShared ? true }: + +stdenv.mkDerivation { + pname = "libc++"; + inherit version; + + src = fetch "libcxx" "136j3v7il9aq8wyp48klx6sifnl5asj4lf5c8yx08cjx5fbn4h9w"; + + postUnpack = '' + unpackFile ${libcxxabi.src} + export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" + ''; + + patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch; + + preConfigure = '' + # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package + cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") + '' + lib.optionalString stdenv.hostPlatform.isMusl '' + patchShebangs utils/cat_files.py + ''; + nativeBuildInputs = [ cmake ] + ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python; + + buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ] ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" + ++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON" + ++ stdenv.lib.optional stdenv.hostPlatform.isWasm [ + "-DLIBCXX_ENABLE_THREADS=OFF" + "-DLIBCXX_ENABLE_FILESYSTEM=OFF" + "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" + ] ++ stdenv.lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; + + enableParallelBuilding = true; + + linkCxxAbi = stdenv.isLinux; + + setupHooks = [ + ../../../../../build-support/setup-hooks/role.bash + ./setup-hook.sh + ]; + + meta = { + homepage = http://libcxx.llvm.org/; + description = "A new implementation of the C++ standard library, targeting C++11"; + license = with stdenv.lib.licenses; [ ncsa mit ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh new file mode 100644 index 000000000000..6611259165ae --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh @@ -0,0 +1,6 @@ +# See pkgs/build-support/setup-hooks/role.bash +getHostRole + +linkCxxAbi="@linkCxxAbi@" +export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/9/libc++abi.nix b/pkgs/development/compilers/llvm/9/libc++abi.nix new file mode 100644 index 000000000000..7afff991e75d --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libc++abi.nix @@ -0,0 +1,67 @@ +{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version +, enableShared ? true }: + +stdenv.mkDerivation { + pname = "libc++abi"; + inherit version; + + src = fetch "libcxxabi" "1s9haplqv8ashlsdx2psxiqxh50gqk2jp2vz5yn0djb56mw42l37"; + + nativeBuildInputs = [ cmake ]; + buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + + cmakeFlags = stdenv.lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + "-DLLVM_ENABLE_LIBCXX=ON" + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" + ] ++ stdenv.lib.optionals stdenv.hostPlatform.isWasm [ + "-DLIBCXXABI_ENABLE_THREADS=OFF" + "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" + ] ++ stdenv.lib.optionals (!enableShared) [ + "-DLIBCXXABI_ENABLE_SHARED=OFF" + ]; + + patches = [ ./libcxxabi-no-threads.patch ]; + + postUnpack = '' + unpackFile ${libcxx.src} + unpackFile ${llvm.src} + cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + export TRIPLE=x86_64-apple-darwin + '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' + patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch} + '' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm '' + patch -p1 -d $(ls -d llvm-*) -i ${./libcxxabi-wasm.patch} + ''; + + installPhase = if stdenv.isDarwin + then '' + for file in lib/*.dylib; do + # this should be done in CMake, but having trouble figuring out + # the magic combination of necessary CMake variables + # if you fancy a try, take a look at + # http://www.cmake.org/Wiki/CMake_RPATH_handling + install_name_tool -id $out/$file $file + done + make install + install -d 755 $out/include + install -m 644 ../include/*.h $out/include + '' + else '' + install -d -m 755 $out/include $out/lib + install -m 644 lib/libc++abi.a $out/lib + install -m 644 ../include/cxxabi.h $out/include + '' + stdenv.lib.optionalString enableShared '' + install -m 644 lib/libc++abi.so.1.0 $out/lib + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 + ''; + + meta = { + homepage = http://libcxxabi.llvm.org/; + description = "A new implementation of low level support for a standard C++ library"; + license = with stdenv.lib.licenses; [ ncsa mit ]; + maintainers = with stdenv.lib.maintainers; [ vlstill ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/9/libcxxabi-no-threads.patch b/pkgs/development/compilers/llvm/9/libcxxabi-no-threads.patch new file mode 100644 index 000000000000..787f3e16500e --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libcxxabi-no-threads.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4138acf..41b4763 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -362,6 +362,7 @@ if (NOT LIBCXXABI_ENABLE_THREADS) + " is also set to ON.") + endif() + add_definitions(-D_LIBCXXABI_HAS_NO_THREADS) ++ add_definitions(-D_LIBCPP_HAS_NO_THREADS) + endif() + + if (LIBCXXABI_HAS_EXTERNAL_THREAD_API) diff --git a/pkgs/development/compilers/llvm/9/libcxxabi-wasm.patch b/pkgs/development/compilers/llvm/9/libcxxabi-wasm.patch new file mode 100644 index 000000000000..4ebfe46aa813 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libcxxabi-wasm.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake +index 15497d405e0..33f7f18193a 100644 +--- a/cmake/modules/HandleLLVMOptions.cmake ++++ b/cmake/modules/HandleLLVMOptions.cmake +@@ -127,7 +127,10 @@ else(WIN32) + set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) + endif() + else(FUCHSIA OR UNIX) +- MESSAGE(SEND_ERROR "Unable to determine platform") ++ if(${CMAKE_SYSTEM_NAME} MATCHES "Wasi") ++ else() ++ MESSAGE(SEND_ERROR "Unable to determine platform") ++ endif() + endif(FUCHSIA OR UNIX) + endif(WIN32) + diff --git a/pkgs/development/compilers/llvm/9/libunwind.nix b/pkgs/development/compilers/llvm/9/libunwind.nix new file mode 100644 index 000000000000..5eba9e03c782 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/libunwind.nix @@ -0,0 +1,14 @@ +{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }: + +stdenv.mkDerivation rec { + pname = "libunwind"; + inherit version; + + src = fetch pname "1chd1nz4bscrs6qa7p8sqgk5df86ll0frv0f451vhks2w44qsslp"; + + nativeBuildInputs = [ cmake ]; + + enableParallelBuilding = true; + + cmakeFlags = stdenv.lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; +} diff --git a/pkgs/development/compilers/llvm/9/lld.nix b/pkgs/development/compilers/llvm/9/lld.nix new file mode 100644 index 000000000000..c5baef4357ec --- /dev/null +++ b/pkgs/development/compilers/llvm/9/lld.nix @@ -0,0 +1,33 @@ +{ stdenv +, fetch +, cmake +, libxml2 +, llvm +, version +}: + +stdenv.mkDerivation rec { + pname = "lld"; + inherit version; + + src = fetch pname "14cgd34gr826qpxzhrkbz6qgm8ymds0hrsiznwzp42ax4f5p9iii"; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ llvm libxml2 ]; + + outputs = [ "out" "dev" ]; + + enableParallelBuilding = true; + + postInstall = '' + moveToOutput include "$dev" + moveToOutput lib "$dev" + ''; + + meta = { + description = "The LLVM Linker"; + homepage = http://lld.llvm.org/; + license = stdenv.lib.licenses.ncsa; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/9/lldb-procfs.patch b/pkgs/development/compilers/llvm/9/lldb-procfs.patch new file mode 100644 index 000000000000..b075dbaeee0a --- /dev/null +++ b/pkgs/development/compilers/llvm/9/lldb-procfs.patch @@ -0,0 +1,31 @@ +--- a/source/Plugins/Process/Linux/Procfs.h ++++ b/source/Plugins/Process/Linux/Procfs.h +@@ -11,21 +11,12 @@ + // sys/procfs.h on Android/Linux for all supported architectures. + + #include <sys/ptrace.h> ++#include <asm/ptrace.h> + +-#ifdef __ANDROID__ +-#if defined(__arm64__) || defined(__aarch64__) +-typedef unsigned long elf_greg_t; +-typedef elf_greg_t +- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))]; +-typedef struct user_fpsimd_state elf_fpregset_t; +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#elif defined(__mips__) +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#endif +-#else // __ANDROID__ ++#if !defined(__GLIBC__) && defined(__powerpc__) ++#define pt_regs musl_pt_regs ++#include <sys/procfs.h> ++#undef pt_regs ++#else + #include <sys/procfs.h> +-#endif // __ANDROID__ ++#endif diff --git a/pkgs/development/compilers/llvm/9/lldb.nix b/pkgs/development/compilers/llvm/9/lldb.nix new file mode 100644 index 000000000000..ee281384c403 --- /dev/null +++ b/pkgs/development/compilers/llvm/9/lldb.nix @@ -0,0 +1,72 @@ +{ stdenv +, fetch +, cmake +, zlib +, ncurses +, swig +, which +, libedit +, libxml2 +, llvm +, clang-unwrapped +, python +, version +, darwin +, lit +}: + +stdenv.mkDerivation rec { + pname = "lldb"; + inherit version; + + src = fetch pname "1507dl0xw03nppxpz2xsq4s30jdbkplx4w14za54ngqm3xm2yk0y"; + + patches = [ ./lldb-procfs.patch ]; + + nativeBuildInputs = [ cmake python which swig lit ]; + buildInputs = [ + ncurses + zlib + libedit + libxml2 + llvm + ] + ++ stdenv.lib.optionals stdenv.isDarwin [ + darwin.libobjc + darwin.apple_sdk.libs.xpc + darwin.apple_sdk.frameworks.Foundation + darwin.bootstrap_cmds + darwin.apple_sdk.frameworks.Carbon + darwin.apple_sdk.frameworks.Cocoa + ]; + + CXXFLAGS = "-fno-rtti"; + hardeningDisable = [ "format" ]; + + cmakeFlags = [ + "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic + "-DClang_DIR=${clang-unwrapped}/lib/cmake" + "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit" + ]; + + enableParallelBuilding = true; + + postInstall = '' + # man page + mkdir -p $out/share/man/man1 + install ../docs/lldb.1 -t $out/share/man/man1/ + + # Editor support + # vscode: + install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json + mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin + ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin + ''; + + meta = with stdenv.lib; { + description = "A next-generation high-performance debugger"; + homepage = http://llvm.org/; + license = licenses.ncsa; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/9/llvm-outputs.patch b/pkgs/development/compilers/llvm/9/llvm-outputs.patch new file mode 100644 index 000000000000..40096fa3497f --- /dev/null +++ b/pkgs/development/compilers/llvm/9/llvm-outputs.patch @@ -0,0 +1,26 @@ +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 94d426b..37f7794 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -333,6 +333,21 @@ int main(int argc, char **argv) { + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + ++ /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared ++ if (!IsInDevelopmentTree) { ++ bool WantShared = true; ++ for (int i = 1; i < argc; ++i) { ++ StringRef Arg = argv[i]; ++ if (Arg == "--link-shared") ++ WantShared = true; ++ else if (Arg == "--link-static") ++ WantShared = false; // the last one wins ++ } ++ ++ if (WantShared) ++ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX; ++ } ++ + /// We only use `shared library` mode in cases where the static library form + /// of the components provided are not available; note however that this is + /// skipped if we're run from within the build dir. However, once installed, diff --git a/pkgs/development/compilers/llvm/9/llvm.nix b/pkgs/development/compilers/llvm/9/llvm.nix new file mode 100644 index 000000000000..9bc7e1fc20ba --- /dev/null +++ b/pkgs/development/compilers/llvm/9/llvm.nix @@ -0,0 +1,182 @@ +{ stdenv +, fetch +, cmake +, python +, libffi +, libbfd +, libpfm +, libxml2 +, ncurses +, version +, release_version +, zlib +, buildPackages +, debugVersion ? false +, enableManpages ? false +, enableSharedLibraries ? true +, enablePFM ? !(stdenv.isDarwin + || stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245 +) +, enablePolly ? false +}: + +let + inherit (stdenv.lib) optional optionals optionalString; + + # Used when creating a version-suffixed symlink of libLLVM.dylib + shortVersion = with stdenv.lib; + concatStringsSep "." (take 1 (splitString "." release_version)); + +in stdenv.mkDerivation (rec { + pname = "llvm"; + inherit version; + + src = fetch pname "117ymdz1by2nkfq1c2p9m4050dp848kbjbiv6nsfj8hzy9f5d86n"; + polly_src = fetch "polly" "0cyl2gsibf1dhqvkyw1qb0f8q58ib6cihzyh4f9kj9g77ll95ym4"; + + unpackPhase = '' + unpackFile $src + mv llvm-${version}* llvm + sourceRoot=$PWD/llvm + '' + optionalString enablePolly '' + unpackFile $polly_src + mv polly-* $sourceRoot/tools/polly + ''; + + outputs = [ "out" "python" ] + ++ optional enableSharedLibraries "lib"; + + nativeBuildInputs = [ cmake python ] + ++ optionals enableManpages [ python.pkgs.sphinx python.pkgs.recommonmark ]; + + buildInputs = [ libxml2 libffi ] + ++ optional enablePFM libpfm; # exegesis + + propagatedBuildInputs = [ ncurses zlib ]; + + postPatch = optionalString stdenv.isDarwin '' + substituteInPlace cmake/modules/AddLLVM.cmake \ + --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \ + --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' "" + '' + # Patch llvm-config to return correct library path based on --link-{shared,static}. + + optionalString (enableSharedLibraries) '' + substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib + patch -p1 < ./llvm-outputs.patch + '' + '' + # FileSystem permissions tests fail with various special bits + substituteInPlace unittests/Support/CMakeLists.txt \ + --replace "Path.cpp" "" + rm unittests/Support/Path.cpp + '' + optionalString stdenv.hostPlatform.isMusl '' + patch -p1 -i ${../TLI-musl.patch} + substituteInPlace unittests/Support/CMakeLists.txt \ + --replace "add_subdirectory(DynamicLibrary)" "" + rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp + # valgrind unhappy with musl or glibc, but fails w/musl only + rm test/CodeGen/AArch64/wineh4.mir + '' + '' + patchShebangs test/BugPoint/compile-custom.ll.py + + # Fix test so that no extra locale files are needed + substituteInPlace test/tools/llvm-ar/mri-utf8.test \ + --replace en_US.UTF-8 C.UTF-8 + + # Fix x86 gold test on non-x86 platforms + # (similar fix made to others in this directory previously, FWIW) + patch -p1 -i ${./fix-test-on-non-x86-like-others.patch} + ''; + + # hacky fix: created binaries need to be run before installation + preBuild = '' + mkdir -p $out/ + ln -sv $PWD/lib $out + ''; + + cmakeFlags = with stdenv; [ + "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}" + "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc + "-DLLVM_BUILD_TESTS=ON" + "-DLLVM_ENABLE_FFI=ON" + "-DLLVM_ENABLE_RTTI=ON" + "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" + "-DLLVM_ENABLE_DUMP=ON" + ] ++ optionals enableSharedLibraries [ + "-DLLVM_LINK_LLVM_DYLIB=ON" + ] ++ optionals enableManpages [ + "-DLLVM_BUILD_DOCS=ON" + "-DLLVM_ENABLE_SPHINX=ON" + "-DSPHINX_OUTPUT_MAN=ON" + "-DSPHINX_OUTPUT_HTML=OFF" + "-DSPHINX_WARNINGS_AS_ERRORS=OFF" + ] ++ optionals (!isDarwin) [ + "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" + ] ++ optionals (isDarwin) [ + "-DLLVM_ENABLE_LIBCXX=ON" + "-DCAN_TARGET_i386=false" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "-DCMAKE_CROSSCOMPILING=True" + "-DLLVM_TABLEGEN=${buildPackages.llvm_7}/bin/llvm-tblgen" + ]; + + postBuild = '' + rm -fR $out + ''; + + preCheck = '' + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib + ''; + + postInstall = '' + mkdir -p $python/share + mv $out/share/opt-viewer $python/share/opt-viewer + '' + + optionalString enableSharedLibraries '' + moveToOutput "lib/libLLVM-*" "$lib" + moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" + substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-" + '' + + optionalString (stdenv.isDarwin && enableSharedLibraries) '' + substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib + ''; + + doCheck = stdenv.isLinux && (!stdenv.isx86_32); + + checkTarget = "check-all"; + + enableParallelBuilding = true; + + meta = { + description = "Collection of modular and reusable compiler and toolchain technologies"; + homepage = http://llvm.org/; + license = stdenv.lib.licenses.ncsa; + maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ]; + platforms = stdenv.lib.platforms.all; + }; +} // stdenv.lib.optionalAttrs enableManpages { + pname = "llvm-manpages"; + + buildPhase = '' + make docs-llvm-man + ''; + + propagatedBuildInputs = []; + + installPhase = '' + make -C docs install + ''; + + postPatch = null; + postInstall = null; + + outputs = [ "out" ]; + + doCheck = false; + + meta.description = "man pages for LLVM ${version}"; +}) diff --git a/pkgs/development/compilers/llvm/9/openmp.nix b/pkgs/development/compilers/llvm/9/openmp.nix new file mode 100644 index 000000000000..a511aed2eb8c --- /dev/null +++ b/pkgs/development/compilers/llvm/9/openmp.nix @@ -0,0 +1,26 @@ +{ stdenv +, fetch +, cmake +, llvm +, perl +, version +}: + +stdenv.mkDerivation rec { + pname = "openmp"; + inherit version; + + src = fetch pname "0nrv9np134b7c483jnq786spy3hbpj11d7g21g67cqq66c8ynycr"; + + nativeBuildInputs = [ cmake perl ]; + buildInputs = [ llvm ]; + + enableParallelBuilding = true; + + meta = { + description = "Components required to build an executable OpenMP program"; + homepage = http://openmp.llvm.org/; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/llvm/9/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/9/sanitizers-nongnu.patch new file mode 100644 index 000000000000..1f2ac97818eb --- /dev/null +++ b/pkgs/development/compilers/llvm/9/sanitizers-nongnu.patch @@ -0,0 +1,412 @@ +From f7a253f8f85d0f49df6b73996737a3e84ac64236 Mon Sep 17 00:00:00 2001 +From: Will Dietz <w@wdtz.org> +Date: Mon, 24 Sep 2018 11:17:25 -0500 +Subject: [PATCH] Ported to 7.0, taken from gentoo-musl project. + +------ +Ported to compiler-rt-sanitizers-5.0.0. Taken from + +https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch +Signed-off-by: Jory A. Pratt <anarchy@gentoo.org> + +Taken from gentoo-musl project, with a few additional minor fixes. +--- + lib/asan/asan_linux.cc | 4 +- + lib/interception/interception_linux.cc | 2 +- + lib/interception/interception_linux.h | 2 +- + lib/msan/msan_linux.cc | 2 +- + lib/sanitizer_common/sanitizer_allocator.cc | 2 +- + .../sanitizer_common_interceptors_ioctl.inc | 4 +- + .../sanitizer_common_syscalls.inc | 2 +- + lib/sanitizer_common/sanitizer_linux.cc | 8 +++- + .../sanitizer_linux_libcdep.cc | 10 ++--- + lib/sanitizer_common/sanitizer_platform.h | 6 +++ + .../sanitizer_platform_interceptors.h | 4 +- + .../sanitizer_platform_limits_posix.cc | 37 +++++++++++-------- + lib/tsan/rtl/tsan_platform_linux.cc | 2 +- + 13 files changed, 51 insertions(+), 34 deletions(-) + +diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc +index 625f32d40..73cf77aca 100644 +--- a/lib/asan/asan_linux.cc ++++ b/lib/asan/asan_linux.cc +@@ -46,7 +46,7 @@ + #include <link.h> + #endif + +-#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS ++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU + #include <ucontext.h> + extern "C" void* _DYNAMIC; + #elif SANITIZER_NETBSD +@@ -139,7 +139,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { + UNIMPLEMENTED(); + } + +-#if SANITIZER_ANDROID ++#if SANITIZER_ANDROID || SANITIZER_NONGNU + // FIXME: should we do anything for Android? + void AsanCheckDynamicRTPrereqs() {} + void AsanCheckIncompatibleRT() {} +diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc +index 26bfcd8f6..529b234f7 100644 +--- a/lib/interception/interception_linux.cc ++++ b/lib/interception/interception_linux.cc +@@ -43,7 +43,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, + } + + // Android and Solaris do not have dlvsym +-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD ++#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD && !SANITIZER_NONGNU + void *GetFuncAddrVer(const char *func_name, const char *ver) { + return dlvsym(RTLD_NEXT, func_name, ver); + } +diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h +index 942c25609..24a4d5080 100644 +--- a/lib/interception/interception_linux.h ++++ b/lib/interception/interception_linux.h +@@ -36,7 +36,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver); + (::__interception::uptr) & WRAP(func)) + + // Android, Solaris and OpenBSD do not have dlvsym +-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD ++#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD && !SANITIZER_NONGNU + #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ + (::__interception::real_##func = (func##_f)( \ + unsigned long)::__interception::GetFuncAddrVer(#func, symver)) +diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc +index 385a650c4..6e30a8ce9 100644 +--- a/lib/msan/msan_linux.cc ++++ b/lib/msan/msan_linux.cc +@@ -13,7 +13,7 @@ + //===----------------------------------------------------------------------===// + + #include "sanitizer_common/sanitizer_platform.h" +-#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD ++#if SANITIZER_FREEBSD || (SANITIZER_LINUX && !SANITIZER_NONGNU) || SANITIZER_NETBSD + + #include "msan.h" + #include "msan_report.h" +diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc +index 6bfd5e5ee..048f6154f 100644 +--- a/lib/sanitizer_common/sanitizer_allocator.cc ++++ b/lib/sanitizer_common/sanitizer_allocator.cc +@@ -27,7 +27,7 @@ const char *SecondaryAllocatorName = "LargeMmapAllocator"; + + // ThreadSanitizer for Go uses libc malloc/free. + #if SANITIZER_GO || defined(SANITIZER_USE_MALLOC) +-# if SANITIZER_LINUX && !SANITIZER_ANDROID ++# if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + extern "C" void *__libc_malloc(uptr size); + # if !SANITIZER_GO + extern "C" void *__libc_memalign(uptr alignment, uptr size); +diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +index 2d633c173..b6eb23116 100644 +--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -104,7 +104,7 @@ static void ioctl_table_fill() { + _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); + #endif + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + // Conflicting request ids. + // _(CDROMAUDIOBUFSIZ, NONE, 0); + // _(SNDCTL_TMR_CONTINUE, NONE, 0); +@@ -365,7 +365,7 @@ static void ioctl_table_fill() { + _(VT_WAITACTIVE, NONE, 0); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE + _(CYGETDEFTHRESH, WRITE, sizeof(int)); + _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc +index 469c8eb7e..24f87867d 100644 +--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc ++++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc +@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) { + } + } + +-#if !SANITIZER_ANDROID ++#if !SANITIZER_ANDROID && !SANITIZER_NONGNU + PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, + void *old_rlim) { + if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); +diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc +index 96d6c1eff..9e2b7fb9d 100644 +--- a/lib/sanitizer_common/sanitizer_linux.cc ++++ b/lib/sanitizer_common/sanitizer_linux.cc +@@ -541,13 +541,13 @@ const char *GetEnv(const char *name) { + #endif + } + +-#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_OPENBSD ++#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_NONGNU + extern "C" { + SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end; + } + #endif + +-#if !SANITIZER_GO && !SANITIZER_FREEBSD && !SANITIZER_NETBSD && \ ++#if (!SANITIZER_GO || SANITIZER_NONGNU) && !SANITIZER_FREEBSD && !SANITIZER_NETBSD && \ + !SANITIZER_OPENBSD + static void ReadNullSepFileToArray(const char *path, char ***arr, + int arr_size) { +@@ -590,6 +590,10 @@ static void GetArgsAndEnv(char ***argv, char ***envp) { + #elif SANITIZER_NETBSD + *argv = __ps_strings->ps_argvstr; + *envp = __ps_strings->ps_envstr; ++#elif SANITIZER_NONGNU ++ static const int kMaxArgv = 2000, kMaxEnvp = 2000; ++ ReadNullSepFileToArray("/proc/self/cmdline", argv, kMaxArgv); ++ ReadNullSepFileToArray("/proc/self/environ", envp, kMaxEnvp); + #else // SANITIZER_FREEBSD + #if !SANITIZER_GO + if (&__libc_stack_end) { +diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc +index 4962ff832..438f94dbe 100644 +--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc ++++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc +@@ -179,7 +179,7 @@ __attribute__((unused)) static bool GetLibcVersion(int *major, int *minor, + } + + #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \ +- !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_SOLARIS ++ !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_SOLARIS && !SANITIZER_NONGNU + static uptr g_tls_size; + + #ifdef __i386__ +@@ -261,7 +261,7 @@ void InitTlsSize() { } + #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) || \ + defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) || \ + defined(__arm__)) && \ +- SANITIZER_LINUX && !SANITIZER_ANDROID ++ SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // sizeof(struct pthread) from glibc. + static atomic_uintptr_t thread_descriptor_size; + +@@ -426,7 +426,7 @@ int GetSizeFromHdr(struct dl_phdr_info *info, size_t size, void *data) { + + #if !SANITIZER_GO + static void GetTls(uptr *addr, uptr *size) { +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + # if defined(__x86_64__) || defined(__i386__) || defined(__s390__) + *addr = ThreadSelf(); + *size = GetTlsSize(); +@@ -470,7 +470,7 @@ static void GetTls(uptr *addr, uptr *size) { + #elif SANITIZER_OPENBSD + *addr = 0; + *size = 0; +-#elif SANITIZER_ANDROID ++#elif SANITIZER_ANDROID || SANITIZER_NONGNU + *addr = 0; + *size = 0; + #elif SANITIZER_SOLARIS +@@ -486,7 +486,7 @@ static void GetTls(uptr *addr, uptr *size) { + #if !SANITIZER_GO + uptr GetTlsSize() { + #if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NETBSD || \ +- SANITIZER_OPENBSD || SANITIZER_SOLARIS ++ SANITIZER_OPENBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU + uptr addr, size; + GetTls(&addr, &size); + return size; +diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h +index d81e25580..e10680ac8 100644 +--- a/lib/sanitizer_common/sanitizer_platform.h ++++ b/lib/sanitizer_common/sanitizer_platform.h +@@ -208,6 +208,12 @@ + # define SANITIZER_SOLARIS32 0 + #endif + ++#if defined(__linux__) && !defined(__GLIBC__) ++# define SANITIZER_NONGNU 1 ++#else ++# define SANITIZER_NONGNU 0 ++#endif ++ + #if defined(__myriad2__) + # define SANITIZER_MYRIAD2 1 + #else +diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h +index f95539a73..6c53b3415 100644 +--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h ++++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h +@@ -39,7 +39,7 @@ + # include "sanitizer_platform_limits_solaris.h" + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + # define SI_LINUX_NOT_ANDROID 1 + #else + # define SI_LINUX_NOT_ANDROID 0 +@@ -322,7 +322,7 @@ + #define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID) + #define SANITIZER_INTERCEPT_SHMCTL \ + (SI_NETBSD || SI_OPENBSD || SI_SOLARIS || \ +- ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \ ++ ((SI_FREEBSD || SI_LINUX_NOT_ANDROID || SANITIZER_NONGNU) && \ + SANITIZER_WORDSIZE == 64)) // NOLINT + #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID + #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX +diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +index 54da635d7..2f6ff69c3 100644 +--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -14,6 +14,9 @@ + + #include "sanitizer_platform.h" + ++// Workaround musl <--> linux conflicting definition of 'struct sysinfo' ++#define _LINUX_SYSINFO_H ++ + #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC + // Tests in this file assume that off_t-dependent data structures match the + // libc ABI. For example, struct dirent here is what readdir() function (as +@@ -138,12 +141,14 @@ typedef struct user_fpregs elf_fpregset_t; + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + #include <glob.h> +-#include <obstack.h> ++# if !SANITIZER_NONGNU ++# include <obstack.h> ++# endif + #include <mqueue.h> +-#include <net/if_ppp.h> +-#include <netax25/ax25.h> +-#include <netipx/ipx.h> +-#include <netrom/netrom.h> ++#include <linux/if_ppp.h> ++#include <linux/ax25.h> ++#include <linux/ipx.h> ++#include <linux/netrom.h> + #if HAVE_RPC_XDR_H + # include <rpc/xdr.h> + #elif HAVE_TIRPC_RPC_XDR_H +@@ -251,7 +256,7 @@ namespace __sanitizer { + unsigned struct_itimerspec_sz = sizeof(struct itimerspec); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which + // has been removed from glibc 2.28. + #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ +@@ -322,7 +327,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); + unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + #endif + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + int glob_nomatch = GLOB_NOMATCH; + int glob_altdirfunc = GLOB_ALTDIRFUNC; + #endif +@@ -416,7 +421,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned struct_termios_sz = sizeof(struct termios); + unsigned struct_winsize_sz = sizeof(struct winsize); + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + unsigned struct_arpreq_sz = sizeof(struct arpreq); + unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); + unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); +@@ -466,7 +471,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned struct_vt_mode_sz = sizeof(struct vt_mode); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); + unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) +@@ -834,7 +839,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; + unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; + unsigned IOCTL_CYGETMON = CYGETMON; +@@ -989,7 +994,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr); + CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + CHECK_TYPE_SIZE(glob_t); + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc); + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv); +@@ -1023,6 +1028,7 @@ CHECK_TYPE_SIZE(iovec); + CHECK_SIZE_AND_OFFSET(iovec, iov_base); + CHECK_SIZE_AND_OFFSET(iovec, iov_len); + ++#if !SANITIZER_NONGNU + CHECK_TYPE_SIZE(msghdr); + CHECK_SIZE_AND_OFFSET(msghdr, msg_name); + CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen); +@@ -1036,6 +1042,7 @@ CHECK_TYPE_SIZE(cmsghdr); + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len); + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level); + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); ++#endif + + #ifndef __GLIBC_PREREQ + #define __GLIBC_PREREQ(x, y) 0 +@@ -1145,7 +1152,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno); + + CHECK_TYPE_SIZE(ether_addr); + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + CHECK_TYPE_SIZE(ipc_perm); + # if SANITIZER_FREEBSD + CHECK_SIZE_AND_OFFSET(ipc_perm, key); +@@ -1206,7 +1213,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr); + CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data); + #endif + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo)); + #endif + +@@ -1256,7 +1263,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE); + COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE)); + CHECK_SIZE_AND_OFFSET(FILE, _flags); + CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr); +@@ -1275,7 +1282,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain); + CHECK_SIZE_AND_OFFSET(FILE, _fileno); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk)); + CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit); + CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev); +diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc +index de989b780..51a97b554 100644 +--- a/lib/tsan/rtl/tsan_platform_linux.cc ++++ b/lib/tsan/rtl/tsan_platform_linux.cc +@@ -294,7 +294,7 @@ void InitializePlatform() { + // This is required to properly "close" the fds, because we do not see internal + // closes within glibc. The code is a pure hack. + int ExtractResolvFDs(void *state, int *fds, int nfd) { +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + int cnt = 0; + struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { +-- +2.19.0 + diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 4228c368e566..129b8ca4dd8a 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -1,15 +1,15 @@ # based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml -{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-11_x, openssl, pcre, readline, +{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils, sqlite }: stdenv.mkDerivation rec { pname = "nim"; - version = "0.20.2"; + version = "1.0.0"; src = fetchurl { url = "https://nim-lang.org/download/${pname}-${version}.tar.xz"; - sha256 = "0pibil10x0c181kw705phlwk8bn8dy5ghqd9h9fm6i9afrz5ryp1"; + sha256 = "1pg0lxahis8zfk6rdzdj281bahl8wglpjgngkc4vg1pc9p61fj03"; }; doCheck = !stdenv.isDarwin; @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { # as part of building it, so it cannot be read-only checkInputs = [ - nodejs-slim-11_x tzdata coreutils + nodejs-slim tzdata coreutils ]; nativeBuildInputs = [ @@ -64,9 +64,6 @@ stdenv.mkDerivation rec { substituteInPlace ./tests/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin" substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" - # reported upstream: https://github.com/nim-lang/Nim/issues/11435 - ${disableTest} ./tests/misc/tstrace.nim - # runs out of memory on a machine with 8GB RAM ${disableTest} ./tests/system/t7894.nim @@ -80,11 +77,20 @@ stdenv.mkDerivation rec { ${disableCompile} ./lib/nimhcr.nim ${disableTest} ./tests/dll/nimhcr_unit.nim ${disableTest} ./tests/dll/nimhcr_integration.nim + + # reported upstream: https://github.com/nim-lang/Nim/issues/12262 + ${disableTest} ./tests/range/tcompiletime_range_checks.nim + + # requires "immintrin.h" which is available only on x86 + ${disableTest} ./tests/misc/tsizeof3.nim ''; checkPhase = '' runHook preCheck + # Fortify hardening breaks tests + # https://github.com/nim-lang/Nim/issues/11435#issuecomment-534545696 + NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} \ ./koch tests --nim:bin/nim all runHook postCheck @@ -97,7 +103,10 @@ stdenv.mkDerivation rec { ./koch install $out mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin mv $out/nim/* $out/ && rmdir $out/nim + + # Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds. wrapProgram $out/bin/nim \ + --run 'NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}' \ --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]} runHook postInstall @@ -107,7 +116,7 @@ stdenv.mkDerivation rec { description = "Statically typed, imperative programming language"; homepage = "https://nim-lang.org/"; license = licenses.mit; - maintainers = with maintainers; [ ehmry peterhoeg ]; + maintainers = with maintainers; [ ehmry ]; platforms = with platforms; linux ++ darwin; # arbitrary }; } diff --git a/pkgs/development/compilers/openjdk/openjfx/11.nix b/pkgs/development/compilers/openjdk/openjfx/11.nix index 9e6d30efda81..43fe8ed83876 100644 --- a/pkgs/development/compilers/openjdk/openjfx/11.nix +++ b/pkgs/development/compilers/openjdk/openjfx/11.nix @@ -83,6 +83,9 @@ in makePackage { cp -r build/modular-sdk $out ''; + # glib-2.62 deprecations + NIX_CFLAGS_COMPILE = [ "-DGLIB_DISABLE_DEPRECATION_WARNINGS" ]; + stripDebugList = [ "." ]; postFixup = '' diff --git a/pkgs/development/compilers/openjdk/openjfx/12.nix b/pkgs/development/compilers/openjdk/openjfx/12.nix index 418c58ac683e..356ac4800d9f 100644 --- a/pkgs/development/compilers/openjdk/openjfx/12.nix +++ b/pkgs/development/compilers/openjdk/openjfx/12.nix @@ -83,6 +83,9 @@ in makePackage { cp -r build/modular-sdk $out ''; + # glib-2.62 deprecations + NIX_CFLAGS_COMPILE = [ "-DGLIB_DISABLE_DEPRECATION_WARNINGS" ]; + stripDebugList = [ "." ]; postFixup = '' diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index 43a72985ddec..7b774d066b7f 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -3,16 +3,16 @@ let # Note: the version MUST be one version prior to the version we're # building - version = "1.36.0"; + version = "1.37.0"; - # fetch hashes by running `print-hashes.sh 1.36.0` + # fetch hashes by running `print-hashes.sh 1.37.0` hashes = { - i686-unknown-linux-gnu = "9f95c3e96622a792858c8a1c9274fa63e6992370493b27c1ac7299a3bec5156d"; - x86_64-unknown-linux-gnu = "15e592ec52f14a0586dcebc87a957e472c4544e07359314f6354e2b8bd284c55"; - armv7-unknown-linux-gnueabihf = "798181a728017068f9eddfa665771805d97846cd87bddcd67e0fe27c8d082ceb"; - aarch64-unknown-linux-gnu = "db78c24d93756f9fe232f081dbc4a46d38f8eec98353a9e78b9b164f9628042d"; - i686-apple-darwin = "3dbc34fdea8bc030badf9c8b2572c09fd3f5369b59ac099fc521064b390b9e60"; - x86_64-apple-darwin = "91f151ec7e24f5b0645948d439fc25172ec4012f0584dd16c3fb1acb709aa325"; + i686-unknown-linux-gnu = "74510e0e52a55e65a9f716673c2cda4d2bd427e2453541c6993c77c3ec04acf9"; + x86_64-unknown-linux-gnu = "cb573229bfd32928177c3835fdeb62d52da64806b844bc1095c6225b0665a1cb"; + armv7-unknown-linux-gnueabihf = "5b87b877f0ed20c6a09ce26e7a15d8c61b26b62484b97e78a51099d0efefec98"; + aarch64-unknown-linux-gnu = "263ef98fa3a6b2911b56f89c06615cdebf6ef676eb9b2493ad1539602f79b6ba"; + i686-apple-darwin = "e45d0c4d882fc6c404ffa6fe790294f4ea96384a2b48804adbf723f3635477a8"; + x86_64-apple-darwin = "b2310c97ffb964f253c4088c8d29865f876a49da2a45305493af5b5c7a3ca73d"; }; platform = diff --git a/pkgs/development/compilers/rust/patches/net-tcp-disable-tests.patch b/pkgs/development/compilers/rust/patches/net-tcp-disable-tests.patch deleted file mode 100644 index 583a6027f83a..000000000000 --- a/pkgs/development/compilers/rust/patches/net-tcp-disable-tests.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -ru rustc-1.36.0-src-orig/src/libstd/net/tcp.rs rustc-1.36.0-src/src/libstd/net/tcp.rs ---- rustc-1.36.0-src-orig/src/libstd/net/tcp.rs 2019-07-03 10:00:00.000000000 +0200 -+++ rustc-1.36.0-src/src/libstd/net/tcp.rs 2019-07-07 11:33:35.378130207 +0200 -@@ -973,6 +973,7 @@ - } - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - fn listen_localhost() { - let socket_addr = next_test_ip4(); -@@ -1031,6 +1032,7 @@ - }) - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - fn read_eof() { - each_ip(&mut |addr| { -@@ -1050,6 +1052,7 @@ - }) - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - fn write_close() { - each_ip(&mut |addr| { -@@ -1076,6 +1079,7 @@ - }) - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - fn multiple_connect_serial() { - each_ip(&mut |addr| { -@@ -1098,6 +1102,7 @@ - }) - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - fn multiple_connect_interleaved_greedy_schedule() { - const MAX: usize = 10; -@@ -1134,6 +1139,7 @@ - } - - #[test] -+ #[cfg_attr(target_os = "macos", ignore)] - fn multiple_connect_interleaved_lazy_schedule() { - const MAX: usize = 10; - each_ip(&mut |addr| { -@@ -1467,6 +1473,7 @@ - } - - #[test] -+ #[cfg_attr(target_os = "macos", ignore)] - fn clone_while_reading() { - each_ip(&mut |addr| { - let accept = t!(TcpListener::bind(&addr)); -@@ -1597,7 +1604,7 @@ - - // FIXME: re-enabled openbsd tests once their socket timeout code - // no longer has rounding errors. -- #[cfg_attr(any(target_os = "netbsd", target_os = "openbsd"), ignore)] -+ #[cfg_attr(any(target_os = "netbsd", target_os = "openbsd", target_os = "macos"), ignore)] - #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31 - #[test] - fn timeouts() { -@@ -1643,6 +1650,7 @@ - drop(listener); - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31 - fn test_read_with_timeout() { -@@ -1687,6 +1695,7 @@ - drop(listener); - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - #[cfg_attr(target_env = "sgx", ignore)] - fn nodelay() { -@@ -1719,6 +1728,7 @@ - assert_eq!(ttl, t!(stream.ttl())); - } - -+ #[cfg_attr(target_os = "macos", ignore)] - #[test] - #[cfg_attr(target_env = "sgx", ignore)] - fn set_nonblocking() { diff --git a/pkgs/development/compilers/rust/patches/stdsimd-disable-doctest.patch b/pkgs/development/compilers/rust/patches/stdsimd-disable-doctest.patch deleted file mode 100644 index 6ef7fd0f7ce4..000000000000 --- a/pkgs/development/compilers/rust/patches/stdsimd-disable-doctest.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/stdsimd/coresimd/x86/mod.rs b/src/stdsimd/coresimd/x86/mod.rs -index 32915c332..7cb54f31e 100644 ---- a/src/stdsimd/coresimd/x86/mod.rs -+++ b/src/stdsimd/coresimd/x86/mod.rs -@@ -279,7 +279,6 @@ types! { - /// - /// # Examples - /// -- /// ``` - /// # #![feature(cfg_target_feature, target_feature, stdsimd)] - /// # #![cfg_attr(not(dox), no_std)] - /// # #[cfg(not(dox))] -@@ -301,7 +300,6 @@ types! { - /// # } - /// # if is_x86_feature_detected!("sse") { unsafe { foo() } } - /// # } -- /// ``` - pub struct __m256(f32, f32, f32, f32, f32, f32, f32, f32); - - /// 256-bit wide set of four `f64` types, x86-specific diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index daf7af1babdc..27336aa501b5 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -1,7 +1,8 @@ { stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget -, fetchurl, file, python2, tzdata, ps -, llvmPackages_7, darwin, git, cmake, rustPlatform -, which, libffi, gdb +, fetchurl, file, python2 +, llvm_7, darwin, git, cmake, rustPlatform +, pkgconfig, openssl +, which, libffi , withBundledLLVM ? false }: @@ -9,31 +10,21 @@ let inherit (stdenv.lib) optional optionalString; inherit (darwin.apple_sdk.frameworks) Security; - llvmPackages = llvmPackages_7; - - llvmSharedForBuild = pkgsBuildBuild.llvmPackages.llvm.override { enableSharedLibraries = true; }; - llvmSharedForHost = pkgsBuildHost.llvmPackages.llvm.override { enableSharedLibraries = true; }; - llvmSharedForTarget = pkgsBuildTarget.llvmPackages.llvm.override { enableSharedLibraries = true; }; + llvmSharedForBuild = pkgsBuildBuild.llvm_7.override { enableSharedLibraries = true; }; + llvmSharedForHost = pkgsBuildHost.llvm_7.override { enableSharedLibraries = true; }; + llvmSharedForTarget = pkgsBuildTarget.llvm_7.override { enableSharedLibraries = true; }; # For use at runtime - llvmShared = llvmPackages.llvm.override { enableSharedLibraries = true; }; -in - -stdenv.mkDerivation rec { + llvmShared = llvm_7.override { enableSharedLibraries = true; }; +in stdenv.mkDerivation rec { pname = "rustc"; - version = "1.37.0"; + version = "1.38.0"; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"; + sha256 = "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4"; }; - # Provide the compiler-rt sources needed for profiling. - preConfigure = '' - mkdir src/llvm-project/compiler-rt - tar xf ${llvmPackages.compiler-rt.src} -C src/llvm-project/compiler-rt --strip-components=1 - ''; - __darwinAllowLocalNetworking = true; # rustc complains about modified source files otherwise @@ -107,18 +98,6 @@ stdenv.mkDerivation rec { --replace 'BOOTSTRAP_ARGS :=' 'BOOTSTRAP_ARGS := --jobs $(NIX_BUILD_CORES)' ''; - patches = [ - ./patches/net-tcp-disable-tests.patch - - # Re-evaluate if this we need to disable this one - #./patches/stdsimd-disable-doctest.patch - - # Fails on hydra - not locally; the exact reason is unknown. - # Comments in the test suggest that some non-reproducible environment - # variables such $RANDOM can make it fail. - # ./patches/disable-test-inherit-env.patch - ]; - # the rust build system complains that nix alters the checksums dontFixLibtool = true; @@ -131,74 +110,26 @@ stdenv.mkDerivation rec { sed -i configure \ -e '/probe_need CFG_CURL curl/d' - # On Hydra: `TcpListener::bind(&addr)`: Address already in use (os error 98)' - sed '/^ *fn fast_rebind()/i#[ignore]' -i src/libstd/net/tcp.rs - - # https://github.com/rust-lang/rust/issues/39522 - echo removing gdb-version-sensitive tests... - find src/test/debuginfo -type f -execdir grep -q ignore-gdb-version '{}' \; -print -delete - rm src/test/debuginfo/{borrowed-c-style-enum.rs,c-style-enum-in-composite.rs,gdb-pretty-struct-and-enums.rs,generic-enum-with-different-disr-sizes.rs} - # Useful debugging parameter # export VERBOSE=1 - '' + optionalString stdenv.isDarwin '' - # Disable all lldb tests. - # error: Can't run LLDB test because LLDB's python path is not set - rm -vr src/test/debuginfo/* - rm -v src/test/run-pass/backtrace-debuginfo.rs || true - - # error: No such file or directory - rm -v src/test/ui/run-pass/issues/issue-45731.rs || true - - # Disable tests that fail when sandboxing is enabled. - substituteInPlace src/libstd/sys/unix/ext/net.rs \ - --replace '#[test]' '#[test] #[ignore]' - substituteInPlace src/test/run-pass/env-home-dir.rs \ - --replace 'home_dir().is_some()' true - rm -v src/test/run-pass/fds-are-cloexec.rs || true # FIXME: pipes? - rm -v src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs || true # FIXME: ??? ''; # rustc unfortunately needs cmake to compile llvm-rt but doesn't # use it for the normal build. This disables cmake in Nix. dontUseCmakeConfigure = true; - # ps is needed for one of the test cases nativeBuildInputs = [ - file python2 ps rustPlatform.rust.rustc git cmake - which libffi removeReferencesTo - ] # Only needed for the debuginfo tests - ++ optional (!stdenv.isDarwin) gdb; + file python2 rustPlatform.rust.rustc git cmake + which libffi removeReferencesTo pkgconfig + ]; - buildInputs = optional stdenv.isDarwin Security + buildInputs = [ openssl ] + ++ optional stdenv.isDarwin Security ++ optional (!withBundledLLVM) llvmShared; outputs = [ "out" "man" "doc" ]; setOutputFlags = false; - # Disable codegen units and hardening for the tests. - preCheck = '' - export RUSTFLAGS= - export TZDIR=${tzdata}/share/zoneinfo - export hardeningDisable=all - '' + - # Ensure TMPDIR is set, and disable a test that removing the HOME - # variable from the environment falls back to another home - # directory. - optionalString stdenv.isDarwin '' - export TMPDIR=/tmp - sed -i '28s/home_dir().is_some()/true/' ./src/test/run-pass/env-home-dir.rs - ''; - - # 1. Upstream is not running tests on aarch64: - # see https://github.com/rust-lang/rust/issues/49807#issuecomment-380860567 - # So we do the same. - # 2. Tests run out of memory for i686 - #doCheck = !stdenv.isAarch64 && !stdenv.isi686; - - # Disabled for now; see https://github.com/NixOS/nixpkgs/pull/42348#issuecomment-402115598. - doCheck = false; - # remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so # and thus a transitive dependency on ncurses postInstall = '' diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix index 15ed7f8bd29d..9714a8ebd505 100644 --- a/pkgs/development/compilers/vala/default.nix +++ b/pkgs/development/compilers/vala/default.nix @@ -22,27 +22,20 @@ let }; in { - "0.38" = fp { - commit = "2c290f7253bba5ceb0d32e7d0b0ec0d0e81cc263"; - sha256 = "056ybapfx18d7xw1k8k85nsjrc26qk2q2d9v9nz2zrcwbq5brhkp"; - }; # NOTE: the openembedded-core project doesn't have a patch for 0.40.12 # We've fixed the single merge conflict in the following patch. # 0.40.12: https://github.com/openembedded/openembedded-core/raw/8553c52f174af4c8c433c543f806f5ed5c1ec48c/meta/recipes-devtools/vala/vala/disable-graphviz.patch "0.40" = ./disable-graphviz-0.40.12.patch; - "0.42" = fp { - commit = "f2b4f9ec6f44dced7f88df849cca68961419eeb8"; - sha256 = "112qhdzix0d7lfpfcam1cxprzmfzpwypb1226m5ma1vq9qy0sn7g"; - }; - # NOTE: the openembedded-core project doesn't have a patch for 0.44.1 # We've reverted the addition of the "--disable-valadoc" option # and then applied the following patch. # 0.42.4: https://github.com/openembedded/openembedded-core/raw/f2b4f9ec6f44dced7f88df849cca68961419eeb8/meta/recipes-devtools/vala/vala/disable-graphviz.patch "0.44" = ./disable-graphviz-0.44.3.patch; + "0.46" = ./disable-graphviz-0.46.1.patch; + }.${lib.versions.majorMinor version} or (throw "no graphviz patch for this version of vala"); disableGraphviz = lib.versionAtLeast version "0.38" && !withGraphviz; @@ -108,14 +101,8 @@ let in rec { vala_0_36 = generic { - version = "0.36.19"; - sha256 = "05si2f4zjvq0q3wqfh1wxdq20jy1xqxq2skqh8vfh2jyp355lwar"; - }; - - vala_0_38 = generic { - version = "0.38.10"; - sha256 = "1rdwwqs973qv225v8b5izcgwvqn56jxgr4pa3wxxbliar3aww5sw"; - extraNativeBuildInputs = [ autoconf ] ++ lib.optional stdenv.isDarwin libtool; + version = "0.36.20"; + sha256 = "19v7zjhr9yxkh9lxg46n9gjr0lb7j6v0xqfhrdvgz18xhj3hm5my"; }; vala_0_40 = generic { @@ -123,15 +110,15 @@ in rec { sha256 = "0vv25fmr9jqiqf080vak1x4raa4w3cz3n5ysjglqsq9qfx304i7b"; }; - vala_0_42 = generic { - version = "0.42.7"; - sha256 = "029ksbsdpl581wzy570kj4kkw8b4bizgh494c051zsvkwck55p83"; + vala_0_44 = generic { + version = "0.44.7"; + sha256 = "0z5xy4qc95rm2gj7s2k14xm1xp3mrf0yz64fx4kddqjxkpsz87xz"; }; - vala_0_44 = generic { - version = "0.44.6"; - sha256 = "0fkrrpnisgq3y816piyr7hm2b94jaj7ki9y974galq3lmxb1g7xb"; + vala_0_46 = generic { + version = "0.46.1"; + sha256 = "10czkhclnisdz6k5qfiicmvx47m9177l5dkhjn29g43khnmpkr8l"; }; - vala = vala_0_44; + vala = vala_0_46; } diff --git a/pkgs/development/compilers/vala/disable-graphviz-0.46.1.patch b/pkgs/development/compilers/vala/disable-graphviz-0.46.1.patch new file mode 100644 index 000000000000..8c3e54b6a959 --- /dev/null +++ b/pkgs/development/compilers/vala/disable-graphviz-0.46.1.patch @@ -0,0 +1,261 @@ +diff --git a/Makefile.am b/Makefile.am +index f70234759..b3d6c3833 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -13,19 +13,9 @@ SUBDIRS = \ + doc \ + gobject-introspection \ + vapigen \ +- $(NULL) +- +-if ENABLE_VALADOC +-SUBDIRS += \ + libvaladoc \ + valadoc \ + $(NULL) +-endif +- +-DISTCHECK_CONFIGURE_FLAGS = \ +- --enable-valadoc \ +- --enable-unversioned \ +- $(NULL) + + if ENABLE_UNVERSIONED + aclocaldir = $(datadir)/aclocal +diff --git a/configure.ac b/configure.ac +index 6de326bbb..91f159b16 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -160,10 +160,11 @@ AC_SUBST(GMODULE_CFLAGS) + AC_SUBST(GMODULE_LIBS) + + AC_ARG_WITH(cgraph, AS_HELP_STRING([--with-cgraph], [Required flag for cross-compilation to define capability of graphviz]), [], with_cgraph=check) +-AC_ARG_ENABLE(valadoc, AS_HELP_STRING([--disable-valadoc], [Disable valadoc]), enable_valadoc=$enableval, enable_valadoc=yes) +-if test x$enable_valadoc = xyes; then ++AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--disable-graphviz], [Disable graphviz usage for valadoc]), enable_graphviz=$enableval, enable_graphviz=yes) ++if test x$enable_graphviz = xyes; then + PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED) + AC_MSG_CHECKING([for CGRAPH]) ++ VALAFLAGS="$VALAFLAGS -D HAVE_GRAPHVIZ" + cgraph_tmp_LIBADD="$LIBADD" + cgraph_tmp_CFLAGS="$CFLAGS" + LIBADD="$LIBADD $LIBGVC_LIBS" +@@ -201,8 +202,8 @@ if test x$enable_valadoc = xyes; then + LIBADD="$cgraph_tmp_LIBADD" + CFLAGS="$cgraph_tmp_CFLAGS" + fi ++AM_CONDITIONAL(ENABLE_GRAPHVIZ, test x$enable_graphviz = xyes) + AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes") +-AM_CONDITIONAL(ENABLE_VALADOC, test x$enable_valadoc = xyes) + + AC_PATH_PROG([XSLTPROC], [xsltproc], :) + AM_CONDITIONAL(HAVE_XSLTPROC, test "$XSLTPROC" != :) +diff --git a/doc/Makefile.am b/doc/Makefile.am +index d2684a0e0..b343c7c10 100644 +--- a/doc/Makefile.am ++++ b/doc/Makefile.am +@@ -6,16 +6,11 @@ SUBDIRS = \ + + dist_man_MANS = \ + valac.1 \ ++ valadoc.1 \ + vala-gen-introspect.1 \ + vapigen.1 \ + $(NULL) + +-if ENABLE_VALADOC +-dist_man_MANS += \ +- valadoc.1 \ +- $(NULL) +-endif +- + EXTRA_DIST = \ + valac.h2m \ + valadoc.h2m \ +@@ -24,11 +19,7 @@ EXTRA_DIST = \ + $(NULL) + + if HAVE_HELP2MAN +-if ENABLE_VALADOC + manpages: valac.1 valadoc.1 vala-gen-introspect.1 vapigen.1 +-else +-manpages: valac.1 vala-gen-introspect.1 vapigen.1 +-endif + @rm $^ + $(MAKE) $(AM_MAKEFLAGS) $^ + +@@ -37,13 +28,11 @@ valac.1: + --include $(srcdir)/valac.h2m \ + --libtool --no-info \ + --output=$@ +-if ENABLE_VALADOC + valadoc.1: + $(HELP2MAN) $(top_builddir)/valadoc/valadoc \ + --include $(srcdir)/valadoc.h2m \ + --libtool --no-info \ + --output=$@ +-endif + vala-gen-introspect.1: + $(HELP2MAN) $(top_builddir)/gobject-introspection/gen-introspect \ + --include $(srcdir)/vala-gen-introspect.h2m \ +@@ -60,15 +49,12 @@ endif + if ENABLE_UNVERSIONED + install-data-hook: + cd $(DESTDIR)$(man1dir) && $(LN_S) -f valac@PACKAGE_SUFFIX@.1 valac.1 +-if ENABLE_VALADOC + cd $(DESTDIR)$(man1dir) && $(LN_S) -f valadoc@PACKAGE_SUFFIX@.1 valadoc.1 +-endif + cd $(DESTDIR)$(man1dir) && $(LN_S) -f vala-gen-introspect@PACKAGE_SUFFIX@.1 vala-gen-introspect.1 + cd $(DESTDIR)$(man1dir) && $(LN_S) -f vapigen@PACKAGE_SUFFIX@.1 vapigen.1 + endif + + +-if ENABLE_VALADOC + COMMON_VALADOCFLAGS = \ + --force \ + --verbose \ +@@ -150,7 +136,6 @@ internal-apis/valadoc: $(valadoc_VALASOURCES) internal-apis/codegen + @touch $@ + + internal-api-docs: internal-apis/gee internal-apis/vala internal-apis/ccode internal-apis/codegen internal-apis/valadoc +-endif + + clean-local: + rm -rf $(builddir)/internal-apis +diff --git a/libvaladoc/Makefile.am b/libvaladoc/Makefile.am +index 8a3924b54..81fde9ac8 100644 +--- a/libvaladoc/Makefile.am ++++ b/libvaladoc/Makefile.am +@@ -119,10 +119,6 @@ libvaladoc_la_VALASOURCES = \ + content/tablerow.vala \ + content/taglet.vala \ + content/text.vala \ +- charts/chart.vala \ +- charts/chartfactory.vala \ +- charts/hierarchychart.vala \ +- charts/simplechartfactory.vala \ + parser/manyrule.vala \ + parser/oneofrule.vala \ + parser/optionalrule.vala \ +@@ -149,13 +145,24 @@ libvaladoc_la_VALASOURCES = \ + highlighter/codetoken.vala \ + highlighter/highlighter.vala \ + html/basicdoclet.vala \ +- html/htmlchartfactory.vala \ + html/linkhelper.vala \ + html/cssclassresolver.vala \ + html/htmlmarkupwriter.vala \ + html/htmlrenderer.vala \ + $(NULL) + ++if ENABLE_GRAPHVIZ ++libvaladoc_la_VALASOURCES += \ ++ charts/chart.vala \ ++ charts/chartfactory.vala \ ++ charts/hierarchychart.vala \ ++ charts/simplechartfactory.vala \ ++ html/htmlchartfactory.vala \ ++ $(NULL) ++ ++LIBGVC_PKG = --vapidir $(top_srcdir)/vapi --pkg libgvc ++endif ++ + libvaladoc@PACKAGE_SUFFIX@_la_SOURCES = \ + libvaladoc.vala.stamp \ + $(libvaladoc_la_VALASOURCES:.vala=.c) \ +@@ -175,11 +182,11 @@ libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES) + --library valadoc \ + --vapi valadoc@PACKAGE_SUFFIX@.vapi \ + --vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \ +- --vapidir $(top_srcdir)/vapi --pkg libgvc \ + --vapidir $(top_srcdir)/gee --pkg gee \ + --vapidir $(top_srcdir)/vala --pkg vala \ + --vapidir $(top_srcdir)/ccode --pkg ccode \ + --vapidir $(top_srcdir)/codegen --pkg codegen \ ++ $(LIBGVC_PKG) \ + --pkg config \ + $(filter %.vala %.c,$^) + touch $@ +@@ -207,6 +214,9 @@ nodist_pkgconfig_DATA = valadoc@PACKAGE_SUFFIX@.pc + + valadoc@PACKAGE_SUFFIX@.pc: valadoc.pc + cp $< $@ ++if !ENABLE_GRAPHVIZ ++ sed -i "s/libgvc //g" $@ ++endif + + vapidir = $(datadir)/vala/vapi + dist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.vapi +@@ -214,6 +224,9 @@ nodist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.deps + + valadoc@PACKAGE_SUFFIX@.deps: valadoc.deps + cp $< $@ ++if !ENABLE_GRAPHVIZ ++ sed -i "s/libgvc//g" $@ ++endif + + EXTRA_DIST = \ + $(libvaladoc_la_VALASOURCES) \ +diff --git a/libvaladoc/html/basicdoclet.vala b/libvaladoc/html/basicdoclet.vala +index 46578c28f..f6ce7097c 100644 +--- a/libvaladoc/html/basicdoclet.vala ++++ b/libvaladoc/html/basicdoclet.vala +@@ -46,7 +46,11 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { + protected HtmlRenderer _renderer; + protected Html.MarkupWriter writer; + protected Html.CssClassResolver cssresolver; ++#if HAVE_GRAPHVIZ + protected Charts.Factory image_factory; ++#else ++ protected void* image_factory; ++#endif + protected ErrorReporter reporter; + protected string package_list_link = "../index.html"; + +@@ -120,7 +124,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { + this.linker = new LinkHelper (); + + _renderer = new HtmlRenderer (settings, this.linker, this.cssresolver); ++#if HAVE_GRAPHVIZ + this.image_factory = new SimpleChartFactory (settings, linker); ++#endif + } + + +@@ -1025,6 +1031,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { + } + + protected void write_image_block (Api.Node element) { ++#if HAVE_GRAPHVIZ + if (element is Class || element is Interface || element is Struct) { + unowned string format = (settings.use_svg_images ? "svg" : "png"); + var chart = new Charts.Hierarchy (image_factory, element); +@@ -1044,6 +1051,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { + this.get_img_path_html (element, format)}); + writer.add_usemap (chart); + } ++#endif + } + + public void write_namespace_content (Namespace node, Api.Node? parent) { +diff --git a/libvaladoc/html/htmlmarkupwriter.vala b/libvaladoc/html/htmlmarkupwriter.vala +index 5aa4afdea..e79b0b8f5 100644 +--- a/libvaladoc/html/htmlmarkupwriter.vala ++++ b/libvaladoc/html/htmlmarkupwriter.vala +@@ -51,12 +51,16 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter { + } + } + ++#if HAVE_GRAPHVIZ + public unowned MarkupWriter add_usemap (Charts.Chart chart) { + string? buf = (string?) chart.write_buffer ("cmapx"); + if (buf != null) { + raw_text ("\n"); + raw_text ((!) buf); + } ++#else ++ public unowned MarkupWriter add_usemap (void* chart) { ++#endif + + return this; + } diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix index 35ad09320dec..961e28da82e7 100644 --- a/pkgs/development/compilers/zig/default.nix +++ b/pkgs/development/compilers/zig/default.nix @@ -1,19 +1,23 @@ { stdenv, fetchFromGitHub, cmake, llvmPackages, libxml2, zlib }: stdenv.mkDerivation rec { - version = "0.4.0"; + version = "0.5.0"; pname = "zig"; src = fetchFromGitHub { owner = "ziglang"; repo = pname; rev = version; - sha256 = "1cq6cc5pvybz9kn3y0j5gskkjq88hkmmcsva54mfzpcc65l3pv6p"; + sha256 = "0xyl0riakh6kwb3yvxihb451kqs4ai4q0aygqygnlb2rlr1dn1zb"; }; nativeBuildInputs = [ cmake ]; buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm libxml2 zlib ]; + preBuild = '' + export HOME=$TMPDIR; + ''; + meta = with stdenv.lib; { description = "Programming languaged designed for robustness, optimality, and clarity"; homepage = https://ziglang.org/; |