Skip to content

Instantly share code, notes, and snippets.

@tesuji
Created October 2, 2020 11:37
Show Gist options
  • Save tesuji/a09855fe25a36bcd81cc3227d6e6fac7 to your computer and use it in GitHub Desktop.
Save tesuji/a09855fe25a36bcd81cc3227d6e6fac7 to your computer and use it in GitHub Desktop.
# Sample TOML configuration file for building Rust.
changelog-seen = 1
# =============================================================================
# Tweaking how LLVM is compiled
# =============================================================================
[llvm]
# Whether to use Rust CI built LLVM instead of locally building it.
#
# Unless you're developing for a target where Rust CI doesn't build a compiler
# toolchain or changing LLVM locally, you probably want to set this to true.
#
# It's currently false by default due to being newly added; please file bugs if
# enabling this did not work for you on Linux (macOS and Windows support is
# coming soon).
#
# We also currently only support this when building LLVM for the build triple.
#
# Note that many of the LLVM options are not currently supported for
# downloading. Currently only the "assertions" option can be toggled.
download-ci-llvm = true
# Indicates whether ccache is used when building LLVM
ccache = true
# or alternatively ...
#ccache = "/path/to/ccache"
# Whether to use Ninja to build LLVM. This runs much faster than make.
ninja = true
# LLVM targets to build support for.
# Note: this is NOT related to Rust compilation targets. However, as Rust is
# dependent on LLVM for code generation, turning targets off here WILL lead to
# the resulting rustc being unable to compile for the disabled architectures.
# Also worth pointing out is that, in case support for new targets are added to
# LLVM, enabling them here doesn't mean Rust is automatically gaining said
# support. You'll need to write a target specification at least, and most
# likely, teach rustc about the C ABI of the target. Get in touch with the
# Rust team and file an issue if you need assistance in porting!
#targets = "AArch64;ARM;Mips;X86"
#experimental-targets = ""
# =============================================================================
# General build configuration options
# =============================================================================
[build]
# Instead of downloading the src/stage0.txt version of Cargo specified, use
# this Cargo binary instead to build all Rust code
cargo = "/home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo"
# Instead of downloading the src/stage0.txt version of the compiler
# specified, use this rustc binary instead as the stage0 snapshot compiler.
rustc = "/home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc"
# Instead of download the src/stage0.txt version of rustfmt specified,
# use this rustfmt binary instead as the stage0 snapshot rustfmt.
#rustfmt = "/path/to/bin/rustfmt"
# Flag to specify whether any documentation is built. If false, rustdoc and
# friends will still be compiled but they will not be used to generate any
# documentation.
#docs = true
# Indicate whether the compiler should be documented in addition to the standard
# library and facade crates.
#compiler-docs = false
# Indicate whether git submodules are managed and updated automatically.
submodules = false
# Indicates that a local rebuild is occurring instead of a full bootstrap,
# essentially skipping stage0 as the local compiler is recompiling itself again.
local-rebuild = true
# Print out how long each rustbuild step took (mostly intended for CI and
# tracking over time)
#print-step-timings = false
# =============================================================================
# Options for compiling Rust code itself
# =============================================================================
[rust]
# Whether to always use incremental compilation when building rustc
incremental = true
# debug = true
# Whether or not debug assertions are enabled for the compiler and standard
# library. Debug assertions control the maximum log level used by rustc. When
# enabled calls to `trace!` and `debug!` macros are preserved in the compiled
# binary, otherwise they are omitted.
#
# Defaults to rust.debug value
#debug-assertions = debug
# Whether or not to leave debug! and trace! calls in the rust binary.
# Overrides the `debug-assertions` option, if defined.
#
# Defaults to rust.debug-assertions value
#debug-logging = debug-assertions
# =============================================================================
# Options for specific targets
#
# Each of the following options is scoped to the specific target triple in
# question and is used for determining how to compile each target.
# =============================================================================
[target.x86_64-unknown-linux-gnu]
# Path to the `llvm-config` binary of the installation of a custom LLVM to link
# against. Note that if this is specified we don't compile LLVM at all for this
# target.
#llvm-config = "/home/lzutao/.local/bin/llvm-config"
# Normally the build system can find LLVM's FileCheck utility, but if
# not, you can specify an explicit file name for it.
#llvm-filecheck = "/path/to/FileCheck"
#!/usr/bin/env bash
set -e
git config feature.manyFiles true
GIT_COMMON_DIR=$(git rev-parse --git-common-dir)
cp -if "$GIT_COMMON_DIR"/../../config.toml .
# for path in $(grep 'path = ' .gitmodules | awk '{print $3}'); do
# if [[ -e "$path" ]]; then
# rmdir "$path"
# fi
# cp -lr "$ROOT/../$path" "$path"
# done
git submodule deinit --all -f
LOCAL_MODULES=$(git rev-parse --git-dir)
# not supported in ext4
# cp --archive --reflink "$GIT_COMMON_DIR"/modules "$LOCAL_MODULES"
cp --archive --link "$GIT_COMMON_DIR"/modules "$LOCAL_MODULES"
git submodule init
git submodule update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment