[network-manager-applet/wip/inigomartinez/meson: 1/3] build: Port to meson build system



commit 56bf3c8dd18fbb99290c988e36eca8abf190b03e
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Mon Sep 25 12:27:58 2017 +0200

    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788146

 Makefile.am                       |   31 ++-
 config.h.meson                    |  144 ++++++++++
 gtkdocentities.ent.in             |    7 +
 icons/meson.build                 |  107 +++++++
 man/meson.build                   |   17 ++
 meson.build                       |  548 +++++++++++++++++++++++++++++++++++++
 meson_options.txt                 |   11 +
 meson_post_install.py             |   21 ++
 po/meson.build                    |    1 +
 shared/meson.build                |    3 +
 src/connection-editor/meson.build |  122 ++++++++
 src/libnm-gtk/meson.build         |  151 ++++++++++
 src/libnma/meson.build            |  148 ++++++++++
 src/meson.build                   |  114 ++++++++
 src/utils/meson.build             |   59 ++++
 src/wireless-security/meson.build |   86 ++++++
 16 files changed, 1564 insertions(+), 6 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 58c536f..cb583b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -153,6 +153,8 @@ iconscalable_DATA = \
        icons/scalable/nm-no-connection.svg
 EXTRA_DIST += $(iconscalable_DATA)
 
+EXTRA_DIST += icons/meson.build
+
 ###############################################################################
 
 shared_files = \
@@ -160,7 +162,6 @@ shared_files = \
        shared/nm-utils/nm-shared-utils.h \
        $(NULL)
 
-
 noinst_LTLIBRARIES += src/utils/libutils-libnm.la
 
 src_utils_libutils_libnm_la_CPPFLAGS = \
@@ -213,6 +214,8 @@ src_utils_tests_test_utils_LDADD = \
        $(GTK_LIBS) \
        $(LIBNM_LIBS)
 
+EXTRA_DIST += src/utils/meson.build
+
 ###############################################################################
 
 src/wireless-security/ws-resources.h: src/wireless-security/ws.gresource.xml
@@ -325,7 +328,8 @@ EXTRA_DIST += \
        src/wireless-security/ws-wep-key.ui \
        src/wireless-security/ws-wpa-eap.ui \
        src/wireless-security/ws-wpa-psk.ui \
-       src/wireless-security/ws.gresource.xml
+       src/wireless-security/ws.gresource.xml \
+       src/wireless-security/meson.build
 
 ###############################################################################
 
@@ -456,6 +460,7 @@ EXTRA_DIST += \
        src/libnm-gtk/check-exports.sh \
        src/libnm-gtk/wifi.ui \
        src/libnm-gtk/nm.gresource.xml \
+       src/libnm-gtk/meson.build \
        \
        src/libnm-gtk/tests/iso3166-test.xml \
        src/libnm-gtk/tests/serviceproviders-test.xml \
@@ -586,7 +591,8 @@ EXTRA_DIST += \
        src/libnma/wifi.ui \
        src/libnma/nma-pkcs11-token-login-dialog.ui \
        src/libnma/nma-pkcs11-cert-chooser-dialog.ui \
-       src/libnma/nma.gresource.xml
+       src/libnma/nma.gresource.xml \
+       src/libnma/meson.build
 
 ###############################################################################
 
@@ -747,7 +753,8 @@ EXTRA_DIST += \
        src/connection-editor/ce-ppp-auth-methods.ui \
        src/connection-editor/nm-connection-editor.ui \
        src/connection-editor/nm-connection-list.ui \
-       src/connection-editor/ce.gresource.xml
+       src/connection-editor/ce.gresource.xml \
+       src/connection-editor/meson.build
 
 ###############################################################################
 
@@ -850,7 +857,8 @@ EXTRA_DIST += \
        src/8021x.ui \
        src/gsm-unlock.ui \
        src/info.ui \
-       src/applet.gresource.xml
+       src/applet.gresource.xml \
+       src/meson.build
 
 ###############################################################################
 
@@ -864,6 +872,7 @@ EXTRA_DIST += \
        shared/nm-utils/nm-vpn-editor-plugin-call.h \
        shared/nm-default.h \
        shared/nm-libnm-compat.h \
+       shared/meson.build \
        $(NULL)
 
 ###############################################################################
@@ -872,6 +881,8 @@ man_MANS += \
        man/nm-applet.1 \
        man/nm-connection-editor.1
 
+EXTRA_DIST += man/meson.build
+
 ###############################################################################
 
 DOC_MODULE = libnma
@@ -923,7 +934,15 @@ EXTRA_DIST += \
        intltool-merge.in \
        intltool-update.in \
        Makefile.glib \
-       autogen.sh
+       autogen.sh \
+       meson.build \
+       meson_options.txt \
+       meson_post_install.py \
+       config.h.meson \
+       gtkdocentities.ent.in \
+       \
+       po/meson.build
+
 
 autostartdir = $(sysconfdir)/xdg/autostart
 autostart_in_files = nm-applet.desktop.in
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 0000000..0c71ba5
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,144 @@
+/* Gettext package */
+#mesondefine GETTEXT_PACKAGE
+
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */
+#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
+
+/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+#mesondefine HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define to 1 if you have the `dcgettext' function. */
+#mesondefine HAVE_DCGETTEXT
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#mesondefine HAVE_DLFCN_H
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#mesondefine HAVE_GETTEXT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#mesondefine HAVE_INTTYPES_H
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+#mesondefine HAVE_LC_MESSAGES
+
+/* Define if you have libnotify 0.7 or later */
+#mesondefine HAVE_LIBNOTIFY_07
+
+/* Define to 1 if you have the <locale.h> header file. */
+#mesondefine HAVE_LOCALE_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#mesondefine HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#mesondefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#mesondefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#mesondefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#mesondefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#mesondefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#mesondefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#mesondefine HAVE_UNISTD_H
+
+/* ISO codes prefix */
+#mesondefine ISO_CODES_PREFIX
+
+/* git commit id of the original source code version */
+#mesondefine NMA_GIT_SHA
+
+/* Define if more asserts are enabled */
+#mesondefine NM_MORE_ASSERTS
+
+/* Name of package */
+#mesondefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#mesondefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#mesondefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#mesondefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+/* Version number of package */
+#mesondefine VERSION
+
+/* Enable using libappindicator */
+#mesondefine WITH_APPINDICATOR
+
+/* Define if Gcr is available */
+#mesondefine WITH_GCR
+
+/* Define if Jansson is available */
+#mesondefine WITH_JANSSON
+
+/* Define if libselinux is available */
+#mesondefine WITH_SELINUX
+
+/* Define if you have ModemManager/WWAN support */
+#mesondefine WITH_WWAN
+
+/* Define to 1 if on MINIX. */
+#mesondefine _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#mesondefine _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#mesondefine _POSIX_SOURCE
+
+/* Define to `int' if <sys/types.h> does not define. */
+#mesondefine pid_t
diff --git a/gtkdocentities.ent.in b/gtkdocentities.ent.in
new file mode 100644
index 0000000..d2a068a
--- /dev/null
+++ b/gtkdocentities.ent.in
@@ -0,0 +1,7 @@
+<!ENTITY package @PACKAGE@>
+<!ENTITY package_bugreport @PACKAGE_BUGREPORT@>
+<!ENTITY package_name @PACKAGE_NAME@>
+<!ENTITY package_string @PACKAGE_STRING@>
+<!ENTITY package_tarname @PACKAGE_TARNAME@>
+<!ENTITY package_url @PACKAGE_URL@>
+<!ENTITY package_version @PACKAGE_VERSION@>
diff --git a/icons/meson.build b/icons/meson.build
new file mode 100644
index 0000000..c06cefa
--- /dev/null
+++ b/icons/meson.build
@@ -0,0 +1,107 @@
+icons_16 = [
+  'nm-device-wired.png',
+  'nm-no-connection.png',
+  'nm-vpn-standalone-lock.png'
+]
+
+icons_22 = [
+  'nm-adhoc.png',
+  'nm-device-wired.png',
+  'nm-device-wwan.png',
+  'nm-mb-roam.png',
+  'nm-no-connection.png',
+  'nm-secure-lock.png',
+  'nm-signal-00.png',
+  'nm-signal-100.png',
+  'nm-signal-25.png',
+  'nm-signal-50.png',
+  'nm-signal-75.png',
+  'nm-stage01-connecting01.png',
+  'nm-stage01-connecting02.png',
+  'nm-stage01-connecting03.png',
+  'nm-stage01-connecting04.png',
+  'nm-stage01-connecting05.png',
+  'nm-stage01-connecting06.png',
+  'nm-stage01-connecting07.png',
+  'nm-stage01-connecting08.png',
+  'nm-stage01-connecting09.png',
+  'nm-stage01-connecting10.png',
+  'nm-stage01-connecting11.png',
+  'nm-stage02-connecting01.png',
+  'nm-stage02-connecting02.png',
+  'nm-stage02-connecting03.png',
+  'nm-stage02-connecting04.png',
+  'nm-stage02-connecting05.png',
+  'nm-stage02-connecting06.png',
+  'nm-stage02-connecting07.png',
+  'nm-stage02-connecting08.png',
+  'nm-stage02-connecting09.png',
+  'nm-stage02-connecting10.png',
+  'nm-stage02-connecting11.png',
+  'nm-stage03-connecting01.png',
+  'nm-stage03-connecting02.png',
+  'nm-stage03-connecting03.png',
+  'nm-stage03-connecting04.png',
+  'nm-stage03-connecting05.png',
+  'nm-stage03-connecting06.png',
+  'nm-stage03-connecting07.png',
+  'nm-stage03-connecting08.png',
+  'nm-stage03-connecting09.png',
+  'nm-stage03-connecting10.png',
+  'nm-stage03-connecting11.png',
+  'nm-tech-3g.png',
+  'nm-tech-cdma-1x.png',
+  'nm-tech-edge.png',
+  'nm-tech-evdo.png',
+  'nm-tech-gprs.png',
+  'nm-tech-hspa.png',
+  'nm-tech-lte.png',
+  'nm-tech-umts.png',
+  'nm-vpn-active-lock.png',
+  'nm-vpn-connecting01.png',
+  'nm-vpn-connecting02.png',
+  'nm-vpn-connecting03.png',
+  'nm-vpn-connecting04.png',
+  'nm-vpn-connecting05.png',
+  'nm-vpn-connecting06.png',
+  'nm-vpn-connecting07.png',
+  'nm-vpn-connecting08.png',
+  'nm-vpn-connecting09.png',
+  'nm-vpn-connecting10.png',
+  'nm-vpn-connecting11.png',
+  'nm-vpn-connecting12.png',
+  'nm-vpn-connecting13.png',
+  'nm-vpn-connecting14.png',
+  'nm-wwan-tower.png'
+]
+
+icons_32 = [
+  'nm-device-wired.png',
+  'nm-no-connection.png'
+]
+
+icons_48 = ['nm-device-wireless.png']
+
+icons_scalable = [
+  'nm-device-wired.svg',
+  'nm-no-connection.svg'
+]
+
+icons = [
+  # local dir, install dir, files
+  ['16', '16x16', icons_16],
+  ['22', '22x22', icons_22],
+  ['32', '32x32', icons_32],
+  ['48', '48x48', icons_48],
+  ['scalable', 'scalable', icons_scalable]
+]
+
+foreach icon: icons
+  icon_dir = join_paths(nma_datadir, 'icons', 'hicolor', icon[1], 'apps')
+  foreach name: icon[2]
+    install_data(
+      join_paths(icon[0], name),
+      install_dir: icon_dir
+    )
+  endforeach
+endforeach
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..4a12eff
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,17 @@
+mans = [
+  'nm-applet.1',
+  'nm-connection-editor.1'
+]
+
+man1_dir = join_paths(nma_mandir, 'man1')
+
+foreach man: mans
+  configure_file(
+    input: man + '.in',
+    output: man,
+    install: true,
+    install_dir: man1_dir,
+    # FIXME: empty configuration
+    configuration: configuration_data()
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1aa233e
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,548 @@
+project(
+  'nm-applet', 'c',
+  version: '1.8.3',
+  license: 'GPL2+',
+  default_options: [
+    'b_lundef=true',
+    'buildtype=debugoptimized',
+    'c_std=gnu99',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.42.0'
+)
+
+nma_long_name = 'network-manager-applet'
+
+nma_version = meson.project_version()
+version_array = nma_version.split('.')
+nma_major_version = version_array[0].to_int()
+nma_minor_version = version_array[1].to_int()
+nma_micro_version = version_array[2].to_int()
+
+nma_gir_version = '1.0'
+nma_gir_prefix = 'NMA'
+
+nma_gir_ns = 'NMA'
+nma_gtk_gir_ns = 'NMGtk'
+
+nma_prefix = get_option('prefix')
+nma_bindir = join_paths(nma_prefix, get_option('bindir'))
+nma_datadir = join_paths(nma_prefix, get_option('datadir'))
+nma_includedir = join_paths(nma_prefix, get_option('includedir'))
+nma_libdir = join_paths(nma_prefix, get_option('libdir'))
+nma_libexecdir = join_paths(nma_prefix, get_option('libexecdir'))
+nma_localedir = join_paths(nma_prefix, get_option('localedir'))
+nma_mandir = join_paths(nma_prefix, get_option('mandir'))
+nma_sysconfdir = join_paths(nma_prefix, get_option('sysconfdir'))
+
+nma_appdir = join_paths(nma_datadir, 'applications')
+nma_autostartdir = join_paths(nma_sysconfdir, 'xdg', 'autostart')
+nma_icondir = join_paths(nma_datadir, 'icons')
+
+soversion = 0
+current = 0
+revision = 0
+libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+
+nma_debug = get_option('buildtype').contains('debug')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+  # package
+  ['PACKAGE', nma_long_name],
+  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager'],
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), nma_version)],
+  ['PACKAGE_TARNAME', nma_long_name],
+  ['PACKAGE_URL', ''],
+  ['PACKAGE_VERSION', nma_version],
+  ['VERSION', nma_version],
+  # i18n
+  ['GETTEXT_PACKAGE', meson.project_name()]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+res = run_command(find_program('git'), 'rev-parse', '--verify', '-q', 'HEAD')
+config_h.set_quoted('NMA_GIT_SHA', res.stdout().strip())
+
+# headers
+check_headers = [
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
+  ['HAVE_LOCALE_H', 'locale.h'],
+  ['HAVE_MEMORY_H', 'memory.h'],
+  ['HAVE_STDINT_H', 'stdint.h'],
+  ['HAVE_STDLIB_H', 'stdlib.h'],
+  ['HAVE_STRINGS_H', 'strings.h'],
+  ['HAVE_STRING_H', 'string.h'],
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+  ['HAVE_UNISTD_H', 'unistd.h']
+]
+
+foreach header: check_headers
+  config_h.set(header[0], cc.has_header(header[1]))
+endforeach
+
+# functions
+check_functions = [
+  # i18n
+  ['HAVE_DCGETTEXT', 'dcgettext'],
+  ['HAVE_GETTEXT', 'gettext'],
+  ['HAVE_ICONV', 'iconv']
+]
+
+if host_machine.system().contains('darwin')
+  check_functions += [
+    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+  ]
+endif
+
+foreach func: check_functions
+  config_h.set(func[0], cc.has_function(func[1]))
+endforeach
+
+# symbols
+check_symbols = [
+  # i18n
+  ['HAVE_LC_MESSAGES', 'locale.h', 'LC_MESSAGES'],
+  ['HAVE_BIND_TEXTDOMAIN_CODESET', 'libintl.h', 'bind_textdomain_codeset']
+]
+
+foreach symbol: check_symbols
+  config_h.set(symbol[0], cc.has_header_symbol(symbol[1], symbol[2]))
+endforeach
+
+# types
+check_types = [
+  # type, header, fallback type
+  ['pid_t', 'sys/types.h', 'int']
+]
+
+foreach type: check_types
+  if not cc.has_type(type[0], prefix: '#include<@0@>'.format(type[1]))
+    config_h.set(type[0], type[2])
+  endif
+endforeach
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+common_ldflags = []
+
+enable_ld_gc = get_option('enable-ld-gc')
+if enable_ld_gc
+  test_cflags = [
+    '-fdata-sections',
+    '-ffunction-sections',
+  ]
+
+  test_ldflags = ['-Wl,--gc-sections']
+
+  foreach cflag: test_cflags + test_ldflags
+    assert(cc.has_argument(cflag), 'Unused symbol eviction requested but not supported. Use 
-Denable-ld-gc=false to build without it.')
+  endforeach
+
+  common_flags += test_cflags
+  common_ldflags += test_ldflags
+endif
+
+if nma_debug
+  test_cflags = [
+    '-Wdeclaration-after-statement',
+    '-Wfloat-equal',
+    '-Wformat=2',
+    '-Wimplicit-fallthrough',
+    '-Winit-self',
+    '-Wmissing-declarations',
+    '-Wmissing-include-dirs',
+    '-Wmissing-prototypes',
+    '-Wno-duplicate-decl-specifier',
+    '-Wno-format-truncation',
+    '-Wno-format-y2k',
+    '-Wno-missing-field-initializers',
+    '-Wno-pragmas',
+    '-Wno-sign-compare',
+    '-Wno-unused-but-set-variable',
+    '-Wno-unused-parameter',
+    '-Wshadow',
+    '-Wstrict-prototypes',
+    '-Wundef'
+  ]
+
+  foreach cflag: test_cflags
+    if cc.has_argument(cflag)
+      common_flags += [cflag]
+    endif
+  endforeach
+endif
+
+add_project_arguments(common_flags, language: 'c')
+add_project_link_arguments(common_ldflags, language: 'c')
+
+ldflag = '-Wl,--version-script'
+have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag)
+
+linker_script_ver = join_paths(meson.source_root(), 'linker-script-binary.ver')
+
+# Check for iso-codes for country names translation
+enable_iso_codes = get_option('enable-iso-codes')
+message('whether to disable iso-codes at build-time: ' + enable_iso_codes.to_string())
+if enable_iso_codes
+  iso_codes_dep = dependency('iso-codes')
+
+  str = 'Consider installing the package or adjusting the PKG_CONFIG_PATH environment variable.\n'
+  str += 'You can also disable build-time check for \'iso-codes\' via -Denable-iso-codes=false'
+  assert(iso_codes_dep.found(), str)
+
+  iso_3166 = iso_codes_dep.get_pkgconfig_variable('domains').contains('iso_3166')
+  message('whether iso-codes has iso_3166 domain: ' + iso_3166.to_string())
+
+  config_h.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix'))
+else
+  config_h.set_quoted('ISO_CODES_PREFIX', nma_prefix)
+endif
+
+gio_dep = dependency('gio-2.0', version: '>= 2.38')
+gmodule_export_dep = dependency('gmodule-export-2.0')
+libsecret_dep = dependency('libsecret-1', version: '>= 0.18')
+
+m_dep = cc.find_library('m')
+
+# Check for gtk+
+gtk_req_version = '>= 3.4'
+
+gtk_dep = declare_dependency(
+  dependencies: dependency('gtk+-3.0', version: gtk_req_version),
+  compile_args: [
+    '-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4',
+    '-DGTK_VERSION_MAX_ALLOWED=GTK_VERSION_3_4'
+  ]
+)
+
+# Check for gudev
+gudev_dep = dependency('gudev-1.0', version: '>= 147')
+
+# Check for libnotify >= 0.7
+libnotify_dep = dependency('libnotify', version: '>= 0.4.3')
+config_h.set10('HAVE_LIBNOTIFY_07', libnotify_dep.found() and libnotify_dep.version().version_compare('>= 
0.7'),
+               description: 'Define if you have libnotify 0.7 or later')
+
+# API documentation
+nm_req_version = '>= 1.7'
+
+deps = [
+  gio_dep,
+  gmodule_export_dep,
+  dependency('libnm', version: nm_req_version)
+]
+
+cflags = [
+  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38',
+  '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38',
+  '-DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_8',
+  '-DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_8'
+]
+
+libnm_dep = declare_dependency(
+  dependencies: deps,
+  compile_args: cflags
+)
+
+enable_libnm_gtk = get_option('enable-libnm-gtk')
+if enable_libnm_gtk
+  deps = [
+    gio_dep,
+    gmodule_export_dep,
+    dependency('libnm-glib', version: nm_req_version),
+    dependency('libnm-glib-vpn', version: nm_req_version),
+    dependency('libnm-util', version: nm_req_version),
+    dependency('NetworkManager', version: nm_req_version)
+  ]
+
+  cflags = [
+    '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38',
+    '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38',
+    '-DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_4',
+    '-DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4'
+  ]
+
+  libnm_glib_dep = declare_dependency(
+    dependencies: deps,
+    compile_args: cflags
+  )
+endif
+
+enable_appindicator = get_option('enable-appindicator')
+if enable_appindicator
+  appindicator_dep = dependency('appindicator3-0.1')
+  dbusmenu_dep = dependency('dbusmenu-gtk3-0.4', version: '>= 16.04.0')
+endif
+config_h.set('WITH_APPINDICATOR', enable_appindicator)
+
+# ModemManager1 with libmm-glib for WWAN support
+enable_wwan = get_option('enable-wwan')
+if enable_wwan
+  mm_glib_dep = dependency('mm-glib', required: false)
+  assert(mm_glib_dep.found(), 'libmm-glib is needed for WWAN support. Use -Denable-wwan=false to build 
without it.')
+endif
+config_h.set10('WITH_WWAN', enable_wwan)
+
+# SELinux
+enable_selinux = get_option('enable-selinux')
+if enable_selinux
+  libselinux_dep = dependency('libselinux', required: false)
+  assert(libselinux_dep.found(), 'libselinux is needed for SELinux label support in configuration editor. 
Use -Denable-selinux=false to build without it.')
+endif
+config_h.set10('WITH_SELINUX', enable_selinux)
+
+# Jansson for team configuration editing
+enable_team = get_option('enable-team')
+if enable_team
+  jansson_dep = dependency('jansson', version: '>= 2.7', required: false)
+  assert(jansson_dep.found(), 'jansson is needed for team configuration editor. Use -Denable-team=false to 
build without it.')
+endif
+config_h.set10('WITH_JANSSON', enable_team)
+
+# GCR for PKCS#11 enabled certificate chooser
+enable_gcr = get_option('enable-gcr')
+if enable_gcr
+  deps = [
+    dependency('gcr-3', version: '>= 3.14'),
+    dependency('gck-1', version: '>= 3.14')
+  ]
+
+  cflags = [
+    '-DGCR_API_SUBJECT_TO_CHANGE',
+    '-DGCK_API_SUBJECT_TO_CHANGE'
+  ]
+
+  # GCR API is declared subject to change, do an extensive check of the prototypes
+  gcr_src = '''
+    #ifndef GCR_API_SUBJECT_TO_CHANGE
+    # define GCR_API_SUBJECT_TO_CHANGE
+    #endif
+    #ifndef GCK_API_SUBJECT_TO_CHANGE
+    # define GCK_API_SUBJECT_TO_CHANGE
+    #endif
+
+    #include <gcr/gcr.h>
+    #include <gck/gck.h>
+
+    const GckAttribute *gck_attributes_find (GckAttributes *attrs, gulong attr_type);
+    gboolean gck_attributes_find_string (GckAttributes *attrs, gulong attr_type, gchar **value);
+    gboolean gck_attributes_find_ulong (GckAttributes *attrs, gulong attr_type, gulong *value);
+    GckAttributes *gck_attributes_new_empty (gulong first_type, ...);
+    void gck_attributes_unref (gpointer attrs);
+    void gck_builder_add_all (GckBuilder *builder, GckAttributes *attrs);
+    void gck_builder_add_only (GckBuilder *builder, GckAttributes *attrs, gulong only_type, ...);
+    GckAttributes *gck_builder_end (GckBuilder *builder);
+    GckBuilder *gck_builder_new (GckBuilderFlags flags);
+    void gck_enumerator_next_async (GckEnumerator *self, gint max_objects, GCancellable *cancellable,
+                                    GAsyncReadyCallback callback, gpointer user_data);
+    GList *gck_enumerator_next_finish (GckEnumerator *self, GAsyncResult *result, GError **error);
+    void gck_list_unref_free (GList *reflist);
+    GList *gck_modules_get_slots (GList *modules, gboolean token_present);
+    void gck_modules_initialize_registered_async (GCancellable *cancellable, GAsyncReadyCallback callback,
+                                                  gpointer user_data);
+    GList *gck_modules_initialize_registered_finish (GAsyncResult *result, GError **error);
+    void gck_object_get_async (GckObject *self, const gulong *attr_types, guint n_attr_types,
+                               GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+    GckAttributes *gck_object_get_finish (GckObject *self, GAsyncResult *result, GError **error);
+    void gck_session_login_async (GckSession *self, gulong user_type, const guchar *pin,
+                                  gsize n_pin, GCancellable *cancellable,
+                                  GAsyncReadyCallback callback, gpointer user_data);
+    gboolean gck_session_login_finish (GckSession *self, GAsyncResult *result, GError **error);
+    GckSlotInfo *gck_slot_get_info (GckSlot *self);
+    GckTokenInfo *gck_slot_get_token_info (GckSlot *self);
+    void gck_slot_open_session_async (GckSlot *self, GckSessionOptions options, GCancellable *cancellable,
+                                      GAsyncReadyCallback callback, gpointer user_data);
+    GckSession *gck_slot_open_session_finish (GckSlot *self, GAsyncResult *result, GError **error);
+    void gck_token_info_free (GckTokenInfo *token_info);
+    gchar *gck_uri_build (GckUriData *uri_data, GckUriFlags flags);
+    void gck_uri_data_free (GckUriData *uri_data);
+    GckUriData *gck_uri_parse (const gchar *string, GckUriFlags flags, GError **error);
+    gchar *gcr_certificate_get_issuer_name (GcrCertificate *self);
+    gchar *gcr_certificate_get_subject_name (GcrCertificate *self);
+    GcrCertificate *gcr_simple_certificate_new (const guchar *data, gsize n_data);
+  '''
+
+  assert(cc.compiles(gcr_src, dependencies: deps), 'gcr support was requested, but the gcr library is not 
available. Use -Denable-gcr=false to build without it.')
+
+  gcr_dep = declare_dependency(
+    dependencies: deps,
+    compile_args: cflags
+  )
+endif
+config_h.set10('WITH_GCR', enable_gcr)
+
+# introspection support
+enable_introspection = get_option('enable-introspection')
+if enable_introspection
+  gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.9.6', required: false)
+  assert(gir_dep.found(), 'introspection support was requested, but the gobject-introspection library is not 
available. Use -Denable-introspection=false to build without it.')
+endif
+
+more_asserts = get_option('with-more-asserts')
+if more_asserts == 'no'
+  more_asserts = 0
+elif more_asserts == 'yes'
+  more_asserts = 100
+else
+  more_asserts = more_asserts.to_int()
+endif
+config_h.set('NM_MORE_ASSERTS', more_asserts)
+
+config = 'config.h'
+
+configure_file(
+  input: config + '.meson',
+  output: config,
+  configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+intltool_merge = find_program('intltool-merge')
+intltool_cache = join_paths(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('.')
+
+subdir('po')
+subdir('icons')
+subdir('shared')
+subdir('src')
+subdir('man')
+
+desktop = 'nm-applet.desktop'
+
+# FIXME: The same target can not be copied into two directories.
+#        There is a workaround in meson_post_install.py until proper solution arises:
+#        https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
+custom_target(
+  desktop,
+  input: desktop + '.in',
+  output: desktop,
+  command: intltool_desktop_cmd,
+  install: true,
+  install_dir: nma_appdir
+  #install_dir: [
+  #  nma_appdir,
+  #  nma_autostartdir
+  #]
+)
+
+desktop = 'nm-connection-editor.desktop'
+
+custom_target(
+  desktop,
+  input: desktop + '.in',
+  output: desktop,
+  command: intltool_desktop_cmd,
+  install: true,
+  install_dir: nma_appdir
+)
+
+info = 'nm-connection-editor.metainfo.xml'
+
+custom_target(
+  info,
+  input: 'nm-connection-editor.appdata.xml.in',
+  output: info,
+  command: intltool_xml_cmd,
+  install: true,
+  install_dir: join_paths(nma_datadir, 'metainfo')
+)
+
+schema_conf = configuration_data()
+schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
+
+schema = 'org.gnome.@0  gschema xml'.format(meson.project_name())
+
+configure_file(
+  input: schema + '.in',
+  output: schema,
+  install: true,
+  install_dir: join_paths(nma_datadir, 'glib-2.0', 'schemas'),
+  configuration: schema_conf
+)
+
+install_data(
+  meson.project_name() + '.convert',
+  install_dir: join_paths(nma_datadir, 'GConf', 'gsettings')
+)
+
+# documentation
+enable_gtk_doc = get_option('enable-gtk-doc')
+if enable_gtk_doc
+  mod_name = 'libnma'
+
+  private_headers = [
+    'nma-cert-chooser-button.h',
+    'nma-cert-chooser-private.h',
+    'nma-pkcs11-cert-chooser-dialog.h',
+    'nma-pkcs11-token-login-dialog.h',
+    'nma-resources.h',
+    'nma-version.h'
+  ]
+
+  private_sources = [
+    'nma-cert-chooser-button.c',
+    'nma-file-cert-chooser.c',
+    'nma-pkcs11-cert-chooser-dialog.c',
+    'nma-pkcs11-cert-chooser.c',
+    'nma-pkcs11-token-login-dialog.c',
+    'nma-resources.c'
+  ]
+
+  ent = 'gtkdocentities.ent'
+
+  configure_file(
+    input: ent + '.in',
+    output: ent,
+    configuration: config_h
+  )
+
+  doc_path = join_paths(nma_datadir, 'gtk-doc', 'html', mod_name)
+
+  gnome.gtkdoc(
+    mod_name,
+    main_xml: mod_name + '-docs.xml',
+    src_dir: libnma_inc,
+    dependencies: libnma_dep,
+    scan_args: [
+      '--rebuild-types',
+      '--rebuild-sections',
+      '--ignore-headers=' + ' '.join(private_headers)
+    ],
+    mkdb_args: '--ignore-files=' + ' '.join(private_headers + private_sources),
+    gobject_typesfile: mod_name + '.types',
+    install: true,
+    install_dir: doc_path
+  )
+endif
+
+meson.add_install_script(
+  'meson_post_install.py',
+  nma_datadir,
+  nma_sysconfdir
+)
+
+output = '\n  Build legacy library libnm-gtk: ' + enable_libnm_gtk.to_string() + '\n'
+output += '  GCR: ' + enable_gcr.to_string() + '\n'
+output += '  LTO: ' + get_option('b_lto').to_string() + '\n'
+output += '  Linker garbage collection: ' + enable_ld_gc.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..4929ca7
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('enable-libnm-gtk', type: 'boolean', value: true, description: 'build legacy library libnm-gtk which 
depends on libnm-glib/libnm-util/dbus-glib')
+option('enable-appindicator', type: 'boolean', value: true, description: 'Build with libappindicator support 
instead of xembed systray support.')
+option('enable-wwan', type: 'boolean', value: true, description: 'Enable WWAN support.')
+option('enable-selinux', type: 'boolean', value: true, description: 'Enable support for adjusting SELinux 
labels in configuration editor.')
+option('enable-team', type: 'boolean', value: true, description: 'Enable team configuration editor.')
+option('enable-gcr', type: 'boolean', value: true, description: 'Enable advanced certificate chooser.')
+option('with-more-asserts', type: 'string', value: '0', description: 'Enable more assertions for debugging.')
+option('enable-iso-codes', type: 'boolean', value: true, description: 'check for iso-codes at build-time')
+option('enable-ld-gc', type: 'boolean', value: true, description: 'Enable garbage collection of unused 
symbols on linking')
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('enable-introspection', type: 'boolean', value: false, description: 'Enable introspection for this 
build')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..c1e6a54
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  print('Compile gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
+
+  # FIXME: this is due to unable to copy a generated target file:
+  #        https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
+  dst_dir = os.path.join(sys.argv[2], 'xdg', 'autostart')
+  if not os.path.exists(dst_dir):
+    os.makedirs(dst_dir)
+
+  src = os.path.join(sys.argv[1], 'applications', 'nm-applet.desktop')
+  dst = os.path.join(dst_dir, 'nm-applet.desktop')
+  shutil.copyfile(src, dst)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..e9b77d7
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/shared/meson.build b/shared/meson.build
new file mode 100644
index 0000000..6a5fa34
--- /dev/null
+++ b/shared/meson.build
@@ -0,0 +1,3 @@
+shared_inc = include_directories('.')
+
+shared_sources = files('nm-utils/nm-shared-utils.c')
diff --git a/src/connection-editor/meson.build b/src/connection-editor/meson.build
new file mode 100644
index 0000000..990f1b4
--- /dev/null
+++ b/src/connection-editor/meson.build
@@ -0,0 +1,122 @@
+sources = files(
+  'ce-page.c',
+  'ce-polkit-button.c',
+  'ce-polkit.c',
+  'connection-helpers.c',
+  'ip4-routes-dialog.c',
+  'ip6-routes-dialog.c',
+  'nm-connection-editor.c',
+  'nm-connection-list.c',
+  'main.c',
+  'page-8021x-security.c',
+  'page-bridge.c',
+  'page-bridge-port.c',
+  'page-bluetooth.c',
+  'page-bond.c',
+  'page-dcb.c',
+  'page-dsl.c',
+  'page-ethernet.c',
+  'page-general.c',
+  'page-infiniband.c',
+  'page-ip-tunnel.c',
+  'page-ip4.c',
+  'page-ip6.c',
+  'page-macsec.c',
+  'page-master.c',
+  'page-mobile.c',
+  'page-ppp.c',
+  'page-proxy.c',
+  'page-team.c',
+  'page-team-port.c',
+  'page-vlan.c',
+  'page-vpn.c',
+  'page-wifi.c',
+  'page-wifi-security.c',
+  'ppp-auth-methods-dialog.c',
+  'vpn-helpers.c'
+)
+
+resource_data = files(
+  'ce-ip4-routes.ui',
+  'ce-ip6-routes.ui',
+  'ce-new-connection.ui',
+  'ce-page-bluetooth.ui',
+  'ce-page-bond.ui',
+  'ce-page-bridge-port.ui',
+  'ce-page-bridge.ui',
+  'ce-page-dcb.ui',
+  'ce-page-dsl.ui',
+  'ce-page-ethernet.ui',
+  'ce-page-general.ui',
+  'ce-page-infiniband.ui',
+  'ce-page-ip4.ui',
+  'ce-page-ip6.ui',
+  'ce-page-ip-tunnel.ui',
+  'ce-page-macsec.ui',
+  'ce-page-mobile.ui',
+  'ce-page-ppp.ui',
+  'ce-page-proxy.ui',
+  'ce-page-team-port.ui',
+  'ce-page-team.ui',
+  'ce-page-vlan.ui',
+  'ce-page-wifi-security.ui',
+  'ce-page-wifi.ui',
+  'ce-ppp-auth-methods.ui',
+  'nm-connection-editor.ui',
+  'nm-connection-list.ui'
+)
+
+sources += gnome.compile_resources(
+  'ce-resources',
+  'ce.gresource.xml',
+  dependencies: resource_data
+)
+
+incs = [
+  top_inc,
+  utils_inc,
+  src_inc,
+  shared_inc
+]
+
+deps = [
+  gtk_dep,
+  libnm_dep,
+  libnma_dep,
+  libwireless_security_libnm_dep,
+  m_dep
+]
+
+cflags = [
+  '-DBINDIR="@0@"'.format(nma_bindir),
+  '-DDATADIR="@0@"'.format(nma_datadir),
+  '-DLIBDIR="@0@"'.format(nma_libdir),
+  '-DNMALOCALEDIR="@0@"'.format(nma_localedir),
+  '-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
+  '-DICONDIR="@0@"'.format(nma_icondir)
+]
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,@0@'.format(linker_script_ver)
+endif
+
+if enable_selinux
+  deps += libselinux_dep
+endif
+
+if enable_team
+  deps += jansson_dep
+endif
+
+executable(
+  'nm-connection-editor',
+  sources,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: linker_script_ver,
+  install: true,
+  install_dir: nma_bindir
+)
diff --git a/src/libnm-gtk/meson.build b/src/libnm-gtk/meson.build
new file mode 100644
index 0000000..9aaf219
--- /dev/null
+++ b/src/libnm-gtk/meson.build
@@ -0,0 +1,151 @@
+lib_name = 'libnm-gtk'
+
+gir_headers = files(
+  'nm-cert-chooser.h',
+  'nm-mobile-providers.h',
+  'nm-mobile-wizard.h',
+  'nm-ui-utils.h',
+  'nm-vpn-password-dialog.h',
+  'nm-wifi-dialog.h'
+)
+
+headers = gir_headers + files('nm-wireless-dialog.h')
+
+install_headers(
+  headers,
+  subdir: lib_name
+)
+
+gir_sources = cert_chooser_sources + files(
+  'init.c',
+  'nm-mobile-providers.c',
+  'nm-mobile-wizard.c',
+  'nm-ui-utils.c',
+  'nm-vpn-password-dialog.c',
+  'nm-wifi-dialog.c'
+)
+
+sources = [version_header] + gir_sources + files('nm-wireless-dialog.c')
+
+resource_data = files('wifi.ui')
+
+sources += gnome.compile_resources(
+  'nm-resources',
+  'nm.gresource.xml',
+  dependencies: resource_data
+)
+
+incs = [
+  top_inc,
+  shared_inc,
+  src_inc,
+  libnma_inc
+]
+
+deps = [
+  gtk_dep,
+  gudev_dep,
+  libnm_glib_dep,
+  libutils_libnm_glib_dep,
+  libwireless_security_libnm_glib_dep
+]
+
+cflags = [
+  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY',
+  '-DBINDIR="@0@"'.format(nma_bindir),
+  '-DDATADIR="@0@"'.format(nma_datadir),
+  '-DLIBEXECDIR="@0@"'.format(nma_libexecdir),
+  '-DNMALOCALEDIR="@0@"'.format(nma_localedir),
+  '-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
+  '-DAUTOSTARTDIR="@0@"'.format(nma_autostartdir),
+  '-DICONDIR="@0@"'.format(nma_icondir)
+]
+
+symbol_map = join_paths(meson.current_source_dir(), 'libnm-gtk.ver')
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,' + symbol_map
+endif
+
+libnm_gtk = shared_library(
+  'nm-gtk',
+  sources: sources,
+  version: libversion,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: symbol_map,
+  install: true,
+  install_dir: nma_libdir
+)
+
+pkg.generate(
+  libraries: libnm_gtk,
+  version: nma_version,
+  name: lib_name,
+  description: 'NetworkManager UI utilities (libnm-glib version)',
+  filebase: lib_name,
+  subdirs: lib_name,
+  requires: [
+    'NetworkManager ' + nm_req_version,
+    'libnm-util ' + nm_req_version,
+    'linm-glib ' + nm_req_version,
+    'gtk+-3.0 ' + gtk_req_version
+  ],
+  variables: 'exec_prefix=' + nma_prefix,
+  install_dir: join_paths(nma_libdir, 'pkgconfig')
+)
+
+if enable_introspection
+  gir_incs = [
+    'Gtk-3.0',
+    'NetworkManager-1.0',
+    'NMClient-1.0'
+  ]
+
+  gir_dir = join_paths(nma_datadir, 'gir-' + nma_gir_version)
+  typelib_dir = join_paths(nma_libdir, 'girepository-' + nma_gir_version)
+
+  # FIXME: the generated gir file is slightly different
+  gnome.generate_gir(
+    libnm_gtk,
+    sources: gir_sources + gir_headers,
+    nsversion: nma_gir_version,
+    namespace: nma_gtk_gir_ns,
+    includes: gir_incs,
+    identifier_prefix: nma_gir_prefix,
+    symbol_prefix: nma_gir_prefix.to_lower(),
+    export_packages: lib_name,
+    install: true,
+    install_dir_gir: gir_dir,
+    install_dir_typelib: typelib_dir
+  )
+endif
+
+test_unit = 'test-mobile-providers'
+
+deps = [
+ gtk_dep,
+ libnm_glib_dep
+]
+
+cflags = '-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'tests'))
+
+exe = executable(
+  test_unit,
+  'tests/' + test_unit + '.c',
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  link_with: libnm_gtk
+)
+
+test(test_unit, exe)
+
+run_target(
+  'check-local-exports-libnm-gtk',
+  command: [find_program('check-exports.sh'), libnm_gtk.full_path(), symbol_map],
+  depends: libnm_gtk
+)
diff --git a/src/libnma/meson.build b/src/libnma/meson.build
new file mode 100644
index 0000000..0659268
--- /dev/null
+++ b/src/libnma/meson.build
@@ -0,0 +1,148 @@
+lib_name = 'libnma'
+
+cert_chooser_headers = files('nma-cert-chooser.h')
+
+cert_chooser_sources = files(
+  'nma-cert-chooser.c',
+  'nma-file-cert-chooser.c'
+)
+
+resource_data = files(
+  'nma-pkcs11-cert-chooser-dialog.ui',
+  'nma-pkcs11-token-login-dialog.ui',
+  'wifi.ui'
+)
+
+built_sources = gnome.compile_resources(
+  'nma-resources',
+  'nma.gresource.xml',
+  dependencies: resource_data
+)
+
+gir_headers = cert_chooser_headers + files(
+  'nma-mobile-providers.h',
+  'nma-mobile-wizard.h',
+  'nma-ui-utils.h',
+  'nma-vpn-password-dialog.h',
+  'nma-wifi-dialog.h'
+)
+
+headers = gir_headers + files('nma-cert-chooser-private.h')
+
+install_headers(
+  gir_headers,
+  subdir: lib_name
+)
+
+gir_sources = [version_header] + cert_chooser_sources + files(
+  'init.c',
+  'nma-mobile-providers.c',
+  'nma-mobile-wizard.c',
+  'nma-ui-utils.c',
+  'nma-vpn-password-dialog.c',
+  'nma-wifi-dialog.c'
+)
+
+incs = [
+  top_inc,
+  shared_inc,
+  src_inc,
+  libnma_inc
+]
+
+deps = [
+  gtk_dep,
+  gudev_dep,
+  libnm_dep,
+  libutils_libnm_dep,
+  libwireless_security_libnm_dep
+]
+
+cflags = [
+  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB',
+  '-DBINDIR="@0@"'.format(nma_bindir),
+  '-DDATADIR="@0@"'.format(nma_datadir),
+  '-DLIBEXECDIR="@0@"'.format(nma_libexecdir),
+  '-DNMALOCALEDIR="@0@"'.format(nma_localedir),
+  '-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
+  '-DAUTOSTARTDIR="@0@"'.format(nma_autostartdir),
+  '-DICONDIR="@0@"'.format(nma_icondir)
+]
+
+symbol_map = join_paths(meson.current_source_dir(), 'libnma.ver')
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,' + symbol_map
+endif
+
+if enable_gcr
+  headers += files(
+    'nma-cert-chooser-button.h',
+    'nma-pkcs11-cert-chooser-dialog.h',
+    'nma-pkcs11-token-login-dialog.h'
+  )
+
+  gir_sources += files(
+    'nma-cert-chooser-button.c',
+    'nma-pkcs11-cert-chooser.c',
+    'nma-pkcs11-cert-chooser-dialog.c',
+    'nma-pkcs11-token-login-dialog.c'
+  )
+
+  deps += gcr_dep
+endif
+
+libnma = shared_library(
+  'nma',
+  sources: gir_sources + built_sources,
+  version: libversion,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: symbol_map,
+  install: true,
+  install_dir: nma_libdir
+)
+
+libnma_dep = declare_dependency(
+  link_with: libnma,
+  include_directories: libnma_inc
+)
+
+pkg.generate(
+  libraries: libnma,
+  version: nma_version,
+  name: lib_name,
+  description: 'NetworkManager UI utilities (libnm version)',
+  filebase: lib_name,
+  subdirs: lib_name,
+  requires: 'libnm',
+  variables: 'exec_prefix=' + nma_prefix,
+  install_dir: join_paths(nma_libdir, 'pkgconfig')
+)
+
+if enable_introspection
+  gir_incs = [
+    'Gtk-3.0',
+    'NM-1.0'
+  ]
+
+  gir_dir = join_paths(nma_datadir, 'gir-' + nma_gir_version)
+  typelib_dir = join_paths(nma_libdir, 'girepository-' + nma_gir_version)
+
+  gnome.generate_gir(
+    libnma,
+    sources: gir_sources + gir_headers,
+    nsversion: nma_gir_version,
+    namespace: nma_gir_ns,
+    includes: gir_incs,
+    identifier_prefix: nma_gir_prefix,
+    symbol_prefix: nma_gir_prefix.to_lower(),
+    export_packages: lib_name,
+    install: true,
+    install_dir_gir: gir_dir,
+    install_dir_typelib: typelib_dir
+  )
+endif
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..c8e2872
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,114 @@
+src_inc = include_directories('.')
+
+# FIXME: although this file is contained in the libnma directory
+#        it should be generated before because it's used at
+#        wireless-security directory, which is needed later for
+#        libnma directory.
+libnma_inc = include_directories('libnma')
+
+version_conf = configuration_data()
+version_conf.set('NMA_MAJOR_VERSION', nma_major_version)
+version_conf.set('NMA_MINOR_VERSION', nma_minor_version)
+version_conf.set('NMA_MICRO_VERSION', nma_micro_version)
+
+version = 'nma-version.h'
+
+version_header = configure_file(
+  input: 'libnma/' + version + '.in',
+  output: version,
+  configuration: version_conf,
+  install: true,
+  install_dir: join_paths(nma_includedir, 'libnma')
+)
+
+subdir('utils')
+subdir('wireless-security')
+subdir('libnma')
+
+if enable_libnm_gtk
+  subdir('libnm-gtk')
+endif
+
+subdir('connection-editor')
+
+program_name = 'nm-applet'
+
+sources = files(
+  'ap-menu-item.c',
+  'applet-agent.c',
+  'applet.c',
+  'applet-device-bt.c',
+  'applet-device-ethernet.c',
+  'applet-device-wifi.c',
+  'applet-dialogs.c',
+  'applet-vpn-request.c',
+  'ethernet-dialog.c',
+  'main.c',
+  'mb-menu-item.c',
+  'mobile-helpers.c'
+)
+
+resource_data = files(
+  '8021x.ui',
+  'connection-editor/ce-page-dsl.ui',
+  'gsm-unlock.ui',
+  'info.ui'
+)
+
+sources += gnome.compile_resources(
+  'applet-resources',
+  'applet.gresource.xml',
+  dependencies: resource_data
+)
+
+deps = [
+  gtk_dep,
+  libnm_dep,
+  libnma_dep,
+  libnotify_dep,
+  libsecret_dep,
+  libwireless_security_libnm_dep,
+  m_dep
+]
+
+cflags = [
+  '-DBINDIR="@0@"'.format(nma_bindir),
+  '-DDATADIR="@0@"'.format(nma_datadir),
+  '-DLIBDIR="@0@"'.format(nma_libdir),
+  '-DLIBEXECDIR="@0@"'.format(nma_libexecdir),
+  '-DNMALOCALEDIR="@0@"'.format(nma_localedir),
+  '-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
+  '-DAUTOSTARTDIR="@0@"'.format(nma_autostartdir),
+  '-DICONDIR="@0@"'.format(nma_icondir),
+  '-DG_LOG_DOMAIN="@0@"'.format(program_name)
+]
+
+ldflags = []
+if have_version_script
+  ldflags += '-Wl,--version-script,@0@'.format(linker_script_ver)
+endif
+
+if enable_appindicator
+  deps += [
+    appindicator_dep,
+    dbusmenu_dep
+  ]
+endif
+
+if enable_wwan
+  sources += files('applet-device-broadband.c')
+
+  deps += mm_glib_dep
+endif
+
+executable(
+  program_name,
+  sources,
+  include_directories: incs,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: ldflags,
+  link_depends: linker_script_ver,
+  install: true,
+  install_dir: nma_bindir
+)
diff --git a/src/utils/meson.build b/src/utils/meson.build
new file mode 100644
index 0000000..b06a5cc
--- /dev/null
+++ b/src/utils/meson.build
@@ -0,0 +1,59 @@
+utils_inc = include_directories('.')
+
+sources = shared_sources + files('utils.c')
+
+incs = [
+  top_inc,
+  shared_inc
+]
+
+deps = [
+  gtk_dep,
+  libnm_dep
+]
+
+libutils_libnm = static_library(
+  'utils-libnm',
+  sources: sources,
+  include_directories: incs,
+  dependencies: deps
+)
+
+libutils_libnm_dep = declare_dependency(
+  link_with: libutils_libnm,
+  include_directories: utils_inc
+)
+
+test_unit = 'test-utils'
+
+exe = executable(
+  test_unit,
+  'tests/' + test_unit + '.c',
+  include_directories: incs,
+  dependencies: deps,
+  link_with: libutils_libnm
+)
+
+test(test_unit, exe)
+
+if enable_libnm_gtk
+  deps = [
+    gtk_dep,
+    libnm_glib_dep
+  ]
+
+  cflags = '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY'
+
+  libutils_libnm_glib = static_library(
+    'utils-libnm-glib',
+    sources: sources,
+    include_directories: incs,
+    dependencies: deps,
+    c_args: cflags
+  )
+
+  libutils_libnm_glib_dep = declare_dependency(
+    link_with: libutils_libnm_glib,
+    include_directories: utils_inc
+  )
+endif
diff --git a/src/wireless-security/meson.build b/src/wireless-security/meson.build
new file mode 100644
index 0000000..e3efcdb
--- /dev/null
+++ b/src/wireless-security/meson.build
@@ -0,0 +1,86 @@
+wireless_security_inc = include_directories('.')
+
+sources = [version_header] + files(
+  'eap-method.c',
+  'eap-method-fast.c',
+  'eap-method-leap.c',
+  'eap-method-peap.c',
+  'eap-method-simple.c',
+  'eap-method-tls.c',
+  'eap-method-ttls.c',
+  'helpers.c',
+  'wireless-security.c',
+  'ws-dynamic-wep.c',
+  'ws-leap.c',
+  'ws-wep-key.c',
+  'ws-wpa-eap.c',
+  'ws-wpa-psk.c'
+)
+
+resource_data = files(
+  'eap-method-fast.ui',
+  'eap-method-leap.ui',
+  'eap-method-peap.ui',
+  'eap-method-simple.ui',
+  'eap-method-tls.ui',
+  'eap-method-ttls.ui',
+  'ws-dynamic-wep.ui',
+  'ws-leap.ui',
+  'ws-wep-key.ui',
+  'ws-wpa-eap.ui',
+  'ws-wpa-psk.ui'
+)
+
+sources += gnome.compile_resources(
+  'ws-resources',
+  'ws.gresource.xml',
+  dependencies: resource_data
+)
+
+incs = [
+  top_inc,
+  shared_inc,
+  src_inc,
+  libnma_inc
+]
+
+deps = [
+  gtk_dep,
+  libnm_dep,
+  libutils_libnm_dep
+]
+
+libwireless_security_libnm = static_library(
+  'wireless-security-libnm',
+  sources: sources,
+  include_directories: incs,
+  dependencies: deps
+)
+
+libwireless_security_libnm_dep = declare_dependency(
+  link_with: libwireless_security_libnm,
+  include_directories: wireless_security_inc
+)
+
+if enable_libnm_gtk
+  deps = [
+    gtk_dep,
+    libnm_glib_dep,
+    libutils_libnm_glib_dep
+  ]
+
+  cflags = '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY'
+
+  libwireless_security_libnm_glib = static_library(
+    'wireless-security-libnm-glib',
+    sources: sources,
+    include_directories: incs,
+    dependencies: deps,
+    c_args: cflags
+  )
+
+  libwireless_security_libnm_glib_dep = declare_dependency(
+    link_with: libwireless_security_libnm_glib,
+    include_directories: wireless_security_inc
+  )
+endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]