| #!/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[@]}" |
| make -j"$(nproc || echo 3)" |
| make install |
| |
| cat ./npth-config | awk '/^prefix=/ { print "prefix=$(cd -P \"$(dirname -- \"$0\")\" && cd .. && pwd -P)"; next } 1 { print }' > ./npth-config.NEW |
| rm ./npth-config |
| mv ./npth-config.NEW ./npth-config |
| install -c -m 755 ./npth-config "$PREFIX"/bin |