mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
eff149b398
The only supported way to target an older glibc is to build against that glibc; consequently, we need to build on an Ubuntu 16 system (or similar) to target Ubuntu 16. This requires downloading second-party versions of Clang and CMake, which are too old in the default Ubuntu repository, as well as building our own Python. Do all this in a new Dockerfile based on Ubuntu 16.04. This isn't as rigorous as the Java "reproducible build" Dockerfile, since we're not pinning the base image or the repositories we're fetching from, but it's still an image with the environment and tools we need.
29 lines
878 B
Bash
Executable File
29 lines
878 B
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
|
|
|
|
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)
|
|
docker run --rm -v "${PWD}":/home/libsignal/src ${DOCKER_IMAGE} sh -c '
|
|
cd ~/src/node &&
|
|
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
|
|
'
|