From e22c7150e05e5a0cf267f27cb89042e128c87ca2 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 26 Sep 2018 08:41:05 +0200 Subject: [PATCH 1/7] build: meson: ifcfg-rh plugin should not enable ibft This is not the case with autotools. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 32e9522171..4dab561d07 100644 --- a/meson.build +++ b/meson.build @@ -244,7 +244,7 @@ endif enable_ifcfg_rh = get_option('ifcfg_rh') or (distro == 'redhat') enable_ifupdown = get_option('ifupdown') or (distro == 'debian') -enable_ibft = get_option('ibft') or enable_ifcfg_rh +enable_ibft = get_option('ibft') config_h.set10('WITH_SETTINGS_PLUGIN_IBFT', enable_ibft) From 929298333e1f34fcd519593897f16823d45be65a Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sat, 22 Sep 2018 09:17:07 +0200 Subject: [PATCH 2/7] build: meson: add missing man file Fixes: 9f9609555d1c8606b2a177151b2e255b34c5594a --- man/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man/meson.build b/man/meson.build index 41fbf583a6..63348054c7 100644 --- a/man/meson.build +++ b/man/meson.build @@ -40,7 +40,8 @@ mans = [ ['nm-online', '1'], ['nmcli-examples', '7'], ['nmcli', '1'], - ['nmtui', '1'] + ['nmtui', '1'], + ['nm-initrd-generator', '8'], ] if enable_ovs From dcfddeef7a7af537f3d271e94d2170ad0d28e39f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sun, 23 Sep 2018 16:30:18 +0200 Subject: [PATCH 3/7] build: meson: fix generation of api docs We need to copy all introspection files to the same directory when building the documentation. Note that we only require Meson 0.44, but for the documentation at least 0.46 is needed because of a new functionality of gnome.gdbus_codegen(). In this way we can still build on Travis CI (without documentation). --- docs/api/meson.build | 17 +++++++++++++++++ introspection/meson.build | 12 ++++++++++-- man/meson.build | 2 -- meson.build | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/api/meson.build b/docs/api/meson.build index d0cc3ac8cf..31b9776c88 100644 --- a/docs/api/meson.build +++ b/docs/api/meson.build @@ -21,6 +21,23 @@ configure_file( ) content_files += join_paths(meson.source_root(), 'COPYING') +filecopier = find_program('cp') +foreach intro : introspection_files + path = intro.full_path().split('/')[-1] + custom_target(path, + input: intro, + output: path, + command : [filecopier, '@INPUT@', '@OUTPUT@'], + build_by_default: true, +) +endforeach + +custom_target('common.ent', + input: common_ent_file, + output: 'common.ent', + command: [filecopier, '@INPUT@', '@OUTPUT@'], + build_by_default: true, +) gnome.gtkdoc( doc_module, diff --git a/introspection/meson.build b/introspection/meson.build index a554083684..35d8c87c42 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -53,6 +53,7 @@ ifaces = [ ifaces_xmls = [] sources = [] +introspection_files = [] # FIXME?: DBUS_INTERFACE_DOCS/docbook files are generated in # "meson.current_build_dir()" instead of "meson.source_root()/docs/api" @@ -60,7 +61,7 @@ foreach iface: ifaces iface_xml = iface + '.xml' ifaces_xmls += files(iface_xml) - sources += gnome.gdbus_codegen( + res = gnome.gdbus_codegen( iface, iface_xml, interface_prefix: 'org.freedesktop.NetworkManager', @@ -68,8 +69,15 @@ foreach iface: ifaces docbook: 'dbus' ) - # FIXME: gnome.gdbus_codegen should return the docbook as a target result + sources += res + content_files += join_paths(meson.current_build_dir(), 'dbus-' + iface_xml) + + # res is an array only since 0.46. Documentation won't work with + # older versions + if meson.version().version_compare('>= 0.46.0') + introspection_files += res[2] + endif endforeach install_data( diff --git a/man/meson.build b/man/meson.build index 63348054c7..21fac21d1d 100644 --- a/man/meson.build +++ b/man/meson.build @@ -48,8 +48,6 @@ if enable_ovs mans += [['nm-openvswitch', '7']] endif -content_files += join_paths(meson.current_build_dir(), 'common.ent') - foreach man: mans input = man[0] + '.xml' content_files += join_paths(meson.current_source_dir(), input) diff --git a/meson.build b/meson.build index 4dab561d07..278f5a2c3c 100644 --- a/meson.build +++ b/meson.build @@ -879,6 +879,7 @@ enable_docs = get_option('docs') if enable_docs assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') + assert(meson.version().version_compare('>= 0.46.0'), '-Ddocs requires meson >= 0.46') subdir('man') subdir('docs') endif From 24fc3c54a3393a40fe9983fccbf30f961052461c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sun, 23 Sep 2018 16:57:14 +0200 Subject: [PATCH 4/7] build: meson: fix install script Fix directory paths and modes. Fixes: 98b4a19a536ddb9f75611deaa272ae5661c5df4d --- meson.build | 2 +- tools/meson-post-install.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 278f5a2c3c..c7c0bfc589 100644 --- a/meson.build +++ b/meson.build @@ -928,7 +928,7 @@ meson.add_install_script( nm_bindir, nm_pkgconfdir, nm_pkglibdir, - nm_localstatedir, + nm_pkgstatedir, enable_docs ? 'install_docs' : '', nm_mandir ) diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh index fd21941bbd..8a60ce33c7 100755 --- a/tools/meson-post-install.sh +++ b/tools/meson-post-install.sh @@ -4,7 +4,7 @@ datadir=$1 bindir=$2 pkgconfdir=$3 pkglibdir=$4 -localstatedir=$5 +pkgstatedir=$5 [ -n "$DESTDIR" ] && DESTDIR=${DESTDIR%%/}/ @@ -26,12 +26,15 @@ for dir in "${pkgconfdir}/conf.d" \ "${pkgconfdir}/dispatcher.d/pre-up.d" \ "${pkgconfdir}/dnsmasq.d" \ "${pkgconfdir}/dnsmasq-shared.d" \ - "${pkgconfdir}/conf.d" \ - "${pkgconfdir}/VPN" \ - "${localstatedir}/lib/NetworkManager"; do + "${pkglibdir}/conf.d" \ + "${pkglibdir}/VPN"; do mkdir -p "${DESTDIR}${dir}" + chmod 0755 "${DESTDIR}${dir}" done +mkdir -p "${DESTDIR}${pkgstatedir}" +chmod 0700 "${DESTDIR}${pkgstatedir}" + if [ "$6" = install_docs ]; then mandir=$7 From 34ffd9fcab4de1d42e333dafc713bb9a8072ce1f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 24 Sep 2018 14:05:04 +0200 Subject: [PATCH 5/7] build: meson: install ifcfg-rh files and directory --- src/settings/plugins/ifcfg-rh/meson.build | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index e4bce09b2a..e84ae80cf7 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -63,6 +63,15 @@ check-local-symbols-settings-ifcfg-rh: src/settings/plugins/ifcfg-rh/libnm-setti $(call check_so_symbols,$(builddir)/src/settings/plugins/ifcfg-rh/.libs/libnm-settings-plugin-ifcfg-rh.so) ''' +install_data( + ['nm-ifup', 'nm-ifdown'], + install_dir: nm_libexecdir, + install_mode: 'rwxr-xr-x', +) + +meson.add_install_script('sh', '-c', + 'mkdir -p $DESTDIR/@0@/sysconfig/network-scripts'.format(nm_sysconfdir)) + if enable_tests subdir('tests') endif From 1f18783404cc97e795c7d1e89a4d1baabb3af643 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 25 Sep 2018 15:13:25 +0200 Subject: [PATCH 6/7] contrib/rpm: remove duplicate documentation In NetworkManager-libnm-devel we ship the same documentation in two different places: /usr/share/doc/NetworkManager-libnm-devel /usr/share/gtk-doc/html/NetworkManager Remove the former, which was added in commit e01c17523a85. Also, remove the same documentation from NetworkManager-glib-devel since it's already present in NetworkManager-libnm-devel. --- contrib/fedora/rpm/NetworkManager.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 92386ecd7e..b32255090a 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -780,7 +780,6 @@ fi %if %{with libnm_glib} %files glib-devel -%doc docs/api/html/* %dir %{_includedir}/libnm-glib %dir %{_includedir}/%{name} %{_includedir}/libnm-glib/*.h @@ -816,7 +815,6 @@ fi %files libnm-devel -%doc docs/api/html/* %dir %{_includedir}/libnm %{_includedir}/libnm/*.h %{_libdir}/pkgconfig/libnm.pc From 295b9d5b81946ca0bd249dc08aeb613c530c4734 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 21 Sep 2018 22:49:20 +0200 Subject: [PATCH 7/7] contrib/rpm: support building with meson Add support for building with meson, enabled by '--with meson' so that we can regularly test the whole build+test+install procedure with meson. I compared the RPM contents of NM, NM-libnm, NM-libnm-devel packages and they match the autotools ones. It's also faster: $ time contrib/fedora/rpm/build_clean.sh -g -Q -f real 3m54.239s user 11m15.000s sys 1m28.456s $ time contrib/fedora/rpm/build_clean.sh -g -Q -f -w meson real 3m9.938s user 9m5.225s sys 1m4.392s --- contrib/fedora/rpm/NetworkManager.spec | 113 ++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index b32255090a..e9aa69ee3d 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -45,6 +45,7 @@ ############################################################################### +%bcond_with meson %bcond_without adsl %bcond_without bluetooth %bcond_without wwan @@ -144,8 +145,12 @@ Conflicts: kde-plasma-networkmanagement < 1:0.9-0.49.20110527git.nm09 BuildRequires: gcc BuildRequires: libtool BuildRequires: pkgconfig +%if %{with meson} +BuildRequires: meson +%else BuildRequires: automake BuildRequires: autoconf +%endif BuildRequires: intltool BuildRequires: gettext-devel @@ -453,6 +458,99 @@ by nm-connection-editor and nm-applet in a non-graphical environment. %build +%if %{with meson} +%meson \ + -Ddhcpcanon=no \ + -Ddhcpcd=no \ + -Dconfig_dhcp_default=%{dhcp_default} \ +%if %{with crypto_gnutls} + -Dcrypto=gnutls \ +%else + -Dcrypto=nss \ +%endif +%if %{with debug} + -Dmore_logging=true \ + -Dmore_asserts=10000 \ +%else + -Dmore_logging=false \ + -Dmore_asserts=0 \ +%endif + -Dld_gc=true \ + -Dlibaudit=yes-disabled-by-default \ +%if 0%{?with_modem_manager_1} + -Dmodem_manager=true \ +%else + -Dmodem_manager=false \ +%endif +%if %{with wifi} + -Dwifi=true \ +%if 0%{?fedora} + -Dwext=true \ +%else + -Dwext=false \ +%endif +%else + -Dwifi=false \ +%endif +%if %{with iwd} + -Diwd=true \ +%else + -Diwd=false \ +%endif + -Dvapi=true \ + -Dintrospection=true \ +%if %{with regen_docs} + -Ddocs=true \ +%else + -Ddocs=false \ +%endif +%if %{with team} + -Dteamdctl=true \ +%else + -Dteamdctl=false \ +%endif +%if %{with ovs} + -Dovs=true \ +%else + -Dovs=false \ +%endif + -Dselinux=true \ + -Dpolkit=yes \ + -Dpolkit_agent=true \ + -Dmodify_system=true \ + -Dconcheck=true \ +%if 0%{?fedora} + -Dlibpsl=true \ +%else + -Dlibpsl=false \ +%endif + -Dsession_tracking=systemd \ + -Dsuspend_resume=systemd \ + -Dsystemdsystemunitdir=%{systemd_dir} \ + -Dsystem_ca_path=/etc/pki/tls/cert.pem \ + -Ddbus_conf_dir=%{dbus_sys_dir} \ + -Dtests=yes \ + -Dvalgrind=no \ + -Difcfg_rh=true \ +%if %{with ppp} + -Dpppd_plugin_dir=%{_libdir}/pppd/%{ppp_version} \ + -Dppp=true \ +%endif + -Ddist_version=%{version}-%{release} \ + -Dconfig_plugins_default='ifcfg-rh' \ + -Dconfig_dns_rc_manager_default=symlink \ + -Dconfig_logging_backend_default=journal \ + -Djson_validation=true \ +%if %{with libnm_glib} + -Dlibnm_glib=true +%else + -Dlibnm_glib=false +%endif + +%meson_build + +%else +# autotools %if %{with regen_docs} gtkdocize %endif @@ -565,10 +663,14 @@ intltoolize --automake --copy --force make %{?_smp_mflags} +%endif # end autotools %install -# install NM +%if %{with meson} +%meson_install +%else make install DESTDIR=%{buildroot} +%endif cp %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/ @@ -604,11 +706,20 @@ touch %{buildroot}%{_sbindir}/ifup %{buildroot}%{_sbindir}/ifdown %check +%if %{with meson} +%if %{with test} +%meson_test +%else +%ninja_test -C %{_vpath_builddir} || : +%endif +%else +# autotools %if %{with test} make -k %{?_smp_mflags} check %else make -k %{?_smp_mflags} check || : %endif +%endif # end autotools %pre