|
|
3580f2 |
From b7f7e5dfc1e441fb443837b9a95a70fca1df7fb1 Mon Sep 17 00:00:00 2001
|
|
|
3580f2 |
From: Neal Gompa <ngompa@centosproject.org>
|
|
|
3580f2 |
Date: Fri, 14 Oct 2022 06:34:43 -0400
|
|
|
3580f2 |
Subject: [PATCH] meson: Revert upgrade to Meson 0.62
|
|
|
3580f2 |
|
|
|
3580f2 |
Red Hat Enterprise Linux 9 is currently stuck at Meson 0.58,
|
|
|
3580f2 |
with a rebase to Meson 0.62 not expected anytime soon.
|
|
|
3580f2 |
---
|
|
|
3580f2 |
data/meson.build | 49 ++++++++++++++++++++++++-----
|
|
|
3580f2 |
data/translate-metainfo.py | 51 +++++++++++++++++++++++++++++++
|
|
|
3580f2 |
docs/api/compose/meson.build | 18 ++++++-----
|
|
|
3580f2 |
docs/api/meson.build | 18 ++++++-----
|
|
|
3580f2 |
docs/meson.build | 38 +++++++++++++++++------
|
|
|
3580f2 |
meson.build | 2 +-
|
|
|
3580f2 |
po/meson.build | 18 ++++++++++-
|
|
|
3580f2 |
tests/ci/Dockerfile-debian-stable | 3 --
|
|
|
3580f2 |
8 files changed, 158 insertions(+), 39 deletions(-)
|
|
|
3580f2 |
create mode 100755 data/translate-metainfo.py
|
|
|
3580f2 |
|
|
|
3580f2 |
diff --git a/data/meson.build b/data/meson.build
|
|
|
3580f2 |
index aea0cb2..53f31cb 100644
|
|
|
3580f2 |
--- a/data/meson.build
|
|
|
3580f2 |
+++ b/data/meson.build
|
|
|
3580f2 |
@@ -17,14 +17,47 @@ metainfo_with_relinfo = custom_target('gen-output',
|
|
|
3580f2 |
command : [ascli_exe, 'news-to-metainfo', '--limit=6', '@INPUT0@', '@INPUT1@', '@OUTPUT@']
|
|
|
3580f2 |
)
|
|
|
3580f2 |
|
|
|
3580f2 |
-metainfo_i18n = i18n.itstool_join(
|
|
|
3580f2 |
- input: metainfo_with_relinfo,
|
|
|
3580f2 |
- output: 'org.freedesktop.appstream.cli.metainfo.xml',
|
|
|
3580f2 |
- mo_targets: i18n_result[0],
|
|
|
3580f2 |
- its_files: [join_paths(meson.current_source_dir(), 'its', 'metainfo.its')],
|
|
|
3580f2 |
- install: true,
|
|
|
3580f2 |
- install_dir: metainfo_dir,
|
|
|
3580f2 |
-)
|
|
|
3580f2 |
+if meson.version().version_compare('>=0.60')
|
|
|
3580f2 |
+ # starting with Meson 0.60 we can use a crazy hack to generate sane output data
|
|
|
3580f2 |
+ # using itstool - hopefully Meson will gain the ability to do this natively soon
|
|
|
3580f2 |
+ itstool_exe = find_program('itstool', required: true)
|
|
|
3580f2 |
+ python_exe = find_program('python3', required: true)
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ known_locale = run_command(python_exe,
|
|
|
3580f2 |
+ '-c',
|
|
|
3580f2 |
+ 'print(open("'
|
|
|
3580f2 |
+ + join_paths(source_root, 'po', 'LINGUAS') +
|
|
|
3580f2 |
+ '", "r", encoding="utf-8").read())',
|
|
|
3580f2 |
+ check: true).stdout().split()
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ metainfo_i18n = custom_target('metainfo-i18n',
|
|
|
3580f2 |
+ input : [metainfo_with_relinfo, i18n_result[0]],
|
|
|
3580f2 |
+ output : 'org.freedesktop.appstream.cli.metainfo.xml',
|
|
|
3580f2 |
+ command : [python_exe,
|
|
|
3580f2 |
+ join_paths(meson.current_source_dir(), 'translate-metainfo.py'),
|
|
|
3580f2 |
+ itstool_exe,
|
|
|
3580f2 |
+ '@INPUT0@',
|
|
|
3580f2 |
+ '@OUTPUT@',
|
|
|
3580f2 |
+ 'appstream',
|
|
|
3580f2 |
+ join_paths(meson.current_source_dir(), 'its', 'metainfo.its'),
|
|
|
3580f2 |
+ join_paths(meson.project_build_root(), 'po'),
|
|
|
3580f2 |
+ known_locale,
|
|
|
3580f2 |
+ ],
|
|
|
3580f2 |
+ install: true,
|
|
|
3580f2 |
+ install_dir: metainfo_dir
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+else
|
|
|
3580f2 |
+ # generates XML with mangled description markup tags, but better than nothing...
|
|
|
3580f2 |
+ metainfo_i18n = i18n.merge_file (
|
|
|
3580f2 |
+ input: metainfo_with_relinfo,
|
|
|
3580f2 |
+ output: 'org.freedesktop.appstream.cli.metainfo.xml',
|
|
|
3580f2 |
+ type: 'xml',
|
|
|
3580f2 |
+ data_dirs: [meson.current_source_dir()],
|
|
|
3580f2 |
+ po_dir: join_paths (source_root, 'po'),
|
|
|
3580f2 |
+ install: true,
|
|
|
3580f2 |
+ install_dir: metainfo_dir
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+endif
|
|
|
3580f2 |
|
|
|
3580f2 |
test('as-validate_metainfo.cli',
|
|
|
3580f2 |
ascli_exe,
|
|
|
3580f2 |
diff --git a/data/translate-metainfo.py b/data/translate-metainfo.py
|
|
|
3580f2 |
new file mode 100755
|
|
|
3580f2 |
index 0000000..db85882
|
|
|
3580f2 |
--- /dev/null
|
|
|
3580f2 |
+++ b/data/translate-metainfo.py
|
|
|
3580f2 |
@@ -0,0 +1,51 @@
|
|
|
3580f2 |
+#!/usr/bin/env python3
|
|
|
3580f2 |
+#
|
|
|
3580f2 |
+# Copyright (C) 2021-2022 Matthias Klumpp <mak@debian.org>
|
|
|
3580f2 |
+#
|
|
|
3580f2 |
+# SPDX-License-Identifier: LGPL-2.1+
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+#
|
|
|
3580f2 |
+# This is a hack around msgfmt ignoring inline markup tags, and Meson not
|
|
|
3580f2 |
+# having itstool integration in old versions.
|
|
|
3580f2 |
+# FIXME: This is a terrible workaround that should go away as soon as possible.
|
|
|
3580f2 |
+#
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+import os
|
|
|
3580f2 |
+import sys
|
|
|
3580f2 |
+import shutil
|
|
|
3580f2 |
+import subprocess
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+def main(args):
|
|
|
3580f2 |
+ itstool_exe = args[0]
|
|
|
3580f2 |
+ input_fname = args[1]
|
|
|
3580f2 |
+ output_fname = args[2]
|
|
|
3580f2 |
+ domain = args[3]
|
|
|
3580f2 |
+ its_fname = args[4]
|
|
|
3580f2 |
+ locale_dir = args[5]
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ temp_mo_dir = output_fname + '.mo'
|
|
|
3580f2 |
+ shutil.rmtree(temp_mo_dir, ignore_errors=True)
|
|
|
3580f2 |
+ os.makedirs(temp_mo_dir, exist_ok=True)
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ mo_files = []
|
|
|
3580f2 |
+ for locale in args[6:]:
|
|
|
3580f2 |
+ locale = locale.strip()
|
|
|
3580f2 |
+ mo_src = os.path.join(locale_dir, locale, 'LC_MESSAGES', domain + '.mo')
|
|
|
3580f2 |
+ mo_dst = os.path.join(temp_mo_dir, locale + '.mo')
|
|
|
3580f2 |
+ shutil.copy(mo_src, mo_dst, follow_symlinks=False)
|
|
|
3580f2 |
+ mo_files.append(mo_dst)
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ cmd = [itstool_exe,
|
|
|
3580f2 |
+ '-i', its_fname,
|
|
|
3580f2 |
+ '-j', input_fname,
|
|
|
3580f2 |
+ '-o', output_fname]
|
|
|
3580f2 |
+ cmd.extend(mo_files)
|
|
|
3580f2 |
+ subprocess.run(cmd, check=True)
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ # cleanup
|
|
|
3580f2 |
+ shutil.rmtree(temp_mo_dir, ignore_errors=True)
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+if __name__ == '__main__':
|
|
|
3580f2 |
+ main(sys.argv[1:])
|
|
|
3580f2 |
diff --git a/docs/api/compose/meson.build b/docs/api/compose/meson.build
|
|
|
3580f2 |
index ca1d8b3..6c2300c 100644
|
|
|
3580f2 |
--- a/docs/api/compose/meson.build
|
|
|
3580f2 |
+++ b/docs/api/compose/meson.build
|
|
|
3580f2 |
@@ -14,11 +14,13 @@ glib.gtkdoc (
|
|
|
3580f2 |
install_dir: join_paths(get_option('prefix'), as_composeapi_doc_target_dir) # requires an absolute path
|
|
|
3580f2 |
)
|
|
|
3580f2 |
|
|
|
3580f2 |
-# we need to install the empty dir, as the gtkdoc generation happens last
|
|
|
3580f2 |
-# and a symlink target must exist first.
|
|
|
3580f2 |
-install_emptydir(join_paths(get_option('prefix'), as_composeapi_doc_target_dir))
|
|
|
3580f2 |
-install_symlink(
|
|
|
3580f2 |
- 'appstream-compose',
|
|
|
3580f2 |
- pointing_to: '..' / '..' / '..' / as_composeapi_doc_target_dir,
|
|
|
3580f2 |
- install_dir: gtk_doc_root
|
|
|
3580f2 |
-)
|
|
|
3580f2 |
+if meson.version().version_compare('>=0.61')
|
|
|
3580f2 |
+ # we need to install the empty dir, as the gtkdoc generation happens last
|
|
|
3580f2 |
+ # and a symlink target must exist first.
|
|
|
3580f2 |
+ install_emptydir(join_paths(get_option('prefix'), as_composeapi_doc_target_dir))
|
|
|
3580f2 |
+ install_symlink(
|
|
|
3580f2 |
+ 'appstream-compose',
|
|
|
3580f2 |
+ pointing_to: '..' / '..' / '..' / as_composeapi_doc_target_dir,
|
|
|
3580f2 |
+ install_dir: gtk_doc_root
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+endif
|
|
|
3580f2 |
diff --git a/docs/api/meson.build b/docs/api/meson.build
|
|
|
3580f2 |
index 6053c4a..ec06ab4 100644
|
|
|
3580f2 |
--- a/docs/api/meson.build
|
|
|
3580f2 |
+++ b/docs/api/meson.build
|
|
|
3580f2 |
@@ -19,14 +19,16 @@ glib.gtkdoc (
|
|
|
3580f2 |
# We hardcore the gtk-doc path here, because gtkdoc_html_dir('appstream') creates a
|
|
|
3580f2 |
# wrong path due to a Meson bug at the moment
|
|
|
3580f2 |
gtk_doc_root = join_paths(get_option('prefix'), get_option('datadir'), 'gtk-doc', 'html')
|
|
|
3580f2 |
-# we need to install the empty dir, as the gtkdoc generation happens last
|
|
|
3580f2 |
-# and a symlink target must exist first.
|
|
|
3580f2 |
-install_emptydir(join_paths(get_option('prefix'), as_api_doc_target_dir))
|
|
|
3580f2 |
-install_symlink(
|
|
|
3580f2 |
- 'appstream',
|
|
|
3580f2 |
- pointing_to: '..' / '..' / '..' / as_api_doc_target_dir,
|
|
|
3580f2 |
- install_dir: gtk_doc_root
|
|
|
3580f2 |
-)
|
|
|
3580f2 |
+if meson.version().version_compare('>=0.61')
|
|
|
3580f2 |
+ # we need to install the empty dir, as the gtkdoc generation happens last
|
|
|
3580f2 |
+ # and a symlink target must exist first.
|
|
|
3580f2 |
+ install_emptydir(join_paths(get_option('prefix'), as_api_doc_target_dir))
|
|
|
3580f2 |
+ install_symlink(
|
|
|
3580f2 |
+ 'appstream',
|
|
|
3580f2 |
+ pointing_to: '..' / '..' / '..' / as_api_doc_target_dir,
|
|
|
3580f2 |
+ install_dir: gtk_doc_root
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+endif
|
|
|
3580f2 |
|
|
|
3580f2 |
#
|
|
|
3580f2 |
# Build API documentation for libappstream-compose,
|
|
|
3580f2 |
diff --git a/docs/meson.build b/docs/meson.build
|
|
|
3580f2 |
index 15ad472..e8fc381 100644
|
|
|
3580f2 |
--- a/docs/meson.build
|
|
|
3580f2 |
+++ b/docs/meson.build
|
|
|
3580f2 |
@@ -120,11 +120,20 @@ if get_option('docs')
|
|
|
3580f2 |
|
|
|
3580f2 |
if get_option('install-docs')
|
|
|
3580f2 |
install_subdir('html', install_dir: as_doc_target_dir)
|
|
|
3580f2 |
- if fs.is_file(hljs_installed_file)
|
|
|
3580f2 |
- install_symlink(
|
|
|
3580f2 |
- 'highlight.min.js',
|
|
|
3580f2 |
- pointing_to: hljs_installed_file,
|
|
|
3580f2 |
- install_dir: join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js')
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ if meson.version().version_compare('>=0.61')
|
|
|
3580f2 |
+ if fs.is_file(hljs_installed_file)
|
|
|
3580f2 |
+ install_symlink(
|
|
|
3580f2 |
+ 'highlight.min.js',
|
|
|
3580f2 |
+ pointing_to: hljs_installed_file,
|
|
|
3580f2 |
+ install_dir: join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js')
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+ endif
|
|
|
3580f2 |
+ else
|
|
|
3580f2 |
+ meson.add_install_script('sh', '-c',
|
|
|
3580f2 |
+ 'if [ -f "@0@" ]; then mkdir -p $DESTDIR/@1@ && ln -sf @0@ $DESTDIR/@1@; fi'
|
|
|
3580f2 |
+ .format(hljs_installed_file,
|
|
|
3580f2 |
+ join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js'))
|
|
|
3580f2 |
)
|
|
|
3580f2 |
endif
|
|
|
3580f2 |
endif
|
|
|
3580f2 |
@@ -141,11 +150,20 @@ elif get_option('install-docs')
|
|
|
3580f2 |
if fs.is_dir(join_paths(meson.current_source_dir(), 'html'))
|
|
|
3580f2 |
# install documentation, if it exists
|
|
|
3580f2 |
install_subdir('html', install_dir: as_doc_target_dir)
|
|
|
3580f2 |
- if fs.is_file(hljs_installed_file)
|
|
|
3580f2 |
- install_symlink(
|
|
|
3580f2 |
- 'highlight.min.js',
|
|
|
3580f2 |
- pointing_to: hljs_installed_file,
|
|
|
3580f2 |
- install_dir: join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js')
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+ if meson.version().version_compare('>=0.61')
|
|
|
3580f2 |
+ if fs.is_file(hljs_installed_file)
|
|
|
3580f2 |
+ install_symlink(
|
|
|
3580f2 |
+ 'highlight.min.js',
|
|
|
3580f2 |
+ pointing_to: hljs_installed_file,
|
|
|
3580f2 |
+ install_dir: join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js')
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+ endif
|
|
|
3580f2 |
+ else
|
|
|
3580f2 |
+ meson.add_install_script('sh', '-c',
|
|
|
3580f2 |
+ 'if [ -f "@0@" ]; then mkdir -p $DESTDIR/@1@ && ln -sf @0@ $DESTDIR/@1@; fi'
|
|
|
3580f2 |
+ .format(hljs_installed_file,
|
|
|
3580f2 |
+ join_paths(get_option('prefix'), as_doc_target_dir, 'html', 'static', 'js'))
|
|
|
3580f2 |
)
|
|
|
3580f2 |
endif
|
|
|
3580f2 |
endif
|
|
|
3580f2 |
diff --git a/meson.build b/meson.build
|
|
|
3580f2 |
index 0849b05..3504554 100644
|
|
|
3580f2 |
--- a/meson.build
|
|
|
3580f2 |
+++ b/meson.build
|
|
|
3580f2 |
@@ -1,5 +1,5 @@
|
|
|
3580f2 |
project('AppStream', 'c',
|
|
|
3580f2 |
- meson_version: '>=0.62',
|
|
|
3580f2 |
+ meson_version: '>=0.56',
|
|
|
3580f2 |
default_options: ['c_std=c11', 'cpp_std=gnu++14'],
|
|
|
3580f2 |
|
|
|
3580f2 |
license: 'LGPL-2.1+',
|
|
|
3580f2 |
diff --git a/po/meson.build b/po/meson.build
|
|
|
3580f2 |
index e9ede19..20c68fa 100644
|
|
|
3580f2 |
--- a/po/meson.build
|
|
|
3580f2 |
+++ b/po/meson.build
|
|
|
3580f2 |
@@ -1,6 +1,21 @@
|
|
|
3580f2 |
|
|
|
3580f2 |
as_gettext_domain = 'appstream'
|
|
|
3580f2 |
-i18n_result = i18n.gettext(as_gettext_domain,
|
|
|
3580f2 |
+
|
|
|
3580f2 |
+if meson.version().version_compare('>=0.60')
|
|
|
3580f2 |
+ i18n_result = i18n.gettext(as_gettext_domain,
|
|
|
3580f2 |
+ preset : 'glib',
|
|
|
3580f2 |
+ data_dirs: [join_paths(source_root, 'data')],
|
|
|
3580f2 |
+ args: [
|
|
|
3580f2 |
+ '--default-domain=' + as_gettext_domain,
|
|
|
3580f2 |
+ '--from-code=UTF-8',
|
|
|
3580f2 |
+ '-i', '-F', '-c', '--no-wrap',
|
|
|
3580f2 |
+ '--package-name=' + as_gettext_domain,
|
|
|
3580f2 |
+ '--copyright-holder=Matthias Klumpp',
|
|
|
3580f2 |
+ '--msgid-bugs-address=appstream@lists.freedesktop.org'
|
|
|
3580f2 |
+ ]
|
|
|
3580f2 |
+ )
|
|
|
3580f2 |
+else
|
|
|
3580f2 |
+i18n.gettext(as_gettext_domain,
|
|
|
3580f2 |
preset : 'glib',
|
|
|
3580f2 |
data_dirs: [join_paths(source_root, 'data')],
|
|
|
3580f2 |
args: [
|
|
|
3580f2 |
@@ -12,6 +27,7 @@ i18n_result = i18n.gettext(as_gettext_domain,
|
|
|
3580f2 |
'--msgid-bugs-address=appstream@lists.freedesktop.org'
|
|
|
3580f2 |
]
|
|
|
3580f2 |
)
|
|
|
3580f2 |
+endif
|
|
|
3580f2 |
|
|
|
3580f2 |
run_target ('make-linguas',
|
|
|
3580f2 |
command: ['sh',
|
|
|
3580f2 |
diff --git a/tests/ci/Dockerfile-debian-stable b/tests/ci/Dockerfile-debian-stable
|
|
|
3580f2 |
index eb8cff4..483c8f3 100644
|
|
|
3580f2 |
--- a/tests/ci/Dockerfile-debian-stable
|
|
|
3580f2 |
+++ b/tests/ci/Dockerfile-debian-stable
|
|
|
3580f2 |
@@ -10,8 +10,5 @@ RUN mkdir -p /build/ci/
|
|
|
3580f2 |
COPY install-deps-deb.sh /build/ci/
|
|
|
3580f2 |
RUN chmod +x /build/ci/install-deps-deb.sh && /build/ci/install-deps-deb.sh
|
|
|
3580f2 |
|
|
|
3580f2 |
-RUN eatmydata apt-get install -yq --no-install-recommends python3-pip
|
|
|
3580f2 |
-RUN pip install 'meson~=0.62'
|
|
|
3580f2 |
-
|
|
|
3580f2 |
# finish
|
|
|
3580f2 |
WORKDIR /build
|
|
|
3580f2 |
--
|
|
|
3580f2 |
2.36.1
|
|
|
3580f2 |
|