- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz

        sed 's/-Winline//g' -i "$BUILD_DIR"/Makefile*
      "dependencies": []
      "install": |+
        cd "$BUILD_DIR"

        # Build
        make ${JOBS:+-j$JOBS} -f Makefile-libbz2_so PREFIX=/
        make ${JOBS:+-j$JOBS} bzip2 bzip2recover PREFIX=/

        # Install
        INSTALLDIR="${DESTDIR}${ORCHESTRA_ROOT}"
        install -dm755 "$INSTALLDIR"/{bin,lib64,include,lib64/pkgconfig}

        install -m755 bzip2-shared "$INSTALLDIR"/bin/bzip2
        install -m755 bzip2recover bzdiff bzgrep bzmore "$INSTALLDIR"/bin
        ln -sf bzip2 "$INSTALLDIR"/bin/bunzip2
        ln -sf bzip2 "$INSTALLDIR"/bin/bzcat

        cp -a libbz2.so* "$INSTALLDIR"/lib64
        ln -s libbz2.so.1.0.8 "$INSTALLDIR"/lib64/libbz2.so
        install -m644 bzlib.h "$INSTALLDIR"/include/

        cat > "$INSTALLDIR"/lib64/pkgconfig/bzip2.pc <<'EOF'
        prefix=${pcfiledir}/../..
        exec_prefix=${prefix}
        bindir=${exec_prefix}/bin
        libdir=${exec_prefix}/lib64
        includedir=${prefix}/include

        Name: bzip2
        Description: A file compression library
        Version: 1.0.8
        Libs: -L${libdir} -lbz2
        Cflags: -I${includedir}
        EOF

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    LICENSE
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        cmake
      - |-
        clang-vanilla
      "configure": |+
        extract.sh --into "$BUILD_DIR/source" "https://github.com/revng/llvm-project/archive/de75a69.tar.gz"

        SUPPORT_UNITTESTS="$BUILD_DIR/source/llvm/unittests/Support"
        rm "$SUPPORT_UNITTESTS/JSONTest.cpp"
        rm "$SUPPORT_UNITTESTS/DJBTest.cpp"
        grep -vE 'JSONTest.cpp|DJBTest.cpp' "$SUPPORT_UNITTESTS/CMakeLists.txt" > "$SUPPORT_UNITTESTS/CMakeLists.txt.tmp"
        mv "$SUPPORT_UNITTESTS/CMakeLists.txt.tmp" "$SUPPORT_UNITTESTS/CMakeLists.txt"

        sed -i 's|GIT_FOUND|FALSE|g' "$BUILD_DIR/source/llvm/cmake/modules/VersionFromVCS.cmake"
        export PATH="$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin:$ORCHESTRA_ROOT/clang-vanilla/bin:$PATH"
        export HARD_FLAGS_CXX_CLANG=""
        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$BUILD_DIR/source/llvm" \
          -GNinja \
          -DCMAKE_BUILD_RPATH="\$ORIGIN/../lib:$ORCHESTRA_ROOT/lib" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib" \
          -DCMAKE_BUILD_TYPE="Release" \
          -DCMAKE_EXE_LINKER_FLAGS="-w" \
          -DCMAKE_SHARED_LINKER_FLAGS="-w" \
          -DCMAKE_MODULE_LINKER_FLAGS="-w" \
          -DCMAKE_C_FLAGS="-w" \
          -DCMAKE_CXX_FLAGS="-w" \
          -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;Mips;SystemZ;X86" \
          -DLLVM_INSTALL_UTILS=ON \
          -DLLVM_ENABLE_DUMP=ON \
          -DLLVM_ENABLE_TERMINFO=OFF \
          -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF \
          -DCMAKE_CXX_STANDARD=20 \
          -DLLVM_ENABLE_Z3_SOLVER=OFF \
          -DLLVM_INCLUDE_GO_TESTS=OFF \
          -DLLVM_ENABLE_ZLIB=ON \
          -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libcxxabi;libcxx;clang-tools-extra;lld" \
          -DBUILD_SHARED_LIBS=OFF \
          -DLLVM_ENABLE_LTO=Thin \
          -DLLVM_USE_LINKER=lld \
          -DLLVM_BUILD_INSTRUMENTED=IR \
          -DLLVM_BUILD_RUNTIME=No \
          -DCMAKE_AR=$ORCHESTRA_ROOT/clang-vanilla/bin/llvm-ar \
          -DCMAKE_RANLIB=$ORCHESTRA_ROOT/clang-vanilla/bin/llvm-ranlib \
          -DCMAKE_C_COMPILER=$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin/clang \
          -DCMAKE_CXX_COMPILER=$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin/clang++ \
          -DLIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL=0 \
          -DLLVM_TARGETS_TO_BUILD=X86 \
          -Wno-dev

      "dependencies":
      - |-
        gcc-host-toolchain
      - |-
        libunwind
      - |-
        zlib
      - |-
        ncurses
      "install": |+
        export PATH="$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin:$ORCHESTRA_ROOT/clang-vanilla/bin:$PATH"
        export HARD_FLAGS_CXX_CLANG=""
        cd "$BUILD_DIR"

        ninja ${JOBS:+-j$JOBS} clang
        ninja ${JOBS:+-j$JOBS} check-llvm || true
        ninja ${JOBS:+-j$JOBS} check-clang || true

        rm -rf build-for-profiling
        mkdir build-for-profiling
        cd build-for-profiling
        cmake \
          "$BUILD_DIR/source/llvm" \
          -GNinja \
          -DCMAKE_C_COMPILER="$BUILD_DIR/bin/clang" \
          -DCMAKE_CXX_COMPILER="$BUILD_DIR/bin/clang++" \
          -DLLVM_ENABLE_TERMINFO=OFF \
          -DCMAKE_CXX_STANDARD=20 \
          -DLLVM_ENABLE_Z3_SOLVER=OFF \
          -DLLVM_INCLUDE_GO_TESTS=OFF \
          -DLLVM_TARGETS_TO_BUILD=X86 \
          -DCMAKE_BUILD_TYPE=RelWithDebInfo
        ninja ${JOBS:+-j$JOBS}

        PROFDATA_DIR="${DESTDIR}${ORCHESTRA_ROOT}/share/profdata"
        mkdir -p "$PROFDATA_DIR"
        llvm-profdata merge -output="$PROFDATA_DIR/clang-release.prof" $BUILD_DIR/profiles/*.profraw

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    source/llvm/LICENSE.TXT
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        cmake
      - |-
        clang-vanilla
      - |-
        clang-profiling-data
      "configure": |+
        extract.sh --into "$BUILD_DIR/source" "https://github.com/revng/llvm-project/archive/de75a69.tar.gz"

        # compiler-rt tests fail abundantly (in the CI only)
        find "$BUILD_DIR/source/compiler-rt/test" -name "lit.*" -type f | while read FILE; do
          echo > "$FILE"
        done

        sed -i 's|GIT_FOUND|FALSE|g' "$BUILD_DIR/source/llvm/cmake/modules/VersionFromVCS.cmake"

        export PATH="$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin:$ORCHESTRA_ROOT/clang-vanilla/bin:$PATH"

        export HARD_FLAGS_CXX_CLANG=""
        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$BUILD_DIR/source/llvm" \
          -GNinja \
          -DCMAKE_BUILD_RPATH="\$ORIGIN/../lib:$ORCHESTRA_ROOT/lib" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib" \
          -DCMAKE_BUILD_TYPE="Release" \
          -DCMAKE_EXE_LINKER_FLAGS="-w" \
          -DCMAKE_SHARED_LINKER_FLAGS="-w" \
          -DCMAKE_MODULE_LINKER_FLAGS="-w" \
          -DCMAKE_C_FLAGS="-w" \
          -DCMAKE_CXX_FLAGS="-w" \
          -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;Mips;SystemZ;X86" \
          -DLLVM_INSTALL_UTILS=ON \
          -DLLVM_ENABLE_DUMP=ON \
          -DLLVM_ENABLE_TERMINFO=OFF \
          -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF \
          -DCMAKE_CXX_STANDARD=20 \
          -DLLVM_ENABLE_Z3_SOLVER=OFF \
          -DLLVM_INCLUDE_GO_TESTS=OFF \
          -DLLVM_ENABLE_ZLIB=ON \
          -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libcxxabi;libcxx;clang-tools-extra;lld" \
          -DBUILD_SHARED_LIBS=ON \
          -DLIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT/lib/llvm/clang-release" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib/llvm/clang-release/lib:$RPATH_PLACEHOLDER/lib" \
          -DLLVM_ENABLE_LTO=Thin \
          -DLLVM_USE_LINKER=lld \
          -DCMAKE_AR=$ORCHESTRA_ROOT/clang-vanilla/bin/llvm-ar \
          -DCMAKE_RANLIB=$ORCHESTRA_ROOT/clang-vanilla/bin/llvm-ranlib \
          -DCMAKE_C_COMPILER=$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin/clang \
          -DCMAKE_CXX_COMPILER=$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin/clang++ \
          -DLLVM_PROFDATA_FILE="$ORCHESTRA_ROOT/share/profdata/clang-release.prof" \
          -Wno-dev

      "dependencies":
      - |-
        gcc-host-toolchain
      - |-
        libunwind
      - |-
        zlib
      - |-
        ncurses
      "install": |2+

        export PATH="$ORCHESTRA_ROOT/clang-vanilla/wrapped-bin:$ORCHESTRA_ROOT/clang-vanilla/bin:$PATH"

        export HARD_FLAGS_CXX_CLANG=""

        cd "$BUILD_DIR"

        # Build
        ninja ${JOBS:+-j$JOBS} install

        # Run tests
        export HARD_FLAGS_C_CLANG="-w"
        export HARD_FLAGS_CXX_CLANG="-w"
        if test "$RUN_TESTS" -eq 1; then
          ninja ${JOBS:+-j$JOBS} check-all
        fi

        # Fix libc++
        rm "${DESTDIR}${ORCHESTRA_ROOT}/lib/llvm/clang-release/lib/libc++.so" || true
        echo 'INPUT(libc++.so.1 -lc++abi -lpthread)' > "${DESTDIR}${ORCHESTRA_ROOT}/lib/llvm/clang-release/lib/libc++.so"

        # Symlink to /lib/llvm/clang-release/bin/* to /bin
        for EXECUTABLE in "${DESTDIR}${ORCHESTRA_ROOT}/lib/llvm/clang-release/bin/"*; do
          ln \
            -s $(
              realpath \
                --no-symlinks \
                --relative-to="${DESTDIR}${ORCHESTRA_ROOT}/bin" \
                "${EXECUTABLE}"
            ) \
            "${DESTDIR}${ORCHESTRA_ROOT}/bin"
        done

        # Symlink to /lib/llvm/clang-release/lib/libc++*.so* to /lib
        for LIBRARY in "${DESTDIR}${ORCHESTRA_ROOT}/lib/llvm/clang-release/lib/"libc++*.so*; do
          ln \
            -s $(
              realpath \
                --no-symlinks \
                --relative-to="${DESTDIR}${ORCHESTRA_ROOT}/lib" \
                "${LIBRARY}"
            ) \
            "${DESTDIR}${ORCHESTRA_ROOT}/lib"
        done

        # Leave `opt` and `llvm-config` to the `llvm` component
        rm -f "${DESTDIR}${ORCHESTRA_ROOT}/bin/opt"*
        rm -f "${DESTDIR}${ORCHESTRA_ROOT}/bin/llvm-config"*

        # Create wrappers
        mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
        COMPILER_WRAPPER="${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py"
        cd "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
        cp -a "$COMPILER_WRAPPER" clang
        cp -a "$COMPILER_WRAPPER" clang++
        cp -a "$COMPILER_WRAPPER" clang-tidy

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    source/llvm/LICENSE.TXT
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        cmake
      "configure": |+
        extract.sh --into "$BUILD_DIR/source" "https://github.com/revng/llvm-project/archive/de75a69.tar.gz"
        sed -i 's|GIT_FOUND|FALSE|g' "$BUILD_DIR/source/llvm/cmake/modules/VersionFromVCS.cmake"
        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$BUILD_DIR/source/llvm" \
          -GNinja \
          -DCMAKE_BUILD_RPATH="\$ORIGIN/../lib:$ORCHESTRA_ROOT/lib" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib" \
          -DCMAKE_BUILD_TYPE="Release" \
          -DCMAKE_EXE_LINKER_FLAGS="-w" \
          -DCMAKE_SHARED_LINKER_FLAGS="-w" \
          -DCMAKE_MODULE_LINKER_FLAGS="-w" \
          -DCMAKE_C_FLAGS="-w" \
          -DCMAKE_CXX_FLAGS="-w" \
          -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;Mips;SystemZ;X86" \
          -DLLVM_INSTALL_UTILS=ON \
          -DLLVM_ENABLE_DUMP=ON \
          -DLLVM_ENABLE_TERMINFO=OFF \
          -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF \
          -DCMAKE_CXX_STANDARD=20 \
          -DLLVM_ENABLE_Z3_SOLVER=OFF \
          -DLLVM_INCLUDE_GO_TESTS=OFF \
          -DLLVM_ENABLE_ZLIB=ON \
          -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
          -DBUILD_SHARED_LIBS=OFF \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT/clang-vanilla" \
          -DLLVM_TARGETS_TO_BUILD="X86" \
          -Wno-dev

      "dependencies":
      - |-
        gcc-host-toolchain
      - |-
        libunwind
      - |-
        zlib
      - |-
        ncurses
      "install": |+
        cd "$BUILD_DIR"

        ninja ${JOBS:+-j$JOBS} install

        COMPILER_WRAPPER="${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py"
        mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/clang-vanilla/wrapped-bin"
        cd "${DESTDIR}${ORCHESTRA_ROOT}/clang-vanilla/wrapped-bin"
        cp -a "$COMPILER_WRAPPER" clang
        cp -a "$COMPILER_WRAPPER" clang++
        cp -a "$COMPILER_WRAPPER" clang-tidy

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    source/llvm/LICENSE.TXT
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        gcc-host-toolchain
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2.tar.gz
        cd "$BUILD_DIR" && ./bootstrap \
          --prefix="$ORCHESTRA_ROOT" \
          --parallel=16 \
          LDFLAGS="-static-libstdc++ -static-libgcc" \
          -- -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_SHARED_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
          -DCMAKE_MODULE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
          -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
          -DCMAKE_USE_OPENSSL=OFF
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    Licenses/README.rst
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "debug":
      "build_dependencies":
      - |-
        cmake
      - |-
        host-c-toolchain
      "configure": |2

        extract.sh "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.gz"
        mkdir -p "$BUILD_DIR"

        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$SOURCE_DIR" \
          -G"Ninja" \
          -DCMAKE_C_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang" \
          -DCMAKE_CXX_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang++" \
          -DCMAKE_C_FLAGS="-ggdb3 -O0   " \
          -DCMAKE_CXX_FLAGS="-ggdb3 -O0   " \
          -DCMAKE_BUILD_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_BUILD_TYPE="Debug"
      "dependencies": []
      "install": |
        cmake --build "$BUILD_DIR" ${JOBS:+-j$JOBS}



        cmake --install "$BUILD_DIR"
      "ndebug": !!bool |-
        false
    "optimized":
      "build_dependencies":
      - |-
        cmake
      - |-
        host-c-toolchain
      "configure": |2

        extract.sh "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.gz"
        mkdir -p "$BUILD_DIR"

        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$SOURCE_DIR" \
          -G"Ninja" \
          -DCMAKE_C_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang" \
          -DCMAKE_CXX_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang++" \
          -DCMAKE_C_FLAGS="-ggdb3 -O2 -fno-omit-frame-pointer   " \
          -DCMAKE_CXX_FLAGS="-ggdb3 -O2 -fno-omit-frame-pointer   " \
          -DCMAKE_BUILD_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_BUILD_TYPE="Debug"
      "dependencies": []
      "install": |
        cmake --build "$BUILD_DIR" ${JOBS:+-j$JOBS}



        cmake --install "$BUILD_DIR"
      "ndebug": !!bool |-
        false
    "release":
      "build_dependencies":
      - |-
        cmake
      - |-
        host-c-toolchain
      "configure": |2

        extract.sh "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.gz"
        mkdir -p "$BUILD_DIR"

        cd "$BUILD_DIR";
        cmake \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
          -DCMAKE_INSTALL_SO_NO_EXE=0 \
          -DCMAKE_INSTALL_PREFIX="$ORCHESTRA_ROOT" \
          -DCMAKE_PREFIX_PATH="$ORCHESTRA_ROOT" \
          "$SOURCE_DIR" \
          -G"Ninja" \
          -DCMAKE_C_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang" \
          -DCMAKE_CXX_COMPILER="$ORCHESTRA_ROOT/link-only/bin/clang++" \
          -DCMAKE_C_FLAGS="-ggdb3 -O2   " \
          -DCMAKE_CXX_FLAGS="-ggdb3 -O2   " \
          -DCMAKE_BUILD_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib:$RPATH_PLACEHOLDER/lib64/clang/12.0.0/lib/linux:$RPATH_PLACEHOLDER/lib/revng/analyses" \
          -DCMAKE_BUILD_TYPE="Release"
      "dependencies": []
      "install": |
        cmake --build "$BUILD_DIR" ${JOBS:+-j$JOBS}



        cmake --install "$BUILD_DIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    optimized
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies": []
      "configure": |-
        mkdir -p "$BUILD_DIR"
      "dependencies":
      - |-
        toolchain/host/gcc
      - |-
        toolchain/host/binutils
      "install": |-
        exit 0
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": !!null |-
    null
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies": []
      "configure": |
        mkdir -p "$BUILD_DIR/source"
        extract.sh --into "$BUILD_DIR/source" https://ftp.gnu.org/gnu/glibc/glibc-2.13.tar.xz

        sed -i 's|test -n ".critic_missing"|false|g' "$BUILD_DIR/source/configure"
        sed -i 's|struct obstack ._obstack_compat|\0 = 0|g' "$BUILD_DIR/source/malloc/obstack.c"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/glibc-2.13-fix-isinf.patch" "$BUILD_DIR/source"

        cd $BUILD_DIR
        export CC="cc -no-pie -fuse-ld=bfd -Wl,-z,origin -Wl,--enable-new-dtags -Wl,-rpath,$RPATH_PLACEHOLDER/link-only/lib"
        ./source/configure \
          --disable-profile \
          --without-gd \
          --enable-crypt \
          --disable-static-pie \
          --disable-systemtap \
          --disable-nscd \
          --disable-timezone-tools \
          --enable-stack-protector=strong \
          --enable-stackguard-randomization \
          --disable-cet \
          --without-selinux \
          --without-cvs \
          --disable-werror \
          --enable-bind-now \
          --disable-sanity-checks \
          --prefix="$INSTALL_LINK_ONLY_PATH" \
          CFLAGS="-w -O2 -fno-stack-protector -DNDEBUG -march=core2 -U_FORTIFY_SOURCE"
      "dependencies": []
      "install": |+
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install_root="$DESTDIR" install
        sed -i "s|$INSTALL_LINK_ONLY_PATH/lib/||g" \
          "$DESTDIR$INSTALL_LINK_ONLY_PATH/lib/libpthread.so" \
          "$DESTDIR$INSTALL_LINK_ONLY_PATH/lib/libc.so"
        ln -s . "$DESTDIR$INSTALL_LINK_ONLY_PATH/usr"
        rm -f "$DESTDIR$INSTALL_LINK_ONLY_PATH"/libexec/getconf/POSIX_V7_LP64_OFF64*
        rm -rf "$DESTDIR$INSTALL_LINK_ONLY_PATH"/bin
        cp -a "$DESTDIR$INSTALL_LINK_ONLY_PATH"/lib/*.o "$DESTDIR$ORCHESTRA_ROOT"/lib/

        # This file is needed because gcc fixinclude detects it when bootstrapping toolchains
        touch "$DESTDIR$INSTALL_LINK_ONLY_PATH/include/stdc-predef.h"

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    source/COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" "https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz"
        cd "$BUILD_DIR" && ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --enable-shared=no \
          --enable-fat \
          CFLAGS="-fPIC" \
          CXXFLAGS="-fPIC" \
          LDFLAGS="-static-libgcc"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies": []
      "configure": |-
        mkdir -p "$BUILD_DIR"
      "dependencies":
      - |-
        glibc
      - |-
        toolchain/host/binutils
      - |-
        clang-release
      "install": |-
        exit 0
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": !!null |-
    null
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies": []
      "configure": |-
        mkdir -p "$BUILD_DIR"
      "dependencies":
      - |-
        glibc
      - |-
        toolchain/host/binutils
      - |-
        clang-release
      "install": |-
        exit 0
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": !!null |-
    null
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-cxx-toolchain
      - |-
        glibc
      - |-
        python
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-src.tgz

        cd "$BUILD_DIR"
        ./source/configure \
          --disable-static \
          --disable-debug \
          --disable-samples \
          --disable-tests \
          --enable-shared \
          --enable-tools \
          --prefix="$ORCHESTRA_ROOT"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    LICENSE
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz

        cd "$BUILD_DIR"
        ./configure \
          --disable-multi-os-directory \
          --disable-static \
          --disable-pax_emutramp \
          --disable-debug \
          --prefix="$ORCHESTRA_ROOT"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    LICENSE
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        gcc-host-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://download.savannah.nongnu.org/releases/libunwind/libunwind-1.6.2.tar.gz
        cd "$BUILD_DIR"
        export CC="cc -fcommon"
        ./configure \
          --enable-cxx-exceptions \
          --disable-coredump \
          --disable-ptrace \
          --enable-setjmp \
          --disable-debug-frame \
          --disable-documentation \
          --disable-minidebuginfo \
          --disable-static \
          --disable-conservative_checks \
          --disable-debug \
          --prefix="$ORCHESTRA_ROOT"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://github.com/besser82/libxcrypt/releases/download/v4.4.28/libxcrypt-4.4.28.tar.xz

        cd "$BUILD_DIR"
        # By specifying --enable-obsolete-api=glibc we're providing libcrypt.so.1
        # and not libcrypt.so.2. Python seems to link only to the former.
        # The latter should be preferred but we'd rather not ship both.
        ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --disable-static \
          --enable-hashes=strong,glibc \
          --enable-obsolete-api=glibc \
          --disable-failure-tokens
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING.LIB
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
        cd "$BUILD_DIR" && ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --with-gmp="$ORCHESTRA_ROOT" \
          --with-mpfr="$ORCHESTRA_ROOT" \
          --enable-shared=no \
          CFLAGS="-fPIC" \
          CXXFLAGS="-fPIC" \
          LDFLAGS="-static-libgcc"
      "dependencies":
      - |-
        gmp
      - |-
        mpfr
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING.LESSER
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz
        cd "$BUILD_DIR" && ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --with-gmp="$ORCHESTRA_ROOT" \
          --enable-shared=no \
          CFLAGS="-fPIC" \
          CXXFLAGS="-fPIC" \
          LDFLAGS="-static-libgcc"
      "dependencies":
      - |-
        gmp
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        gcc-host-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz
        cd "$BUILD_DIR"
        ./configure \
          --enable-pc-files \
          --enable-widec \
          --with-cxx \
          --with-cxx-binding \
          --with-cxx-shared \
          --with-shared \
          --with-versioned-syms \
          --with-xterm-kbs=del \
          --with-manpage-format=normal \
          --without-ada \
          --without-assertions \
          --without-debug \
          --without-dlsym \
          --without-expanded \
          --without-gpm \
          --without-hashed-db \
          --without-profile \
          --without-tack \
          --without-tests \
          --without-trace \
          --prefix="$ORCHESTRA_ROOT"
      "dependencies": []
      "install": |+
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"

        INSTALLDIR="${DESTDIR}${ORCHESTRA_ROOT}"

        # Adapted from ArchLinux PKGBUILD
        # fool packages looking to link to non-wide-character ncurses libraries
        for lib in ncurses ncurses++ form panel menu; do
          printf "INPUT(-l%sw)\n" "${lib}" > "$INSTALLDIR/lib/lib${lib}.so"
          ln -sv lib${lib}w.so.6.3 "$INSTALLDIR/lib/lib${lib}.so.6.3"
          ln -sv lib${lib}w.so.6.3 "$INSTALLDIR/lib/lib${lib}.so.6"
          ln -sv ${lib}w.pc "$INSTALLDIR/lib/pkgconfig/${lib}.pc"
        done

        # some packages look for -lcurses during build
        printf 'INPUT(-lncursesw)\n' > "$INSTALLDIR/lib/libcursesw.so"
        ln -sv libncurses.so "$INSTALLDIR/lib/libcurses.so"

        # tic and ticinfo functionality is built in by default
        # make sure that anything linking against it links against libncursesw.so instead
        for lib in tic tinfo; do
          printf "INPUT(libncursesw.so.6)\n" > "$INSTALLDIR/lib/lib${lib}.so"
          ln -sv libncursesw.so.6.3 "$INSTALLDIR/lib/lib${lib}.so.6.3"
          ln -sv libncursesw.so.6.3 "$INSTALLDIR/lib/lib${lib}.so.6"
          ln -sv ncursesw.pc "$INSTALLDIR/lib/pkgconfig/${lib}.pc"
        done

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1q.tar.gz

        #@ # Note: openssldir is set to /etc/ssl; we assume that distros provide this.
        #@ # On distros that don't, the following check will fail at build-time,
        #@ # but unfortunately not at install-time when binary archives are used.
        if ! [[ -d /etc/ssl ]]; then
          echo "Error: openssldir /etc/ssl is missing in host root!" >&2
          exit 1
        fi

        cd "$BUILD_DIR"
        ./Configure \
          --prefix="$ORCHESTRA_ROOT" \
          --openssldir="/etc/ssl" \
          --libdir=lib64 \
          linux-x86_64 \
          enable-camellia \
          enable-ec \
          enable-ec2m \
          enable-sm2 \
          enable-srp \
          enable-idea \
          enable-mdc2 \
          enable-rc5 \
          no-ssl3 \
          no-ssl3-method \
          enable-asm \
          no-rfc3779 \
          no-sctp \
          no-tests \
          no-zlib \
          no-heartbeats \
          no-weak-ssl-ciphers \
          shared \
          threads
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install_sw DESTDIR="$DESTDIR"
        find "$DESTDIR" -name "*.a" -delete
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    LICENSE
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz
        cd "$BUILD_DIR"

        # orchestra's libc has a buggy getaddrinfo; we expect users to have a newer libc
        ac_cv_buggy_getaddrinfo=no ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --libdir="${ORCHESTRA_ROOT}/lib64" \
          --enable-optimizations \
          --enable-shared \
          --enable-ipv6 \
          --disable-test-modules \
          --with-ensurepip=install \
          --with-lto \
          --with-readline \
          --with-system-ffi \
          --with-system-expat \
          --without-static-libpython

        grep -v HAVE_SYS_AUXV_H pyconfig.h > pyconfig.h.tmp
        mv pyconfig.h.tmp pyconfig.h
      "dependencies":
      - |-
        bzip2
      - |-
        expat
      - |-
        libffi
      - |-
        libxcrypt
      - |-
        openssl
      - |-
        readline
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"

        INSTALLDIR="${DESTDIR}${ORCHESTRA_ROOT}"
        ln -s python3 "${INSTALLDIR}"/bin/python
        ln -s python3-config "${INSTALLDIR}"/bin/python-config
        ln -s idle3 "${INSTALLDIR}"/bin/idle
        ln -s pydoc3 "${INSTALLDIR}"/bin/pydoc
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    LICENSE
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        host-c-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://ftp.gnu.org/gnu/readline/readline-8.1.2.tar.gz

        cd "$BUILD_DIR"
        ./configure \
          --prefix="$ORCHESTRA_ROOT" \
          --enable-multibyte \
          --disable-static \
          --disable-install-examples \
          --with-curses
      "dependencies":
      - |-
        ncurses
      "install": |+
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS} SHLIB_LIBS=-lncurses
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"

      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path":
  - |-
    ${ORCHESTRA_ROOT}/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/binutils-bin/2.39
  "builds":
    "default":
      "build_dependencies":
      - |-
        glibc
      - |-
        toolchain/host/gcc
      "configure": |
        extract.sh --into "$SOURCE_DIR" https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.bz2
        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR" && "$SOURCE_DIR/configure" \
          --build=x86_64-pc-linux-gnu \
          --host=x86_64-pc-linux-gnu \
          --target=x86_64-pc-linux-gnu \
          --with-sysroot="$ORCHESTRA_ROOT/x86_64-pc-linux-gnu" \
          --prefix=$ORCHESTRA_ROOT \
          --datadir=$ORCHESTRA_ROOT/share/binutils-data/x86_64-pc-linux-gnu/2.39 \
          --infodir=$ORCHESTRA_ROOT/share/binutils-data/x86_64-pc-linux-gnu/2.39/info \
          --mandir=$ORCHESTRA_ROOT/share/binutils-data/x86_64-pc-linux-gnu/2.39/man \
          --bindir=$ORCHESTRA_ROOT/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/binutils-bin/2.39 \
          --libdir=$ORCHESTRA_ROOT/lib64/binutils/x86_64-pc-linux-gnu/2.39 \
          --libexecdir=$ORCHESTRA_ROOT/lib64/binutils/x86_64-pc-linux-gnu/2.39 \
          --includedir=$ORCHESTRA_ROOT/lib64/binutils/x86_64-pc-linux-gnu/2.39/include \
          --without-included-gettext \
          --with-zlib \
          --enable-poison-system-directories \
          --enable-secureplt \
          --enable-obsolete \
          --enable-gold \
          --disable-shared \
          --enable-threads \
          --enable-install-libiberty \
          --disable-werror \
          --disable-static \
          --disable-gdb \
          --disable-libdecnumber \
          --disable-readline \
          --disable-sim \
          --without-debuginfod \
          --without-stage1-ldflags \
          --enable-gold=default \
          CFLAGS="-w -ggdb3 -O3" \
          CXXFLAGS="-w -ggdb3 -O3"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path":
  - |-
    ${ORCHESTRA_ROOT}/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/gcc-bin/11.2.0
  "builds":
    "stage1":
      "build_dependencies":
      - |-
        glibc
      - |-
        gmp
      - |-
        mpfr
      - |-
        mpc
      "configure": |
        extract.sh --into "$SOURCE_DIR" "https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-cfns-fix-mismatch-in-gnu_inline-attributes.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-cpp-musl-support.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-fixes.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-remove-dependency-on-libc_single_threaded.patch" "$SOURCE_DIR"
        sed -i 's|gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"|gcc_gxx_include_dir="/${gcc_gxx_without_sysroot#/}"|' "$SOURCE_DIR/gcc/configure"

        sed -i "s|SHLIB_LINK = .(CC)|\0 -L$ORCHESTRA_ROOT/link-only/lib|" "$SOURCE_DIR/libgcc/config/t-slibgcc"
        sed -i 's|@multilib_flags@||' "$SOURCE_DIR/libgcc/config/t-slibgcc"


        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR"

        gcc -c -fPIC -x c <(echo 'char __libc_single_threaded __attribute__ ((weak));') -o "$BUILD_DIR/fake-libc-single-threaded.o"

        "$SOURCE_DIR/configure" \
          --host=x86_64-pc-linux-gnu \
          --build=x86_64-pc-linux-gnu \
          --target=x86_64-pc-linux-gnu \
          --prefix=$ORCHESTRA_ROOT \
          --bindir=$ORCHESTRA_ROOT/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/gcc-bin/11.2.0 \
          --includedir=$ORCHESTRA_ROOT/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include \
          --datadir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0 \
          --mandir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/man \
          --infodir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/info \
          --with-sysroot=/ \
          --enable-obsolete \
          --enable-secureplt \
          --disable-werror \
          --enable-nls \
          --without-included-gettext \
          --enable-checking=release \
          --enable-libstdcxx-time \
          --enable-poison-system-directories \
          --disable-host-shared \
          --enable-shared \
          --disable-libatomic \
          --disable-bootstrap \
          --disable-multilib \
          --disable-altivec \
          --disable-fixed-point \
          --disable-libgcj \
          --disable-libgomp \
          --disable-libmudflap \
          --disable-libssp \
          --disable-libcilkrts \
          --disable-vtable-verify \
          --disable-libvtv \
          --disable-libquadmath \
          --disable-rpath \
          --enable-lto \
          --disable-vtable-verify \
          --disable-libsanitizer \
          --with-gmp="$ORCHESTRA_ROOT" \
          --with-mpfr="$ORCHESTRA_ROOT" \
          --with-mpc="$ORCHESTRA_ROOT" \
          --without-zstd \
          --without-cloog \
          --enable-libsanitizer \
          --enable-libssp \
          --enable-shared \
          --enable-libatomic \
          --enable-libquadmath \
          --enable-esp \
          --disable-libstdcxx-pch \
          --enable-threads=posix \
          --enable-__cxa_atexit \
          --enable-clocale=gnu \
          --disable-altivec \
          --disable-fixed-point \
          --enable-targets=all \
          --enable-libgomp \
          --disable-libmudflap \
          --disable-libssp \
          --disable-systemtap \
          --enable-lto \
          --without-isl \
          --enable-default-pie \
          --enable-default-ssp \
          --enable-libmpx \
          CFLAGS_FOR_TARGET="-I/usr/include/tirpc -I$ORCHESTRA_ROOT/link-only/include" \
          CXXFLAGS_FOR_TARGET="-I/usr/include/tirpc -I$ORCHESTRA_ROOT/link-only/include" \
          LDFLAGS_FOR_TARGET="-L$INSTALL_LINK_ONLY_PATH/lib -L$ORCHESTRA_ROOT/lib -lrt --sysroot=/ -Wl,-z,origin -Wl,--enable-new-dtags -Wl,-rpath,$RPATH_PLACEHOLDER/lib" \
          --enable-languages=c \
          CFLAGS="-w -ggdb3 -O3 --sysroot $INSTALL_LINK_ONLY_PATH -idirafter $ORCHESTRA_ROOT/include -idirafter /usr/local/include -idirafter /usr/include/x86_64-linux-gnu -idirafter /usr/include" \
          CXXFLAGS="-w -ggdb3 -O3 --sysroot $INSTALL_LINK_ONLY_PATH -idirafter $ORCHESTRA_ROOT/include -idirafter /usr/local/include -idirafter /usr/include/x86_64-linux-gnu -idirafter /usr/include -std=gnu++11" \
          LDFLAGS="-L$INSTALL_LINK_ONLY_PATH/lib -L$ORCHESTRA_ROOT/lib -lrt --sysroot=/ -Wl,-z,origin -Wl,--enable-new-dtags -fuse-ld=gold -Wl,-rpath,$RPATH_PLACEHOLDER/lib -Wl,-rpath,$RPATH_PLACEHOLDER/lib64/llvm/clang-release/lib/clang/12.0.0/lib/linux -static-libgcc -static-libstdc++ $BUILD_DIR/fake-libc-single-threaded.o"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS} LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
        make install LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

        NEW_GCC_PATH="$ORCHESTRA_ROOT/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/gcc-bin/11.2.0/"

        if test -e "${DESTDIR}${NEW_GCC_PATH}/gcc"; then

          if ! test -e "${DESTDIR}${NEW_GCC_PATH}/cc"; then
            ln -s gcc "${DESTDIR}${NEW_GCC_PATH}/cc"
          fi

          mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
          cp "${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py" "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/gcc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/cc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-cc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-gcc"

          cp -a "${DESTDIR}${ORCHESTRA_ROOT}"/lib/gcc/x86_64-pc-linux-gnu/11.2.0/*.{a,o} "${DESTDIR}${ORCHESTRA_ROOT}"/lib/

        fi

        if test -e "${DESTDIR}${NEW_GCC_PATH}/g++"; then

          if ! test -e "${DESTDIR}${NEW_GCC_PATH}/c++"; then
            ln -s g++ "${DESTDIR}${NEW_GCC_PATH}/c++"
          fi

          cp "${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py" "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/g++"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-g++"
          mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/c++"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-c++"

        fi

        rm -f "${DESTDIR}${ORCHESTRA_ROOT}"/lib64/libcc1.*

        # Fixinclude locates the wrong pthread.h
        find "${DESTDIR}${ORCHESTRA_ROOT}" -type d -name include-fixed -exec rm -f {}/pthread.h \;
      "ndebug": !!bool |-
        true
    "stage2":
      "build_dependencies":
      - |-
        glibc
      - |-
        gmp
      - |-
        mpfr
      - |-
        mpc
      "configure": |
        extract.sh --into "$SOURCE_DIR" "https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-cfns-fix-mismatch-in-gnu_inline-attributes.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-cpp-musl-support.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-fixes.patch" "$SOURCE_DIR"
        patch-if-exists "${ORCHESTRA_DOTDIR}/patches/gcc-11.2.0-remove-dependency-on-libc_single_threaded.patch" "$SOURCE_DIR"
        sed -i 's|gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"|gcc_gxx_include_dir="/${gcc_gxx_without_sysroot#/}"|' "$SOURCE_DIR/gcc/configure"

        sed -i "s|SHLIB_LINK = .(CC)|\0 -L$ORCHESTRA_ROOT/link-only/lib|" "$SOURCE_DIR/libgcc/config/t-slibgcc"
        sed -i 's|@multilib_flags@||' "$SOURCE_DIR/libgcc/config/t-slibgcc"


        mkdir -p "$BUILD_DIR"
        cd "$BUILD_DIR"

        gcc -c -fPIC -x c <(echo 'char __libc_single_threaded __attribute__ ((weak));') -o "$BUILD_DIR/fake-libc-single-threaded.o"

        "$SOURCE_DIR/configure" \
          --host=x86_64-pc-linux-gnu \
          --build=x86_64-pc-linux-gnu \
          --target=x86_64-pc-linux-gnu \
          --prefix=$ORCHESTRA_ROOT \
          --bindir=$ORCHESTRA_ROOT/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/gcc-bin/11.2.0 \
          --includedir=$ORCHESTRA_ROOT/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include \
          --datadir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0 \
          --mandir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/man \
          --infodir=$ORCHESTRA_ROOT/share/gcc-data/x86_64-pc-linux-gnu/11.2.0/info \
          --with-sysroot=/ \
          --enable-obsolete \
          --enable-secureplt \
          --disable-werror \
          --enable-nls \
          --without-included-gettext \
          --enable-checking=release \
          --enable-libstdcxx-time \
          --enable-poison-system-directories \
          --disable-host-shared \
          --enable-shared \
          --disable-libatomic \
          --disable-bootstrap \
          --disable-multilib \
          --disable-altivec \
          --disable-fixed-point \
          --disable-libgcj \
          --disable-libgomp \
          --disable-libmudflap \
          --disable-libssp \
          --disable-libcilkrts \
          --disable-vtable-verify \
          --disable-libvtv \
          --disable-libquadmath \
          --disable-rpath \
          --enable-lto \
          --disable-vtable-verify \
          --disable-libsanitizer \
          --with-gmp="$ORCHESTRA_ROOT" \
          --with-mpfr="$ORCHESTRA_ROOT" \
          --with-mpc="$ORCHESTRA_ROOT" \
          --without-zstd \
          --without-cloog \
          --enable-libsanitizer \
          --enable-libssp \
          --enable-shared \
          --enable-libatomic \
          --enable-libquadmath \
          --enable-esp \
          --disable-libstdcxx-pch \
          --enable-threads=posix \
          --enable-__cxa_atexit \
          --enable-clocale=gnu \
          --disable-altivec \
          --disable-fixed-point \
          --enable-targets=all \
          --enable-libgomp \
          --disable-libmudflap \
          --disable-libssp \
          --disable-systemtap \
          --enable-lto \
          --without-isl \
          --enable-default-pie \
          --enable-default-ssp \
          --enable-libmpx \
          CFLAGS_FOR_TARGET="-I/usr/include/tirpc -I$ORCHESTRA_ROOT/link-only/include" \
          CXXFLAGS_FOR_TARGET="-I/usr/include/tirpc -I$ORCHESTRA_ROOT/link-only/include" \
          LDFLAGS_FOR_TARGET="-L$INSTALL_LINK_ONLY_PATH/lib -L$ORCHESTRA_ROOT/lib -lrt --sysroot=/ -Wl,-z,origin -Wl,--enable-new-dtags -Wl,-rpath,$RPATH_PLACEHOLDER/lib" \
          --enable-languages=c,c++ \
          CFLAGS="-w -ggdb3 -O3 --sysroot $INSTALL_LINK_ONLY_PATH -idirafter $ORCHESTRA_ROOT/include -idirafter /usr/local/include -idirafter /usr/include/x86_64-linux-gnu -idirafter /usr/include" \
          CXXFLAGS="-w -ggdb3 -O3 --sysroot $INSTALL_LINK_ONLY_PATH -idirafter $ORCHESTRA_ROOT/include -idirafter /usr/local/include -idirafter /usr/include/x86_64-linux-gnu -idirafter /usr/include -std=gnu++11" \
          LDFLAGS="-L$INSTALL_LINK_ONLY_PATH/lib -L$ORCHESTRA_ROOT/lib -lrt --sysroot=/ -Wl,-z,origin -Wl,--enable-new-dtags -fuse-ld=gold -Wl,-rpath,$RPATH_PLACEHOLDER/lib -Wl,-rpath,$RPATH_PLACEHOLDER/lib64/llvm/clang-release/lib/clang/12.0.0/lib/linux -static-libgcc -static-libstdc++ $BUILD_DIR/fake-libc-single-threaded.o"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS} LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
        make install LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

        NEW_GCC_PATH="$ORCHESTRA_ROOT/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/gcc-bin/11.2.0/"

        if test -e "${DESTDIR}${NEW_GCC_PATH}/gcc"; then

          if ! test -e "${DESTDIR}${NEW_GCC_PATH}/cc"; then
            ln -s gcc "${DESTDIR}${NEW_GCC_PATH}/cc"
          fi

          mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
          cp "${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py" "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/gcc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/cc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-cc"
          ln -s gcc "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-gcc"

          cp -a "${DESTDIR}${ORCHESTRA_ROOT}"/lib/gcc/x86_64-pc-linux-gnu/11.2.0/*.{a,o} "${DESTDIR}${ORCHESTRA_ROOT}"/lib/

        fi

        if test -e "${DESTDIR}${NEW_GCC_PATH}/g++"; then

          if ! test -e "${DESTDIR}${NEW_GCC_PATH}/c++"; then
            ln -s g++ "${DESTDIR}${NEW_GCC_PATH}/c++"
          fi

          cp "${ORCHESTRA_DOTDIR}/support/hard-flags-compiler-wrapper.py" "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/g++"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-g++"
          mkdir -p "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/c++"
          ln -s g++ "${DESTDIR}${ORCHESTRA_ROOT}/link-only/bin/x86_64-pc-linux-gnu-c++"

        fi

        rm -f "${DESTDIR}${ORCHESTRA_ROOT}"/lib64/libcc1.*

        # Fixinclude locates the wrong pthread.h
        find "${DESTDIR}${ORCHESTRA_ROOT}" -type d -name include-fixed -exec rm -f {}/pthread.h \;
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    stage2
  "license": |-
    COPYING
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
- "add_to_path": []
  "builds":
    "default":
      "build_dependencies":
      - |-
        gcc-host-toolchain
      - |-
        glibc
      "configure": |
        mkdir -p "$BUILD_DIR"
        extract.sh --into "$BUILD_DIR" https://zlib.net/fossils/zlib-1.2.12.tar.gz
        cd "$BUILD_DIR"
        ./configure \
          --shared \
          --uname=linux \
          --prefix="$ORCHESTRA_ROOT"
      "dependencies": []
      "install": |
        cd "$BUILD_DIR"
        make ${JOBS:+-j$JOBS}
        make ${JOBS:+-j$JOBS} install DESTDIR="$DESTDIR"
      "ndebug": !!bool |-
        true
  "commit": !!null |-
    null
  "default_build": |-
    default
  "license": |-
    README
  "repository": !!null |-
    null
  "skip_post_install": !!bool |-
    false
