chore: Attempt to run install.sh for CI

master
Sean McBride 4 years ago
parent 02b6510a4e
commit f7d10ad97c

@ -76,9 +76,14 @@ jobs:
wamerican wamerican
- name: Compile sledge - name: Compile sledge
run: | run: |
make install make build
echo "/opt/sledge/bin:$PATH" >> $GITHUB_PATH make build-validate
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV make rtinit
mkdir bin
mkdir lib
SYS_PREFIX="$(pwd)" ./install.sh
echo "$(pwd)/bin:$PATH" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$(pwd)/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Compile sample apps and run tests - name: Compile sample apps and run tests
run: | run: |
./test.sh ./test.sh

@ -6,6 +6,15 @@ build:
test -f ./${COMPILER}/wasmception/dist/bin/clang || make -C ${COMPILER}/wasmception test -f ./${COMPILER}/wasmception/dist/bin/clang || make -C ${COMPILER}/wasmception
@cd ${COMPILER} && cargo build --release && cd ${ROOT} @cd ${COMPILER} && cargo build --release && cd ${ROOT}
.PHONY: build-validate
build-validate:
which awsm
awsm --version
cd ${COMPILER}
which awsm
awsm --version
cd ${ROOT}
.PHONY: build-dev .PHONY: build-dev
build-dev: build-dev:
test -f ./${COMPILER}/wasmception/dist/bin/clang || make -C ${COMPILER}/wasmception test -f ./${COMPILER}/wasmception/dist/bin/clang || make -C ${COMPILER}/wasmception
@ -35,6 +44,6 @@ runtime:
make -C runtime make -C runtime
.PHONY: install .PHONY: install
install: build rtinit install: build build-validate rtinit
@./install.sh wasmception @./install.sh wasmception

@ -4,10 +4,14 @@
echo "Setting up toolchain environment" echo "Setting up toolchain environment"
# Get the path of this repo # Get the path of this repo
# SYS_SRC_PREFIX could be externally set
# This is written assuming that install.sh might be in the project top level directory or a subdirectory,
# but that it is always called with a relative path from the project root
SYS_SRC_PREFIX=${SYS_SRC_PREFIX:-"$( SYS_SRC_PREFIX=${SYS_SRC_PREFIX:-"$(
cd "$(dirname "$(dirname "${0}")")" || exit 1 cd "$(dirname "$(dirname "${0}")")" || exit 1
pwd -P pwd -P
)"} )"}
echo SYS_SRC_PREFIX: "$SYS_SRC_PREFIX"
# And check for the presence of this script to make sure we got it right # And check for the presence of this script to make sure we got it right
if [ ! -x "${SYS_SRC_PREFIX}/install.sh" ]; then if [ ! -x "${SYS_SRC_PREFIX}/install.sh" ]; then
@ -17,21 +21,27 @@ fi
SYS_NAME='sledge' SYS_NAME='sledge'
COMPILER='awsm' COMPILER='awsm'
COMPILER_EXECUTABLE='silverfish' COMPILER_EXECUTABLE=$COMPILER
# /opt/sledge # /opt/sledge
SYS_PREFIX=${SYS_PREFIX:-"/opt/${SYS_NAME}"} SYS_PREFIX=${SYS_PREFIX:-"/opt/${SYS_NAME}"}
echo SYS_PREFIX: "$SYS_PREFIX"
# /sledge, where the sledge repo is mounted from the host # /sledge, where the sledge repo is mounted from the host
SYS_SRC_PREFIX=${SYS_SRC_PREFIX:-"/${SYS_NAME}"} SYS_SRC_PREFIX=${SYS_SRC_PREFIX:-"/${SYS_NAME}"}
echo SYS_SRC_PREFIX: "$SYS_SRC_PREFIX"
# The release directory containing the binary of the aWsm compiler # The release directory containing the binary of the aWsm compiler
SYS_COMPILER_REL_DIR=${SYS_COMPILER_REL_DIR:-"${SYS_SRC_PREFIX}/${COMPILER}/target/release"} SYS_COMPILER_REL_DIR=${SYS_COMPILER_REL_DIR:-"${SYS_SRC_PREFIX}/${COMPILER}/target/release"}
echo SYS_COMPILER_REL_DIR: "$SYS_COMPILER_REL_DIR"
# /opt/sledge/bin # /opt/sledge/bin
SYS_BIN_DIR=${SYS_BIN_DIR:-"${SYS_PREFIX}/bin"} SYS_BIN_DIR=${SYS_BIN_DIR:-"${SYS_PREFIX}/bin"}
echo SYS_BIN_DIR: "$SYS_BIN_DIR"
# /opt/sledge/lib # /opt/sledge/lib
SYS_LIB_DIR=${SYS_LIB_DIR:-"${SYS_PREFIX}/lib"} SYS_LIB_DIR=${SYS_LIB_DIR:-"${SYS_PREFIX}/lib"}
echo SYS_LIB_DIR: "$SYS_LIB_DIR"
# The first argument can be either wasi or wasmception. This determines the system interface used # The first argument can be either wasi or wasmception. This determines the system interface used
# The default is wasmception # The default is wasmception
@ -53,14 +63,30 @@ elif [ "$1" = "wasi" ]; then
WASM_BIN_PREFIX=${WASM_BIN_PREFIX:-"$WASM_TARGET"} WASM_BIN_PREFIX=${WASM_BIN_PREFIX:-"$WASM_TARGET"}
WASM_TOOLS=ar dwarfdump nm ranlib size WASM_TOOLS=ar dwarfdump nm ranlib size
fi fi
echo WASM_PREFIX: "$WASM_PREFIX"
echo WASM_BIN: "$WASM_BIN"
echo WASM_SYSROOT: "$WASM_SYSROOT"
echo WASM_TARGET: "$WASM_TARGET"
echo WASM_BIN_PREFIX: "$WASM_BIN_PREFIX"
echo WASM_TOOLS: "$WASM_TOOLS"
# Delete all existing installations of the binaries
echo rm -f "${SYS_BIN_DIR}"/*
rm -f "${SYS_BIN_DIR}"/* rm -f "${SYS_BIN_DIR}"/*
# And reinstall
echo install -d -v "$SYS_BIN_DIR" || exit 1
install -d -v "$SYS_BIN_DIR" || exit 1 install -d -v "$SYS_BIN_DIR" || exit 1
# Link the Awsm compiler. Rename to awsm if still using legacy "silverfish" name # Symbolically link the Awsm compiler
# /sledge/awsm/target/release/silverfish /opt/sledge/bin/awsm # /sledge/awsm/target/release/silverfish /opt/sledge/bin/awsm
ln -sfv "${SYS_COMPILER_REL_DIR}/${COMPILER_EXECUTABLE}" "${SYS_BIN_DIR}/awsm" echo ln -sfv "${SYS_COMPILER_REL_DIR}/${COMPILER_EXECUTABLE}" "${SYS_BIN_DIR}/${COMPILER_EXECUTABLE}"
ln -sfv "${SYS_COMPILER_REL_DIR}/${COMPILER_EXECUTABLE}" "${SYS_BIN_DIR}/${COMPILER_EXECUTABLE}"
# Generate shell script stubs that act as aliases that automatically set the approproiate target and sysroot
# for either Wasmception or WASI-SDK
# For example, when wasmception is set, calling `wasm32-unknown-unknown-wasm-clang` results in
# `exec "/sledge/awsm/wasmception/dist/bin/clang" --target="wasm32-unknown-unknown-wasm" --sysroot="/sledge/awsm/wasmception/sysroot" "$@"`
for file in clang clang++; do for file in clang clang++; do
wrapper_file="$(mktemp)" wrapper_file="$(mktemp)"
cat >"$wrapper_file" <<EOT cat >"$wrapper_file" <<EOT
@ -68,20 +94,30 @@ for file in clang clang++; do
exec "${WASM_BIN}/${file}" --target="$WASM_TARGET" --sysroot="$WASM_SYSROOT" "\$@" exec "${WASM_BIN}/${file}" --target="$WASM_TARGET" --sysroot="$WASM_SYSROOT" "\$@"
EOT EOT
cat "$wrapper_file"
echo install -p -v "$wrapper_file" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
install -p -v "$wrapper_file" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}" install -p -v "$wrapper_file" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
echo rm -f "$wrapper_file"
rm -f "$wrapper_file" rm -f "$wrapper_file"
done done
exit
#for file in ar dwarfdump nm ranlib size; do # Link the LLVM Tools with the proper prefix
for file in ${WASM_TOOLS}; do for file in ${WASM_TOOLS}; do
echo ln -sfv "${WASM_BIN}/llvm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
ln -sfv "${WASM_BIN}/llvm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}" ln -sfv "${WASM_BIN}/llvm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
done done
# Link any other tools with the proper prefix
for file in ld; do for file in ld; do
echo ln -sfv "${WASM_BIN}/wasm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
ln -sfv "${WASM_BIN}/wasm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}" ln -sfv "${WASM_BIN}/wasm-${file}" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-${file}"
done done
# Link clang as gcc if needed
echo ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-gcc"
ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-gcc" ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-gcc"
echo ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang++" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-g++"
ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang++" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-g++" ln -svf "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-clang++" "${SYS_BIN_DIR}/${WASM_BIN_PREFIX}-g++"
echo "Done!" echo "Done!"

Loading…
Cancel
Save