-
Notifications
You must be signed in to change notification settings - Fork 1
/
kde-static.sh
executable file
·85 lines (72 loc) · 3.1 KB
/
kde-static.sh
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
set -e # Exit immediately on error
. ./local-env
SOURCEDIR=$HOME/src/kde/source
INSTALLDIR=$HOME/src/kde/install-static
KDESRC_BUILDRC=kdesrc-buildrc-static
DOCKERFILE=kde-static.Dockerfile
IMAGE_TAG=voidlinux/kde-static
CONTAINER_NAME=kde-static
cd $(dirname $(realpath $0))
# Build proot if we don't already have it
if ! test -f binpkgs/proot-*.x86_64-musl.xbps; then
# Build the initial build container
docker build \
$@ \
--build-arg mirror=$mirror \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--build-arg ftp_proxy=$ftp_proxy \
--build-arg certificate=$certificate \
--file=voidlinux-musl.Dockerfile \
--tag=voidlinux/build .
# Build proot inside the build container
# This is required until proot release is made that includes https://github.com/proot-me/PRoot/pull/149
# No idea why the need to chown owner of volume within container but build fails with a permission error
# otherwise.
docker run \
--rm --privileged --cap-add=SYS_ADMIN \
--volume=`pwd`/binpkgs:/void-packages/hostdir/binpkgs \
voidlinux/build \
sh -c "\
cd void-packages && \
chown root.root /void-packages/hostdir/binpkgs && \
./xbps-src binary-bootstrap && \
./xbps-src pkg -j4 proot"
fi
# Build the docker image
docker build \
$@ \
--build-arg mirror=$mirror \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--build-arg ftp_proxy=$ftp_proxy \
--build-arg certificate=$certificate \
--file=$DOCKERFILE \
--tag=$IMAGE_TAG .
# Create installation directory - otherwise Docker will create it with root ownership.
if ! test -d $INSTALLDIR; then
mkdir $INSTALLDIR
fi
# Create container to build KDE
docker create \
--volume /tmp/.X11-unix:/tmp/.X11-unix --env DISPLAY=$DISPLAY \
--volume /srv/docker/ccache:/ccache --env CCACHE_DIR=/ccache \
--volume $SOURCEDIR:/home/kdedev/kde/source \
--volume $INSTALLDIR:/home/kdedev/kde/install \
--interactive --tty \
--name=$CONTAINER_NAME --hostname=$CONTAINER_NAME \
$IMAGE_TAG
# Pick up the built packages for next time
rm -rf binpkgs.bak
mv binpkgs binpkgs.bak
docker cp $CONTAINER_NAME:/home/kdedev/void-packages/hostdir/binpkgs/ .
# Prepare the KDE build
docker cp $KDESRC_BUILDRC $CONTAINER_NAME:/home/kdedev/kde/kdesrc-buildrc
docker cp kf5-frameworks-build-include $CONTAINER_NAME:/home/kdedev/kde
# Copy our public key to the image for eash SSH access
docker cp $HOME/.ssh/id_rsa.pub $CONTAINER_NAME:/home/kdedev/.ssh/authorized_keys
docker start $CONTAINER_NAME
docker exec $CONTAINER_NAME sh -c "\$HOME/kdesrc-build/kdesrc-build --rc-file=\$HOME/kde/kdesrc-buildrc --build-only --refresh-build --include-dependencies frameworks"
docker exec $CONTAINER_NAME sh -c "\$HOME/kdesrc-build/kdesrc-build --rc-file=\$HOME/kde/kdesrc-buildrc --build-only --refresh-build libkexiv2"
docker exec $CONTAINER_NAME sh -c "\$HOME/kdesrc-build/kdesrc-build --rc-file=\$HOME/kde/kdesrc-buildrc --build-only --refresh-build okular"