diff options
author | Jan Rybar <jrybar@redhat.com> | 2020-10-26 17:00:27 +0000 |
---|---|---|
committer | Jan Rybar <jrybar@redhat.com> | 2020-10-26 17:00:27 +0000 |
commit | 957a015157fd359d9679540f664183e4b9492896 (patch) | |
tree | 41e7f5541d01e479e588cd3dd5a1769e1af0127a /src | |
parent | ff4c2144f0fb1325275887d9e254117fcd8a1b52 (diff) |
build: Port to meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/examples/Makefile.am | 5 | ||||
-rw-r--r-- | src/examples/meson.build | 27 | ||||
-rw-r--r-- | src/meson.build | 14 | ||||
-rw-r--r-- | src/polkit/Makefile.am | 7 | ||||
-rw-r--r-- | src/polkit/meson.build | 135 | ||||
-rw-r--r-- | src/polkitagent/Makefile.am | 8 | ||||
-rw-r--r-- | src/polkitagent/meson.build | 119 | ||||
-rw-r--r-- | src/polkitbackend/Makefile.am | 1 | ||||
-rw-r--r-- | src/polkitbackend/meson.build | 72 | ||||
-rw-r--r-- | src/programs/Makefile.am | 2 | ||||
-rw-r--r-- | src/programs/meson.build | 16 | ||||
-rw-r--r-- | src/symbol.map | 6 |
13 files changed, 414 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 09fc7b3..b313826 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,11 @@ if BUILD_EXAMPLES SUBDIRS += examples endif +EXTRA_DIST = \ + meson.build \ + symbol.map \ + $(NULL) + clean-local : rm -f *~ diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am index 9b885f3..3ee373f 100644 --- a/src/examples/Makefile.am +++ b/src/examples/Makefile.am @@ -59,7 +59,10 @@ dist_polkit_action_DATA = org.freedesktop.policykit.examples.pkexec.policy DISTCLEANFILES = org.freedesktop.policykit.examples.pkexec.policy -EXTRA_DIST = org.freedesktop.policykit.examples.pkexec.policy.in +EXTRA_DIST = \ + org.freedesktop.policykit.examples.pkexec.policy.in \ + meson.build \ + $(NULL) # ---------------------------------------------------------------------------------------------------- diff --git a/src/examples/meson.build b/src/examples/meson.build new file mode 100644 index 0000000..5f33afc --- /dev/null +++ b/src/examples/meson.build @@ -0,0 +1,27 @@ +policy = 'org.freedesktop.policykit.examples.pkexec.policy' + +custom_target( + policy, + input: policy + '.in', + output: '@BASENAME@', + command: intltool_xml_cmd, + install: true, + install_dir: pk_pkgactiondir, +) + +program = 'cancel' + +executable( + program, + program + '.c', + include_directories: top_inc, + dependencies: libpolkit_gobject_dep, +) + +executable( + 'pk-example-frobnicate', + 'frobnicate.c', + include_directories: top_inc, + dependencies: glib_dep, + install: true, +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..4073333 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,14 @@ +src_inc = include_directories('.') + +symbol_map = meson.current_source_dir() / 'symbol.map' +ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map)) + +subdir('polkit') +subdir('polkitbackend') +subdir('polkitagent') +subdir('programs') + +enable_examples = get_option('examples') +if enable_examples + subdir('examples') +endif diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am index ca36355..2fb5616 100644 --- a/src/polkit/Makefile.am +++ b/src/polkit/Makefile.am @@ -129,7 +129,12 @@ include $(INTROSPECTION_MAKEFILE) endif # HAVE_INTROSPECTION -EXTRA_DIST = polkitenumtypes.h.template polkitenumtypes.c.template +EXTRA_DIST = \ + polkitenumtypes.h.template \ + polkitenumtypes.c.template \ + meson.build \ + $(NULL) + CLEANFILES = $(gir_DATA) $(typelibs_DATA) dist-hook : diff --git a/src/polkit/meson.build b/src/polkit/meson.build new file mode 100644 index 0000000..63dc1e8 --- /dev/null +++ b/src/polkit/meson.build @@ -0,0 +1,135 @@ +name = '@0@-gobject-@1@'.format(meson.project_name(), pk_api_version) + +enum_headers = files( + 'polkitauthorityfeatures.h', + 'polkitcheckauthorizationflags.h', + 'polkiterror.h', + 'polkitimplicitauthorization.h', +) + +headers = enum_headers + files( + 'polkitactiondescription.h', + 'polkitauthority.h', + 'polkitauthorizationresult.h', + 'polkitdetails.h', + 'polkit.h', + 'polkitidentity.h', + 'polkitpermission.h', + 'polkitsubject.h', + 'polkitsystembusname.h', + 'polkittemporaryauthorization.h', + 'polkitunixgroup.h', + 'polkitunixnetgroup.h', + 'polkitunixprocess.h', + 'polkitunixsession.h', + 'polkitunixuser.h', +) + +private_headers = files( + 'polkitprivate.h', + 'polkittypes.h', +) + +install_headers( + headers + private_headers, + install_dir: pk_pkgincludedir / 'polkit', +) + +common_deps = [ + gio_dep, + glib_dep, +] + +enum_sources = gnome.mkenums_simple( + 'polkitenumtypes', + sources: enum_headers, + install_header: true, + install_dir: pk_pkgincludedir / 'polkit', +) + +sources = enum_sources + files( + 'polkitactiondescription.c', + 'polkitauthority.c', + 'polkitauthorityfeatures.c', + 'polkitauthorizationresult.c', + 'polkitcheckauthorizationflags.c', + 'polkitdetails.c', + 'polkiterror.c', + 'polkitidentity.c', + 'polkitimplicitauthorization.c', + 'polkitpermission.c', + 'polkitsubject.c', + 'polkitsystembusname.c', + 'polkittemporaryauthorization.c', + 'polkitunixgroup.c', + 'polkitunixnetgroup.c', + 'polkitunixprocess.c', + 'polkitunixuser.c', +) + +incs = [ + top_inc, + src_inc, +] + +deps = common_deps + +c_flags = '-D_POLKIT_COMPILATION' + +if enable_logind + sources += 'polkitunixsession-systemd.c' + + deps += logind_dep +else + sources += 'polkitunixsession.c' +endif + +libpolkit_gobject = shared_library( + name, + sources: sources, + version: libversion, + include_directories: incs, + dependencies: deps, + c_args: c_flags, + link_args: ldflags, + link_depends: symbol_map, + install: true, +) + +libpolkit_gobject_dep = declare_dependency( + sources: enum_sources[1], + include_directories: src_inc, + dependencies: common_deps, + link_with: libpolkit_gobject, +) + +pkg.generate( + libraries: libpolkit_gobject, + version: pk_version, + name: name, + description: 'PolicyKit Authorization API', + filebase: name, + subdirs: pk_api_name, + requires: common_deps, + variables: [ + 'exec_prefix=${prefix}', + 'datadir=' + ('${prefix}' / pk_datadir), + 'policydir=' + ('${datadir}' / pk_actiondir), + 'actiondir=' + ('${datadir}' / pk_actiondir), + 'pkcheck_supports_uid=true', + ], +) + +if enable_introspection + libpolkit_gobject_gir = gnome.generate_gir( + libpolkit_gobject, + sources: sources + headers, + extra_args: c_flags, + nsversion: pk_gir_version, + namespace: pk_gir_ns, + export_packages: name, + includes: 'Gio-2.0', + header: 'polkit/polkit.h', + install: true, + ) +endif diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am index 49720db..c98f29d 100644 --- a/src/polkitagent/Makefile.am +++ b/src/polkitagent/Makefile.am @@ -150,7 +150,13 @@ install-data-hook: -chown root $(DESTDIR)$(libprivdir)/polkit-agent-helper-1 -chmod 4755 $(DESTDIR)$(libprivdir)/polkit-agent-helper-1 -EXTRA_DIST = polkitagentmarshal.list polkitagentenumtypes.h.template polkitagentenumtypes.c.template +EXTRA_DIST = \ + polkitagentmarshal.list \ + polkitagentenumtypes.h.template \ + polkitagentenumtypes.c.template \ + meson.build \ + $(NULL) + CLEANFILES = $(gir_DATA) $(typelibs_DATA) dist-hook : diff --git a/src/polkitagent/meson.build b/src/polkitagent/meson.build new file mode 100644 index 0000000..84aa260 --- /dev/null +++ b/src/polkitagent/meson.build @@ -0,0 +1,119 @@ +name = '@0@-agent-@1@'.format(meson.project_name(), pk_api_version) + +enum_headers = files('polkitagentlistener.h') + +headers = enum_headers + files( + 'polkitagent.h', + 'polkitagentsession.h', + 'polkitagenttextlistener.h', + 'polkitagenttypes.h', +) + +install_headers( + headers, + install_dir: pk_pkgincludedir / 'polkitagent', +) + +enum_sources = gnome.mkenums_simple( + 'polkitagentenumtypes', + sources: enum_headers, + install_header: true, + install_dir: pk_pkgincludedir / 'polkitagent', +) + +marshal = 'polkitagentmarshal' + +marshal_sources = gnome.genmarshal( + marshal, + sources: marshal + '.list', + prefix: '_polkit_agent_marshal', +) + +sources = enum_sources + marshal_sources + files( + 'polkitagentlistener.c', + 'polkitagentsession.c', + 'polkitagenttextlistener.c', +) + +deps = [ + expat_dep, + gio_unix_dep, + libpolkit_gobject_dep, +] + +c_flags = [ + '-D_POLKIT_COMPILATION', + '-D_POLKIT_AGENT_COMPILATION', + '-DPACKAGE_PREFIX="@0@"'.format(pk_prefix), +] + +libpolkit_agent = shared_library( + name, + sources: sources, + version: libversion, + include_directories: top_inc, + dependencies: deps, + c_args: c_flags, + link_args: ldflags, + link_depends: symbol_map, + install: true, +) + +libpolkit_agent_dep = declare_dependency( + sources: enum_sources[1], + include_directories: '.', + dependencies: libpolkit_gobject_dep, + link_with: libpolkit_agent, +) + +pkg.generate( + libraries: libpolkit_agent, + version: pk_version, + name: name, + description: 'PolicyKit Authentication Agent API', + filebase: name, + subdirs: pk_api_name, + requires: 'polkit-gobject-1', + variables: 'exec_prefix=${prefix}', +) + +if enable_introspection + incs = [ + 'Gio-2.0', + libpolkit_gobject_gir[0], + ] + + c_flags = [ + '-D_POLKIT_AGENT_COMPILATION', + '-D_POLKIT_COMPILATION', + ] + + gnome.generate_gir( + libpolkit_agent, + sources: sources + headers, + includes: incs, + extra_args: c_flags, + nsversion: pk_gir_version, + namespace: 'PolkitAgent', + export_packages: name, + header: 'polkitagent/polkitagent.h', + install: true, + ) +endif + +sources = files( + 'polkitagenthelperprivate.c', + 'polkitagenthelper-@0@.c'.format(auth_fw), +) + +deps = auth_deps + [libpolkit_gobject_dep] + +executable( + '@0@-agent-helper-@1@'.format(meson.project_name(), pk_api_version), + sources, + include_directories: top_inc, + dependencies: deps, + c_args: '-D_POLKIT_COMPILATION', + install: true, + install_dir: pk_pkglibdir, +) diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am index e48b739..7e3c080 100644 --- a/src/polkitbackend/Makefile.am +++ b/src/polkitbackend/Makefile.am @@ -99,6 +99,7 @@ CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ init.js \ toarray.pl \ + meson.build \ $(rules_DATA) \ $(NULL) diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build new file mode 100644 index 0000000..93c3c34 --- /dev/null +++ b/src/polkitbackend/meson.build @@ -0,0 +1,72 @@ +name = '@0@-backend-@1@'.format(meson.project_name(), pk_api_version) + +sources = files( + 'polkitbackendactionlookup.c', + 'polkitbackendactionpool.c', + 'polkitbackendauthority.c', + 'polkitbackendinteractiveauthority.c', + 'polkitbackendjsauthority.cpp', +) + +output = 'initjs.h' + +sources += custom_target( + output, + input: 'init.js', + output: output, + capture: true, + command: [find_program('perl'), meson.current_source_dir() / 'toarray.pl', '@INPUT@', 'init_js'], +) + +deps = [ + expat_dep, + libpolkit_gobject_dep, + mozjs_dep, +] + +c_flags = [ + '-D_POLKIT_COMPILATION', + '-D_POLKIT_BACKEND_COMPILATION', + '-DPACKAGE_DATA_DIR="@0@"'.format(pk_prefix / pk_datadir), + '-DPACKAGE_SYSCONF_DIR="@0@"'.format(pk_prefix / pk_sysconfdir), +] + +if enable_logind + sources += files('polkitbackendsessionmonitor-systemd.c') + + deps += logind_dep +else + sources += files('polkitbackendsessionmonitor.c') +endif + +libpolkit_backend = static_library( + name, + sources: sources, + include_directories: top_inc, + dependencies: deps, + c_args: c_flags, + cpp_args: c_flags, +) + +install_data( + '50-default.rules', + install_dir: pk_pkgsysconfdir / 'rules.d', +) + +program = 'polkitd' + +c_flags = [ + '-DG_LOG_DOMAIN="@0@-@1@"'.format(program, pk_api_version), + '-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE', +] + +executable( + program, + program + '.c', + include_directories: top_inc, + dependencies: libpolkit_gobject_dep, + c_args: c_flags, + link_with: libpolkit_backend, + install: true, + install_dir: pk_pkglibdir, +) diff --git a/src/programs/Makefile.am b/src/programs/Makefile.am index d69853c..f19a7c8 100644 --- a/src/programs/Makefile.am +++ b/src/programs/Makefile.am @@ -84,6 +84,8 @@ pkaction_LDADD = \ # ---------------------------------------------------------------------------------------------------- +EXTRA_DIST = meson.build + clean-local : rm -f *~ diff --git a/src/programs/meson.build b/src/programs/meson.build new file mode 100644 index 0000000..03794be --- /dev/null +++ b/src/programs/meson.build @@ -0,0 +1,16 @@ +programs = [ + ['pkexec', auth_deps + [libpolkit_agent_dep]], + ['pkcheck', [libpolkit_agent_dep]], + ['pkaction', [libpolkit_gobject_dep]], + ['pkttyagent', [libpolkit_agent_dep]], +] + +foreach program: programs + executable( + program[0], + program[0] + '.c', + include_directories: top_inc, + dependencies: program[1], + install: true, + ) +endforeach diff --git a/src/symbol.map b/src/symbol.map new file mode 100644 index 0000000..2d38225 --- /dev/null +++ b/src/symbol.map @@ -0,0 +1,6 @@ +{ +global: + polkit_*; +local: + *; +}; |