glibmm: Fix static library linking with glib2

This commit is contained in:
Biswapriyo Nath
2023-10-25 04:03:41 +00:00
parent 5163766a91
commit 6096ec173d

View File

@@ -4,7 +4,7 @@ _realname=glibmm
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.66.6
pkgrel=1
pkgrel=2
pkgdesc="Glib-- (glibmm) is a C++ interface for glib (V2.66) (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
@@ -27,42 +27,54 @@ prepare() {
}
build() {
[[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"
local -a _static_flags=(
-DGIO_STATIC_COMPILATION
-DGLIB_STATIC_COMPILATION
-DGMODULE_STATIC_COMPILATION
-DGOBJECT_STATIC_COMPILATION
)
declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("--buildtype=release")
else
extra_config+=("--buildtype=debug")
fi
local -a _meson_options=(
--prefix=${MINGW_PREFIX}
--buildtype=plain
--wrap-mode=nodownload
--auto-features=enabled
-Dmaintainer-mode=false
-Dbuild-documentation=false
-Dbuild-examples=true
)
CFLAGS+=" ${_static_flags[@]} -Wno-attributes" \
CXXFLAGS+=" ${_static_flags[@]} -Wno-attributes" \
MSYS2_ARG_CONV_EXCL="--prefix=" \
${MINGW_PREFIX}/bin/meson.exe setup \
"${_meson_options[@]}" \
--default-library=static \
"${_realname}-${pkgver}" \
"build-${MSYSTEM}-static"
${MINGW_PREFIX}/bin/meson.exe compile -C "build-${MSYSTEM}-static"
CFLAGS+=" -Wno-attributes" \
CXXFLAGS+=" -Wno-attributes" \
MSYS2_ARG_CONV_EXCL="--prefix=" \
${MINGW_PREFIX}/bin/meson.exe \
--prefix="${MINGW_PREFIX}" \
"${extra_config[@]}" \
--wrap-mode=nodownload \
--default-library=both \
--auto-features=enabled \
-Dmaintainer-mode=false \
-Dbuild-documentation=false \
-Dbuild-examples=true \
"../${_realname}-${pkgver}"
${MINGW_PREFIX}/bin/meson.exe setup \
"${_meson_options[@]}" \
--default-library=shared \
"${_realname}-${pkgver}" \
"build-${MSYSTEM}-shared"
${MINGW_PREFIX}/bin/meson.exe compile
${MINGW_PREFIX}/bin/meson.exe compile -C "build-${MSYSTEM}-shared"
}
check() {
cd "${srcdir}/build-${MSYSTEM}"
${MINGW_PREFIX}/bin/meson.exe test || true
${MINGW_PREFIX}/bin/meson.exe test -C "build-${MSYSTEM}-static" || warning "Tests failed"
${MINGW_PREFIX}/bin/meson.exe test -C "build-${MSYSTEM}-shared" || warning "Tests failed"
}
package() {
cd "${srcdir}/build-${MSYSTEM}"
DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/meson.exe install
${MINGW_PREFIX}/bin/meson.exe install -C "build-${MSYSTEM}-static" --destdir "${pkgdir}"
${MINGW_PREFIX}/bin/meson.exe install -C "build-${MSYSTEM}-shared" --destdir "${pkgdir}"
sed -s "s|$(cygpath -wm /usr/bin)|/usr/bin|g" -i "${pkgdir}${MINGW_PREFIX}"/lib/glibmm-2.4/proc/gmmproc
sed -s 's|#!.*|#! /usr/bin/perl|g' -i "${pkgdir}${MINGW_PREFIX}"/lib/glibmm-2.4/proc/gmmproc