-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cocoa <[email protected]>
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
|
||
DOCKER_PLATFORM=$1 | ||
DOCKER_IMAGE=$2 | ||
OTP_VERSION=$3 | ||
ELIXIR_VERSION=$4 | ||
TARGET_TRIPLET=$5 | ||
|
||
sudo docker run --privileged --network=host --rm --platform="${DOCKER_PLATFORM}" -v $(pwd):/work "${DOCKER_IMAGE}" \ | ||
sh -c "chmod a+x /work/do-build.sh && /work/do-build.sh ${OTP_VERSION} ${ELIXIR_VERSION} ${TARGET_TRIPLET}" | ||
|
||
sudo chmod -R a+r ./cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
|
||
OTP_VERSION=$1 | ||
ELIXIR_VERSION=$2 | ||
TARGET_TRIPLET=$3 | ||
|
||
OTP_MAIN_VER="${OTP_VERSION%%.*}" | ||
export DEBIAN_FRONTEND=noninteractive | ||
export LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 | ||
|
||
case $TARGET_TRIPLET in | ||
armv7l-linux-gnueabihf ) | ||
apt-get update && \ | ||
apt-get install -y libncurses-dev libssl-dev make cmake build-essential gcc g++ curl unzip locales locales-all && \ | ||
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ | ||
locale-gen | ||
;; | ||
*) | ||
echo "Unknown TRIPLET: ${TARGET_TRIPLET}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
ROOTDIR="/work" | ||
OTP_ROOTDIR="${ROOTDIR}/.tools/otp" | ||
ELIXIR_DIR="${ROOTDIR}/.tools/elixir" | ||
export PATH="${OTP_ROOTDIR}/usr/local/bin:${ELIXIR_DIR}/${ELIXIR_VERSION}/bin:${PATH}" | ||
export ERL_ROOTDIR="${OTP_ROOTDIR}/usr/local/lib/erlang" | ||
export ELIXIR_MAKE_CACHE_DIR="${ROOTDIR}/cache" | ||
export CC_PRECOMPILER_PRECOMPILE_ONLY_LOCAL="true" | ||
|
||
mkdir -p "${OTP_ROOTDIR}" && \ | ||
mkdir -p "${ELIXIR_DIR}" && \ | ||
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}" && \ | ||
cd "${OTP_ROOTDIR}" && \ | ||
curl -fSL "https://github.com/cocoa-xu/otp-build/releases/download/v${OTP_VERSION}/otp-${TARGET_TRIPLET}.tar.gz" -o "otp-${TARGET_TRIPLET}.tar.gz" && \ | ||
tar -xzf "otp-${TARGET_TRIPLET}.tar.gz" && \ | ||
cd "${ELIXIR_DIR}" && \ | ||
curl -fSL "https://github.com/elixir-lang/elixir/releases/download/v${ELIXIR_VERSION}/elixir-otp-${OTP_MAIN_VER}.zip" -o "elixir-otp-${OTP_MAIN_VER}.zip" && \ | ||
unzip -o -q "elixir-otp-${OTP_MAIN_VER}.zip" -d "${ELIXIR_VERSION}" && \ | ||
mix local.hex --force && \ | ||
mix local.rebar --force && \ | ||
cd "${ROOTDIR}" && \ | ||
mix deps.get && \ | ||
mix elixir_make.precompile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters