Skip to content
Snippets Groups Projects
Unverified Commit a40c50f1 authored by Johannes Schauer Marin Rodrigues's avatar Johannes Schauer Marin Rodrigues
Browse files

wip: build xwayland as patched Debian package

parent 6b26cc14
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# Copyright 2021 Helmut Grohne & Johannes Schauer Marin Rodrigues
set -e
set -u
BASESUITE=unstable
OURSUITE=reform
WORKDIR=$(mktemp -d)
PATCHDIR=$(realpath patches)
REPREPRO_BASE_DIR=$(realpath repo)
HTTP_PORT=7251
: "${MIRROR:=http://deb.debian.org/debian}"
SOURCE_DATE_EPOCH=$(date +%s)
export SOURCE_DATE_EPOCH
export REPREPRO_BASE_DIR
HTTPD_PID=
export DEBEMAIL='robot <reform@reform.repo>'
cleanup() {
if test -n "$HTTPD_PID"; then
kill "$HTTPD_PID"
fi
if test -d "$WORKDIR"; then
rm -Rf "$WORKDIR"
fi
}
trap cleanup EXIT
python3 -m http.server --bind 127.0.0.1 --directory "$REPREPRO_BASE_DIR" "$HTTP_PORT" &
HTTPD_PID=$!
SRC_LIST_PATCHED="deb [ trusted=yes ] http://127.0.0.1:$HTTP_PORT/ $OURSUITE main"
BUILD_ARCH=$(dpkg --print-architecture)
HOST_ARCH=arm64
if ! test -d "$REPREPRO_BASE_DIR"; then
mkdir -p "$REPREPRO_BASE_DIR/conf"
cat > "$REPREPRO_BASE_DIR/conf/distributions" <<EOF
Codename: $OURSUITE
Label: $OURSUITE
Architectures: $HOST_ARCH $(test "$BUILD_ARCH" = "$HOST_ARCH" || echo "$BUILD_ARCH")
Components: main
UDebComponents: main
Description: updated packages for mnt reform
EOF
cat > "$REPREPRO_BASE_DIR/conf/options" <<EOF
verbose
ignore wrongdistribution
EOF
reprepro export
fi
chdistdata=$(pwd)/chdist
chdist_base() {
local cmd
cmd=$1
shift
chdist "--data-dir=$chdistdata" "$cmd" base "$@"
}
if [ ! -d "$chdistdata" ]; then
chdist_base create
fi
cat << END > "$chdistdata/base/etc/apt/sources.list"
deb-src $MIRROR $BASESUITE main
END
chdist_base apt-get update
BUILD_CHROOT=$(realpath build-chroot.tar)
if [ ! -e "$BUILD_CHROOT" ] || [ $(stat --format=%Y $BUILD_CHROOT) -le $(date --date=yesterday +%s) ]; then
mmdebstrap --variant=buildd unstable "$BUILD_CHROOT"
fi
for p in patches/*; do
p=${p#patches/}
if [ ! -e "patches/$p" ]; then
echo "patches/$p doesn't exist"
continue
fi
if [ ! -x "patches/$p" ]; then
echo "patches/$p is not executable"
continue
fi
# shellcheck disable=SC2016
our_version=$(reprepro --list-format '${version}_${source}\n' -T deb listfilter "$OURSUITE" "\$Source (== $p)" | sed 's/.*_.*(\(.*\))$/\1/;s/_.*//' | uniq)
their_version=$(chdist_base apt-get source --only-source -t "$BASESUITE" --no-act "$p" | sed "s/^Selected version '\\([^']*\\)' ($BASESUITE) for .*/\\1/;t;d")
if test -z "$their_version"; then
echo "cannot determine source version for $p"
exit 1
fi
if test -n "$our_version" && dpkg --compare-versions "$our_version" gt "$their_version"; then
if [ -e repo/dists/$OURSUITE/Release ] && [ repo/dists/$OURSUITE/Release -ot "patches/$p" ]; then
echo "patches/$p has been changed -- rebuilding"
else
echo "package $p up to date"
continue
fi
fi
reprepro removesrc "$OURSUITE" "$p"
rm -Rf "$WORKDIR"
mkdir --mode=0777 "$WORKDIR"
(
cd "$WORKDIR"
chdist_base apt-get source --only-source -t "$BASESUITE" "$p"
cd "$p-"*
"$PATCHDIR/$p"
dch --local "+$OURSUITE" "apply mnt reform patch"
dch --release ""
# build foreign arch:any packages
if ! chdist_base apt-cache showsrc --only-source "$p" | grep -q '^Architecture: all$'; then
rm -f ../*.changes
DEB_BUILD_OPTIONS="noautodbgsym nocheck" sbuild -d "$BASESUITE" --host="$HOST_ARCH" --no-arch-all --arch-any --nolog --no-clean-source --no-source-only-changes --no-run-lintian --no-run-autopkgtest --profiles=cross,nobiarch,nocheck,noudeb --extra-repository="$SRC_LIST_PATCHED" --chroot-mode=unshare --chroot="$BUILD_CHROOT"
reprepro include "$OURSUITE" ../*.changes
fi
# build potential arch:all packages
if chdist_base apt-cache showsrc --only-source "$p" | grep -q '^Architecture:.* all$'; then
rm -f ../*.changes
DEB_BUILD_OPTIONS="noautodbgsym nocheck" sbuild -d "$BASESUITE" --arch-all --no-arch-any --nolog --no-clean-source --no-source-only-changes --no-run-lintian --no-run-autopkgtest --profiles=nobiarch,nocheck,noudeb --extra-repository="$SRC_LIST_PATCHED" --chroot-mode=unshare --chroot="$BUILD_CHROOT"
reprepro include "$OURSUITE" ../*.changes
fi
cd ..
)
rm -Rf "$WORKDIR"
done
#!/bin/sh
set -e
# the following is a workaround for https://bugs.debian.org/939515
patch -p1 << 'EOF'
diff --git a/debian/control b/debian/control
index 847a23938..790fb5de0 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends:
libxshmfence-dev,
libxv-dev,
libwayland-dev,
+ libwayland-dev:native,
mesa-common-dev,
x11proto-dev,
xfonts-utils,
--
2.33.0
EOF
patch -p1 << 'EOF'
--- /dev/null
+++ b/debian/patches/glamor
@@ -0,0 +1,11 @@
+--- a/glamor/glamor_render.c
++++ b/glamor/glamor_render.c
+@@ -1589,6 +1589,8 @@ glamor_composite_clipped_region(CARD8 op
+ if (prect != rect)
+ free(prect);
+ out:
++ glFinish();
++
+ if (temp_src != source)
+ FreePicture(temp_src, 0);
+ if (temp_mask != mask)
diff --git a/debian/patches/series b/debian/patches/series
index a82d1b41e..4b2d3a3f2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
#placeholder
+glamor
EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment