build: meson: merge branch 'bg/rpm-meson'

Add meson support to RPM spec file.

https://github.com/NetworkManager/NetworkManager/pull/212
This commit is contained in:
Beniamino Galvani 2018-09-28 18:13:04 +02:00
commit d6db262597
7 changed files with 160 additions and 14 deletions

View file

@ -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
@ -780,7 +891,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 +926,6 @@ fi
%files libnm-devel
%doc docs/api/html/*
%dir %{_includedir}/libnm
%{_includedir}/libnm/*.h
%{_libdir}/pkgconfig/libnm.pc

View file

@ -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,

View file

@ -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(

View file

@ -40,15 +40,14 @@ mans = [
['nm-online', '1'],
['nmcli-examples', '7'],
['nmcli', '1'],
['nmtui', '1']
['nmtui', '1'],
['nm-initrd-generator', '8'],
]
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)

View file

@ -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)
@ -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
@ -927,7 +928,7 @@ meson.add_install_script(
nm_bindir,
nm_pkgconfdir,
nm_pkglibdir,
nm_localstatedir,
nm_pkgstatedir,
enable_docs ? 'install_docs' : '',
nm_mandir
)

View file

@ -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

View file

@ -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