mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
ci: Make it easier to run the build scripts locally
* Move the exported PATH variables into a script so we can source it in all the wrapper scripts. * Add a guard to only copy over the cache when the SUBPROJECTS_CACHE_DIR variable is set, which only happens on CI by default * Make it possible to run the scripts with default values for some of the variables, like WERROR and MESON_ARGS. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7591>
This commit is contained in:
parent
128dd3d82c
commit
9c5523d529
4 changed files with 40 additions and 19 deletions
|
@ -1,7 +1,6 @@
|
|||
#! /bin/bash
|
||||
|
||||
builddir="$1"
|
||||
|
||||
if [[ -z "$builddir" ]]; then
|
||||
echo "Usage: build-docs.sh <build_directory>"
|
||||
exit 1
|
||||
|
@ -9,14 +8,11 @@ fi
|
|||
|
||||
set -eux
|
||||
|
||||
export PATH="/usr/local/cargo/bin/:/usr/local/bin/:$PATH"
|
||||
export RUSTUP_HOME="/usr/local/rustup"
|
||||
export CARGO_HOME="/usr/local/cargo"
|
||||
source "ci/scripts/source_image_env.sh"
|
||||
|
||||
./ci/scripts/handle-subprojects-cache.py --cache-dir /subprojects subprojects/
|
||||
|
||||
echo "$MESON_ARGS"
|
||||
meson setup "$builddir" $MESON_ARGS
|
||||
meson_args="${MESON_ARGS:--Ddoc=enabled -Drs=enabled -Dgst-docs:fatal_warnings=true}"
|
||||
echo "$meson_args"
|
||||
meson setup "$builddir" $meson_args
|
||||
ccache --show-stats
|
||||
|
||||
ninja -C "$builddir" update_girs
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
builddir="$1"
|
||||
|
||||
error="${GST_WERROR:-false}"
|
||||
gtk_args="${GTK_ARGS:-}"
|
||||
meson_args="${MESON_ARGS:-}"
|
||||
|
||||
if [[ -z "$builddir" ]]; then
|
||||
echo "Usage: build.sh <build_directory>"
|
||||
exit 1
|
||||
|
@ -9,6 +13,8 @@ fi
|
|||
|
||||
set -eux
|
||||
|
||||
source "ci/scripts/source_image_env.sh"
|
||||
|
||||
# Expects:
|
||||
# BUILD_TYPE: Proxy of meson's --default-library arg
|
||||
# must be 'shared' or 'static' or 'both'
|
||||
|
@ -18,25 +24,18 @@ set -eux
|
|||
# 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
|
||||
|
||||
export RUSTUP_HOME="/usr/local/rustup"
|
||||
export CARGO_HOME="/usr/local/cargo"
|
||||
export PATH="/usr/local/cargo/bin:$PATH"
|
||||
|
||||
# Allow unbound variable
|
||||
GTK_ARGS="${GTK_ARGS:-}"
|
||||
|
||||
# nproc works on linux
|
||||
# sysctl for macos
|
||||
_jobs=$(nproc || sysctl -n hw.ncpu)
|
||||
jobs="${FDO_CI_CONCURRENT:-$_jobs}"
|
||||
|
||||
date -R
|
||||
ci/scripts/handle-subprojects-cache.py --cache-dir "${SUBPROJECTS_CACHE_DIR}" subprojects/
|
||||
|
||||
ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} ${MESON_ARGS} ${GTK_ARGS}"
|
||||
echo "Werror: $GST_WERROR"
|
||||
ARGS="${BUILD_TYPE:---default-library=both} ${BUILD_GST_DEBUG:--Dgstreamer:gst_debug=true} $meson_args $gtk_args"
|
||||
echo "Werror: $error"
|
||||
|
||||
if [ "$GST_WERROR" = "true" ]; then
|
||||
# If the variable is not true, we are either running locally or explicitly false. Thus false by default.
|
||||
if [ "$error" = "true" ]; then
|
||||
ARGS="$ARGS --native-file ./ci/meson/gst-werror.ini"
|
||||
fi
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ cargo install --locked cargo-c --version 0.10.5+cargo-0.83.0
|
|||
rustup --version
|
||||
cargo --version
|
||||
rustc --version
|
||||
cargo cinstall --version
|
||||
|
||||
# Cleanup the registry after install
|
||||
# so we don't have to save 200mb of the index in the ci image
|
||||
|
|
25
ci/scripts/source_image_env.sh
Normal file
25
ci/scripts/source_image_env.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#! /bin/bash
|
||||
|
||||
image_cache="${SUBPROJECTS_CACHE_DIR:-}"
|
||||
|
||||
# On the CI image we install the rust toolcahin under this path
|
||||
# If it exists set the HOME and PATH variables and print the versions
|
||||
# of what we have installed
|
||||
cargo_binary="/usr/local/cargo/bin/cargo";
|
||||
if [[ -e "$cargo_binary" ]]; then
|
||||
export RUSTUP_HOME="/usr/local/rustup"
|
||||
export CARGO_HOME="/usr/local/cargo"
|
||||
export PATH="/usr/local/cargo/bin:$PATH"
|
||||
|
||||
rustup --version
|
||||
rustc --version
|
||||
cargo --version
|
||||
cargo cinstall --version
|
||||
fi
|
||||
|
||||
# Only copy the cache over if the variable is set, which usually only happens on CI.
|
||||
if [ -n "$image_cache" ]; then
|
||||
date -R
|
||||
ci/scripts/handle-subprojects-cache.py --cache-dir "$image_cache" subprojects/
|
||||
date -R
|
||||
fi
|
Loading…
Reference in a new issue