-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-libserialport.sh
executable file
·35 lines (29 loc) · 1.06 KB
/
build-libserialport.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Copyright 2024-2025 Nick Brassel (@tzarc)
# SPDX-License-Identifier: GPL-2.0-or-later
set -eEuo pipefail
this_script=$(realpath "${BASH_SOURCE[0]}")
script_dir=$(dirname "$this_script")
source "$script_dir/common.bashinc"
cd "$script_dir"
build_one_help "$@"
respawn_docker_if_needed "$@"
source_dir="$script_dir/.repos/libserialport"
if [ ! -e "$source_dir/configure" ]; then
pushd "$source_dir" >/dev/null 2>&1
./autogen.sh
popd >/dev/null 2>&1
fi
for triple in "${triples[@]}"; do
echo
build_dir="$script_dir/.build/$(fn_os_arch_fromtriplet "$triple")/libserialport"
xroot_dir="$script_dir/.xroot/$(fn_os_arch_fromtriplet "$triple")"
mkdir -p "$build_dir"
echo "Building libserialport for $triple => $build_dir"
pushd "$build_dir" >/dev/null 2>&1
rm -rf "$build_dir/*"
rcmd "$source_dir/configure" --prefix="$xroot_dir" --host=$triple --enable-shared=no --disable-shared --enable-static CC="${triple}-gcc" CXX="${triple}-g++"
rcmd make clean
rcmd make -j$(nproc) install
popd >/dev/null 2>&1
done