2021-09-22 09:09:21 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# This file will need to be run in bash, for now.
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2023-04-24 21:24:22 +03:00
|
|
|
# shellcheck source=/dev/null
|
|
|
|
. "${DIR}/../Meta/shell_include.sh"
|
|
|
|
|
|
|
|
exit_if_running_as_root "Do not run BuildRuby.sh as root, parts of your Toolchain directory will become root-owned"
|
|
|
|
|
2022-06-16 11:32:26 +03:00
|
|
|
PREFIX_DIR="$DIR/Local/ruby"
|
|
|
|
BUILD_DIR="$DIR/Build/ruby"
|
2021-09-22 09:09:21 +03:00
|
|
|
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
|
|
|
|
|
2023-05-02 22:05:04 +03:00
|
|
|
NPROC=$(get_number_of_processing_units)
|
|
|
|
[ -z "$MAKEJOBS" ] && MAKEJOBS=${NPROC}
|
2021-09-22 09:09:21 +03:00
|
|
|
|
|
|
|
mkdir -p "${PREFIX_DIR}"
|
2022-06-16 11:32:26 +03:00
|
|
|
mkdir -p "${BUILD_DIR}"
|
2021-09-22 09:09:21 +03:00
|
|
|
|
2022-06-16 11:32:26 +03:00
|
|
|
pushd "${BUILD_DIR}"
|
2021-09-22 09:09:21 +03:00
|
|
|
"${TARBALLS_DIR}"/ruby-"${RUBY_VERSION}"/configure --prefix="${PREFIX_DIR}"
|
|
|
|
make -j "${MAKEJOBS}"
|
|
|
|
make install
|
|
|
|
popd
|