From 957a015157fd359d9679540f664183e4b9492896 Mon Sep 17 00:00:00 2001 From: Jan Rybar Date: Mon, 26 Oct 2020 17:00:27 +0000 Subject: 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. --- .gitlab-ci.yml | 35 +- Makefile.am | 4 + actions/Makefile.am | 5 +- actions/meson.build | 10 + data/Makefile.am | 1 + data/meson.build | 47 +++ docs/Makefile.am | 5 +- docs/man/Makefile.am | 1 + docs/man/meson.build | 36 ++ docs/meson.build | 29 ++ docs/polkit/Makefile.am | 2 + docs/polkit/meson.build | 30 ++ meson.build | 363 +++++++++++++++++++++ meson_options.txt | 18 + meson_post_install.py | 37 +++ po/meson.build | 1 + src/Makefile.am | 5 + src/examples/Makefile.am | 5 +- src/examples/meson.build | 27 ++ src/meson.build | 14 + src/polkit/Makefile.am | 7 +- src/polkit/meson.build | 135 ++++++++ src/polkitagent/Makefile.am | 8 +- src/polkitagent/meson.build | 119 +++++++ src/polkitbackend/Makefile.am | 1 + src/polkitbackend/meson.build | 72 ++++ src/programs/Makefile.am | 2 + src/programs/meson.build | 16 + src/symbol.map | 6 + subprojects/mocklibc.wrap | 10 + subprojects/packagecache/mocklibc-1.0-2-wrap.zip | Bin 0 -> 3989 bytes subprojects/packagecache/mocklibc-1.0.tar.gz | Bin 0 -> 294222 bytes test/Makefile.am | 5 +- test/meson.build | 26 ++ test/polkit/Makefile.am | 2 + test/polkit/meson.build | 27 ++ test/polkitbackend/Makefile.am | 2 + test/polkitbackend/meson.build | 32 ++ .../polkitbackendjsauthoritytest-wrapper.py | 23 +- 39 files changed, 1144 insertions(+), 24 deletions(-) create mode 100644 actions/meson.build create mode 100644 data/meson.build create mode 100644 docs/man/meson.build create mode 100644 docs/meson.build create mode 100644 docs/polkit/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 meson_post_install.py create mode 100644 po/meson.build create mode 100644 src/examples/meson.build create mode 100644 src/meson.build create mode 100644 src/polkit/meson.build create mode 100644 src/polkitagent/meson.build create mode 100644 src/polkitbackend/meson.build create mode 100644 src/programs/meson.build create mode 100644 src/symbol.map create mode 100644 subprojects/mocklibc.wrap create mode 100644 subprojects/packagecache/mocklibc-1.0-2-wrap.zip create mode 100644 subprojects/packagecache/mocklibc-1.0.tar.gz create mode 100644 test/meson.build create mode 100644 test/polkit/meson.build create mode 100644 test/polkitbackend/meson.build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fbca9d8..acebd43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: fedora:rawhide +image: fedora:latest variables: DEPENDENCIES: gcc @@ -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' diff --git a/Makefile.am b/Makefile.am index 6060263..dc0768f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/actions/Makefile.am b/actions/Makefile.am index 4498f4a..1709992 100644 --- a/actions/Makefile.am +++ b/actions/Makefile.am @@ -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 diff --git a/actions/meson.build b/actions/meson.build new file mode 100644 index 0000000..26d2d2d --- /dev/null +++ b/actions/meson.build @@ -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, +) diff --git a/data/Makefile.am b/data/Makefile.am index 7c53902..f5ee4ba 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -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) \ diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..14c100b --- /dev/null +++ b/data/meson.build @@ -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 diff --git a/docs/Makefile.am b/docs/Makefile.am index 8d7da9d..3c285e4 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -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 diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 0b2dc44..38e037e 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -24,6 +24,7 @@ EXTRA_DIST = \ pkcheck.xml \ pkaction.xml \ pkttyagent.xml \ + meson.build \ $(NULL) clean-local: diff --git a/docs/man/meson.build b/docs/man/meson.build new file mode 100644 index 0000000..241e82c --- /dev/null +++ b/docs/man/meson.build @@ -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 diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 0000000..d4a0548 --- /dev/null +++ b/docs/meson.build @@ -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 diff --git a/docs/polkit/Makefile.am b/docs/polkit/Makefile.am index 1fce92c..2da0192 100644 --- a/docs/polkit/Makefile.am +++ b/docs/polkit/Makefile.am @@ -86,6 +86,8 @@ else CLEANFILES = endif +EXTRA_DIST = meson.build + CLEANFILES += *~ \ polkit-1-scan.* \ polkit-1.args \ diff --git a/docs/polkit/meson.build b/docs/polkit/meson.build new file mode 100644 index 0000000..297a261 --- /dev/null +++ b/docs/polkit/meson.build @@ -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, +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c7b07ba --- /dev/null +++ b/meson.build @@ -0,0 +1,363 @@ +project( + 'polkit', ['c', 'cpp'], + version: '0.117', + license: 'LGPL2+', + default_options: [ + 'buildtype=debugoptimized', + 'cpp_std=c++17', + ], + meson_version: '>= 0.50.0', +) + +pk_version = meson.project_version() + +pk_api_version = '1' +pk_api_name = '@0@-@1@'.format(meson.project_name(), pk_api_version) + +pk_gir_ns = 'Polkit' +pk_gir_version = '1.0' + +pk_prefix = get_option('prefix') +pk_datadir = get_option('datadir') +pk_includedir = get_option('includedir') +pk_libdir = get_option('libdir') +pk_mandir = get_option('mandir') +pk_sysconfdir = get_option('sysconfdir') + +pk_pkgdatadir = pk_datadir / pk_api_name +pk_pkgincludedir = pk_includedir / pk_api_name +pk_pkglibdir = pk_libdir / pk_api_name +pk_pkgsysconfdir = pk_sysconfdir / pk_api_name + +pk_actiondir = pk_api_name / 'actions' +pk_pkgactiondir = pk_datadir / pk_actiondir + +soversion = 0 +current = 0 +revision = 0 +libversion = '@0@.@1@.@2@'.format(soversion, current, revision) + +gnome = import('gnome') +i18n = import('i18n') +pkg = import('pkgconfig') + +source_root = meson.current_source_dir() +build_root = meson.current_build_dir() + +data_dir = source_root / 'data' +po_dir = source_root / 'po' + +intltool_merge = find_program('intltool-merge') +intltool_cache = po_dir / '.intltool-merge-cache' +intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] +intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] + +top_inc = include_directories('.') + +cc = meson.get_compiler('c') + +config_h = configuration_data() + +# defines +set_defines = [ + # package + ['PACKAGE_BUGREPORT', 'http://lists.freedesktop.org/mailman/listinfo/polkit-devel'], + ['PACKAGE_NAME', meson.project_name()], + ['PACKAGE_URL', 'http://www.freedesktop.org/wiki/Software/polkit'], + ['PACKAGE_VERSION', pk_version], + ['VERSION', pk_version], + # i18n + ['GETTEXT_PACKAGE', pk_api_name], +] + +foreach define: set_defines + config_h.set_quoted(define[0], define[1]) +endforeach + +# Globally define_GNU_SOURCE and therefore enable the GNU extensions +config_h.set('_GNU_SOURCE', true) + +# functions +check_functions = [ + 'clearenv', + 'fdatasync', +] + +foreach func: check_functions + config_h.set('HAVE_' + func.to_upper(), cc.has_function(func)) +endforeach + +# compiler flags +common_c_flags = [ + # FIXME: this should go as 'c_std=c99' in project's default_options. + # https://github.com/mesonbuild/meson/issues/1889 + # https://github.com/mesonbuild/meson/pull/6729 + '-std=c99', + '-DHAVE_CONFIG_H', +] +compiler_flags = [] +compiler_c_flags = [] + +if get_option('buildtype').contains('debug') + compiler_c_flags += cc.get_supported_arguments([ + '-Waggregate-return', + '-Wdeclaration-after-statement', + '-Wformat=2', + '-Wimplicit-function-declaration', + '-Winit-self', + '-Wmissing-declarations', + '-Wmissing-include-dirs', + '-Wmissing-prototypes', + '-Wstrict-prototypes', + ]) +endif + +add_project_arguments(common_c_flags + compiler_c_flags, language: 'c') + +glib_req_version = '>= 2.30.0' + +gio_dep = dependency('gio-2.0', version: glib_req_version) +gio_unix_dep = dependency('gio-unix-2.0', version: glib_req_version) +glib_dep = dependency('glib-2.0', version: glib_req_version) +gobject_dep = dependency('gobject-2.0', version: glib_req_version) + +expat_dep = dependency('expat') +assert(cc.has_header('expat.h', dependencies: expat_dep), 'Can\'t find expat.h. Please install expat.') +assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t find expat library. Please install expat.') + +mozjs_dep = dependency('mozjs-78') + +dbus_dep = dependency('dbus-1') +dbus_sysconfdir = dbus_dep.get_pkgconfig_variable('sysconfdir', define_variable: ['sysconfdir', pk_prefix / pk_sysconfdir]) +dbus_policydir = dbus_sysconfdir / 'dbus-1/system.d' +dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', pk_prefix / pk_datadir]) + +# check OS +host_system = host_machine.system() +config_h.set('HAVE_' + host_system.to_upper(), true) + +# Check whether setnetgrent has a return value +config_h.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h')) + +setnetgrent_return_src = ''' + #include + #ifdef HAVE_NETGROUP_H + #include + #else + #include + #endif + int main() { + int r = setnetgrent (NULL); + }; +''' + +config_h.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support')) + +# Select wether to use libsystemd-login, libelogind or ConsoleKit for session tracking +session_tracking = get_option('session_tracking') +enable_logind = (session_tracking != 'ConsoleKit') +if enable_logind + if session_tracking == 'libsystemd-login' + logind_dep = dependency('libsystemd', required: false) + if not logind_dep.found() + logind_dep = dependency('libsystemd-login', not_found_message: 'libsystemd support requested but libsystemd or libsystemd-login library not found') + endif + else + logind_dep = dependency('libelogind', not_found_message: 'libelogind support requested but libelogind library not found') + endif + + func = 'sd_uid_get_display' + config_h.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep)) + + # systemd unit / service files + systemd_systemdsystemunitdir = get_option('systemdsystemunitdir') + if systemd_systemdsystemunitdir == '' + systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it') + # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used + systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') + endif +endif +config_h.set('HAVE_LIBSYSTEMD', enable_logind) + +# User for running polkitd +polkitd_user = get_option('polkitd_user') +config_h.set_quoted('POLKITD_USER', polkitd_user) + +# Select which authentication framework to use +auth_deps = [] + +auth_fw = get_option('authfw') +enable_pam = (auth_fw == 'pam') +if enable_pam + # Check for PAM + pam_dep = cc.find_library('pam') + assert(pam_dep.found() and cc.has_function('pam_start', dependencies: pam_dep), 'Could not find pam/pam-devel, please install the needed packages.') + + # how to call pam_strerror + pam_strerror_src = ''' + #include + #include + #include + #endif + int main() { + @0@ + }; + ''' + + # FIXME: Not necessary anymore? + if cc.compiles(pam_strerror_src.format('pam_handle_t *pamh = 0; char *s = pam_strerror(pamh, PAM_SUCCESS);')) + # FIXME: unused? + config_h.set('PAM_STRERROR_TWO_ARGS', true) + else + message('how to call pam_strerror: ' + cc.compiles(pam_strerror_src.format('char *s = pam_strerror(PAM_SUCCESS);')).to_string('1', 'unknown')) + endif + + pam_prefix = get_option('pam_prefix') + if pam_prefix == '' + pam_prefix = pk_sysconfdir + else + message('PAM files will be installed in prefix ' + pam_prefix) + endif + + pam_module_dir = get_option('pam_module_dir') + if pam_module_dir == '' + pam_module_dir = pk_libdir / 'security' + endif + + auth_deps += pam_dep +elif auth_fw == 'shadow' + auth_deps += cc.find_library('crypt') +endif +config_h.set('POLKIT_AUTHFW_' + auth_fw.to_upper(), true) + +# FIXME: sigtimedwait is not used anywhere? +''' +if host_system == 'solaris' + rt_dep = cc.find_library('rt') + cc.has_function('sigtimedwait', dependencies: rt_dep) +else + cc.has_function('sigtimedwait') +endif +''' + +os_type = get_option('os_type') +if os_type == '' + os_paths = [ + ['redhat', '/etc/sysconfig/network-scripts'], + ['suse', '/etc/SuSE-release'], + ['debian', '/etc/debian_version'], + ['gentoo', '/etc/gentoo-release'], + ['pardus', '/etc/pardus-release'], + ] + + foreach os_path: os_paths + if run_command('test', '-e', os_path[1]).returncode() == 0 + os_type = os_path[0] + break + endif + endforeach + + if os_type == '' + message('Linux distribution autodetection failed, specify the distribution to target using -Dos_type=') + endif +endif + +pam_include = get_option('pam_include') +if pam_include == '' + if ['suse', 'solaris'].contains(os_type) + pam_conf = { + 'PAM_FILE_INCLUDE_AUTH': 'common-auth', + 'PAM_FILE_INCLUDE_ACCOUNT': 'common-account', + 'PAM_FILE_INCLUDE_PASSWORD': 'common-password', + 'PAM_FILE_INCLUDE_SESSION': 'common-session', + } + elif os_type.contains('bsd') + pam_conf = { + 'PAM_FILE_INCLUDE_AUTH': 'system', + 'PAM_FILE_INCLUDE_ACCOUNT': 'system', + 'PAM_FILE_INCLUDE_PASSWORD': 'system', + 'PAM_FILE_INCLUDE_SESSION': 'system', + } + #if ['redhat', 'gentoo', 'pardus'].contains(os_type) + else + pam_conf = { + 'PAM_FILE_INCLUDE_AUTH': 'system-auth', + 'PAM_FILE_INCLUDE_ACCOUNT': 'system-auth', + 'PAM_FILE_INCLUDE_PASSWORD': 'system-auth', + 'PAM_FILE_INCLUDE_SESSION': 'system-auth', + } + endif +else + pam_conf = { + 'PAM_FILE_INCLUDE_AUTH': pam_include, + 'PAM_FILE_INCLUDE_ACCOUNT': pam_include, + 'PAM_FILE_INCLUDE_PASSWORD': pam_include, + 'PAM_FILE_INCLUDE_SESSION': pam_include, + } +endif + +enable_introspection = get_option('introspection') +if enable_introspection + dependency('gobject-introspection-1.0', version: '>= 0.6.2') +endif + +content_files = files('COPYING') + +subdir('actions') +subdir('data') +subdir('src') +subdir('docs') +subdir('po') + +enable_tests = get_option('tests') +if enable_tests + subdir('test') +endif + +configure_file( + output: 'config.h', + configuration: config_h, +) + +meson.add_install_script( + 'meson_post_install.py', + get_option('bindir'), + pk_pkgdatadir, + pk_pkglibdir, + pk_pkgsysconfdir, + polkitd_user, +) + +output = '\n ' + meson.project_name() + ' ' + meson.project_version() + '\n' +output += ' ============\n\n' +output += ' prefix: ' + pk_prefix + '\n' +output += ' datadir: ' + pk_datadir + '\n\n' +output += ' includedir: ' + pk_includedir + '\n' +output += ' libdir: ' + pk_libdir + '\n' +output += ' sysconfdir: ' + pk_sysconfdir + '\n' +output += ' source code location: ' + source_root + '\n' +output += ' compiler: ' + cc.get_id() + '\n' +output += ' c_flags: ' + ' '.join(compiler_c_flags) + '\n\n' +if enable_man + output += ' xsltproc: ' + xsltproc.path() + '\n' +endif +output += ' introspection: ' + enable_introspection.to_string() + '\n' +output += ' Distribution/OS: ' + os_type + '\n' +output += ' Authentication framework: ' + auth_fw + '\n' +output += ' Session tracking: ' + session_tracking + '\n' +if enable_logind + output += ' systemdsystemunitdir: ' + systemd_systemdsystemunitdir + '\n' +endif +output += ' polkitd user: ' + polkitd_user + ' \n' +output += ' PAM support: ' + enable_pam.to_string() + '\n\n' +if enable_pam + output += ' PAM file auth: ' + pam_conf['PAM_FILE_INCLUDE_AUTH'] + '\n' + output += ' PAM file acount: ' + pam_conf['PAM_FILE_INCLUDE_ACCOUNT'] + '\n' + output += ' PAM file password: ' + pam_conf['PAM_FILE_INCLUDE_PASSWORD'] + '\n' + output += ' PAM file session: ' + pam_conf['PAM_FILE_INCLUDE_SESSION'] + '\n\n' +endif +output += ' Building api docs: ' + enable_gtk_doc.to_string() + '\n' +output += ' Building man pages: ' + enable_man.to_string() + '\n' +output += ' Building examples: ' + enable_examples.to_string() + '\n' +output += ' Building tests: ' + enable_tests.to_string() +message(output) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..25e3e77 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,18 @@ +option('session_tracking', type: 'combo', choices: ['libsystemd-login', 'libelogind', 'ConsoleKit'], value: 'ConsoleKit', description: 'session tracking (libsystemd-login/libelogind/ConsoleKit)') +option('systemdsystemunitdir', type: 'string', value: '', description: 'custom directory for systemd system units') + +option('polkitd_user', type: 'string', value: 'polkitd', description: 'User for running polkitd (polkitd)') + +option('authfw', type: 'combo', choices: ['pam', 'shadow', 'bsdauth'], value: 'pam', description: 'Authentication framework (pam/shadow)') +option('os_type', type: 'combo', choices: ['redhat', 'suse', 'gentoo', 'pardus', 'solaris', 'netbsd', ''], value: '', description: 'distribution or OS') + +option('pam_include', type: 'string', value: '', description: 'pam file to include') +option('pam_module_dir', type: 'string', value: '', description: 'directory to install PAM security module') +option('pam_prefix', type: 'string', value: '', description: 'specify where pam files go') + +option('examples', type: 'boolean', value: false, description: 'Build example programs') +option('tests', type: 'boolean', value: false, description: 'Build tests') +option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build') + +option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation') +option('man', type: 'boolean', value: false, description: 'build manual pages') diff --git a/meson_post_install.py b/meson_post_install.py new file mode 100644 index 0000000..784d491 --- /dev/null +++ b/meson_post_install.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +import getpass +import os +import subprocess +import sys + +prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] + +bindir = os.path.join(prefix, sys.argv[1]) +pkgdatadir = os.path.join(prefix, sys.argv[2]) +pkglibdir = os.path.join(prefix, sys.argv[3]) +pkgsysconfdir = os.path.join(prefix, sys.argv[4]) + +polkitd_user = sys.argv[5] + +subprocess.check_call(['chmod', '4755', os.path.join(bindir, 'pkexec')]) + +dst_dirs = [ + os.path.join(pkgsysconfdir, 'rules.d'), + os.path.join(pkgdatadir, 'rules.d') +] + +for dst in dst_dirs: + if not os.path.exists(dst): + os.makedirs(dst) + subprocess.check_call(['chmod', '700', dst]) + if getpass.getuser() == "root": + subprocess.check_call(['chown', polkitd_user, dst]) + +# polkit-agent-helper-1 need to be setuid root because it's used to +# authenticate not only the invoking user, but possibly also root +# and/or other users. +dst = os.path.join(pkglibdir, 'polkit-agent-helper-1') +subprocess.check_call(['chmod', '4755', dst]) +if getpass.getuser() == "root": + subprocess.check_call(['chown', 'root', dst]) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..4d9ab58 --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext(pk_api_name, preset: 'glib') 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: + *; +}; diff --git a/subprojects/mocklibc.wrap b/subprojects/mocklibc.wrap new file mode 100644 index 0000000..af82298 --- /dev/null +++ b/subprojects/mocklibc.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = mocklibc-1.0 + +source_url = https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mocklibc/mocklibc-1.0.tar.gz +source_filename = mocklibc-1.0.tar.gz +source_hash = b2236a6af1028414783e9734a46ea051916ec226479d6a55a3bb823bff68f120 + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/mocklibc/1.0/2/get_zip +patch_filename = mocklibc-1.0-2-wrap.zip +patch_hash = 0280f96a2eeb3c023e5acf4e00cef03d362868218d4a85347ea45137c0ef6c56 diff --git a/subprojects/packagecache/mocklibc-1.0-2-wrap.zip b/subprojects/packagecache/mocklibc-1.0-2-wrap.zip new file mode 100644 index 0000000..656ebaf Binary files /dev/null and b/subprojects/packagecache/mocklibc-1.0-2-wrap.zip differ diff --git a/subprojects/packagecache/mocklibc-1.0.tar.gz b/subprojects/packagecache/mocklibc-1.0.tar.gz new file mode 100644 index 0000000..568a053 Binary files /dev/null and b/subprojects/packagecache/mocklibc-1.0.tar.gz differ diff --git a/test/Makefile.am b/test/Makefile.am index 59d0680..aacc892 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -6,7 +6,10 @@ noinst_LTLIBRARIES = libpolkit-test-helper.la libpolkit_test_helper_la_SOURCES = polkittesthelper.c polkittesthelper.h libpolkit_test_helper_la_LIBADD = $(GLIB_LIBS) -EXTRA_DIST = data +EXTRA_DIST = \ + data \ + meson.build \ + $(NULL) # Use mocklibc to override NSS services for tests export MOCK_PASSWD := $(abs_top_srcdir)/test/data/etc/passwd diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..3f02d35 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,26 @@ +libpolkit_test_helper = static_library( + 'polkit-test-helper', + sources: 'polkittesthelper.c', + dependencies: glib_dep, +) + +libpolkit_test_helper_dep = declare_dependency( + include_directories: '.', + dependencies: glib_dep, + link_with: libpolkit_test_helper, +) + +libmocklibc = subproject('mocklibc').get_variable('libmocklibc') + +test_data_dir = meson.current_source_dir() / 'data' +test_etc_dir = test_data_dir / 'etc' + +test_env = environment() +test_env.set('LD_PRELOAD', libmocklibc.full_path()) +test_env.set('MOCK_PASSWD', test_etc_dir / 'passwd') +test_env.set('MOCK_GROUP', test_etc_dir / 'group') +test_env.set('MOCK_NETGROUP', test_etc_dir / 'netgroup') +test_env.set('POLKIT_TEST_DATA', test_data_dir) + +subdir('polkit') +subdir('polkitbackend') diff --git a/test/polkit/Makefile.am b/test/polkit/Makefile.am index 1e0a23f..261d1d5 100644 --- a/test/polkit/Makefile.am +++ b/test/polkit/Makefile.am @@ -48,6 +48,8 @@ polkitidentitytest_SOURCES = polkitidentitytest.c check_PROGRAMS = $(TEST_PROGS) TESTS = $(TEST_PROGS) +EXTRA_DIST = meson.build + clean-local : rm -f *~ diff --git a/test/polkit/meson.build b/test/polkit/meson.build new file mode 100644 index 0000000..9c5254f --- /dev/null +++ b/test/polkit/meson.build @@ -0,0 +1,27 @@ +test_units = [ + 'polkitunixusertest', + 'polkitunixgrouptest', + 'polkitunixnetgrouptest', + 'polkitidentitytest', +] + +c_flags = [ + '-D_POLKIT_COMPILATION', + '-D_POLKIT_BACKEND_COMPILATION', +] + +foreach test_unit: test_units + exe = executable( + test_unit, + test_unit + '.c', + dependencies: libpolkit_gobject_dep, + c_args: c_flags, + ) + + test( + test_unit, + exe, + env: test_env, + is_parallel: false, + ) +endforeach diff --git a/test/polkitbackend/Makefile.am b/test/polkitbackend/Makefile.am index b714c60..267a2d2 100644 --- a/test/polkitbackend/Makefile.am +++ b/test/polkitbackend/Makefile.am @@ -48,6 +48,8 @@ TEST_PROGS += polkitbackendjsauthoritytest-wrapper.py noinst_PROGRAMS = polkitbackendjsauthoritytest TESTS = $(TEST_PROGS) +EXTRA_DIST = meson.build + clean-local : rm -f *~ diff --git a/test/polkitbackend/meson.build b/test/polkitbackend/meson.build new file mode 100644 index 0000000..98ba120 --- /dev/null +++ b/test/polkitbackend/meson.build @@ -0,0 +1,32 @@ +test_unit = 'test-polkitbackendjsauthority' + +deps = [ + libpolkit_gobject_dep, + libpolkit_test_helper_dep, +] + +c_flags = [ + '-D_POLKIT_COMPILATION', + '-D_POLKIT_BACKEND_COMPILATION', +] + +test_env.set('TOP_BUILD_DIR', build_root) +test_env.set('TOP_SRC_DIR', source_root) + +exe = executable( + test_unit, + test_unit + '.c', + include_directories: top_inc, + dependencies: deps, + c_args: c_flags, + link_with: libpolkit_backend, +) + +prog = find_program('polkitbackendjsauthoritytest-wrapper.py') + +test( + test_unit, + prog, + env: test_env, + is_parallel: false, +) diff --git a/test/polkitbackend/polkitbackendjsauthoritytest-wrapper.py b/test/polkitbackend/polkitbackendjsauthoritytest-wrapper.py index 2a4e160..8e067eb 100755 --- a/test/polkitbackend/polkitbackendjsauthoritytest-wrapper.py +++ b/test/polkitbackend/polkitbackendjsauthoritytest-wrapper.py @@ -28,13 +28,22 @@ class TestPolkitBackendJsAuthority(dbusmock.DBusTestCase): @classmethod def setUpClass(klass): klass.start_system_bus() + klass.mocklibc_path = None - klass.top_build_dir = '../../' if 'TOP_BUILD_DIR' in os.environ: klass.top_build_dir = os.environ['TOP_BUILD_DIR'] - klass.mocklibc_path = klass.top_build_dir + '/test/mocklibc/bin/mocklibc' - assert(os.path.exists(klass.mocklibc_path)) + klass.mocklibc_path = klass.top_build_dir + '/subprojects/mocklibc-1.0/bin/mocklibc' + + # suppose autotools over meson + if not os.path.exists(klass.mocklibc_path): + klass.top_build_dir = '../../' + klass.mocklibc_path = klass.top_build_dir + '/test/mocklibc/bin/mocklibc' print ('Top build dir: %s' % klass.top_build_dir) + print ('mocklibc path: %s' % klass.mocklibc_path) + assert(os.path.exists(klass.mocklibc_path)) + + # WORKAROUND - unzipped mocklibc does not preserve file permissions + os.chmod(klass.mocklibc_path, 0o755) klass.top_src_dir = os.path.dirname(os.path.realpath(__file__)) + '/../../' if 'TOP_SRC_DIR' in os.environ: @@ -54,7 +63,13 @@ class TestPolkitBackendJsAuthority(dbusmock.DBusTestCase): def test_polkitbackendjsauthoritytest(self): # Add '; exit 0' at the end of the cmd line if launching fails and you # want to capture the error output - out = subprocess.check_output(self.mocklibc_path + ' ' + self.top_build_dir + '/test/polkitbackend/polkitbackendjsauthoritytest', + test_path = self.top_build_dir + '/test/polkitbackend/test-polkitbackendjsauthority' + + if not os.path.exists(test_path): + print('\n %s... not found' % test_path) + test_path = self.top_build_dir + '/test/polkitbackend/polkitbackendjsauthoritytest' + + out = subprocess.check_output(self.mocklibc_path + ' ' + test_path, stderr=subprocess.STDOUT, shell=True, universal_newlines=True) -- cgit v1.2.1