blob: cb9f15b1f5ce463e4751fc012c8365ff608d72c0 [file] [edit]
#!/bin/bash
# Copyright 2025 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
set -x
set -o pipefail
PREFIX="$1"
DEPS_PREFIX="$2"
_CONFIG_ARGS=(
"--enable-maintainer-mode"
"--enable-static"
"--disable-shared"
"--prefix=${PREFIX}"
"LDFLAGS=-L${DEPS_PREFIX}/lib"
)
if [[ -n "${CROSS_TRIPLE}" ]]; then
_CONFIG_ARGS=( "${_CONFIG_ARGS[@]}" "--host=${CROSS_TRIPLE}" )
fi
sh autogen.sh
./configure "${_CONFIG_ARGS[@]}" || cat config.log
make -j"$(nproc || echo 3)"
make install
# Install a gpg-error-config script that is relocatable.
# This thing works by computing the "prefix" relative to where it is installed.
#
# Note that we are intentionally modifying gpg-error-config in the source tree
# before installing it in the destination ($PREFIX).
# This is to avoid weird permission errors when you try to copy or move files
# around in the destination.
cat src/gpg-error-config | awk '/^prefix=/ { print "prefix=$(cd -P \"$(dirname -- \"$0\")\" && cd .. && pwd -P)"; next } 1 { print }' > src/gpg-error-config.NEW
rm src/gpg-error-config
mv src/gpg-error-config.NEW src/gpg-error-config
install -c -m 755 src/gpg-error-config "$PREFIX"/bin