|
@ -1,9 +1,23 @@ |
|
|
#!/bin/sh |
|
|
#!/bin/sh |
|
|
set -eu |
|
|
set -eu |
|
|
|
|
|
|
|
|
|
|
|
# From: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass |
|
|
|
|
|
makeopts_jobs() { |
|
|
|
|
|
# This assumes the first .* will be more greedy than the second .* |
|
|
|
|
|
# since POSIX doesn't specify a non-greedy match (i.e. ".*?"). |
|
|
|
|
|
local jobs=$(echo " $MAKEFLAGS " | sed -r -n \ |
|
|
|
|
|
-e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ |
|
|
|
|
|
-e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') |
|
|
|
|
|
echo ${jobs:-1} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
version_mrustc=0.10.1 |
|
|
version_mrustc=0.10.1 |
|
|
version_mrustc_rust=1.29.0 |
|
|
version_mrustc_rust=1.29.0 |
|
|
|
|
|
|
|
|
|
|
|
VERSION_GIT_FULLHASH="2a9ab55bbaa706544858ab0968180e665fe7ff4a" |
|
|
|
|
|
VERSION_GIT_SHORTHASH="2a9ab55" |
|
|
|
|
|
VERSION_GIT_BRANCH="v$version_mrustc" |
|
|
|
|
|
|
|
|
dir_download="$PWD/download" |
|
|
dir_download="$PWD/download" |
|
|
dir_patches="$PWD/patches" |
|
|
dir_patches="$PWD/patches" |
|
|
mkdir -p build; cd build |
|
|
mkdir -p build; cd build |
|
@ -13,29 +27,34 @@ dir_install="$PWD/install-rustc-$version_mrustc_rust" |
|
|
tar xf "$dir_download/mrustc-$version_mrustc.tar.gz" |
|
|
tar xf "$dir_download/mrustc-$version_mrustc.tar.gz" |
|
|
cd "mrustc-$version_mrustc" |
|
|
cd "mrustc-$version_mrustc" |
|
|
|
|
|
|
|
|
sed -i -e 's/$(shell git show --pretty=%H -s --no-show-signature)/b6754f574f8846eb842feba4ccbeeecb10bdfacc/g' \ |
|
|
sed -i -e 's/$(shell git show --pretty=%H -s --no-show-signature)/'"$VERSION_GIT_FULLHASH"'/g' \ |
|
|
-e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/v0.10.1/g' \ |
|
|
-e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/'"$VERSION_GIT_BRANCH"'/g' \ |
|
|
-e 's/$(shell git show -s --pretty=%h --no-show-signature)/b6754f5/g' \ |
|
|
-e 's/$(shell git show -s --pretty=%h --no-show-signature)/'"$VERSION_GIT_SHORTHASH"'/g' \ |
|
|
-e 's/$(shell git diff-index --quiet HEAD; echo $$?)/0/g' \ |
|
|
-e 's/$(shell git diff-index --quiet HEAD; echo $$?)/0/g' \ |
|
|
Makefile |
|
|
Makefile |
|
|
sed -i -e 's/ -g\>//' Makefile tools/common/Makefile tools/minicargo/Makefile |
|
|
sed -i -e 's/ -g\>//' Makefile tools/common/Makefile tools/minicargo/Makefile |
|
|
sed -i -e '/args.push_back("-g");/d' tools/minicargo/build.cpp |
|
|
sed -i -e '/args.push_back("-g");/d' tools/minicargo/build.cpp |
|
|
|
|
|
|
|
|
|
|
|
export RUSTC_VERSION="$version_mrustc_rust" |
|
|
|
|
|
export MRUSTC_TARGET_VER="${version_mrustc_rust%.*}" |
|
|
|
|
|
|
|
|
cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" . |
|
|
cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" . |
|
|
|
|
|
touch "rustc-$version_mrustc_rust-src.tar.gz" |
|
|
make RUSTC_SRC_TARBALL="rustc-$version_mrustc_rust-src.tar.xz" RUSTCSRC |
|
|
make RUSTC_SRC_TARBALL="rustc-$version_mrustc_rust-src.tar.xz" RUSTCSRC |
|
|
|
|
|
|
|
|
# Build and install |
|
|
# Build and install |
|
|
export PKG_CONFIG_PATH="$PWD/../install-openssl/lib/pkgconfig:${PKG_CONFIG_PATH:-}" |
|
|
export PKG_CONFIG_PATH="$PWD/../install-openssl/lib/pkgconfig:${PKG_CONFIG_PATH:-}" |
|
|
export CMAKE_GENERATOR='Unix Makefiles' |
|
|
export CMAKE_GENERATOR='Unix Makefiles' |
|
|
|
|
|
export PARLEVEL="$(makeopts_jobs)" |
|
|
|
|
|
|
|
|
make |
|
|
make |
|
|
make -f minicargo.mk rustc-$version_mrustc_rust-src/build/bin/llvm-config |
|
|
make -f minicargo.mk "rustc-$version_mrustc_rust-src/build/bin/llvm-config" |
|
|
make -f minicargo.mk |
|
|
make -f minicargo.mk |
|
|
make -C run_rustc |
|
|
make -C run_rustc |
|
|
|
|
|
|
|
|
cp -a run_rustc/output/prefix "$dir_install" |
|
|
cp -a run_rustc/output/prefix "$dir_install" |
|
|
cat > "$dir_install/bin/rustc" << EOF |
|
|
cat > "$dir_install/bin/rustc" << EOF |
|
|
#!/bin/sh |
|
|
#!/bin/sh |
|
|
d=\$(dirname \$0) |
|
|
d="\$(dirname "\$0")" |
|
|
LD_LIBRARY_PATH="$dir_install/lib:$dir_install/lib/rustlib/$(uname -m)-unknown-linux-gnu/lib" \$d/rustc_binary \$@ |
|
|
LD_LIBRARY_PATH="$dir_install/lib:$dir_install/lib/rustlib/$(uname -m)-unknown-linux-gnu/lib" "\$d/rustc_binary" "\$@" |
|
|
EOF |
|
|
EOF |
|
|