Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
backport rsvg
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Oct 5, 2023
1 parent 0c30ca8 commit f6d2329
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From f539faa31f32b240ad414cfb566bb343be148508 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <[email protected]>
Date: Sat, 18 Dec 2021 13:25:40 +0100
Subject: [PATCH] configure: set pass prefix to pkg-config when retrieving
paths

Otherwise we get back paths for the installed prefix and not the one
we want to install to.
---
configure.ac | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d06baf3b..20267fd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,9 +193,9 @@ AS_IF([test "x$enable_pixbuf_loader" = "xyes"], [

# First try the standalone gdk-pixbuf
gdk_pixbuf_binary_version="`$PKG_CONFIG --variable=gdk_pixbuf_binary_version gdk-pixbuf-2.0`"
- gdk_pixbuf_binarydir="`$PKG_CONFIG --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0`"
- gdk_pixbuf_moduledir=`$PKG_CONFIG --variable gdk_pixbuf_moduledir gdk-pixbuf-2.0`
- gdk_pixbuf_cache_file=`$PKG_CONFIG --variable gdk_pixbuf_cache_file gdk-pixbuf-2.0`
+ gdk_pixbuf_binarydir="`$PKG_CONFIG "--define-variable=prefix=$prefix" --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0`"
+ gdk_pixbuf_moduledir="`$PKG_CONFIG "--define-variable=prefix=$prefix" --variable gdk_pixbuf_moduledir gdk-pixbuf-2.0`"
+ gdk_pixbuf_cache_file="`$PKG_CONFIG "--define-variable=prefix=$prefix" --variable gdk_pixbuf_cache_file gdk-pixbuf-2.0`"
])

AC_SUBST([gdk_pixbuf_binary_version])
--
2.34.1

83 changes: 41 additions & 42 deletions mingw-w64-librsvg/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

_realname=librsvg
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.50.5
pkgrel=2
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.57.0
pkgrel=1
pkgdesc="SVG rendering library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://wiki.gnome.org/Projects/LibRsvg"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-pkg-config"
"setconf"
"gtk-doc"
"autoconf"
"automake"
"libtool")
license=("spdx:LGPL-2.1-or-later")
makedepends=("autoconf" "automake" "libtool"
"${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2"
"${MINGW_PACKAGE_PREFIX}-glib2"
"${MINGW_PACKAGE_PREFIX}-harfbuzz"
Expand All @@ -24,28 +20,24 @@ depends=("${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2"
"${MINGW_PACKAGE_PREFIX}-libxml2")
options=('staticlibs' 'strip')
source=("https://download.gnome.org/sources/librsvg/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"
"0005-hack-unixy-paths.patch"
"configure.patch")
sha256sums=('32701574c234fed352520c6d0bd5081f728184bc1a9b9c87d423dd27c32b9272'
'b23b094c0cb65fcbbbb952350448de6f3430b30f273e05acdbf7a56d634212dc'
'SKIP')
"0001-configure-set-pass-prefix-to-pkg-config-when-retriev.patch")
sha256sums=('335fe2e0c2cbf1b7bf0668651224a23e135451f0b1793cd813649be2bffa74e8'
'189eec6486c9ef6cf1071af9750405bc41e16ae3a55ad663435e574369fec915')
msys2_repository_url="https://gitlab.gnome.org/GNOME/librsvg"

prepare() {
# Hack: use external rust for now, until we have our own
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i "${srcdir}/0001-configure-set-pass-prefix-to-pkg-config-when-retriev.patch"

# Hack: use external rust which lets us select a target version
export PATH="$(cygpath -u $USERPROFILE)/.cargo/bin:$PATH"
TARGET="${MINGW_CHOST/w64-mingw32/pc-windows-gnu}"

# The new ntdll dependency gives conflicts on win32
#if [[ $CARCH = "i686" ]]; then
RUSTVER="1.69"
#else
# RUSTVER="stable"
#fi

# Avoid the ntdll dependency which gives conflicts on msvcrt
if command -v rustup; then
echo "Found existing rustup!"
rustup target add $TARGET
rustup default "$RUSTVER-$TARGET"
rustup default "1.69-$TARGET"
else
curl -L https://win.rustup.rs -o rustup-init.exe
./rustup-init.exe -yv --default-toolchain stable --default-host $TARGET
Expand All @@ -54,24 +46,36 @@ prepare() {
echo "PATH=$PATH"
rustc --version

# Actual patches
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i "${srcdir}/0005-hack-unixy-paths.patch"
patch -p1 -i "${srcdir}/configure.patch"
autoreconf -fiv
## Jeroen: try to fix static linking of rust to glib
## See: https://github.com/msys2/MINGW-packages/issues/18574
echo "" >> Cargo.toml
echo "[patch.crates-io]" >> Cargo.toml
echo 'glib = { git = "https://github.com/jeroen/glib-rs.git" }' >> Cargo.toml

cargo update --package glib
cargo fetch --locked
}

build() {
[[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
cp -rf ${srcdir}/${_realname}-${pkgver} "${srcdir}/build-${MINGW_CHOST}"
cd "${srcdir}/build-${MINGW_CHOST}"
[[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
mkdir "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

CXXFLAGS+=" -D_POSIX_SOURCE"
CFLAGS+=" -D_POSIX_SOURCE"
# html documentation doesn't install from out of tree
cp -rf "${srcdir}/${_realname}-${pkgver}/doc" "${srcdir}/build-${MSYSTEM}/doc"

# https://github.com/msys2/MINGW-packages/pull/13622#issuecomment-1285820970
export WINAPI_NO_BUNDLED_LIBRARIES=1

export lt_cv_deplibs_check_method='pass_all'

# an argument passed to glib-mkenums starts with a c++ comment
export MSYS2_ARG_CONV_EXCL="/*"
LIBS="-lgdi32 -lgdiplus -ldnsapi -liphlpapi -lbcrypt -lntdll" \
# so the unix path gets preserved when passed through pkg-config
MSYS2_ARG_CONV_EXCL="$MSYS2_ARG_CONV_EXCL;--define-variable=prefix"

# Autoconf thinks we need pangoft2, but it is not needed.
cp -fv ${MINGW_PREFIX}/lib/pkgconfig/pango.pc ${MINGW_PREFIX}/lib/pkgconfig/pangoft2.pc

../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
Expand All @@ -85,15 +89,10 @@ build() {
--enable-gtk-doc-html=no \
--enable-silent-rules

# pass static rust package to linker
sed -i "s/^deplibs_check_method=.*/deplibs_check_method=\"pass_all\"/g" libtool
# add missing crt libs (ws2_32 and userenv) to LIBRSVG_LIBS
sed -i "s/^LIBRSVG_LIBS = .*/& -lws2_32 -luserenv/g" Makefile
make
}

package() {
cd "${srcdir}/build-${MINGW_CHOST}"
make DESTDIR="${pkgdir}" install || true
make -C "${srcdir}/build-${MSYSTEM}" DESTDIR="${pkgdir}" install
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING.LIB" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.LIB"
}

0 comments on commit f6d2329

Please sign in to comment.