Commit 49fafd99 authored by Richard Hughes's avatar Richard Hughes

Port to the meson build system

Automake and autoconf are impossible to fully understand and Meson now provides
everything we need for a much smaller, faster, and more understandable build.

See http://mesonbuild.com/ for more information.
parent 1ff39f71
i18n.merge_file(
input: 'org.gnome.Software.appdata.xml.in',
output: 'org.gnome.Software.appdata.xml',
type: 'xml',
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('datadir'), 'appdata')
)
install_data('16x16/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/16x16/apps')
install_data('22x22/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/22x22/apps')
install_data('24x24/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/24x24/apps')
install_data('32x32/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/32x32/apps')
install_data('48x48/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/48x48/apps')
install_data('256x256/org.gnome.Software.png',
install_dir : 'share/icons/hicolor/256x256/apps')
install_data('scalable/org.gnome.Software-symbolic.svg',
install_dir : 'share/icons/hicolor/scalable/apps')
install_data('scalable/software-installed-symbolic.svg',
install_dir : 'share/icons/hicolor/scalable/apps')
subdir('hicolor')
subdir('appdata')
subdir('icons')
compiled = gnome.compile_schemas()
install_data('org.gnome.software.gschema.xml',
install_dir : 'share/glib-2.0/schemas')
if get_option('enable-external-appstream')
# replace @libexecdir@
configure_file(
input : 'org.gnome.software.external-appstream.policy.in',
output : 'org.gnome.software.external-appstream.policy',
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions'),
configuration : conf
)
endif
install_data([
'upgrade-bg.png',
'featured-ardour.png',
'featured-ardour-bg.png',
'featured-blender.png',
'featured-builder.png',
'featured-builder-bg.jpg',
'featured-chess.png',
'featured-firefox.png',
'featured-gimp.png',
'featured-gnome-sudoku.png',
'featured-inkscape.svg',
'featured-maps.png',
'featured-maps-bg.png',
'featured-mypaint.png',
'featured-polari.svg',
'featured-transmission.png',
'featured-weather.png',
'featured-weather-bg.png'
],
install_dir : 'share/gnome-software'
)
gnome.gtkdoc('gnome-software',
src_dir : join_paths(meson.source_root(), 'src'),
main_xml : 'gnome-software-docs.xml',
content_files : [
'gs-example-details.png',
'gs-example-installed.png',
'gs-example-search.png'
],
install : true
)
subdir('api')
project('gnome-software', 'c',
version : '3.23.3',
default_options : ['warning_level=1'],
meson_version : '>=0.37.0'
)
conf = configuration_data()
conf.set('VERSION', '"@0@"'.format(meson.project_version()))
conf.set('PACKAGE_NAME', '"@0@"'.format(meson.project_name()))
conf.set('PACKAGE_VERSION', '"@0@"'.format(meson.project_version()))
# this refers to the gnome-software plugin API version
# this is not in any way related to a package or soname version
conf.set('GS_PLUGIN_API_VERSION', '"@0@"'.format('11'))
# install docs
install_data('README', install_dir : 'share/doc/gnome-software')
# get suported warning flags
test_args = [
'-fstack-protector-strong',
'-Waggregate-return',
'-Warray-bounds',
'-Wcast-align',
'-Wclobbered',
'-Wdeclaration-after-statement',
'-Wempty-body',
'-Wextra',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat-signedness',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wno-discarded-qualifiers',
'-Wno-missing-field-initializers',
'-Wno-strict-aliasing',
'-Wno-suggest-attribute=format',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Woverride-init',
'-Wpacked',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wreturn-type',
'-Wshadow',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wtype-limits',
'-Wundef',
'-Wuninitialized',
'-Wunused-but-set-variable',
'-Wwrite-strings'
]
cc = meson.get_compiler('c')
foreach arg: test_args
if cc.has_argument(arg)
add_project_arguments(arg, language : 'c')
endif
endforeach
# enable full RELRO where possible
# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
global_link_args = []
test_link_args = [
'-Wl,-z,relro',
'-Wl,-z,now',
]
foreach arg: test_link_args
if cc.has_argument(arg)
global_link_args += arg
endif
endforeach
add_global_link_arguments(
global_link_args,
language: 'c'
)
appstream_glib = dependency('appstream-glib', version : '>= 0.6.5')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', version : '>= 2.31.5')
gio_unix = dependency('gio-unix-2.0')
gmodule = dependency('gmodule-2.0')
gtk = dependency('gtk+-3.0', version : '>= 3.20.0')
json_glib = dependency('json-glib-1.0', version : '>= 1.1.1')
libm = cc.find_library('libm', required: false)
libsecret = dependency('libsecret-1')
libsoup = dependency('libsoup-2.4', version : '>= 2.51.92')
sqlite3 = dependency('sqlite3')
if get_option('enable-gnome-desktop')
gnome_desktop = dependency('gnome-desktop-3.0', version : '>= 3.17.92')
endif
if get_option('enable-gtkspell')
gtkspell = dependency('gtkspell3-3.0')
endif
if get_option('enable-polkit')
polkit = dependency('polkit-gobject-1')
endif
if get_option('enable-ostree')
ostree = dependency('ostree-1')
endif
if get_option('enable-packagekit')
packagekit = dependency('packagekit-glib2', version : '>= 1.1.0')
conf.set('HAVE_PACKAGEKIT', '1')
add_project_arguments('-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE',
language : 'c')
endif
if get_option('enable-firmware')
fwupd = dependency('fwupd', version : '>= 0.7.0')
endif
if get_option('enable-flatpak')
flatpak = dependency('flatpak', version : '>= 0.6.12')
endif
if get_option('enable-limba')
limba = dependency('limba', version : '>= 0.5.6')
endif
if get_option('enable-rpm')
rpm = dependency('rpm')
endif
if get_option('enable-ubuntu-reviews')
oauth = dependency('oauth')
endif
if get_option('enable-gudev')
gudev = dependency('gudev-1.0')
endif
if get_option('enable-snap')
snap = dependency('snapd-glib')
endif
gnome = import('gnome')
i18n = import('i18n')
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('TESTDATADIR', '..')
conf.set_quoted('LOCALEDIR',
join_paths(get_option('prefix'),
get_option('localedir')))
conf.set_quoted('DATADIR',
join_paths(get_option('prefix'),
get_option('datadir')))
conf.set_quoted('LIBDIR',
join_paths(get_option('prefix'),
get_option('libdir')))
conf.set_quoted('SYSCONFDIR',
join_paths(get_option('prefix'),
get_option('sysconfdir')))
# FIXME: xxx
conf.set_quoted('LOCALSTATEDIR', '/var')
conf.set_quoted('GS_DATA',
join_paths(get_option('prefix'),
get_option('datadir'),
'gnome-software'))
configure_file(
output : 'config.h',
configuration : conf
)
top_build_incdir = include_directories(meson.current_build_dir())
add_project_arguments('-DI_KNOW_THE_GNOME_SOFTWARE_API_IS_SUBJECT_TO_CHANGE',
language : 'c')
subdir('src')
subdir('po')
subdir('data')
subdir('doc')
archiver = find_program('git', required : false)
if archiver.found()
run_target('dist',
# git config tar.tar.xz.command "xz -c"
command: [
'git', 'archive',
'--prefix=' + meson.project_name() + '-' + meson.project_version() + '/',
'HEAD',
'--format=tar.xz',
'--output',
meson.project_name() + '-' + meson.project_version() + '.tar.xz'
]
)
else
message('git not found, you will not be able to run `ninja dist`')
endif
appstream_util = find_program('appstream-util', required : false)
if appstream_util.found()
custom_target('NEWS',
output : 'NEWS',
input : 'data/appdata/org.gnome.Software.appdata.xml.in',
command : [appstream_util, 'appdata-to-news', '@INPUT@'],
capture : true
)
endif
# FIXME: remove when https://github.com/mesonbuild/meson/issues/837 fixed
meson.add_install_script('meson_post_install.sh')
option('enable-tests', type : 'boolean', value : true, description : 'enable tests')
option('enable-gtkspell', type : 'boolean', value : true, description : 'enable gtkspell')
option('enable-gnome-desktop', type : 'boolean', value : true, description : 'enable gnome-desktop')
option('enable-man', type : 'boolean', value : true, description : 'enable man pages')
option('enable-packagekit', type : 'boolean', value : true, description : 'enable PackageKit support')
option('enable-polkit', type : 'boolean', value : true, description : 'enable PolKit support')
option('enable-firmware', type : 'boolean', value : true, description : 'enable firmware support')
option('enable-flatpak', type : 'boolean', value : true, description : 'enable Flatpak support')
option('enable-ostree', type : 'boolean', value : true, description : 'enable OSTree support')
option('enable-limba', type : 'boolean', value : false, description : 'enable Limba support')
option('enable-rpm', type : 'boolean', value : true, description : 'enable RPM support')
option('enable-steam', type : 'boolean', value : true, description : 'enable Steam support')
option('enable-shell-extensions', type : 'boolean', value : true, description : 'enable shell extensions support')
option('enable-odrs', type : 'boolean', value : true, description : 'enable ODRS support')
option('enable-ubuntu-reviews', type : 'boolean', value : true, description : 'enable Ubuntu reviews support')
option('enable-webapps', type : 'boolean', value : true, description : 'enable webapps support')
option('enable-gudev', type : 'boolean', value : true, description : 'enable GUdev support')
option('enable-snap', type : 'boolean', value : false, description : 'enable Snap support')
option('enable-external-appstream', type : 'boolean', value : false, description : 'enable external AppStream support')
#!/bin/sh
if [ -z $MESON_INSTALL_PREFIX ]; then
echo 'This is meant to be ran from Meson only!'
exit 1
fi
if [ -z $DESTDIR ]; then
echo 'Compiling GSchema'
glib-compile-schemas "$MESON_INSTALL_PREFIX/share/glib-2.0/schemas"
echo 'Updating icon cache'
gtk-update-icon-cache -qtf "$MESON_INSTALL_PREFIX/share/icons/hicolor"
echo 'Updating desktop database'
update-desktop-database -q "$MESON_INSTALL_PREFIX/share/applications"
fi
i18n.gettext(meson.project_name(),
preset : 'glib',
args: [
'--default-domain=' + meson.project_name(),
]
)
subdir('plugins')
cargs = ['-DG_LOG_DOMAIN="Gpm"']
resources_src = gnome.compile_resources(
'gs-resources',
'gnome-software.gresource.xml',
source_dir : '.',
c_name : 'gs'
)
gdbus_src = gnome.gdbus_codegen(
'gs-shell-search-provider-generated',
'shell-search-provider-dbus-interfaces.xml',
interface_prefix : 'org.gnome.',
namespace : 'Gs'
)
gnome_software_sources = [
'gnome-software.h',
'gs-utils.c',
'gs-utils.h',
'gs-app.c',
'gs-app.h',
'gs-app-private.h',
'gs-app-list.c',
'gs-app-list.h',
'gs-app-list-private.h',
'gs-auth.c',
'gs-auth.h',
'gs-auth-dialog.c',
'gs-auth-dialog.h',
'gs-category.c',
'gs-category.h',
'gs-category-private.h',
'gs-common.c',
'gs-common.h',
'gs-content-rating.c',
'gs-content-rating.h',
'gs-debug.c',
'gs-debug.h',
'gs-app-addon-row.c',
'gs-app-addon-row.h',
'gs-app-row.c',
'gs-app-row.h',
'gs-star-widget.c',
'gs-star-widget.h',
'gs-popular-tile.c',
'gs-popular-tile.h',
'gs-feature-tile.c',
'gs-feature-tile.h',
'gs-category-tile.c',
'gs-category-tile.h',
'gs-app-tile.c',
'gs-app-tile.h',
'gs-summary-tile.c',
'gs-summary-tile.h',
'gs-app-folder-dialog.c',
'gs-app-folder-dialog.h',
'gs-first-run-dialog.c',
'gs-first-run-dialog.h',
'gs-history-dialog.c',
'gs-history-dialog.h',
'gs-fixed-size-bin.h',
'gs-fixed-size-bin.c',
'gs-hiding-box.h',
'gs-hiding-box.c',
'gs-info-bar.h',
'gs-info-bar.c',
'gs-language.c',
'gs-language.h',
'gs-os-release.c',
'gs-os-release.h',
'gs-page.c',
'gs-page.h',
'gs-plugin.c',
'gs-plugin.h',
'gs-plugin-event.c',
'gs-plugin-event.h',
'gs-plugin-private.h',
'gs-plugin-types.h',
'gs-plugin-vfuncs.h',
'gs-progress-button.c',
'gs-progress-button.h',
'gs-removal-dialog.c',
'gs-removal-dialog.h',
'gs-review-bar.c',
'gs-review-bar.h',
'gs-review-dialog.c',
'gs-review-dialog.h',
'gs-review-histogram.c',
'gs-review-histogram.h',
'gs-review-row.c',
'gs-review-row.h',
'gs-screenshot-image.c',
'gs-screenshot-image.h',
'gs-shell.c',
'gs-shell.h',
'gs-shell-details.c',
'gs-shell-details.h',
'gs-shell-category.c',
'gs-shell-category.h',
'gs-shell-extras.c',
'gs-shell-extras.h',
'gs-shell-installed.c',
'gs-shell-installed.h',
'gs-shell-moderate.c',
'gs-shell-moderate.h',
'gs-shell-loading.c',
'gs-shell-loading.h',
'gs-shell-overview.c',
'gs-shell-overview.h',
'gs-shell-updates.c',
'gs-shell-updates.h',
'gs-shell-search.c',
'gs-shell-search.h',
'gs-sources-dialog.c',
'gs-sources-dialog.h',
'gs-sources-dialog-row.c',
'gs-sources-dialog-row.h',
'gs-update-dialog.c',
'gs-update-dialog.h',
'gs-update-list.c',
'gs-update-list.h',
'gs-update-monitor.c',
'gs-update-monitor.h',
'gs-upgrade-banner.c',
'gs-upgrade-banner.h',
'gs-vendor.c',
'gs-vendor.h',
'gs-plugin-loader.c',
'gs-plugin-loader.h',
'gs-plugin-loader-sync.c',
'gs-plugin-loader-sync.h',
'gs-shell-search-provider.c',
'gs-shell-search-provider.h',
'gs-application.c',
'gs-application.h',
'gs-folders.c',
'gs-folders.h',
'gs-main.c'
]
gnome_software_dependencies = [gtk, gio_unix, libm, appstream_glib, json_glib, libsoup, libsecret, gmodule]
if get_option('enable-packagekit')
gnome_software_sources += [
'gs-dbus-helper.c',
'gs-dbus-helper.h',
]
gnome_software_sources += gnome.gdbus_codegen(
'gs-packagekit-generated',
'org.freedesktop.PackageKit.xml',
interface_prefix : 'org.freedesktop.',
namespace : 'Gs'
)
gnome_software_sources += gnome.gdbus_codegen(
'gs-packagekit-modify2-generated',
'org.freedesktop.PackageKit.Modify2.xml',
interface_prefix : 'org.freedesktop.',
namespace : 'Gs'
)
gnome_software_dependencies += [packagekit]
endif
executable(
'gnome-software',
resources_src,
gdbus_src,
sources : gnome_software_sources,
include_directories : [
include_directories('..'),
],
dependencies : gnome_software_dependencies,
c_args : cargs,
install : true,
install_dir : 'bin'
)
executable(
'gnome-software-cmd',
sources : [
'gs-app.c',
'gs-app-list.c',
'gs-auth.c',
'gs-cmd.c',
'gs-common.c',
'gs-debug.c',
'gs-utils.c',
'gs-os-release.c',
'gs-plugin-event.c',
'gs-plugin-loader.c',
'gs-plugin-loader-sync.c',
'gs-category.c',
'gs-plugin.c'
],
include_directories : [
include_directories('..'),
],
dependencies : [
appstream_glib,
gio_unix,
gmodule,
gtk,
json_glib,
libm,
libsecret,
libsoup
],
c_args : cargs,
install : true,
install_dir : 'libexec'
)
if get_option('enable-tests')
e = executable(
'gs-self-test',
sources : [
'gs-app.c',
'gs-app-list.c',
'gs-auth.c',
'gs-category.c',
'gs-common.c',
'gs-os-release.c',
'gs-plugin-event.c',
'gs-plugin-loader-sync.c',
'gs-plugin-loader.c',
'gs-plugin.c',
'gs-utils.c',
'gs-self-test.c'
],
include_directories : [
include_directories('..'),
],
dependencies : [
appstream_glib,
gio_unix,
gmodule,
gtk,
json_glib,
libm,
libsecret,
libsoup
],
c_args : cargs
)
test('gs-self-test', e)
endif
install_headers([
'gnome-software.h',
'gs-app.h',
'gs-app-list.h',
'gs-auth.h',
'gs-category.h',
'gs-os-release.h',
'gs-plugin.h',
'gs-plugin-event.h',
'gs-plugin-types.h',
'gs-plugin-vfuncs.h',
'gs-utils.h'
],
subdir : 'gnome-software'
)
# replace @VERSION@
configure_file(
input : 'org.gnome.Software.service.in',
output : 'org.gnome.Software.service',
install: true,
install_dir: join_paths(get_option('datadir'), 'dbus-1/services'),
configuration : conf
)
# replace @bindir@
configure_file(
input : 'gnome-software-service.desktop.in',
output : 'gnome-software-service.desktop',
install: true,
install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'),
configuration : conf
)
i18n.merge_file(
input: 'org.gnome.Software.desktop.in',
output: 'org.gnome.Software.desktop',
type: 'desktop',
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)
i18n.merge_file(
input: 'gnome-software-local-file.desktop.in',
output: 'gnome-software-local-file.desktop',
type: 'desktop',
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)
install_data('org.gnome.Software-search-provider.ini',
install_dir : 'share/gnome-shell/search-providers')
if get_option('enable-man')
xsltproc = find_program('xsltproc')
custom_target('manfile',
input: 'gnome-software.xml',
output: 'gnome-software.1',
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'),
command: [
xsltproc,
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@'
]
)
endif
if get_option('enable-packagekit')
# replace @bindir@
configure_file(
input : 'org.freedesktop.PackageKit.service.in',
output : 'org.freedesktop.PackageKit.service',
install: true,
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
configuration : conf
)
endif
configure_file(
input : 'gnome-software.pc.in',
output : 'gnome-software.pc',
install: true,
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
configuration : conf
)
plugin_dir = join_paths(get_option('libdir'), 'gs-plugins-11')
plugin_libs = [
appstream_glib,
gtk,
json_glib,
libsoup
]
metainfos = []
shared_module('gs_plugin_dummy',
sources : 'gs-plugin-dummy.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : [appstream_glib, gtk, libsoup]
)
shared_module('gs_plugin_dpkg',
sources : 'gs-plugin-dpkg.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : plugin_libs
)
if get_option('enable-external-appstream')
executable(
'gnome-software-install-appstream',
sources : 'gs-install-appstream.c',
include_directories : [
include_directories('@0@/..'.format(meson.current_build_dir())),
],
dependencies : [appstream_glib],
c_args : cargs,
install : true,
install_dir : 'libexec'
)
shared_module('gs_plugin_external-appstream',
sources : 'gs-plugin-external-appstream.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : [gio_unix, appstream_glib, libsoup]
)
endif
shared_module('gs_plugin_key-colors',
sources : 'gs-plugin-key-colors.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : plugin_libs
)
if get_option('enable-shell-extensions')
shared_module('gs_plugin_shell-extensions',
sources : 'gs-plugin-shell-extensions.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : plugin_libs
)
endif
shared_module('gs_plugin_fedora-distro-upgrades',
sources : 'gs-plugin-fedora-distro-upgrades.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : plugin_libs
)
if get_option('enable-gudev')
shared_module('gs_plugin_modalias',
sources : 'gs-plugin-modalias.c',
include_directories : [
include_directories('..'),
include_directories('../..'),
],
install : true,
install_dir: plugin_dir,
dependencies : [ plugin_libs, gudev ]
)
endif
shared_module('gs_plugin_provenance',