2023-10-24 04:46:30 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2024-06-29 14:26:20 +00:00
|
|
|
builddir="$1"
|
|
|
|
|
2024-09-30 20:16:36 +00:00
|
|
|
error="${GST_WERROR:-false}"
|
|
|
|
gtk_args="${GTK_ARGS:-}"
|
|
|
|
meson_args="${MESON_ARGS:-}"
|
|
|
|
|
2024-06-29 14:26:20 +00:00
|
|
|
if [[ -z "$builddir" ]]; then
|
|
|
|
echo "Usage: build.sh <build_directory>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-10-24 04:46:30 +00:00
|
|
|
set -eux
|
|
|
|
|
2024-09-30 20:16:36 +00:00
|
|
|
source "ci/scripts/source_image_env.sh"
|
|
|
|
|
2023-10-24 04:46:30 +00:00
|
|
|
# Expects:
|
|
|
|
# BUILD_TYPE: Proxy of meson's --default-library arg
|
|
|
|
# must be 'shared' or 'static' or 'both'
|
|
|
|
# BUILD_GST_DEBUG: Build with gst debug symbols or not
|
|
|
|
# must be a string like this: -Dgstreamer:gst_debug=true.
|
|
|
|
# GST_WERROR: make warning fatal or not
|
|
|
|
# must be a string of a boolean, "true" or "false". Not yaml bool.
|
|
|
|
# SUBPROJECTS_CACHE_DIR: The location in the image of the subprojects cache
|
|
|
|
|
2023-12-05 10:12:35 +00:00
|
|
|
# nproc works on linux
|
|
|
|
# sysctl for macos
|
|
|
|
_jobs=$(nproc || sysctl -n hw.ncpu)
|
|
|
|
jobs="${FDO_CI_CONCURRENT:-$_jobs}"
|
|
|
|
|
2023-10-24 04:46:30 +00:00
|
|
|
date -R
|
|
|
|
|
2024-09-30 20:16:36 +00:00
|
|
|
ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} $meson_args $gtk_args"
|
|
|
|
echo "Werror: $error"
|
2023-10-24 04:46:30 +00:00
|
|
|
|
2024-09-30 20:16:36 +00:00
|
|
|
# If the variable is not true, we are either running locally or explicitly false. Thus false by default.
|
|
|
|
if [ "$error" = "true" ]; then
|
2023-10-24 04:46:30 +00:00
|
|
|
ARGS="$ARGS --native-file ./ci/meson/gst-werror.ini"
|
|
|
|
fi
|
|
|
|
|
|
|
|
date -R
|
2024-06-29 14:26:20 +00:00
|
|
|
meson setup "$builddir" --native-file ./ci/meson/gst-ci-cflags.ini ${ARGS}
|
2023-10-25 07:54:02 +00:00
|
|
|
date -R
|
|
|
|
|
|
|
|
if command -v ccache
|
|
|
|
then
|
|
|
|
ccache --show-stats
|
|
|
|
fi
|
|
|
|
|
2023-10-24 04:46:30 +00:00
|
|
|
date -R
|
2024-06-29 14:26:20 +00:00
|
|
|
meson compile -C "$builddir" --jobs "$jobs"
|
2023-10-24 04:46:30 +00:00
|
|
|
date -R
|
|
|
|
|
2023-10-25 07:54:02 +00:00
|
|
|
if command -v ccache
|
|
|
|
then
|
|
|
|
ccache --show-stats
|
|
|
|
fi
|