aboutsummaryrefslogtreecommitdiffstats
path: root/.github/containers/jammy/build.sh
blob: dc0722ef956c400ad6fd4a0adb6e373268aa68e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash

set -e
set -x

## Basic variables

CURDIR=$(dirname $(readlink -f $0))
TOPDIR=$(git rev-parse --show-toplevel 2>/dev/null)

DEBDIR=${TOPDIR}/contrib/packages/deb/ubuntu-jammy

VERSION=$(grep '^set(VERSION ' ${TOPDIR}/CMakeLists.txt | sed 's@^set(VERSION \(.*\))@\1@')

## Prepare the build directory

rm -rf ${CURDIR}/build
mkdir -p ${CURDIR}/build
chmod a+w ${CURDIR}/build
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled && chcon -Rt container_file_t ${CURDIR}/build

## Copy over the source code

(cd ${TOPDIR} && git archive --prefix tigervnc-${VERSION}/ HEAD) | xz > ${CURDIR}/build/tigervnc_${VERSION}.orig.tar.xz

## Copy over the packaging files

cp -r ${DEBDIR}/debian ${CURDIR}/build/debian

chmod a+x ${CURDIR}/build/debian/rules

# Assemble a fake changelog entry to get the correct version

cat - > ${CURDIR}/build/debian/changelog << EOT
tigervnc (${VERSION}-1ubuntu1) UNRELEASED; urgency=low

  * Automated build for TigerVNC

 -- Build bot <tigervncbot@tigervnc.org>  $(date -R)

EOT
cat ${DEBDIR}/debian/changelog >> ${CURDIR}/build/debian/changelog

## Start the build

docker run --volume ${CURDIR}/build:/home/deb/build --interactive --rm tigervnc/${DOCKER} \
	bash -e -x -c "
	tar -C ~/build -axf ~/build/tigervnc_${VERSION}.orig.tar.xz
	cp -a ~/build/debian ~/build/tigervnc-${VERSION}/debian
	sudo apt-get update
	mk-build-deps ~/build/tigervnc-${VERSION}/debian/control
	sudo apt-get install -y ~/tigervnc-build-deps_*.deb
	cd ~/build/tigervnc-${VERSION} && dpkg-buildpackage
	"

mkdir -p ${CURDIR}/result
cp -av ${CURDIR}/build/*.deb ${CURDIR}/result