Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolchain: Build pretty. Use xz, not gz. Use sha256, not md5 #10449

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Documentation/BuildInstructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Make sure you have all the dependencies installed:
### Debian / Ubuntu

```console
sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs ninja-build qemu-system-i386 qemu-utils ccache rsync genext2fs unzip texinfo
sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs ninja-build qemu-system-i386 qemu-utils ccache rsync genext2fs unzip xz-utils texinfo
```

#### GCC 10
Expand Down Expand Up @@ -43,7 +43,7 @@ for details.
### Arch Linux / Manjaro

```console
sudo pacman -S --needed base-devel cmake curl mpfr libmpc gmp e2fsprogs ninja qemu qemu-arch-extra ccache rsync unzip
sudo pacman -S --needed base-devel cmake curl mpfr libmpc gmp e2fsprogs ninja qemu qemu-arch-extra ccache rsync unzip xz
```

### Other systems
Expand Down
13 changes: 7 additions & 6 deletions Documentation/BuildInstructionsOther.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
### Fedora

```console
sudo dnf install binutils-devel curl cmake mpfr-devel libmpc-devel gmp-devel e2fsprogs ninja-build patch ccache rsync @"C Development Tools and Libraries" @Virtualization
sudo dnf install binutils-devel curl cmake mpfr-devel libmpc-devel gmp-devel e2fsprogs ninja-build patch ccache rsync xz @"C Development Tools and Libraries" @Virtualization
```

## openSUSE

```console
sudo zypper install curl cmake mpfr-devel mpc-devel ninja gmp-devel e2fsprogs patch qemu-x86 qemu-audio-pa gcc gcc-c++ ccache rsync patterns-devel-C-C++-devel_C_C++
sudo zypper install curl cmake mpfr-devel mpc-devel ninja gmp-devel e2fsprogs patch qemu-x86 qemu-audio-pa gcc gcc-c++ ccache rsync xz patterns-devel-C-C++-devel_C_C++
```

## Void Linux

```console
sudo xbps-install -S base-devel cmake curl mpfr-devel libmpc-devel gmp-devel e2fsprogs ninja qemu ccache rsync
sudo xbps-install -S base-devel cmake curl mpfr-devel libmpc-devel gmp-devel e2fsprogs ninja qemu ccache rsync xz
```

## ALT Linux

```console
apt-get install curl cmake libmpc-devel gmp-devel e2fsprogs libmpfr-devel ninja-build patch gcc ccache rsync
apt-get install curl cmake libmpc-devel gmp-devel e2fsprogs libmpfr-devel ninja-build patch gcc ccache rsync xz
```

## NixOS
Expand All @@ -48,6 +48,7 @@ stdenv.mkDerivation {
ccache
rsync
unzip
xz

# Example Build-time Additional Dependencies
pkgconfig
Expand All @@ -73,7 +74,7 @@ First, make sure you have enabled the `community` repository in `/etc/apk/reposi

```console
# the basics, if you have not already done so
apk add bash curl git util-linux sudo
apk add bash curl git util-linux sudo xz

# rough equivalent of build-essential
apk add build-base
Expand All @@ -88,7 +89,7 @@ apk add cmake e2fsprogs grub-bios samurai mpc1-dev mpfr-dev gmp-dev ccache rsync
## OpenBSD prerequisites

```console
doas pkg_add bash cmake g++ gcc git gmake gmp ninja ccache rsync coreutils qemu sudo
doas pkg_add bash cmake g++ gcc git gmake gmp ninja ccache rsync coreutils qemu sudo xz
```

## FreeBSD prerequisites
Expand Down
36 changes: 18 additions & 18 deletions Toolchain/BuildClang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ PREFIX="$DIR/Local/clang/$ARCH"
BUILD="$DIR/../Build/clang/$ARCH"
SYSROOT="$BUILD/Root"

MD5SUM="md5sum"
SHA256SUM="sha256sum"
REALPATH="realpath"
MAKE="make"
NPROC="nproc"

SYSTEM_NAME="$(uname -s)"

if [ "$SYSTEM_NAME" = "OpenBSD" ]; then
MD5SUM="md5 -q"
SHA256SUM="sha256 -q"
REALPATH="readlink -f"
MAKE="gmake"
NPROC="sysctl -n hw.ncpuonline"
export CC=egcc
export CXX=eg++
export LDFLAGS=-Wl,-z,notext
elif [ "$SYSTEM_NAME" = "FreeBSD" ]; then
MD5SUM="md5 -q"
SHA256SUM="sha256 -q"
MAKE="gmake"
NPROC="sysctl -n hw.ncpu"
fi
Expand Down Expand Up @@ -70,17 +70,17 @@ echo SYSROOT is "$SYSROOT"
mkdir -p "$DIR/Tarballs"

LLVM_VERSION="12.0.1"
LLVM_MD5SUM="c28061313a4f1b7d74cd491a19f569b4"
LLVM_SHA256SUM="129cb25cd13677aad951ce5c2deb0fe4afc1e9d98950f53b51bdcfb5a73afa0e"
LLVM_NAME="llvm-project-$LLVM_VERSION.src"
LLVM_PKG="$LLVM_NAME.tar.xz"
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PKG"

# We need GNU binutils because we use a feature that llvm-objdump doesn't support yet.
BINUTILS_VERSION="2.37"
BINUTILS_MD5SUM="1e55743d73c100b7a0d67ffb32398cdb"
BINUTILS_SHA256SUM="820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c"
BINUTILS_NAME="binutils-$BINUTILS_VERSION"
BINUTILS_PKG="${BINUTILS_NAME}.tar.gz"
BINUTILS_BASE_URL="https://ftp.gnu.org/gnu/binutils"
BINUTILS_PKG="${BINUTILS_NAME}.tar.xz"
BINUTILS_BASE_URL="https://ftp.gnu.org/gnu/binutils" # option if that is slow: https://fossies.org/linux/misc/

buildstep() {
NAME=$1
Expand Down Expand Up @@ -175,13 +175,13 @@ popd
# === DOWNLOAD AND PATCH ===

pushd "$DIR/Tarballs"
md5=""
sha256=""
if [ -e "$LLVM_PKG" ]; then
md5="$($MD5SUM ${LLVM_PKG} | cut -f1 -d' ')"
echo "llvm md5='$md5'"
sha256="$($SHA256SUM ${LLVM_PKG} | cut -f1 -d' ')"
echo "llvm sha256='$sha256'"
fi

if [ "$md5" != "$LLVM_MD5SUM" ] ; then
if [ "$sha256" != "$LLVM_SHA256SUM" ] ; then
rm -f "$LLVM_PKG"
curl -LO "$LLVM_URL"
else
Expand All @@ -206,16 +206,16 @@ pushd "$DIR/Tarballs"
else
patch -p1 < "$DIR/Patches/llvm.patch" > /dev/null
fi
$MD5SUM "$DIR/Patches/llvm.patch" > .patch.applied
$SHA256SUM "$DIR/Patches/llvm.patch" > .patch.applied
popd

md5=""
sha256=""
if [ -e "$BINUTILS_PKG" ]; then
md5="$($MD5SUM $BINUTILS_PKG | cut -f1 -d' ')"
echo "bu md5='$md5'"
sha256="$($SHA256SUM $BINUTILS_PKG | cut -f1 -d' ')"
echo "bu sha256='$sha256'"
fi

if [ "$md5" != "$BINUTILS_MD5SUM" ]; then
if [ "$sha256" != "$BINUTILS_SHA256SUM" ]; then
rm -f "$BINUTILS_PKG"
curl -LO "$BINUTILS_BASE_URL/$BINUTILS_PKG"
else
Expand All @@ -229,7 +229,7 @@ pushd "$DIR/Tarballs"
echo "Extracting GNU binutils"


tar -xzf "$BINUTILS_PKG"
tar -xJf "$BINUTILS_PKG"
pushd "$BINUTILS_NAME"
if [ "$dev" = "1" ]; then
git init > /dev/null
Expand All @@ -239,7 +239,7 @@ pushd "$DIR/Tarballs"
else
patch -p1 < "$DIR/Patches/binutils.patch" > /dev/null
fi
$MD5SUM "$DIR/Patches/binutils.patch" > .patch.applied
$SHA256SUM "$DIR/Patches/binutils.patch" > .patch.applied
popd
popd

Expand Down
Loading