Skip to content

Commit

Permalink
build: Port to meson build system
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrybar-rh committed Oct 26, 2020
1 parent ff4c214 commit 957a015
Show file tree
Hide file tree
Showing 39 changed files with 1,144 additions and 24 deletions.
35 changes: 21 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: fedora:rawhide
image: fedora:latest

variables:
DEPENDENCIES: gcc
Expand All @@ -18,27 +18,34 @@ variables:
pkgconfig(systemd)
pam-devel
python3-dbusmock
meson
git
dbus-devel

build_stable:
before_script:
- dnf upgrade -y --nogpgcheck fedora-release fedora-repos*
- dnf update -y && dnf install -y $DEPENDENCIES
- getent group polkitd >/dev/null || groupadd -r polkitd
- getent passwd polkitd >/dev/null || useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd

script:
- mkdir _build
- cd _build
- CPPFLAGS='-D_FORTIFY_SOURCE=2' ../autogen.sh
--disable-dependency-tracking
--enable-ansi
--enable-man-pages
--enable-test
--enable-libsystemd-login=yes
--enable-libelogind=no
- make
- make check
- make install
- meson setup
-D authfw=pam
-D examples=true
-D gtk_doc=true
-D introspection=true
-D man=true
-D session_tracking=libsystemd-login
-D tests=true
-D cpp_args="-D_FORTIFY_SOURCE=2"
builddir
- meson compile -C builddir
- meson test -C builddir
- meson install -C builddir
artifacts:
name: 'test logs'
when: 'always'
paths:
- '_build/test/*/*.log'
- 'builddir/meson-logs/*.txt'

4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ NULL =

EXTRA_DIST = \
HACKING \
meson.build \
meson_options.txt \
meson_post_install.py \
po/meson.build \
$(NULL)

# xsltproc barfs on 'make distcheck'; disable for now
Expand Down
5 changes: 4 additions & 1 deletion actions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ clean-local :

DISTCLEANFILES = org.freedesktop.policykit.policy

EXTRA_DIST = org.freedesktop.policykit.policy.in
EXTRA_DIST = \
org.freedesktop.policykit.policy.in \
meson.build \
$(NULL)

-include $(top_srcdir)/git.mk
10 changes: 10 additions & 0 deletions actions/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
policy = 'org.freedesktop.policykit.policy'

custom_target(
policy,
input: policy + '.in',
output: '@BASENAME@',
command: intltool_xml_cmd,
install: true,
install_dir: pk_pkgactiondir,
)
1 change: 1 addition & 0 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
org.freedesktop.PolicyKit1.Authority.xml \
org.freedesktop.PolicyKit1.AuthenticationAgent.xml \
meson.build \
$(service_in_files) \
$(dbusconf_in_files) \
$(systemdservice_in_files) \
Expand Down
47 changes: 47 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
service_conf = {'libprivdir': pk_prefix / pk_pkglibdir}

configure_file(
input: 'org.freedesktop.PolicyKit1.service.in',
output: '@BASENAME@',
configuration: service_conf,
install: true,
install_dir: dbus_system_bus_services_dir,
)

configure_file(
input: 'org.freedesktop.PolicyKit1.conf.in',
output: '@BASENAME@',
configuration: {'polkitd_user': polkitd_user},
install: true,
install_dir: dbus_policydir,
)

if enable_pam
configure_file(
input: 'polkit-1.in',
output: '@BASENAME@',
configuration: pam_conf,
install: true,
install_dir: pk_sysconfdir / 'pam.d',
)
endif

its_data = files(
'polkit.its',
'polkit.loc',
)

install_data(
its_data,
install_dir: pk_datadir / 'gettext/its',
)

if enable_logind
configure_file(
input: 'polkit.service.in',
output: '@BASENAME@',
configuration: service_conf,
install: true,
install_dir: systemd_systemdsystemunitdir,
)
endif
5 changes: 4 additions & 1 deletion docs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

SUBDIRS = man polkit

EXTRA_DIST = version.xml.in
EXTRA_DIST = \
version.xml.in \
meson.build \
$(NULL)

-include $(top_srcdir)/git.mk
1 change: 1 addition & 0 deletions docs/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ EXTRA_DIST = \
pkcheck.xml \
pkaction.xml \
pkttyagent.xml \
meson.build \
$(NULL)

clean-local:
Expand Down
36 changes: 36 additions & 0 deletions docs/man/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
xsltproc = find_program('xsltproc', required: false)
assert(xsltproc.found(), 'xsltproc is required for man pages generation')

xsltproc_cmd = [
xsltproc,
'--output', '@OUTPUT@',
'--nonet',
'--stringparam', 'man.base.url.for.relative.links', pk_api_docpath + '/',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
]

mans = [
['polkit', '8'],
['polkitd', '8'],
['pkexec', '1'],
['pkcheck', '1'],
['pkaction', '1'],
['pkttyagent', '1'],
]

foreach man: mans
xml = files(man[0] + '.xml')
content_files += xml

output = '@0@.@1@'.format(man[0], man[1])

custom_target(
output,
input: xml,
output: output,
command: xsltproc_cmd,
install: true,
install_dir: pk_mandir / ('man' + man[1]),
)
endforeach
29 changes: 29 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pk_api_docpath = pk_prefix / gnome.gtkdoc_html_dir(pk_api_name)

enable_man = get_option('man')
if enable_man
subdir('man')
endif

enable_gtk_doc = get_option('gtk_doc')
if enable_gtk_doc
content_files += configure_file(
input: 'extensiondir.xml.in',
output: '@BASENAME@',
configuration: {'libdir': pk_prefix / pk_libdir},
)

content_files += configure_file(
input: 'version.xml.in',
output: '@BASENAME@',
configuration: {'VERSION': pk_version},
)

html_images = files(
'polkit-architecture.png',
'polkit-authentication-agent-example.png',
'polkit-authentication-agent-example-wheel.png',
)

subdir('polkit')
endif
2 changes: 2 additions & 0 deletions docs/polkit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ else
CLEANFILES =
endif

EXTRA_DIST = meson.build

CLEANFILES += *~ \
polkit-1-scan.* \
polkit-1.args \
Expand Down
30 changes: 30 additions & 0 deletions docs/polkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
doc_module = pk_api_name

src_dirs = [
source_root / 'src/polkit',
source_root / 'src/polkitagent',
]

private_headers = [
'polkitagenthelperprivate.h',
'polkitprivate.h',
]

content_files += files(
'docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml',
'docbook-interface-org.freedesktop.PolicyKit1.Authority.xml',
)

gnome.gtkdoc(
doc_module,
main_xml: doc_module + '-docs.xml',
src_dir: src_dirs,
ignore_headers: private_headers,
dependencies: libpolkit_agent_dep,
namespace: meson.project_name(),
html_assets: html_images,
fixxref_args: '--html-dir=' + pk_api_docpath,
gobject_typesfile: files(doc_module + '.types'),
content_files: content_files,
install: true,
)
Loading

0 comments on commit 957a015

Please sign in to comment.