mirror of
https://github.com/lbr77/SideImpactor.git
synced 2026-05-06 11:14:01 -04:00
more refactor
This commit is contained in:
17
scripts/build-wasm-libcurl.sh
Normal file
17
scripts/build-wasm-libcurl.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./wasm-common.sh
|
||||
source "$SCRIPT_DIR/wasm-common.sh"
|
||||
|
||||
activate_emscripten
|
||||
|
||||
if [[ "$(uname -s)" != "Linux" ]]; then
|
||||
echo "libcurl-wasm upstream only supports Linux builds." >&2
|
||||
echo "Run this script on Linux, or use orb to enter a Linux environment first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT/wasm/libcurl-wasm"
|
||||
bun run build
|
||||
16
scripts/build-wasm-openssl.sh
Normal file
16
scripts/build-wasm-openssl.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./wasm-common.sh
|
||||
source "$SCRIPT_DIR/wasm-common.sh"
|
||||
|
||||
OPENSSL_PRECOMPILED="$(resolve_openssl_precompiled_dir || true)"
|
||||
if [[ -z "${OPENSSL_PRECOMPILED}" ]]; then
|
||||
echo "OpenSSL precompiled directory not found." >&2
|
||||
echo "Set OPENSSL_PRECOMPILED_DIR or OPENSSL_ROOT to a directory containing include/ and lib/." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT/wasm/openssl"
|
||||
OPENSSL_ROOT="$OPENSSL_PRECOMPILED" bun run build
|
||||
18
scripts/build-wasm-zsign.sh
Normal file
18
scripts/build-wasm-zsign.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./wasm-common.sh
|
||||
source "$SCRIPT_DIR/wasm-common.sh"
|
||||
|
||||
activate_emscripten
|
||||
|
||||
OPENSSL_PRECOMPILED="$(resolve_openssl_precompiled_dir || true)"
|
||||
if [[ -z "${OPENSSL_PRECOMPILED}" ]]; then
|
||||
echo "OpenSSL precompiled directory not found." >&2
|
||||
echo "Set OPENSSL_PRECOMPILED_DIR or OPENSSL_WASM to a directory containing include/ and lib/." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT/wasm/zsign-wasm"
|
||||
OPENSSL_WASM="$OPENSSL_PRECOMPILED" bun run build
|
||||
43
scripts/wasm-common.sh
Normal file
43
scripts/wasm-common.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
resolve_openssl_precompiled_dir() {
|
||||
local candidate
|
||||
|
||||
for candidate in \
|
||||
"${OPENSSL_WASM:-}" \
|
||||
"${OPENSSL_ROOT:-}" \
|
||||
"${OPENSSL_PRECOMPILED_DIR:-}" \
|
||||
"$REPO_ROOT/openssl-wasm/precompiled" \
|
||||
"$REPO_ROOT/wasm/openssl/precompiled" \
|
||||
"$REPO_ROOT/wasm/vendor/openssl-wasm/precompiled" \
|
||||
"$REPO_ROOT/wasm/openssl-wasm/precompiled"
|
||||
do
|
||||
if [[ -n "$candidate" && -d "$candidate" ]]; then
|
||||
printf '%s\n' "$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
activate_emscripten() {
|
||||
if [[ -n "${EMSDK_ENV:-}" ]]; then
|
||||
if [[ ! -f "${EMSDK_ENV}" ]]; then
|
||||
echo "EMSDK_ENV does not exist: ${EMSDK_ENV}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
. "${EMSDK_ENV}"
|
||||
fi
|
||||
|
||||
if ! command -v emcc >/dev/null 2>&1 || ! command -v em++ >/dev/null 2>&1; then
|
||||
echo "Emscripten is not available. Install it or set EMSDK_ENV to emsdk_env.sh." >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user