commit 3dc29cc300f620e47884991e764e0af5cdab17ac Author: mid-kid Date: Wed Jul 15 23:05:08 2020 +0200 Add go, java and rust bootstraps diff --git a/go/build.sh b/go/build.sh new file mode 100755 index 0000000..c08eb37 --- /dev/null +++ b/go/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu + +export MAKEFLAGS="-j$(nproc)" + +[ ! -d build/install-bootstrap ] && ./build_bootstrap.sh +[ ! -d build/install-go ] && ./build_go.sh diff --git a/go/build_bootstrap.sh b/go/build_bootstrap.sh new file mode 100755 index 0000000..0877571 --- /dev/null +++ b/go/build_bootstrap.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +version_bootstrap=20171003 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-bootstrap" + +# Prepare source +mkdir -p "go1.4-bootstrap-$version_bootstrap" +tar xf "$dir_download/go1.4-bootstrap-$version_bootstrap.tar.gz" -C "go1.4-bootstrap-$version_bootstrap" --strip-components 1 +cd "go1.4-bootstrap-$version_bootstrap" + +# Build and install +(cd src; ./make.bash) +rm -rf pkg/obj src/cmd src/internal src/builtin +find src -type f \( ! -name "*.go" \) -delete +find src -type f \( -name "*_test.go" -o -name "*_test_*.go" \) -delete +find src -type d -name "testdata" -exec rm -r {} + +find src -type d -empty -delete +mkdir -p "$dir_install" +cp -at "$dir_install" bin pkg src diff --git a/go/build_go.sh b/go/build_go.sh new file mode 100755 index 0000000..a7a3660 --- /dev/null +++ b/go/build_go.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +version_go=1.13 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-go" + +# Prepare source +mkdir -p "go$version_go" +tar xf "$dir_download/go$version_go.src.tar.gz" -C "go$version_go" --strip-components 1 +cd "go$version_go" + +# Build and install +(cd src; GOROOT_BOOTSTRAP="$PWD/../../install-bootstrap" ./make.bash) +rm -rf pkg/obj src/cmd src/builtin +find src -type f \( ! -name "*.go" -a ! -name "*.s" -a ! -name "*.h" \) -delete +find src -type f \( -name "*_test.go" -o -name "*_test_*.go" \) -delete +find src -type d -name "testdata" -exec rm -r {} + +find src -type d -empty -delete +mkdir -p "$dir_install" +cp -at "$dir_install" bin pkg src diff --git a/go/download.sh b/go/download.sh new file mode 100755 index 0000000..a515ae2 --- /dev/null +++ b/go/download.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +version_go=1.13 # https://golang.org/dl/ +version_bootstrap=20171003 # https://golang.org/doc/install/source#go14 + +mkdir -p download +cd download + +wget -c "https://dl.google.com/go/go$version_go.src.tar.gz" +wget -c "https://dl.google.com/go/go1.4-bootstrap-$version_bootstrap.tar.gz" + +sha256sum -c ../download.sha256 diff --git a/go/download.sha256 b/go/download.sha256 new file mode 100644 index 0000000..81e1df6 --- /dev/null +++ b/go/download.sha256 @@ -0,0 +1,2 @@ +3fc0b8b6101d42efd7da1da3029c0a13f22079c0c37ef9730209d8ec665bf122 go1.13.src.tar.gz +f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52 go1.4-bootstrap-20171003.tar.gz diff --git a/java/build.sh b/java/build.sh new file mode 100755 index 0000000..32a4af8 --- /dev/null +++ b/java/build.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +export MAKEFLAGS="-j$(nproc)" + +[ ! -d build/install-gcc ] && ./build_gcc.sh +[ ! -d build/install-ant ] && ./build_ant.sh +[ ! -d build/install-icedtea7 ] && ./build_icedtea7.sh +[ ! -d build/install-icedtea8 ] && ./build_icedtea8.sh +[ ! -d build/install-jdk9 ] && ./build_jdk9.sh +[ ! -d build/install-jdk10 ] && ./build_jdk10.sh +[ ! -d build/install-jdk11 ] && ./build_jdk11.sh diff --git a/java/build_ant.sh b/java/build_ant.sh new file mode 100755 index 0000000..da12a81 --- /dev/null +++ b/java/build_ant.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eu + +version_ant=1.9.13 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-ant" + +# Prepare source +tar xf "$dir_download/apache-ant-$version_ant-src.tar.bz2" +cd "apache-ant-$version_ant" + +# Build and install +unset JAVAC JAVACMD CLASSPATH +export JAVA_HOME="$PWD/../install-gcc/lib/jvm" +export PATH="$JAVA_HOME/bin:$PATH" +./build.sh +cp -a dist "$dir_install" diff --git a/java/build_gcc.sh b/java/build_gcc.sh new file mode 100755 index 0000000..a852fef --- /dev/null +++ b/java/build_gcc.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -eu + +version_gcc=6.5.0 +version_ecj=4.9 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-gcc" + +# Prepare source +tar xf "$dir_download/gcc-$version_gcc.tar.xz" +cd "gcc-$version_gcc" + +cp "$dir_download/ecj-$version_ecj.jar" ecj.jar +cp "$dir_download/javac.in" . +sed -i -e 's/\.\/fixinc\.sh/-c true/' gcc/Makefile.in + +mkdir -p build; cd build + +# Configure source +../configure \ + --prefix="$dir_install" \ + --disable-multilib \ + --disable-bootstrap \ + --disable-nls \ + --enable-languages=java \ + --enable-java-home \ + --with-java-home="$dir_install/lib/jvm/jre" + +# Build and install +make +make install + +cd .. +sed -e "s#@JAVA@#$dir_install/lib/jvm/bin/java#" \ + -e "s#@ECJ_JAR@#$dir_install/share/java/ecj.jar#" \ + -e "s#@RT_JAR@#$dir_install/lib/jvm/jre/lib/rt.jar#" \ + -e "s#@TOOLS_JAR@#$dir_install/lib/jvm/lib/tools.jar#" \ + javac.in > javac +install -Dm755 -t "$dir_install/lib/jvm/bin" javac diff --git a/java/build_icedtea7.sh b/java/build_icedtea7.sh new file mode 100755 index 0000000..ce71294 --- /dev/null +++ b/java/build_icedtea7.sh @@ -0,0 +1,45 @@ +#!/bin/sh +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_icedtea7=2.6.19 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-icedtea7" + +# Prepare source +tar xf "$dir_download/icedtea-$version_icedtea7.tar.xz" +cd "icedtea-$version_icedtea7" + +for part in corba.tar.bz2 hotspot.tar.bz2 jaxp.tar.bz2 jaxws.tar.bz2 jdk.tar.bz2 langtools.tar.bz2 openjdk.tar.bz2; do + cp "$dir_download/icedtea-$version_icedtea7-$part" "$part" +done + +unset JAVA_HOME BOOTDIR ALT_BOOTDIR # openjdk-boot/hotspot/make/linux/makefiles/sa.make +export PATH="$PWD/../install-ant/bin:$PWD/../install-gcc/lib/jvm/bin:$PWD/../install-gcc/bin:$PATH" + +# Configure source +./configure \ + --prefix="$dir_install" \ + --with-jdk-home="$PWD/../install-gcc/lib/jvm" \ + --with-parallel-jobs="$(makeopts_jobs)" \ + --disable-docs \ + --disable-downloading \ + --without-rhino \ + --disable-system-kerberos \ + --disable-system-pcsc \ + --disable-system-sctp + +# Build and install +make +make install diff --git a/java/build_icedtea8.sh b/java/build_icedtea8.sh new file mode 100755 index 0000000..fc19c07 --- /dev/null +++ b/java/build_icedtea8.sh @@ -0,0 +1,46 @@ +#!/bin/sh +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_icedtea8=3.13.0 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-icedtea8" + +# Prepare source +tar xf "$dir_download/icedtea-$version_icedtea8.tar.xz" +cd "icedtea-$version_icedtea8" + +for part in corba.tar.xz hotspot.tar.xz jaxp.tar.xz jaxws.tar.xz jdk.tar.xz langtools.tar.xz nashorn.tar.xz openjdk.tar.xz; do + cp "$dir_download/icedtea-$version_icedtea8-$part" "$part" +done + +export PATH="$PWD/../install-icedtea7/bin:$PATH" + +# Configure source +./configure \ + --prefix="$dir_install" \ + --with-jdk-home="$PWD/../install-icedtea7" \ + --with-parallel-jobs="$(makeopts_jobs)" \ + --enable-headless \ + --disable-docs \ + --disable-bootstrap \ + --disable-ccache \ + --disable-downloading \ + --disable-system-kerberos \ + --disable-system-pcsc \ + --disable-system-sctp + +# Build and install +make +make install diff --git a/java/build_jdk10.sh b/java/build_jdk10.sh new file mode 100755 index 0000000..2cf1763 --- /dev/null +++ b/java/build_jdk10.sh @@ -0,0 +1,37 @@ +#!/bin/sh +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_jdk10=10.0.2+13 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-jdk10" + +# Prepare source +tar xf "$dir_download/jdk10u-jdk-$version_jdk10.tar.bz2" +cd "jdk10u-jdk-$version_jdk10" +chmod +x configure + +# Configure source +./configure \ + --prefix="$dir_install" \ + --with-boot-jdk="$PWD/../install-jdk9" \ + --with-jobs="$(makeopts_jobs)" \ + --disable-full-docs \ + --enable-headless-only \ + --disable-warnings-as-errors + +# Build and install +unset MAKEFLAGS +make product-images +make install diff --git a/java/build_jdk11.sh b/java/build_jdk11.sh new file mode 100755 index 0000000..5da2081 --- /dev/null +++ b/java/build_jdk11.sh @@ -0,0 +1,37 @@ +#!/bin/sh +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_jdk11=11.0.5+6 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-jdk11" + +# Prepare source +tar xf "$dir_download/jdk11u-jdk-$version_jdk11.tar.bz2" +cd "jdk11u-jdk-$version_jdk11" +chmod +x configure + +# Configure source +./configure \ + --prefix="$dir_install" \ + --with-boot-jdk="$PWD/../install-jdk10" \ + --with-jobs="$(makeopts_jobs)" \ + --disable-full-docs \ + --enable-headless-only \ + --disable-warnings-as-errors + +# Build and install +unset MAKEFLAGS +make product-images +make install diff --git a/java/build_jdk9.sh b/java/build_jdk9.sh new file mode 100755 index 0000000..fbdab82 --- /dev/null +++ b/java/build_jdk9.sh @@ -0,0 +1,37 @@ +#!/bin/sh +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_jdk9=9+181 + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-jdk9" + +# Prepare source +tar xf "$dir_download/jdk-jdk-$version_jdk9.tar.bz2" +cd "jdk-jdk-$version_jdk9" +chmod +x configure + +# Configure source +./configure \ + --prefix="$dir_install" \ + --with-boot-jdk="$PWD/../install-icedtea8" \ + --with-jobs="$(makeopts_jobs)" \ + --disable-full-docs \ + --enable-headless-only \ + --disable-warnings-as-errors + +# Build and install +unset MAKEFLAGS +make product-images +make install diff --git a/java/download.sh b/java/download.sh new file mode 100755 index 0000000..82ce538 --- /dev/null +++ b/java/download.sh @@ -0,0 +1,35 @@ +#!/bin/sh +set -eu + +# BIG FAT NOTE/WARNING: Building icedtea-2.6.19 in this manner seems to fail... + +version_jdk11=11.0.5+6 # https://hg.openjdk.java.net/jdk-updates/jdk11u/tags +version_jdk10=10.0.2+13 # https://hg.openjdk.java.net/jdk-updates/jdk10u/tags +version_jdk9=9+181 # https://hg.openjdk.java.net/jdk/jdk/tags +version_icedtea8=3.13.0 # https://icedtea.classpath.org/wiki/Main_Page#Getting_IcedTea +version_icedtea7=2.6.19 # https://icedtea.classpath.org/wiki/Main_Page#Getting_IcedTea +version_ant=1.9.13 # https://ant.apache.org/manual-1.9.x/index.html (1.9.14 seems to fail) +version_gcc=6.5.0 # Final version +version_ecj=4.9 # Final version + +mkdir -p download +cd download + +wget -O "jdk11u-jdk-$version_jdk11.tar.bz2" -c "https://hg.openjdk.java.net/jdk-updates/jdk11u/archive/jdk-$version_jdk11.tar.bz2" +wget -O "jdk10u-jdk-$version_jdk10.tar.bz2" -c "https://hg.openjdk.java.net/jdk-updates/jdk10u/archive/jdk-$version_jdk10.tar.bz2" +wget -O "jdk-jdk-$version_jdk9.tar.bz2" -c "https://hg.openjdk.java.net/jdk/jdk/archive/jdk-$version_jdk9.tar.bz2" +wget -c "http://icedtea.wildebeest.org/download/source/icedtea-$version_icedtea8.tar.xz" +wget -c "http://icedtea.wildebeest.org/download/source/icedtea-$version_icedtea7.tar.xz" +wget -c "https://archive.apache.org/dist/ant/source/apache-ant-$version_ant-src.tar.bz2" +wget -c "https://ftp.gnu.org/gnu/gcc/gcc-$version_gcc/gcc-$version_gcc.tar.xz" +wget -c "ftp://sourceware.org/pub/java/ecj-$version_ecj.jar" +wget -O javac.in -c 'https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-java/gcj-jdk/files/javac.in?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d' + +for part in corba.tar.bz2 hotspot.tar.bz2 jaxp.tar.bz2 jaxws.tar.bz2 jdk.tar.bz2 langtools.tar.bz2 openjdk.tar.bz2; do + wget -O "icedtea-$version_icedtea7-$part" -c "http://icedtea.wildebeest.org/download/drops/icedtea7/$version_icedtea7/$part" +done +for part in corba.tar.xz hotspot.tar.xz jaxp.tar.xz jaxws.tar.xz jdk.tar.xz langtools.tar.xz nashorn.tar.xz openjdk.tar.xz; do + wget -O "icedtea-$version_icedtea8-$part" -c "http://icedtea.wildebeest.org/download/drops/icedtea8/$version_icedtea8/$part" +done + +sha256sum -c ../download.sha256 diff --git a/java/download.sha256 b/java/download.sha256 new file mode 100644 index 0000000..f880805 --- /dev/null +++ b/java/download.sha256 @@ -0,0 +1,24 @@ +fdefd01c909a69fbeab1c45a815e3a80d86351f61b992dfe2e2191d9b009aaaf apache-ant-1.9.13-src.tar.bz2 +9506e75b862f782213df61af67338eb7a23c35ff425d328affc65585477d34cd ecj-4.9.jar +7ef1796ce497e89479183702635b14bb7a46b53249209a5e0f999bebf4740945 gcc-6.5.0.tar.xz +aae916ff4c1f3cbdb14f57716d03adf1f2d9cb221bf0fa0580f607d7a360245b icedtea-2.6.19-corba.tar.bz2 +fbbfa17c95891491311758d2ef595ec322c46452e0bf7b51eb42a9ca1ccc419b icedtea-2.6.19-hotspot.tar.bz2 +4545cf0b2bfeca6cd019f1c8bab3ed7317963776b859f80ffc4d8d79d3c82e8f icedtea-2.6.19-jaxp.tar.bz2 +9b2b76598996962c5128e586edded4022e162421d9898a57c3d6dce2fbe7ee6b icedtea-2.6.19-jaxws.tar.bz2 +1653315e15f30f4f250d6ec9085043b534a28c293ba445467e274c56fef84b88 icedtea-2.6.19-jdk.tar.bz2 +d9d02a7f135350d66d2dde28dad7f2257843d11cc663b641740b1cf21ec3d710 icedtea-2.6.19-langtools.tar.bz2 +2531838d9cf08755d88c91498da6fef427000d0fd527c7ddeaa60c993aa679ea icedtea-2.6.19-openjdk.tar.bz2 +2ba0d2ec3970a163f27d1996074ac4a8767075fc0b7671ef3974cd667aba277d icedtea-2.6.19.tar.xz +552827f8c7b78e442bffa58989821949d8ab07dba5436420b5a53b5a25624e6b icedtea-3.13.0-corba.tar.xz +29592d513662e853f3156a7afb961eb805f92ea731469bbe1e9812365f573372 icedtea-3.13.0-hotspot.tar.xz +bca5bcaada48e24e1cc968682bf953e4ea4c54a116155e36c9176534e6bc9e38 icedtea-3.13.0-jaxp.tar.xz +70982e8eaa599be615d7464ea619f5d8f02651c55445bca9ff15b96aecc941c5 icedtea-3.13.0-jaxws.tar.xz +77508213af438f96a92a1764d1dcff3ce2d8b96dc90962b34ae372a9ed3154cf icedtea-3.13.0-jdk.tar.xz +f1b3cb9a28fbd9c90819370f4ee00863feb02ecce064d429c4a9d6565f78faab icedtea-3.13.0-langtools.tar.xz +5ca970b7408e8b42f1bdd43a6a22564cbb46a083e022ca2a0598a0f879553138 icedtea-3.13.0-nashorn.tar.xz +8509e143bb996b9cab1b3fb06a8a490215d9418d3c1a3abef56f900532584ccd icedtea-3.13.0-openjdk.tar.xz +2d7a979f22cf7dd95e02b7b396d1a136bac99c044c3063270bdc2da650273bfc icedtea-3.13.0.tar.xz +3bb23cff0a6e5a7a820e19cce4b9b0f51a7b84ee9e0eeb048b463a5f3e996db0 javac.in +374f7ae35f0a7439a40bd2c765d1f410607c75c6c1e788f1a344a42e59431f51 jdk10u-jdk-10.0.2+13.tar.bz2 +a46f84b7cde3231cf004dab94fb96c11f2211caed356e2770d7731f9bdb80531 jdk11u-jdk-11.0.5+6.tar.bz2 +8df9102cd985df96733cd7b6e58136681bd6df8812698393d6fcf5049b0dc7e3 jdk-jdk-9+181.tar.bz2 diff --git a/java/template_gentoo b/java/template_gentoo new file mode 100644 index 0000000..612d7fa --- /dev/null +++ b/java/template_gentoo @@ -0,0 +1,18 @@ +# Emerge java-config and eselect-java +# Copy this file to /usr/share/java-config-2/vm/bootstrap +# Symlink the java home directory to /usr/lib/jvm/bootstrap +# Now you can eselect it, and emerge --nodep the final java + +VERSION="Bootstrap" +JAVA_HOME="/usr/lib/jvm/bootstrap" +JDK_HOME="$JAVA_HOME" +JAVAC="$JAVA_HOME/bin/javac" +PATH="$JAVA_HOME/bin" +ROOTPATH="$PATH" +LDPATH="" +MANPATH="" +PROVIDES_TYPE="JDK JRE" +PROVIDES_VERSION="11" # EDIT ME! +BOOTCLASSPATH="" +GENERATION="2" +ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH" diff --git a/rust/build.sh b/rust/build.sh new file mode 100755 index 0000000..0c04271 --- /dev/null +++ b/rust/build.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +export MAKEFLAGS="-j$(nproc)" +export CFLAGS='-w' +export CXXFLAGS="$CFLAGS" + +version_mrustc_rust=1.29.0 +versions_llvm='7.1.0' +versions_rustc='1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1' + +[ ! -d build/install-rustc-$version_mrustc_rust ] && ./build_mrustc.sh + +for version in $versions_llvm; do + [ ! -d build/install-llvm-$version ] && ./build_llvm.sh $version +done + +last_version=$version_mrustc_rust +for version in $versions_rustc; do + version_llvm=7.1.0 + [ ! -e build/install-rustc-$version/bin/cargo ] && ./build_rust.sh $last_version $version $version_llvm + last_version=$version +done diff --git a/rust/build_llvm.sh b/rust/build_llvm.sh new file mode 100755 index 0000000..7e13a4d --- /dev/null +++ b/rust/build_llvm.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -eu + +version_llvm="$1" + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-llvm-$version_llvm" + +# Prepare source +tar xf "$dir_download/llvm-$version_llvm.src.tar.xz" +cd "llvm-$version_llvm.src" + +mkdir -p build; cd build + +# Configure source +cmake .. \ + -DCMAKE_INSTALL_PREFIX="$dir_install" \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_TARGETS_TO_BUILD="X86" \ + -DLLVM_INSTALL_UTILS=ON + +# Build and install +make +make install diff --git a/rust/build_mrustc.sh b/rust/build_mrustc.sh new file mode 100755 index 0000000..c93e861 --- /dev/null +++ b/rust/build_mrustc.sh @@ -0,0 +1,45 @@ +#!/bin/sh +set -eu + +version_mrustc=0.9 +version_mrustc_rust=1.29.0 + +dir_download="$PWD/download" +dir_patches="$PWD/patches" +mkdir -p build; cd build +dir_install="$PWD/install-rustc-$version_mrustc_rust" + +# Prepare source +tar xf "$dir_download/mrustc-$version_mrustc.tar.gz" +cd "mrustc-$version_mrustc" + +patch -p1 -i "$dir_patches/mrustc-0.9-gcc9.patch" +sed -i -e 's/$(shell git show --pretty=%H -s)/15773561e40ca5c8cffe0a618c544b6cfdc5ad7e/g' \ + -e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/v0.9/g' \ + -e 's/$(shell git show -s --pretty=%h)/15773561/g' \ + -e 's/$(shell git diff-index --quiet HEAD; echo $$?)/0/g' \ + Makefile +sed -i -e 's/$Vtime /$V/' \ + -e "s/^\techo '#\!/\techo -e '#\!/" \ + run_rustc/Makefile +sed -i -e 's/CMAKE_BUILD_TYPE=RelWithDebInfo/CMAKE_BUILD_TYPE=Release/' \ + minicargo.mk +sed -i -e 's/ -g\>//' Makefile tools/common/Makefile tools/minicargo/Makefile +sed -i -e '/args.push_back("-g");/d' tools/minicargo/build.cpp +#cat "$dir_patches/rustc-1.19.0-new-openssl.patch" >> rustc-$version_mrustc_rust-src.patch + +cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" . +make RUSTC_VERSION=$version_mrustc_rust RUSTC_SRC_TARBALL="rustc-$version_mrustc_rust-src.tar.xz" RUSTCSRC + +# Build and install +export RUSTC_VERSION=$version_mrustc_rust +export MRUSTC_TARGET_VER=$(echo $version_mrustc_rust | rev | cut -d . -f 2- | rev) +make -C tools/common +make -C tools/minicargo +make +make -f minicargo.mk rustc-$version_mrustc_rust-src/build/bin/llvm-config +make -j1 -f minicargo.mk output/rustc output/cargo +make -j1 PREFIX="$dir_install/" -C run_rustc + +#mkdir -p "$dir_install" +#cp -aT run_rustc/output/prefix "$dir_install" diff --git a/rust/build_rust.sh b/rust/build_rust.sh new file mode 100755 index 0000000..b65788b --- /dev/null +++ b/rust/build_rust.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -eu + +version_rustc_bootstrap="$1" +version_rustc="$2" +version_llvm="$3" + +dir_download="$PWD/download" +mkdir -p build; cd build +dir_install="$PWD/install-rustc-$version_rustc" + +#export LD_LIBRARY_PATH="$dir_bootstrap/lib/rustlib/x86_64-unknown-linux-gnu/lib:${LD_LIBRARY_PATH:-}" +# TODO: Test this for all versions + +# Prepare source +tar xf "$dir_download/rustc-$version_rustc-src.tar.xz" +cd "rustc-$version_rustc-src" + +# Configure source +./configure \ + --prefix="$dir_install" \ + --sysconfdir="$dir_install/etc" \ + --local-rust-root="$PWD/../install-rustc-$version_rustc_bootstrap" \ + --llvm-root="$PWD/../install-llvm-$version_llvm" \ + --enable-vendor + +# Build and install +mkdir -p "$dir_install" +./x.py install --stage 2 src/libstd src/librustc cargo diff --git a/rust/download.sh b/rust/download.sh new file mode 100755 index 0000000..262ebca --- /dev/null +++ b/rust/download.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +version_mrustc=0.9 # https://github.com/thepowersgang/mrustc/releases/ +version_mrustc_rust=1.29.0 # Depends on mrustc +versions_llvm='7.1.0' # https://github.com/llvm/llvm-project/releases +versions_rustc='1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1' # https://github.com/rust-lang/rust/blob/master/RELEASES.md + +mkdir -p download +cd download + +wget -c "https://github.com/thepowersgang/mrustc/archive/v$version_mrustc/mrustc-$version_mrustc.tar.gz" +wget -c "https://static.rust-lang.org/dist/rustc-$version_mrustc_rust-src.tar.xz" + +for version in $versions_llvm; do + wget -c "https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/llvm-$version.src.tar.xz" +done + +for version in $versions_rustc; do + wget -c "https://static.rust-lang.org/dist/rustc-$version-src.tar.xz" +done + +sha256sum -c ../download.sha256 diff --git a/rust/download.sha256 b/rust/download.sha256 new file mode 100644 index 0000000..8a2c5a3 --- /dev/null +++ b/rust/download.sha256 @@ -0,0 +1,15 @@ +1bcc9b285074ded87b88faaedddb88e6b5d6c331dfcfb57d7f3393dd622b3764 llvm-7.1.0.src.tar.xz +381ded90498a04a667ab67a33c1bf7ff1269026bd45a6bde9bac8bf694929de6 mrustc-0.9.tar.gz +3943da98fb478a336ede7404e42ff76ef6ba4fc2b82012cfccd6b9fc4bd2c191 rustc-1.29.0-src.tar.xz +76c824e26b6a554cd48f45993e42001816c2f515dd1b252e3c8315fe200155ae rustc-1.30.1-src.tar.xz +b38f6a1b5e12619f242e44ea494d177c72fd1f80160386b2e69b69446685fcfa rustc-1.31.1-src.tar.xz +d617a7dc39daaafa8256320991005fc376c8ef2080593918301b24466d0067af rustc-1.32.0-src.tar.xz +f4b1a72f1a29b23dcc9d7be5f60878f0434560513273906aa93dcd5c0de39b71 rustc-1.33.0-src.tar.xz +2b3b3a5462aa31d07f39721af73ef394803ceae3472e2470f28b7ee0b12e38ef rustc-1.34.2-src.tar.xz +169756df2298957bcf02da6a612996c24a51b9ac3b23409e6507d69eb2e6f523 rustc-1.35.0-src.tar.xz +f51645b9f787af4a5d94db17f6af39db0c55980ed24fe366cad55b57900f8f2d rustc-1.36.0-src.tar.xz +10abffac50a729cf74cef6dd03193a2f4647541bd19ee9281be9e5b12ca8cdfd rustc-1.37.0-src.tar.xz +3a7991aa4cb44ef941d71636e45a95468b520dc6fc7cf725364925bd3e3d3a34 rustc-1.38.0-src.tar.xz +4b0dbb356070687a606034f71dc032b783bbf8b5d3f9fff39f2c1fbc4f171c29 rustc-1.39.0-src.tar.xz +6e2aa3a91697f4b225c6b394cbae6b97666f061dba491f666a5281698fe2aace rustc-1.40.0-src.tar.xz +ebac9861b43c7207af36e24402dfdc5463a4df4bdb015ccb2b165251c0fdcf7c rustc-1.41.1-src.tar.xz diff --git a/rust/llvm_versions.txt b/rust/llvm_versions.txt new file mode 100644 index 0000000..8248bdb --- /dev/null +++ b/rust/llvm_versions.txt @@ -0,0 +1,13 @@ +Needed versions: +1.30: >=5 <=7 +1.31: >=5 +1.32: >=5 +1.33: >=6 +1.34: >=6 +1.35: >=6 +1.36: >=6 +1.37: >=6 +1.38: >=6 +1.39: >=6 +1.40: >=6 +1.41: >=7 diff --git a/rust/patches/mrustc-0.9-gcc9.patch b/rust/patches/mrustc-0.9-gcc9.patch new file mode 100644 index 0000000..dca13d5 --- /dev/null +++ b/rust/patches/mrustc-0.9-gcc9.patch @@ -0,0 +1,27 @@ +diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp +index 7c9367e4..bdd5e4a7 100644 +--- a/src/hir_typeck/expr_check.cpp ++++ b/src/hir_typeck/expr_check.cpp +@@ -887,12 +887,16 @@ namespace { + else + { + // 1. Look up the encoded trait +- const auto& trait = ( +- node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::Fn ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn") +- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnMut ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut") +- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnOnce ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once") +- : throw "" +- ); ++ const ::HIR::SimplePath* trait_p; ++ switch(node.m_trait_used) ++ { ++ case ::HIR::ExprNode_CallValue::TraitUsed::Fn: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn"); break; ++ case ::HIR::ExprNode_CallValue::TraitUsed::FnMut: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut"); break; ++ case ::HIR::ExprNode_CallValue::TraitUsed::FnOnce: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once"); break; ++ default: ++ throw ""; ++ } ++ const auto& trait = *trait_p; + + ::std::vector< ::HIR::TypeRef> tup_ents; + for(const auto& arg : node.m_args) { diff --git a/rust/patches/rustc-1.19.0-new-openssl.patch b/rust/patches/rustc-1.19.0-new-openssl.patch new file mode 100644 index 0000000..b0bb999 --- /dev/null +++ b/rust/patches/rustc-1.19.0-new-openssl.patch @@ -0,0 +1,19 @@ +--- src/vendor/openssl-sys/build.rs ++++ src/vendor/openssl-sys/build.rs +@@ -360,13 +360,9 @@ + println!("cargo:version=101"); + Version::Openssl101 + } else { +- panic!(" +- +-This crate is only compatible with OpenSSL 1.0.1, 1.0.2, and 1.1.0, or LibreSSL +-2.5.0, 2.5.1, 2.5.2, 2.5.3, and 2.5.4, but a different version of OpenSSL was +-found. The build is now aborting due to this version mismatch. +- +-"); ++ println!("cargo:rustc-cfg=ossl110"); ++ println!("cargo:version=110"); ++ Version::Openssl110 + } + } +