summaryrefslogtreecommitdiff
path: root/Toolchain
diff options
context:
space:
mode:
authorEric Seifert <seiferteric@gmail.com>2021-09-21 23:09:21 -0700
committerLinus Groh <mail@linusgroh.de>2021-09-24 10:04:47 +0200
commit01a06dde0e8de63aadeb42f01c6a2952feffb892 (patch)
tree5bd2677dee476397495c351000a02e2fb0146305 /Toolchain
parent32932f83be01578025c9e5411be5b2729520036f (diff)
downloadserenity-01a06dde0e8de63aadeb42f01c6a2952feffb892.zip
Ports: Add Ruby 3.0.2
Diffstat (limited to 'Toolchain')
-rwxr-xr-xToolchain/BuildRuby.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/Toolchain/BuildRuby.sh b/Toolchain/BuildRuby.sh
new file mode 100755
index 0000000000..8791285b93
--- /dev/null
+++ b/Toolchain/BuildRuby.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+set -e
+
+# This file will need to be run in bash, for now.
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+ARCH=${ARCH:-"i686"}
+PREFIX_DIR="$DIR/Local/$ARCH"
+BUILD_DIR="$DIR/Build/$ARCH"
+TARBALLS_DIR="$DIR/Tarballs"
+
+# shellcheck source=/dev/null
+source "$DIR/../Ports/ruby/version.sh"
+
+mkdir -p "${TARBALLS_DIR}"
+
+pushd "${TARBALLS_DIR}"
+ if [ ! -e "${RUBY_ARCHIVE}" ]; then
+ echo "Downloading Ruby from ${RUBY_ARCHIVE_URL}..."
+ curl -O "${RUBY_ARCHIVE_URL}"
+ else
+ echo "${RUBY_ARCHIVE} already exists, not downloading archive"
+ fi
+
+ if ! sha256sum --status -c <(echo "${RUBY_ARCHIVE_SHA256SUM}" "${RUBY_ARCHIVE}"); then
+ echo "Ruby archive SHA256 sum mismatch, please run script again"
+ rm -f "${RUBY_ARCHIVE}"
+ exit 1
+ fi
+
+ if [ ! -d "ruby-${RUBY_VERSION}" ]; then
+ echo "Extracting ${RUBY_ARCHIVE}..."
+ tar -xf "${RUBY_ARCHIVE}"
+ else
+ echo "ruby-${RUBY_VERSION} already exists, not extracting archive"
+ fi
+popd
+
+if [ -z "$MAKEJOBS" ]; then
+ MAKEJOBS=$(nproc)
+fi
+
+mkdir -p "${PREFIX_DIR}"
+mkdir -p "${BUILD_DIR}/ruby"
+
+pushd "${BUILD_DIR}/ruby"
+ "${TARBALLS_DIR}"/ruby-"${RUBY_VERSION}"/configure --prefix="${PREFIX_DIR}"
+ make -j "${MAKEJOBS}"
+ make install
+popd