mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 04:38:55 +00:00
Add build support for Meson
To build with meson, use the following commands: ``` $ meson build $ ninja -C build # in case you want to install $ ninja -C build install ```
This commit is contained in:
parent
be0a126399
commit
b19c309096
18
docs/man/meson.build
Normal file
18
docs/man/meson.build
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
secret_tool_man = custom_target('secret-tool.1',
|
||||||
|
input: 'secret-tool.xml',
|
||||||
|
output: 'secret-tool.1',
|
||||||
|
command: [ find_program('xsltproc'),
|
||||||
|
'-o', '@OUTPUT@',
|
||||||
|
'--nonet',
|
||||||
|
'--stringparam', 'man.output.quietly', '1',
|
||||||
|
'--stringparam', 'man.funcsynopsis.style', 'ansi',
|
||||||
|
'--stringparam', 'man.th.extra1.suppress', '1',
|
||||||
|
'--stringparam', 'man.authors.section.enabled', '0',
|
||||||
|
'--stringparam', 'man.copyright.section.enabled', '0',
|
||||||
|
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
|
||||||
|
'@INPUT@',
|
||||||
|
],
|
||||||
|
build_by_default: true,
|
||||||
|
install: true,
|
||||||
|
install_dir: join_paths(libsecret_prefix, get_option('mandir'), 'man1'),
|
||||||
|
)
|
4
docs/meson.build
Normal file
4
docs/meson.build
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
subdir('man')
|
||||||
|
if with_gtkdoc
|
||||||
|
subdir('reference/libsecret')
|
||||||
|
endif
|
39
docs/reference/libsecret/meson.build
Normal file
39
docs/reference/libsecret/meson.build
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
reference_content_files = [
|
||||||
|
'libsecret-examples.sgml',
|
||||||
|
'libsecret-using.sgml',
|
||||||
|
'migrating-libgnome-keyring.xml',
|
||||||
|
]
|
||||||
|
|
||||||
|
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||||
|
reference_expanded_content_files = [
|
||||||
|
'migrating-libgnome-keyring.xml',
|
||||||
|
]
|
||||||
|
|
||||||
|
reference_ignore_headers = [
|
||||||
|
'mock-service.h',
|
||||||
|
'secret-dbus-generated.h',
|
||||||
|
'secret-private.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
version_conf = configuration_data()
|
||||||
|
version_conf.set('VERSION', meson.project_version())
|
||||||
|
configure_file(
|
||||||
|
input: 'version.xml.in',
|
||||||
|
output: 'version.xml',
|
||||||
|
configuration: version_conf,
|
||||||
|
)
|
||||||
|
|
||||||
|
gnome.gtkdoc('libsecret',
|
||||||
|
main_sgml: 'libsecret-docs.sgml',
|
||||||
|
content_files: reference_content_files,
|
||||||
|
src_dir: include_directories('../../../libsecret'),
|
||||||
|
dependencies: libsecret_dep,
|
||||||
|
gobject_typesfile: 'libsecret.types',
|
||||||
|
mkdb_args: '--expand-content-files=' + ' '.join(reference_expanded_content_files),
|
||||||
|
scan_args: [
|
||||||
|
'--deprecated-guards=SECRET_DISABLE_DEPRECATED',
|
||||||
|
'--rebuild-types',
|
||||||
|
'--ignore-headers=' + ' '.join(reference_ignore_headers),
|
||||||
|
],
|
||||||
|
module_version: api_version_major,
|
||||||
|
)
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef EGG_SECURE_MEMORY_H
|
#ifndef EGG_SECURE_MEMORY_H
|
||||||
#define EGG_SECURE_MEMORY_H
|
#define EGG_SECURE_MEMORY_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
|
24
egg/meson.build
Normal file
24
egg/meson.build
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
libegg_sources = [
|
||||||
|
'egg-hex.c',
|
||||||
|
'egg-secure-memory.c',
|
||||||
|
'egg-testing.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
if with_gcrypt
|
||||||
|
libegg_sources += [
|
||||||
|
'egg-dh.c',
|
||||||
|
'egg-hkdf.c',
|
||||||
|
'egg-libgcrypt.c',
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
libegg_deps = [
|
||||||
|
glib_deps,
|
||||||
|
gcrypt_dep,
|
||||||
|
]
|
||||||
|
|
||||||
|
libegg = static_library('egg',
|
||||||
|
libegg_sources,
|
||||||
|
dependencies: libegg_deps,
|
||||||
|
include_directories: config_h_dir,
|
||||||
|
)
|
0
libsecret/.dirstamp
Normal file
0
libsecret/.dirstamp
Normal file
189
libsecret/meson.build
Normal file
189
libsecret/meson.build
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
installed_headers_subdir = join_paths('libsecret-@0@'.format(api_version_major), 'libsecret')
|
||||||
|
|
||||||
|
libsecret_sources = [
|
||||||
|
'secret-attributes.c',
|
||||||
|
'secret-collection.c',
|
||||||
|
'secret-item.c',
|
||||||
|
'secret-methods.c',
|
||||||
|
'secret-password.c',
|
||||||
|
'secret-prompt.c',
|
||||||
|
'secret-schema.c',
|
||||||
|
'secret-schemas.c',
|
||||||
|
'secret-service.c',
|
||||||
|
'secret-value.c',
|
||||||
|
'secret-paths.c',
|
||||||
|
'secret-session.c',
|
||||||
|
'secret-util.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
libsecret_headers = [
|
||||||
|
'secret.h',
|
||||||
|
'secret-attributes.h',
|
||||||
|
'secret-collection.h',
|
||||||
|
'secret-item.h',
|
||||||
|
'secret-password.h',
|
||||||
|
'secret-paths.h',
|
||||||
|
'secret-prompt.h',
|
||||||
|
'secret-schema.h',
|
||||||
|
'secret-schemas.h',
|
||||||
|
'secret-service.h',
|
||||||
|
'secret-types.h',
|
||||||
|
'secret-value.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
_dbus_generated = gnome.gdbus_codegen('secret-dbus-generated',
|
||||||
|
sources: 'org.freedesktop.Secrets.xml',
|
||||||
|
interface_prefix: 'org.freedesktop.Secret.',
|
||||||
|
namespace: '_SecretGen',
|
||||||
|
)
|
||||||
|
|
||||||
|
_enums_generated = gnome.mkenums('secret-enum-types',
|
||||||
|
sources: libsecret_headers,
|
||||||
|
c_template: 'secret-enum-types.c.template',
|
||||||
|
h_template: 'secret-enum-types.h.template',
|
||||||
|
install_header: true,
|
||||||
|
install_dir: join_paths(includedir, installed_headers_subdir),
|
||||||
|
)
|
||||||
|
|
||||||
|
libsecret_dependencies = [
|
||||||
|
glib_deps,
|
||||||
|
]
|
||||||
|
|
||||||
|
if with_gcrypt
|
||||||
|
libsecret_dependencies += gcrypt_dep
|
||||||
|
endif
|
||||||
|
|
||||||
|
libsecret_cflags = [
|
||||||
|
'-DSECRET_COMPILATION',
|
||||||
|
]
|
||||||
|
|
||||||
|
libsecret = shared_library('secret-@0@'.format(api_version_major),
|
||||||
|
[ libsecret_sources, _dbus_generated, _enums_generated ],
|
||||||
|
version: libtool_version,
|
||||||
|
dependencies: libsecret_dependencies,
|
||||||
|
link_with: libegg,
|
||||||
|
c_args: libsecret_cflags,
|
||||||
|
include_directories: config_h_dir,
|
||||||
|
install: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
install_headers(libsecret_headers,
|
||||||
|
subdir: installed_headers_subdir,
|
||||||
|
)
|
||||||
|
|
||||||
|
libsecret_dep = declare_dependency(
|
||||||
|
link_with: [ libsecret, libegg ],
|
||||||
|
dependencies: libsecret_dependencies,
|
||||||
|
)
|
||||||
|
|
||||||
|
# GObject Introspection
|
||||||
|
libsecret_gir_sources = [
|
||||||
|
'secret-attributes.c',
|
||||||
|
'secret-attributes.h',
|
||||||
|
'secret-collection.c',
|
||||||
|
'secret-collection.h',
|
||||||
|
'secret-item.c',
|
||||||
|
'secret-item.h',
|
||||||
|
'secret-methods.c',
|
||||||
|
'secret-password.c',
|
||||||
|
'secret-password.h',
|
||||||
|
'secret-paths.c',
|
||||||
|
'secret-paths.h',
|
||||||
|
'secret-prompt.c',
|
||||||
|
'secret-prompt.h',
|
||||||
|
'secret-schema.c',
|
||||||
|
'secret-schema.h',
|
||||||
|
'secret-schemas.c',
|
||||||
|
'secret-schemas.h',
|
||||||
|
'secret-service.c',
|
||||||
|
'secret-service.h',
|
||||||
|
'secret-types.h',
|
||||||
|
'secret-value.c',
|
||||||
|
'secret-value.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
libsecret_gir = gnome.generate_gir(libsecret,
|
||||||
|
sources: libsecret_gir_sources,
|
||||||
|
namespace: 'Secret',
|
||||||
|
nsversion: api_version_major,
|
||||||
|
export_packages: 'libsecret-@0@'.format(api_version_major),
|
||||||
|
includes: [ 'GObject-2.0', 'Gio-2.0' ],
|
||||||
|
extra_args: [ '-D SECRET_COMPILATION'],
|
||||||
|
install: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Vapi
|
||||||
|
if with_vapi
|
||||||
|
libsecret_vapi = gnome.generate_vapi('libsecret-@0@'.format(api_version_major),
|
||||||
|
sources: libsecret_gir[0],
|
||||||
|
metadata_dirs: join_paths(meson.source_root(), 'libsecret'),
|
||||||
|
packages: [ 'gobject-2.0', 'gio-2.0' ],
|
||||||
|
install: true,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# pkg-config
|
||||||
|
pc_conf = configuration_data()
|
||||||
|
pc_conf.set('prefix', libsecret_prefix)
|
||||||
|
pc_conf.set('exec_prefix', '${prefix}')
|
||||||
|
pc_conf.set('libdir', join_paths('${prefix}', get_option('libdir')))
|
||||||
|
pc_conf.set('includedir', join_paths('${prefix}', get_option('includedir')))
|
||||||
|
pc_conf.set('datarootdir', join_paths('${prefix}', get_option('datadir')))
|
||||||
|
pc_conf.set('datadir', '${datarootdir}')
|
||||||
|
pc_conf.set('sysconfdir', join_paths('${prefix}', get_option('sysconfdir')))
|
||||||
|
pc_conf.set('SECRET_MAJOR', api_version_major)
|
||||||
|
pc_conf.set('VERSION', meson.project_version())
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: 'libsecret.pc.in',
|
||||||
|
output: 'libsecret-@0@.pc'.format(api_version_major),
|
||||||
|
configuration: pc_conf,
|
||||||
|
install: true,
|
||||||
|
install_dir: join_paths(libdir, 'pkgconfig'),
|
||||||
|
)
|
||||||
|
configure_file(
|
||||||
|
input: 'libsecret-unstable.pc.in',
|
||||||
|
output: 'libsecret-unstable.pc',
|
||||||
|
configuration: pc_conf,
|
||||||
|
install: true,
|
||||||
|
install_dir: join_paths(libdir, 'pkgconfig'),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
mock_cflags = [
|
||||||
|
libsecret_cflags,
|
||||||
|
'-DSRCDIR="@0@"'.format(meson.source_root()),
|
||||||
|
]
|
||||||
|
|
||||||
|
mock_service_lib = static_library('mock-service',
|
||||||
|
'mock-service.c',
|
||||||
|
dependencies: glib_deps,
|
||||||
|
c_args: mock_cflags,
|
||||||
|
include_directories: config_h_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
test_names = [
|
||||||
|
'test-attributes',
|
||||||
|
'test-value',
|
||||||
|
'test-prompt',
|
||||||
|
'test-service',
|
||||||
|
'test-session',
|
||||||
|
'test-paths',
|
||||||
|
'test-methods',
|
||||||
|
'test-password',
|
||||||
|
'test-item',
|
||||||
|
'test-collection',
|
||||||
|
]
|
||||||
|
|
||||||
|
foreach _test : test_names
|
||||||
|
|
||||||
|
test_bin = executable(_test,
|
||||||
|
'@0@.c'.format(_test),
|
||||||
|
dependencies: libsecret_dep,
|
||||||
|
link_with: mock_service_lib,
|
||||||
|
include_directories: config_h_dir,
|
||||||
|
c_args: libsecret_cflags,
|
||||||
|
)
|
||||||
|
|
||||||
|
test(_test, test_bin)
|
||||||
|
endforeach
|
85
meson.build
Normal file
85
meson.build
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
project('libsecret', 'c',
|
||||||
|
version: '0.18.7',
|
||||||
|
license: 'GPL2+',
|
||||||
|
meson_version: '>= 0.48',
|
||||||
|
)
|
||||||
|
|
||||||
|
gnome = import('gnome')
|
||||||
|
i18n = import('i18n')
|
||||||
|
|
||||||
|
# API version
|
||||||
|
api_version = '1.0.0'
|
||||||
|
api_version_major = api_version.split('.')[0]
|
||||||
|
api_version_minor = api_version.split('.')[1]
|
||||||
|
api_version_micro = api_version.split('.')[2]
|
||||||
|
|
||||||
|
libtool_version = '0.0.0'
|
||||||
|
|
||||||
|
# Options
|
||||||
|
with_manpage = get_option('manpage')
|
||||||
|
with_gcrypt = get_option('gcrypt')
|
||||||
|
enable_debug = get_option('debugging')
|
||||||
|
with_vapi = get_option('vapi')
|
||||||
|
with_gtkdoc = get_option('gtk_doc')
|
||||||
|
|
||||||
|
# Some variables
|
||||||
|
config_h_dir = include_directories('.')
|
||||||
|
libsecret_prefix = get_option('prefix')
|
||||||
|
datadir = join_paths(libsecret_prefix, get_option('datadir'))
|
||||||
|
includedir = join_paths(libsecret_prefix, get_option('includedir'))
|
||||||
|
bindir = join_paths(libsecret_prefix, get_option('bindir'))
|
||||||
|
libdir = join_paths(libsecret_prefix, get_option('libdir'))
|
||||||
|
libexecdir = join_paths(libsecret_prefix, get_option('libexecdir'))
|
||||||
|
locale_dir = join_paths(libsecret_prefix, get_option('localedir'))
|
||||||
|
pkgdatadir = join_paths(datadir, meson.project_name())
|
||||||
|
pkglibdir = join_paths(libdir, meson.project_name())
|
||||||
|
sysconfdir = join_paths(libsecret_prefix, get_option('sysconfdir'))
|
||||||
|
po_dir = join_paths(meson.source_root(), 'po')
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
min_glib_version = '2.44'
|
||||||
|
glib_deps = [
|
||||||
|
dependency('glib-2.0', version: '>=' + min_glib_version),
|
||||||
|
dependency('gio-2.0', version: '>=' + min_glib_version),
|
||||||
|
dependency('gio-unix-2.0', version: '>=' + min_glib_version),
|
||||||
|
]
|
||||||
|
if with_gcrypt
|
||||||
|
min_libgcrypt_version = '1.2.2'
|
||||||
|
libgcrypt_config = find_program('libgcrypt-config')
|
||||||
|
libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
|
||||||
|
if (libgcrypt_version.version_compare('>' + libgcrypt_version))
|
||||||
|
error('@0@ requires at least gcrypt version @1@, but version found is @2@'
|
||||||
|
.format(meson.project_name(), min_libgcrypt_version, libgcrypt_version))
|
||||||
|
endif
|
||||||
|
message('gcrypt version: @0@'.format(libgcrypt_version))
|
||||||
|
gcrypt_dep = declare_dependency(
|
||||||
|
link_args: run_command(libgcrypt_config, '--libs').stdout().strip().split(),
|
||||||
|
compile_args: run_command(libgcrypt_config, '--cflags').stdout().strip().split(),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
math = meson.get_compiler('c').find_library('m')
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
conf = configuration_data()
|
||||||
|
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
||||||
|
conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
|
||||||
|
conf.set_quoted('LOCALEDIR', locale_dir)
|
||||||
|
conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||||
|
conf.set_quoted('PACKAGE_STRING', meson.project_name())
|
||||||
|
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
|
conf.set('WITH_GCRYPT', with_gcrypt)
|
||||||
|
if with_gcrypt
|
||||||
|
conf.set_quoted('LIBGCRYPT_VERSION', min_libgcrypt_version)
|
||||||
|
endif
|
||||||
|
conf.set('WITH_DEBUG', enable_debug)
|
||||||
|
conf.set('_DEBUG', enable_debug)
|
||||||
|
configure_file(output: 'config.h', configuration: conf)
|
||||||
|
|
||||||
|
# Subfolders
|
||||||
|
subdir('po')
|
||||||
|
subdir('egg')
|
||||||
|
subdir('libsecret')
|
||||||
|
subdir('tool')
|
||||||
|
subdir('docs')
|
5
meson_options.txt
Normal file
5
meson_options.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
option('manpage', type: 'boolean', value: true, description: 'Build man pages')
|
||||||
|
option('gcrypt', type: 'boolean', value: true, description: 'With gcrypt and transport encryption')
|
||||||
|
option('debugging', type: 'boolean', value: false, description: 'Turn debugging on/off')
|
||||||
|
option('vapi', type: 'boolean', value: true, description: 'Create VAPI file.')
|
||||||
|
option('gtk_doc', type: 'boolean', value: true, description: 'Build reference documentation using gtk-doc')
|
3
po/meson.build
Normal file
3
po/meson.build
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
i18n.gettext(meson.project_name(),
|
||||||
|
preset: 'glib'
|
||||||
|
)
|
11
tool/meson.build
Normal file
11
tool/meson.build
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
secret_tool_sources = [
|
||||||
|
'secret-tool.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
secret_tool = executable('secret-tool',
|
||||||
|
secret_tool_sources,
|
||||||
|
dependencies: libsecret_dep,
|
||||||
|
include_directories: config_h_dir,
|
||||||
|
c_args: libsecret_cflags,
|
||||||
|
install: true,
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user