pango: port to meson (#3570)
This commit is contained in:
committed by
Алексей
parent
9d56ca6d33
commit
bde75ccfdc
@@ -0,0 +1,32 @@
|
||||
From 1635b15c4ab4a0aabfab3135c01e0112a97ba978 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sun, 8 Apr 2018 19:16:49 +0200
|
||||
Subject: [PATCH] meson: skip pangoxft headers for the Windows gtk-doc build
|
||||
|
||||
The API isn't available on Windows and gtk-doc fails with a
|
||||
linker error otherwise.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=795045
|
||||
---
|
||||
docs/meson.build | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/docs/meson.build b/docs/meson.build
|
||||
index c784149e..9122dc3c 100644
|
||||
--- a/docs/meson.build
|
||||
+++ b/docs/meson.build
|
||||
@@ -45,6 +45,11 @@ if host_system != 'windows'
|
||||
'pangocairo-win32.h',
|
||||
'pangowin32.h',
|
||||
]
|
||||
+else
|
||||
+ private_headers += [
|
||||
+ 'pangoxft.h',
|
||||
+ 'pangoxft-render.h',
|
||||
+ ]
|
||||
endif
|
||||
|
||||
content_files = [
|
||||
--
|
||||
2.17.0
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
--- pango-1.30.0/docs/pango.types.in.orig 2012-04-03 09:28:11 +0400
|
||||
+++ pango-1.30.0/docs/pango.types.in 2012-04-03 09:27:43 +0400
|
||||
@@ -0,0 +1,77 @@
|
||||
+#include <pango/pango-attributes.h>
|
||||
+#include <pango/pango-context.h>
|
||||
+#include <pango/pango-engine.h>
|
||||
+#include <pango/pango-enum-types.h>
|
||||
+#include <pango/pango-font.h>
|
||||
+#include <pango/pango-fontmap.h>
|
||||
+#include <pango/pango-fontset.h>
|
||||
+#include <pango/pango-glyph-item.h>
|
||||
+#include <pango/pango-glyph.h>
|
||||
+#include <pango/pango-item.h>
|
||||
+#include <pango/pango-language.h>
|
||||
+#include <pango/pango-layout.h>
|
||||
+#include <pango/pango-matrix.h>
|
||||
+#include <pango/pango-ot.h>
|
||||
+#include <pango/pango-renderer.h>
|
||||
+#include <pango/pango-tabs.h>
|
||||
+#include <pango/pangocairo-fc.h>
|
||||
+#include <pango/pangocairo.h>
|
||||
+#include <pango/pangofc-decoder.h>
|
||||
+#include <pango/pangofc-font.h>
|
||||
+#include <pango/pangofc-fontmap.h>
|
||||
+#include <pango/pangoft2.h>
|
||||
+@PANGO_INCLUDE_XFT@
|
||||
+
|
||||
+pango_alignment_get_type
|
||||
+pango_attr_list_get_type
|
||||
+pango_attr_type_get_type
|
||||
+pango_bidi_type_get_type
|
||||
+pango_cairo_fc_font_map_get_type
|
||||
+pango_cairo_font_get_type
|
||||
+pango_cairo_font_map_get_type
|
||||
+pango_color_get_type
|
||||
+pango_context_get_type
|
||||
+pango_coverage_level_get_type
|
||||
+pango_direction_get_type
|
||||
+pango_ellipsize_mode_get_type
|
||||
+pango_engine_get_type
|
||||
+pango_engine_lang_get_type
|
||||
+pango_engine_shape_get_type
|
||||
+pango_fc_decoder_get_type
|
||||
+pango_fc_font_get_type
|
||||
+pango_fc_font_map_get_type
|
||||
+pango_font_description_get_type
|
||||
+pango_font_face_get_type
|
||||
+pango_font_family_get_type
|
||||
+pango_font_get_type
|
||||
+pango_font_map_get_type
|
||||
+pango_font_mask_get_type
|
||||
+pango_font_metrics_get_type
|
||||
+pango_fontset_get_type
|
||||
+pango_fontset_simple_get_type
|
||||
+pango_ft2_font_map_get_type
|
||||
+pango_glyph_item_get_type
|
||||
+pango_glyph_item_iter_get_type
|
||||
+pango_glyph_string_get_type
|
||||
+pango_gravity_get_type
|
||||
+pango_gravity_hint_get_type
|
||||
+pango_item_get_type
|
||||
+pango_language_get_type
|
||||
+pango_layout_get_type
|
||||
+pango_layout_iter_get_type
|
||||
+pango_layout_line_get_type
|
||||
+pango_matrix_get_type
|
||||
+pango_ot_info_get_type
|
||||
+pango_ot_ruleset_get_type
|
||||
+pango_render_part_get_type
|
||||
+pango_renderer_get_type
|
||||
+pango_script_get_type
|
||||
+pango_stretch_get_type
|
||||
+pango_style_get_type
|
||||
+pango_tab_align_get_type
|
||||
+pango_tab_array_get_type
|
||||
+pango_underline_get_type
|
||||
+pango_variant_get_type
|
||||
+pango_weight_get_type
|
||||
+pango_wrap_mode_get_type
|
||||
+@PANGO_XFT_TYPES@
|
||||
\ No newline at end of file
|
||||
--- pango-1.32.6/configure.ac.orig 2013-01-19 18:11:30 +0400
|
||||
+++ pango-1.32.6/configure.ac 2013-01-19 18:13:05 +0400
|
||||
@@ -257,6 +257,8 @@
|
||||
# Checks for Xft/XRender
|
||||
#
|
||||
have_xft=false
|
||||
+pango_include_xft=
|
||||
+pango_xft_types=
|
||||
AC_ARG_WITH(xft,
|
||||
AS_HELP_STRING([--with-xft], [build xft backend]),
|
||||
[], [with_xft=yes])
|
||||
@@ -265,8 +267,15 @@
|
||||
fi
|
||||
if test "x$with_xft" = xyes && $have_xft ; then
|
||||
AC_DEFINE(HAVE_XFT, 1, [Have Xft library])
|
||||
+ pango_include_xft="#include <pango/pangoxft-render.h>
|
||||
+#include <pango/pangoxft.h>"
|
||||
+ psnho_xft_types="pango_xft_font_get_type
|
||||
+pango_xft_font_map_get_type
|
||||
+pango_xft_renderer_get_type"
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_XFT, test "x$with_xft" = xyes && $have_xft )
|
||||
+AC_SUBST(PANGO_INCLUDE_XFT, $pango_include_xft)
|
||||
+AC_SUBST(PANGO_XFT_TYPES, $pango_xft_types)
|
||||
|
||||
#
|
||||
# Checks for Win32 GDI
|
||||
@@ -935,6 +944,7 @@
|
||||
win32/vs12/Makefile
|
||||
win32/vs14/Makefile
|
||||
win32/vs15/Makefile
|
||||
+docs/pango.types
|
||||
pango.pc
|
||||
pangowin32.pc
|
||||
pangoft2.pc
|
||||
@@ -0,0 +1,87 @@
|
||||
From 7df420dcc535e5f71399602a74ba6e5b3d9a7e38 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sat, 7 Apr 2018 06:44:53 +0200
|
||||
Subject: [PATCH 2/2] pangowin32: fix script cache hash key for 64bit builds
|
||||
|
||||
It joins the HFONT and script key to a gint64 and uses this as a
|
||||
hash key, but on 64bit Windows hfont doesn't fit in 32bit.
|
||||
|
||||
This also breaks the build with meson where -Werror=pointer-to-int-cast
|
||||
is enabled by default.
|
||||
|
||||
Instead of using the gint64 hash functions add our own key type and implement
|
||||
matching hash and equality functions.
|
||||
---
|
||||
pango/pangowin32-shape.c | 28 +++++++++++++++++++++++-----
|
||||
1 file changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/pango/pangowin32-shape.c b/pango/pangowin32-shape.c
|
||||
index 001fc430..9fe52488 100644
|
||||
--- a/pango/pangowin32-shape.c
|
||||
+++ b/pango/pangowin32-shape.c
|
||||
@@ -370,6 +370,22 @@ convert_log_clusters_to_byte_offsets (const char *text,
|
||||
g_free (byte_offset);
|
||||
}
|
||||
|
||||
+typedef struct {
|
||||
+ HFONT hfont;
|
||||
+ gint32 script;
|
||||
+} script_cache_key;
|
||||
+
|
||||
+static guint
|
||||
+script_cache_key_hash_func (script_cache_key *key) {
|
||||
+ gint64 temp = key->script;
|
||||
+ return g_direct_hash (key->hfont) ^ g_int64_hash (&temp);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+script_cache_key_equal_func (script_cache_key *a, script_cache_key *b) {
|
||||
+ return (a->hfont == b->hfont) && (a->script == b->script);
|
||||
+}
|
||||
+
|
||||
static gboolean
|
||||
itemize_shape_and_place (PangoFont *font,
|
||||
HDC hdc,
|
||||
@@ -389,7 +405,8 @@ itemize_shape_and_place (PangoFont *font,
|
||||
static GHashTable *script_cache_hash = NULL;
|
||||
|
||||
if (!script_cache_hash)
|
||||
- script_cache_hash = g_hash_table_new (g_int64_hash, g_int64_equal);
|
||||
+ script_cache_hash = g_hash_table_new ((GHashFunc)script_cache_key_hash_func,
|
||||
+ (GEqualFunc)script_cache_key_equal_func);
|
||||
|
||||
memset (&control, 0, sizeof (control));
|
||||
memset (&state, 0, sizeof (state));
|
||||
@@ -440,7 +457,7 @@ itemize_shape_and_place (PangoFont *font,
|
||||
int ng;
|
||||
int char_offset;
|
||||
SCRIPT_CACHE *script_cache;
|
||||
- gint64 font_and_script_key;
|
||||
+ script_cache_key font_and_script_key;
|
||||
|
||||
memset (advances, 0, sizeof (advances));
|
||||
memset (offsets, 0, sizeof (offsets));
|
||||
@@ -472,16 +489,17 @@ itemize_shape_and_place (PangoFont *font,
|
||||
items[item].iCharPos, items[item+1].iCharPos-1, itemlen);
|
||||
#endif
|
||||
/* Create a hash key based on hfont and script engine */
|
||||
- font_and_script_key = (((gint64) ((gint32) hfont)) << 32) | script;
|
||||
+ font_and_script_key.hfont = hfont;
|
||||
+ font_and_script_key.script = script;
|
||||
|
||||
/* Get the script cache for this hfont and script */
|
||||
script_cache = g_hash_table_lookup (script_cache_hash, &font_and_script_key);
|
||||
if (!script_cache)
|
||||
{
|
||||
- gint64 *key_n;
|
||||
+ script_cache_key *key_n;
|
||||
SCRIPT_CACHE *new_script_cache;
|
||||
|
||||
- key_n = g_new (gint64, 1);
|
||||
+ key_n = g_new (script_cache_key, 1);
|
||||
*key_n = font_and_script_key;
|
||||
|
||||
new_script_cache = g_new0 (SCRIPT_CACHE, 1);
|
||||
--
|
||||
2.16.2
|
||||
|
||||
@@ -5,22 +5,16 @@ _realname=pango
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=1.42.1
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="A library for layout and rendering of text (mingw-w64)"
|
||||
arch=('any')
|
||||
url="http://www.pango.org"
|
||||
|
||||
# TODO: what is the license for the package as a whole? The README file says
|
||||
# that most of the code is LGPL but some parts are "GPL/FreeType". However this
|
||||
# non-LGPL note makes reference to non-existing files, so would LGPL apply to
|
||||
# the whole code? If this note is still correct, are the GPL/FreeType parts
|
||||
# under either or both of these licenses, and which versions? What license is
|
||||
# compatible with the answers?
|
||||
license=(partial:'LGPL2')
|
||||
|
||||
license=('LGPL2.1')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
"${MINGW_PACKAGE_PREFIX}-pkg-config"
|
||||
"${MINGW_PACKAGE_PREFIX}-gobject-introspection"
|
||||
"${MINGW_PACKAGE_PREFIX}-meson"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja"
|
||||
"${MINGW_PACKAGE_PREFIX}-gtk-doc")
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
|
||||
"${MINGW_PACKAGE_PREFIX}-cairo"
|
||||
@@ -31,44 +25,74 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
|
||||
"${MINGW_PACKAGE_PREFIX}-fribidi")
|
||||
options=('staticlibs' 'strip' 'emptydirs')
|
||||
source=("https://download.gnome.org/sources/pango/${pkgver:0:4}/${_realname}-${pkgver}.tar.xz"
|
||||
0001-no-unconditional-xft-please.all.patch
|
||||
0001-build-move-usp10-before-gdi32.patch)
|
||||
0001-build-move-usp10-before-gdi32.patch
|
||||
0001-meson-skip-pangoxft-headers-on-Windows-gtk-doc-build.patch
|
||||
0002-pangowin32-fix-script-cache-hash-key-for-64bit-build.patch
|
||||
static-skip-help2man.patch)
|
||||
sha256sums=('915a6756b298578ff27c7a6393f8c2e62e6e382f9411f2504d7af1a13c7bce32'
|
||||
'bebab6128258d300e677df0751177f5c30235d0a49c150d97987d0f00b309f35'
|
||||
'f07bfd26bc4eabb03ea0294d2d428e617a6fb505afec0d1c40dc8af659d22a97')
|
||||
'f07bfd26bc4eabb03ea0294d2d428e617a6fb505afec0d1c40dc8af659d22a97'
|
||||
'6ec49e382d726c5047f3d06cae58e2d270268042f89f06cfb6c5533e2c52c078'
|
||||
'bbe26df33845ed369dbfa9267256828bffe72be14eecc9784ea1b34240bd087d'
|
||||
'5c245a47af6dd883132cf610723c1832d2b92dae93a75c4bbfa8d77702dfc64f')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${_realname}-${pkgver}"
|
||||
patch -p1 -i ${srcdir}/0001-no-unconditional-xft-please.all.patch
|
||||
patch -p1 -i ${srcdir}/0001-build-move-usp10-before-gdi32.patch
|
||||
|
||||
autoreconf -fi
|
||||
sed -i 's/have_libthai=true/have_libthai=false/' configure
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=795045
|
||||
patch -p1 -i ${srcdir}/0001-build-move-usp10-before-gdi32.patch
|
||||
patch -p1 -i ${srcdir}/0001-meson-skip-pangoxft-headers-on-Windows-gtk-doc-build.patch
|
||||
patch -p1 -i ${srcdir}/0002-pangowin32-fix-script-cache-hash-key-for-64bit-build.patch
|
||||
|
||||
# pango-view doesn't work in the static build
|
||||
patch -p1 -i ${srcdir}/static-skip-help2man.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
|
||||
mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
|
||||
cd "${srcdir}"
|
||||
[[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
|
||||
mkdir -p build-${MINGW_CHOST}
|
||||
cd build-${MINGW_CHOST}
|
||||
|
||||
mkdir -p docs/html
|
||||
cp -rf ../${_realname}-${pkgver}/docs/html/* docs/html
|
||||
meson \
|
||||
--default-library shared \
|
||||
--buildtype plain \
|
||||
-Denable_docs=true \
|
||||
-Dgir=true \
|
||||
../${_realname}-${pkgver}
|
||||
|
||||
../${_realname}-${pkgver}/configure \
|
||||
--prefix=${MINGW_PREFIX} \
|
||||
--build=${MINGW_CHOST} \
|
||||
--host=${MINGW_CHOST} \
|
||||
--enable-introspection \
|
||||
--disable-debug \
|
||||
--enable-shared \
|
||||
--enable-static
|
||||
make
|
||||
ninja
|
||||
|
||||
for pcfile in *.pc; do
|
||||
sed -s "s|$(cygpath -m ${MINGW_PREFIX})|${MINGW_PREFIX}|g" -i "${pcfile}"
|
||||
done
|
||||
|
||||
cd "${srcdir}"
|
||||
[[ -d build-static-${MINGW_CHOST} ]] && rm -rf build-static-${MINGW_CHOST}
|
||||
mkdir -p build-static-${MINGW_CHOST}
|
||||
cd build-static-${MINGW_CHOST}
|
||||
|
||||
meson \
|
||||
--default-library static \
|
||||
--buildtype plain \
|
||||
-Denable_docs=false \
|
||||
-Dgir=false \
|
||||
../${_realname}-${pkgver}
|
||||
|
||||
ninja
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/build-static-${MINGW_CHOST}"
|
||||
DESTDIR=${pkgdir}${MINGW_PREFIX} ninja install
|
||||
|
||||
cd "${srcdir}/build-${MINGW_CHOST}"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
DESTDIR=${pkgdir}${MINGW_PREFIX} ninja install
|
||||
|
||||
# remove installed tests, no need and they contain the build path which
|
||||
# leads to pkgbuild warnings
|
||||
rm -Rf "${pkgdir}${MINGW_PREFIX}/share/installed-tests"
|
||||
rm -Rf "${pkgdir}${MINGW_PREFIX}/libexec"
|
||||
|
||||
# License
|
||||
install -Dm644 "${srcdir}/${_realname}-${pkgver}/README" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/README"
|
||||
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
|
||||
}
|
||||
|
||||
11
mingw-w64-pango/static-skip-help2man.patch
Normal file
11
mingw-w64-pango/static-skip-help2man.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- pango-1.42.1/pango-view/meson.build.orig 2018-04-07 12:00:40.000000000 +0200
|
||||
+++ pango-1.42.1/pango-view/meson.build 2018-04-08 20:29:14.002005600 +0200
|
||||
@@ -40,7 +40,7 @@
|
||||
])
|
||||
|
||||
help2man = find_program('help2man', required: false)
|
||||
-if help2man.found()
|
||||
+if help2man.found() and get_option('default_library') != 'static'
|
||||
help2man_opts = [
|
||||
'--no-info',
|
||||
'--section=1',
|
||||
Reference in New Issue
Block a user