meson.build 4.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
libnm_util_inc = include_directories('.')

enums_headers = [version_header] + files(
  'nm-connection.h',
  'nm-setting-8021x.h',
  'nm-setting-adsl.h',
  'nm-setting-bluetooth.h',
  'nm-setting-bond.h',
  'nm-setting-bridge.h',
  'nm-setting-bridge-port.h',
  'nm-setting-cdma.h',
  'nm-setting-connection.h',
  'nm-setting-dcb.h',
  'nm-setting-generic.h',
  'nm-setting-gsm.h',
  'nm-setting.h',
  'nm-setting-infiniband.h',
  'nm-setting-ip4-config.h',
  'nm-setting-ip6-config.h',
  'nm-setting-olpc-mesh.h',
  'nm-setting-ppp.h',
  'nm-setting-pppoe.h',
  'nm-setting-serial.h',
  'nm-setting-team.h',
  'nm-setting-team-port.h',
  'nm-setting-vlan.h',
  'nm-setting-vpn.h',
  'nm-setting-wimax.h',
  'nm-setting-wired.h',
  'nm-setting-wireless.h',
  'nm-setting-wireless-security.h',
  'nm-utils.h',
  'nm-version.h'
)

headers = enums_headers + files(
  'NetworkManager.h',
  'NetworkManagerVPN.h'
)

install_headers(
  headers,
  subdir: nm_name
)

46
enum_types = 'nm-utils-enum-types'
47

48 49
libnm_utils_enum = gnome.mkenums(
  enum_types,
50 51
  sources: enums_headers,
  identifier_prefix: nm_id_prefix,
52 53
  c_template: enum_types + '.c.template',
  h_template: enum_types + '.h.template',
54 55 56 57
  install_header: true,
  install_dir: nm_pkgincludedir
)

58
sources = files(
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  'crypto.c',
  'nm-connection.c',
  'nm-param-spec-specialized.c',
  'nm-setting-8021x.c',
  'nm-setting-adsl.c',
  'nm-setting-bluetooth.c',
  'nm-setting-bridge.c',
  'nm-setting-bridge-port.c',
  'nm-setting-bond.c',
  'nm-setting.c',
  'nm-setting-cdma.c',
  'nm-setting-connection.c',
  'nm-setting-dcb.c',
  'nm-setting-generic.c',
  'nm-setting-gsm.c',
  'nm-setting-infiniband.c',
  'nm-setting-ip4-config.c',
  'nm-setting-ip6-config.c',
  'nm-setting-olpc-mesh.c',
  'nm-setting-ppp.c',
  'nm-setting-pppoe.c',
  'nm-setting-serial.c',
  'nm-setting-team.c',
  'nm-setting-team-port.c',
  'nm-setting-wimax.c',
  'nm-setting-wired.c',
  'nm-setting-wireless.c',
  'nm-setting-wireless-security.c',
  'nm-setting-vlan.c',
  'nm-setting-vpn.c',
  'nm-utils.c',
  'nm-value-transforms.c'
)
92
sources += shared_files_libnm_util
93 94 95 96

deps = [
  dbus_dep,
  dbus_glib_dep,
97
  shared_dep,
98 99 100
  uuid_dep
]

101 102 103 104 105
common_cflags = [
  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL',
]

cflags = common_cflags + [
106
  '-DG_LOG_DOMAIN="@0@"'.format(libnm_util_name)
107 108
]

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
if crypto_gnutls_dep.found()
  libnm_util_crypto_gnutls = static_library(
    'nm-util-crypto-gnutls',
    sources: [ 'crypto_gnutls.c' ],
    dependencies: deps + [ crypto_gnutls_dep ],
    c_args: cflags
  )
endif

if crypto_nss_dep.found()
  libnm_util_crypto_nss = static_library(
    'nm-util-crypto-nss',
    sources: [ 'crypto_nss.c' ],
    dependencies: deps + [ crypto_nss_dep ],
    c_args: cflags
  )
endif

if crypto == 'gnutls'
  libnm_util_crypto = libnm_util_crypto_gnutls
elif crypto == 'nss'
  libnm_util_crypto = libnm_util_crypto_nss
else
  error('bug')
endif

135
linker_script = join_paths(meson.current_source_dir(), 'libnm-util.ver')
136 137 138

libnm_util = shared_library(
  'nm-util',
139
  sources: sources + libnm_utils_enum,
140 141 142
  version: libnm_util_version,
  dependencies: deps,
  c_args: cflags,
143 144 145 146
  link_args: [
    '-Wl,--version-script,@0@'.format(linker_script),
  ],
  link_depends: linker_script,
147
  link_with: libnm_util_crypto,
148
  install: true
149 150 151
)

libnm_util_dep = declare_dependency(
152 153 154
  sources: libnm_utils_enum[1],
  include_directories: libnm_util_inc,
  link_with: libnm_util
155 156 157 158 159
)

pkg.generate(
  libraries: libnm_util,
  version: nm_version,
160
  name: libnm_util_name,
161
  description: 'Convenience library for clients of NetworkManager',
162
  filebase: libnm_util_name,
163 164
  subdirs: nm_name,
  requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
165
  variables: 'exec_prefix=${prefix}'
166 167 168
)

if enable_introspection
169
  gir_sources = sources + headers + libnm_utils_enum
170 171 172 173 174 175 176 177 178 179 180 181 182

  gir_includes = [
    'DBusGLib-1.0',
    'GObject-2.0'
  ]

  libnm_util_gir = gnome.generate_gir(
    libnm_util,
    sources: gir_sources,
    nsversion: nm_gir_version,
    namespace: nm_name,
    identifier_prefix: nm_id_prefix,
    symbol_prefix: nm_id_prefix.to_lower(),
183
    export_packages: libnm_util_name,
184
    includes: gir_includes,
185
    install: true
186 187 188
  )

  libnm_util_gir_dep = declare_dependency(
189 190
    sources: libnm_util_gir,
    link_with: libnm_util
191 192 193
  )
endif

194
test(
195
  'check-local-exports-' + libnm_util_name,
196 197
  check_exports,
  args: [libnm_util.full_path(), linker_script],
198 199 200 201 202 203 204
)

sources = files(
  'crypto.c',
)

deps = [
205
  shared_dep
206 207 208 209 210 211
]

libtest_crypto = static_library(
  'test-crypto',
  sources: sources,
  dependencies: deps,
212
  link_with: libnm_util_crypto,
213 214 215 216 217 218
  c_args: cflags
)

if enable_tests
  subdir('tests')
endif