mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
a5a2b42046
prebuildify 6.0.0, just released, changed the name of the built module, which our locked version of node-gyp-build then couldn't find. By specifying a version in package.json and making sure we always `yarn install` before running prebuildify, we'll use the version from our lockfile, and never accidentally update to a new major version.
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# shellcheck disable=SC1004
|
|
|
|
#
|
|
# Copyright 2022 Signal Messenger, LLC.
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(dirname "$0")
|
|
cd "${SCRIPT_DIR}"/..
|
|
|
|
DOCKER_IMAGE=libsignal-node-builder
|
|
|
|
IS_TTY=""
|
|
if [[ -t 0 ]]; then
|
|
IS_TTY="yes"
|
|
fi
|
|
|
|
docker build --build-arg "UID=${UID:-501}" --build-arg "GID=${GID:-501}" -t ${DOCKER_IMAGE} -f node/Dockerfile .
|
|
|
|
# We build both architectures in the same run action to save on intermediates
|
|
# (including downloading dependencies)
|
|
# We run `yarn install` to make sure the correct prebuildify version is used.
|
|
docker run ${IS_TTY:+ -it} --init --rm -v "${PWD}":/home/libsignal/src ${DOCKER_IMAGE} sh -c '
|
|
cd ~/src/node &&
|
|
npx yarn install --ignore-scripts --frozen-lockfile &&
|
|
env CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
|
CC=aarch64-linux-gnu-gcc \
|
|
CXX=aarch64-linux-gnu-g++ \
|
|
CPATH=/usr/aarch64-linux-gnu/include \
|
|
npx prebuildify --napi -t $(cat ~/.nvmrc) --arch arm64 &&
|
|
npx prebuildify --napi -t $(cat ~/.nvmrc) --arch x64
|
|
'
|