xfce-build 1.45 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
docker_run () {
	# Run the build in the docker container
22
23
	# That z parameter for volume is needed when SELinux is enabled
	docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) --volume $VOLUME:/tmp:z --env CFLAGS="${CFLAGS}" --env CONTAINER=$CONTAINER --env VERSION=$VERSION $CONTAINER:$VERSION /bin/bash -c "${BUILD_CMD}"
24
25
26
}

# Parse the commandline arguments
27
28
if [ -z "$1" ]; then
	VERSION="latest"
29
30
31
elif [[ "$1" == "pull" ]]; then
	docker_pull
	exit 0
32
33
34
35
36
37
38
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
39
40
fi

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