xfce-build 1.38 KB
Newer Older
1 2 3
#!/bin/bash

# Just a small script that runs the same build that we have on gitlab-ci locally.
4 5 6
# Possible arguments:
#  - the version of the xfce-build container (if you want to build with a special version)
#  - 'pull' to simply update the container and exit
7 8
#  - 'version' as second positional argument after an actual version (e.g. xfce-build latest version)
#     to print all git versions built in the container by build_libs.sh
9 10 11 12 13 14 15

CONTAINER="xfce/xfce-build"
VERSION="latest"
CFLAGS="-Wall -Wno-deprecated-declarations -Werror=implicit-function-declaration -Werror=return-type"
VOLUME=$(pwd)
BUILD_CMD='cd /tmp; ./autogen.sh && make distcheck'

16 17 18 19
docker_pull () {
	docker pull xfce/xfce-build:$VERSION
}

20 21 22 23 24 25
docker_run () {
	# Run the build in the docker container
	docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --volume $VOLUME:/tmp --env CFLAGS="${CFLAGS}" --env CONTAINER=$CONTAINER --env VERSION=$VERSION $CONTAINER:$VERSION /bin/bash -c "${BUILD_CMD}"
}

# Parse the commandline arguments
26 27
if [ -z "$1" ]; then
	VERSION="latest"
28 29 30
elif [[ "$1" == "pull" ]]; then
	docker_pull
	exit 0
31 32 33 34 35 36 37
elif [[ "$1" == "describe" ]]; then
	if [[ ! -z "$2" ]]; then
			VERSION="$2"
	fi
	BUILD_CMD='printf "\e[1m$CONTAINER:$VERSION contains:\e[0m\n";cat /git/xfce_build_version_info.txt'
	docker_run
	exit 0
38 39
fi

40
# Run the local build
41
docker_pull
42
docker_run
43
printf "\n---\nBuilt using container $CONTAINER:$VERSION on $VOLUME\n"