Port build system from autotools to meson.

This commit is contained in:
Logan Rathbone 2021-06-08 22:55:49 -04:00
parent 0b5313bc00
commit ae51b76901
18 changed files with 256 additions and 426 deletions

View File

@ -1,32 +0,0 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_CPPFLAGS = src
SUBDIRS = \
src \
po \
data \
help
EXTRA_DIST = \
autogen.sh \
config.rpath \
COPYING \
HACKING \
ChangeLog \
NEWS \
README \
AUTHORS
dist-hook:
@if test -d "$(srcdir)/.git"; \
then \
echo Creating ChangeLog && \
( cd "$(top_srcdir)" && \
echo '# Generated by Makefile. Do not edit.'; echo; \
$(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
|| ( rm -f ChangeLog.tmp ; \
echo Failed to generate ChangeLog >&2 ); \
else \
echo A git clone is required to generate a ChangeLog >&2; \
fi

View File

@ -1,38 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.
olddir=$(pwd)
cd $srcdir
(test -f configure.ac) || {
echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
exit 1
}
# shellcheck disable=SC2016
PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
fi
autoreconf --verbose --force --install || exit 1
cd "$olddir"
if [ "$NOCONFIGURE" = "" ]; then
$srcdir/configure "$@" || exit 1
if [ "$1" = "--help" ]; then
exit 0
else
echo "Now type 'make' to compile $PKG_NAME" || exit 1
fi
else
echo "Skipping configure process."
fi

View File

@ -1,140 +0,0 @@
AC_INIT([Zenity],[3.32.0],[https://bugzilla.gnome.org/enter_bug.cgi?product=zenity],[zenity])
AC_PREREQ([2.69])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.10 foreign no-dist-gzip dist-xz])
AM_MAINTAINER_MODE([enable])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
# *******************************
# Debug
# *******************************
AX_CHECK_ENABLE_DEBUG([yes],[GNOME_ENABLE_DEBUG])
# Check for programs
AC_PROG_CC
GTK_REQUIRED=3.0.0
PKG_CHECK_MODULES([ZENITY],[gtk+-3.0 >= $GTK_REQUIRED glib-2.0])
AC_SUBST([ZENITY_CFLAGS])
AC_SUBST([ZENITY_LIBS])
dnl *************************
dnl Check for the GTK+ backend, if it's X11, we -lX11
dnl *************************
zenity_save_cflags="$CFLAGS"
# pull in the CFLAGS to locate gdkconfig.h
CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <gdk/gdk.h>
int main(void) {
#ifndef GDK_WINDOWING_X11
#error GDK_WINDOWING_X11 not defined
#endif
return 0;
}
])],
GDK_BACKEND_X11=yes,
GDK_BACKEND_X11=no)
CFLAGS="$zenity_save_cflags"
if test "x$GDK_BACKEND_X11" = "xyes"; then
PKG_CHECK_MODULES(X, x11)
ZENITY_CFLAGS="$ZENITY_CFLAGS $X_CFLAGS"
ZENITY_LIBS="$ZENITY_LIBS $X_LIBS"
fi
# *******************************
# perl check
# *******************************
AC_PATH_PROG([PERL],[perl],)
# *******************************
# libnotify check
# *******************************
LIBNOTIFY_REQUIRED=0.6.1
AC_ARG_ENABLE([libnotify],
[AS_HELP_STRING([--enable-libnotify],
[Enable libnotify support])],
[],
[enable_libnotify=yes])
if test x$enable_libnotify = xyes; then
PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= $LIBNOTIFY_REQUIRED],
[HAVE_LIBNOTIFY="yes"],[HAVE_LIBNOTIFY="no"])
AC_SUBST([LIBNOTIFY_CFLAGS])
AC_SUBST([LIBNOTIFY_LIBS])
if test "x$HAVE_LIBNOTIFY" = "xyes"; then
AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify is available on this machine])
fi
fi
# *******************************
# webkit check
# *******************************
WEBKITGTK_REQUIRED=2.8.1
AC_ARG_ENABLE([webkitgtk],
[AS_HELP_STRING([--enable-webkitgtk],
[Enable webkit support])],
[],
[enable_webkitgtk=yes])
if test x$enable_webkitgtk = xyes; then
PKG_CHECK_MODULES([WEBKIT], [webkit2gtk-4.0 >= $WEBKITGTK_REQUIRED],
[HAVE_WEBKITGTK="yes"],[HAVE_WEBKITGTK="no"])
AC_SUBST([WEBKIT_CFLAGS])
AC_SUBST([WEBKIT_LIBS])
if test "x$HAVE_WEBKITGTK" = "xyes"; then
AC_DEFINE([HAVE_WEBKITGTK], [1], [webkitgtk is available on this machine])
fi
fi
# *******************************
# Internationalization
# *******************************
AM_GNU_GETTEXT_VERSION([0.19.4])
AM_GNU_GETTEXT([external])
GETTEXT_PACKAGE=zenity
AC_SUBST([GETTEXT_PACKAGE])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext domain])
# *******************************
# User manual
# *******************************
YELP_HELP_INIT
# *******************************
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
# *******************************
AC_CONFIG_FILES([
Makefile
po/Makefile.in
src/Makefile
src/gdialog
data/Makefile
help/Makefile
])
AC_OUTPUT

View File

@ -1,23 +0,0 @@
clothesdir = $(datadir)/zenity/clothes
clothes_DATA = \
monk.png \
gnome-tshirt.png \
sunglasses.png \
surfboard.png \
hawaii-shirt.png
imagesdir = $(datadir)/zenity
images_DATA = \
zenity.png \
zenity-calendar.png \
zenity-list.png \
zenity-file.png \
zenity-progress.png \
zenity-text.png \
zenity-scale.png \
zenity-entry.png \
zenity-notification.png
man_MANS = zenity.1
EXTRA_DIST = $(images_DATA) $(clothes_DATA) $(man_MANS)

22
data/meson.build Normal file
View File

@ -0,0 +1,22 @@
install_man('zenity.1')
install_data(
['zenity.png',
'zenity-calendar.png',
'zenity-list.png',
'zenity-file.png',
'zenity-progress.png',
'zenity-text.png',
'zenity-scale.png',
'zenity-entry.png',
'zenity-notification.png']
)
install_data(
['monk.png',
'gnome-tshirt.png',
'sunglasses.png',
'surfboard.png',
'hawaii-shirt.png'],
install_dir: join_paths(zenity_datadir, 'clothes')
)

1
help/LINGUAS Normal file
View File

@ -0,0 +1 @@
bg ca cs da de el en_GB es eu fi fr gl hu ja oc pl pt_BR ru sl sv uk zh_CN

View File

@ -1,45 +0,0 @@
@YELP_HELP_RULES@
HELP_ID = zenity
HELP_MEDIA = \
figures/zenity-calendar-screenshot.png \
figures/zenity-colorselection-screenshot.png \
figures/zenity-entry-screenshot.png \
figures/zenity-error-screenshot.png \
figures/zenity-fileselection-screenshot.png \
figures/zenity-forms-screenshot.png \
figures/zenity-information-screenshot.png \
figures/zenity-list-screenshot.png \
figures/zenity-notification-listen-screenshot.png \
figures/zenity-notification-screenshot.png \
figures/zenity-password-screenshot.png \
figures/zenity-progress-screenshot.png \
figures/zenity-question-screenshot.png \
figures/zenity-scale-screenshot.png \
figures/zenity-text-screenshot.png \
figures/zenity-warning-screenshot.png
HELP_FILES = \
legal.xml \
calendar.page \
color-selection.page \
entry.page \
error.page \
file-selection.page \
forms.page \
index.page \
info.page \
intro.page \
list.page \
message.page \
notification.page \
password.page \
progress.page \
question.page \
scale.page \
text.page \
usage.page \
warning.page
HELP_LINGUAS = bg ca cs da de el en_GB es eu fi fr gl hu ja oc pl pt_BR ru sl sv uk zh_CN

48
help/meson.build Normal file
View File

@ -0,0 +1,48 @@
help_pages = [
'legal.xml',
'calendar.page',
'color-selection.page',
'entry.page',
'error.page',
'file-selection.page',
'forms.page',
'index.page',
'info.page',
'intro.page',
'list.page',
'message.page',
'notification.page',
'password.page',
'progress.page',
'question.page',
'scale.page',
'text.page',
'usage.page',
'warning.page'
]
help_media = [
'figures/zenity-calendar-screenshot.png',
'figures/zenity-colorselection-screenshot.png',
'figures/zenity-entry-screenshot.png',
'figures/zenity-error-screenshot.png',
'figures/zenity-fileselection-screenshot.png',
'figures/zenity-forms-screenshot.png',
'figures/zenity-information-screenshot.png',
'figures/zenity-list-screenshot.png',
'figures/zenity-notification-listen-screenshot.png',
'figures/zenity-notification-screenshot.png',
'figures/zenity-password-screenshot.png',
'figures/zenity-progress-screenshot.png',
'figures/zenity-question-screenshot.png',
'figures/zenity-scale-screenshot.png',
'figures/zenity-text-screenshot.png',
'figures/zenity-warning-screenshot.png'
]
gnome.yelp(
meson.project_name(),
sources: help_pages,
media: help_media,
symlink_media: false
)

109
meson.build Normal file
View File

@ -0,0 +1,109 @@
project('zenity', 'c',
version: '3.34.0',
meson_version: '>=0.53.0',
license: 'LGPL-2.1-or-later'
)
version_arr = meson.project_version().split('.')
zenity_version_major = version_arr[0].to_int()
zenity_version_minor = version_arr[1]
zenity_version_micro = version_arr[2].to_int()
zenity_prefix = get_option('prefix')
zenity_bindir = join_paths(zenity_prefix, get_option('bindir'))
zenity_libdir = join_paths(zenity_prefix, get_option('libdir'))
zenity_datadir = join_paths(zenity_prefix, get_option('datadir'), 'zenity')
zenity_localedir = join_paths(zenity_prefix, get_option('localedir'))
zenity_root_dir = include_directories('.')
zenity_po_dir = join_paths(meson.source_root(), 'po')
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
zenity_conf = configuration_data()
zenity_conf.set_quoted('ZENITY_NAME', meson.project_name())
zenity_conf.set_quoted('ZENITY_VERSION', meson.project_version())
zenity_conf.set_quoted('ZENITY_STRING',
'@0@ @1@'.format(meson.project_name(), meson.project_version()))
zenity_conf.set_quoted('ZENITY_DATADIR', zenity_datadir)
zenity_conf.set_quoted('ZENITY_LIBDIR', zenity_libdir)
zenity_conf.set_quoted('ZENITY_LOCALE_DIR', zenity_localedir)
zenity_conf.set('VERSION', 'ZENITY_VERSION')
zenity_conf.set('GETTEXT_PACKAGE', 'ZENITY_NAME')
zenity_conf.set('LOCALEDIR', 'ZENITY_LOCALE_DIR')
zenity_conf.set('DEBUG', get_option('debug'))
check_headers = [
'sys/types.h',
'unistd.h',
'langinfo.h',
'locale.h'
]
foreach h : check_headers
cc.has_header(h, required: true)
endforeach
gtk_dep = dependency('gtk+-3.0', version: '>= 3.0.0')
# Optional dependencies
opt_missing_str = '''
Requested optional @0@ support but library not found.
Please ensure you have any required development libraries installed.'''
libnotify = dependency('libnotify', version: '>= 0.6.1', required: false)
if get_option('libnotify')
if libnotify.found()
zenity_conf.set('HAVE_LIBNOTIFY', true)
else
error(opt_missing_str.format('libnotify'))
endif
endif
webkitgtk = dependency('webkit2gtk-4.0', version: '>= 2.8.1', required: false)
if get_option('webkitgtk')
if webkitgtk.found()
zenity_conf.set('HAVE_WEBKITGTK', true)
else
error(opt_missing_str.format('webkitgtk'))
endif
endif
# link Xlib if we have it. This will likely be removed after gtk4 migration.
x11 = dependency('x11', required: false)
perl = find_program('perl', required: false)
if perl.found()
zenity_conf.set('PERL', perl.path())
endif
configure_file(
output: 'config.h',
configuration: zenity_conf
)
# Print a summary of options at the end.
summary({'prefix': zenity_prefix,
'libdir': zenity_libdir,
'datadir': zenity_datadir,
'localedir': zenity_localedir,
}, section: 'Directories')
summary({'libnotify': get_option('libnotify'),
'webkitgtk': get_option('webkitgtk'),
'gdialog script': perl.found(),
}, section: 'Configuration')
subdir('src')
subdir('data')
subdir('po')
subdir('help')
meson.add_install_script('meson_post_install.py')

5
meson_options.txt Normal file
View File

@ -0,0 +1,5 @@
option('libnotify', type : 'boolean', value : true,
description : 'enable libnotify for desktop notification support')
option('webkitgtk', type : 'boolean', value : true,
description : 'enable webkitgtk support')

15
meson_post_install.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import os
import subprocess
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = os.path.join(prefix, 'share')
# Packaging tools define DESTDIR and this isn't needed for them
if 'DESTDIR' not in os.environ:
print('Updating icon cache...')
icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
if not os.path.exists(icon_cache_dir):
os.makedirs(icon_cache_dir)
subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])

View File

@ -1,78 +0,0 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Zenity authors
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU = no
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = https://gitlab.gnome.org/GNOME/zenity/issues
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = yes
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = no
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = no

View File

@ -1,2 +0,0 @@
# List of source files that should *not* be translated.
# Please keep this file sorted alphabetically.

4
po/meson.build Normal file
View File

@ -0,0 +1,4 @@
i18n.gettext(
meson.project_name(),
preset: 'glib'
)

View File

@ -1,57 +0,0 @@
bin_PROGRAMS = zenity
bin_SCRIPTS = gdialog
zenity_SOURCES = \
about.c \
calendar.c \
entry.c \
fileselection.c \
main.c \
msg.c \
notification.c \
option.c \
option.h \
progress.c \
scale.c \
text.c \
tree.c \
color.c \
password.c \
util.c \
util.h \
forms.c \
zenity.h
zenity_CPPFLAGS = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DZENITY_DATADIR=\""$(pkgdatadir)"\" \
$(AM_CPPFLAGS)
zenity_CFLAGS = \
$(ZENITY_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(WEBKIT_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS)
zenity_LDFLAGS = \
$(AM_LDFLAGS)
zenity_LDADD = \
$(ZENITY_LIBS) \
$(LIBNOTIFY_LIBS) \
$(WEBKIT_LIBS)
uidir = $(datadir)/zenity
ui_DATA = \
zenity.ui
DISTCLEANFILES= \
gdialog
EXTRA_DIST = \
$(ui_DATA) \
gdialog \
gdialog.in

View File

@ -43,7 +43,7 @@ main (gint argc, gchar **argv) {
setlocale (LC_ALL, "");
#endif
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);

51
src/meson.build Normal file
View File

@ -0,0 +1,51 @@
# for i in `ls *.c`; do echo " '${i}',"; done
zenity_sources = [
'about.c',
'calendar.c',
'color.c',
'entry.c',
'fileselection.c',
'forms.c',
'main.c',
'msg.c',
'notification.c',
'option.c',
'password.c',
'progress.c',
'scale.c',
'text.c',
'tree.c',
'util.c'
]
zenity_deps = [
gtk_dep,
libnotify,
webkitgtk,
x11
]
zenity_c_args = [
'-DG_LOG_DOMAIN="Zenity"'
]
zenity = executable(
meson.project_name(),
zenity_sources,
include_directories: zenity_root_dir,
dependencies: zenity_deps,
c_args: zenity_c_args,
install: true
)
if perl.found()
configure_file(
input: 'gdialog.in',
output: 'gdialog',
configuration: zenity_conf,
install_dir: zenity_bindir,
install: true
)
endif
install_data('zenity.ui')

View File

@ -5,7 +5,6 @@
G_BEGIN_DECLS
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(String) dgettext (GETTEXT_PACKAGE, String)
#ifdef gettext_noop
@ -13,15 +12,6 @@ G_BEGIN_DECLS
#else
#define N_(String) (String)
#endif
#else /* NLS is disabled */
#define _(String) (String)
#define N_(String) (String)
#define textdomain(String) (String)
#define gettext(String) (String)
#define dgettext(Domain, String) (String)
#define dcgettext(Domain, String, Type) (String)
#define bindtextdomain(Domain, Directory) (Domain)
#endif
typedef struct {
gchar *dialog_title;