Repository Public License
1#!/bin/bash2# ORIX Convert — Scripts/cli-build.sh3# Description: Shared by matrix.sh, offline-check.sh and bench.sh: builds the `orix-convert` tool (and the helper4# executables its engines start) and sets ORIX_CLI / ORIX_CLI_DIR. Sourced, not executed.5# Author: Simon-Pierre Boucher — contact@spboucher.ai6#7# ORIX_CONFIGURATION=debug|release (default debug; bench.sh uses release). ORIX_SKIP_BUILD=1 reuses the build.8# The native SwiftPM build system is required: with the default one (swiftbuild), the binary targets of several9# engines each install a `module.modulemap` at the same path and the build stops with "Multiple commands produce".10ORIX_PACKAGE="$ROOT/Packages/ConvertKit"11ORIX_CONFIGURATION="${ORIX_CONFIGURATION:-debug}"12ORIX_CLI_DIR="$ORIX_PACKAGE/.build/$ORIX_CONFIGURATION"13ORIX_CLI="$ORIX_CLI_DIR/orix-convert"1415orix_build_cli() {16 if [ "${ORIX_SKIP_BUILD:-0}" = "1" ] && [ -x "$ORIX_CLI" ]; then return 0; fi17 (cd "$ORIX_PACKAGE" && swift build --build-system native -c "$ORIX_CONFIGURATION" --product orix-convert 2>&1 | grep -E "error|warning: unre|Compiling|Build" | grep -v "^\[" | tail -5 || true)18 # Helper executables the engines start (optional: a build without the 3D or scientific engine has no such product).19 for helper in orix-model3d-helper orix-hdf5-probe; do20 (cd "$ORIX_PACKAGE" && swift build --build-system native -c "$ORIX_CONFIGURATION" --product "$helper" >/dev/null 2>&1 || true)21 done22 [ -x "$ORIX_CLI" ] || { echo "cli-build.sh: $ORIX_CLI was not built." >&2; return 1; }23}24