Skip to content

Commit

Permalink
Update build script for Ubuntu focal
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jul 8, 2022
1 parent 111723d commit 6eae375
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
set -e
set -x

LANG=C.UTF-8

ARCH=$1
DLLS="libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll"

Expand All @@ -28,14 +30,17 @@ echo deb https://qemu.weilnetz.de/debian/ testing contrib | \

# Install packages.
sudo apt-get update
sudo apt-get install --no-install-recommends \
sudo apt-get install --assume-yes --no-install-recommends \
asciidoc xsltproc docbook-xsl \
automake dpkg-dev libtool pkg-config default-jdk-headless \
mingw-w64-tools nsis g++-mingw-w64-${ARCH/_/-} \
$PKG_ARCH-liblept5 $PKG_ARCH-curl \
$PKG_ARCH-libarchive $PKG_ARCH-giflib $PKG_ARCH-libpng \
$PKG_ARCH-libwebp $PKG_ARCH-openjpeg2 $PKG_ARCH-tiff \
$PKG_ARCH-libwebp $PKG_ARCH-openjpeg2 $PKG_ARCH-openssl $PKG_ARCH-tiff \
$PKG_ARCH-pango1.0 $PKG_ARCH-icu

sudo ln -sf $PWD/.github/workflows/pkg-config-crosswrapper /usr/bin/$HOST-pkg-config

for dll in $DLLS; do
ln -sf /usr/lib/gcc/$HOST/*-posix/$dll dll/$HOST
done
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/pkg-config-crosswrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#! /bin/sh
# pkg-config wrapper for cross-building
# Sets pkg-config search path to search multiarch and historical cross-compiling paths.

# If the user has already set PKG_CONFIG_LIBDIR, believe it (even if empty):
# it's documented to be an override
if [ x"${PKG_CONFIG_LIBDIR+set}" = x ]; then
# GNU triplet for the compiler, e.g. i486-linux-gnu for Debian i386,
# i686-linux-gnu for Ubuntu i386
basename="$(basename "$0")"
triplet="${basename%-pkg-config}"
# Normalized multiarch path if any, e.g. i386-linux-gnu for i386
dpkg-architecture >/dev/null 2>&1
if [ "$?" != 0 ]; then
# dpkg-architecture is missing.
echo "Please install dpkg-dev to use pkg-config when cross-building" >&2
exit 1
fi
multiarch="$(dpkg-architecture -t"${triplet}" -qDEB_HOST_MULTIARCH 2>/dev/null)"
# Native multiarch path
native_multiarch="$(cat /usr/lib/pkg-config.multiarch)"

# This can be used for native builds as well, in that case, just exec pkg-config "$@" directly.
if [ "$native_multiarch" = "$multiarch" ]; then
exec pkg-config "$@"
fi

PKG_CONFIG_LIBDIR="/usr/local/${triplet}/lib/pkgconfig"
# For a native build we would also want to append /usr/local/lib/pkgconfig
# at this point; but this is a cross-building script, so don't
PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/local/share/pkgconfig"

if [ -n "$multiarch" ]; then
PKG_CONFIG_LIBDIR="/usr/local/lib/${multiarch}/pkgconfig:$PKG_CONFIG_LIBDIR"
PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/lib/${multiarch}/pkgconfig"
fi

PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/${triplet}/lib/pkgconfig"
# For a native build we would also want to append /usr/lib/pkgconfig
# at this point; but this is a cross-building script, so don't
# If you want to allow use of un-multiarched -dev packages for crossing
# (at the risk of finding build-arch stuff you didn't want, if not in a clean chroot)
# Uncomment the next line:
# PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/lib/pkgconfig"
# ... but on Ubuntu we rely cross-building with non-multiarch libraries:
if dpkg-vendor --derives-from Ubuntu; then
PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/lib/pkgconfig"
fi
PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:/usr/share/pkgconfig"

export PKG_CONFIG_LIBDIR
fi

exec pkg-config "$@"

0 comments on commit 6eae375

Please sign in to comment.