meson.build 4.01 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 92
  'crypto.c',
  'crypto_' + 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'
)
93
sources += shared_files_libnm_util
94 95 96 97 98

deps = [
  crypto_dep,
  dbus_dep,
  dbus_glib_dep,
99
  shared_dep,
100 101 102
  uuid_dep
]

103 104 105 106 107
common_cflags = [
  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL',
]

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

111
linker_script = join_paths(meson.current_source_dir(), 'libnm-util.ver')
112 113 114

libnm_util = shared_library(
  'nm-util',
115
  sources: sources + libnm_utils_enum,
116 117 118
  version: libnm_util_version,
  dependencies: deps,
  c_args: cflags,
119 120 121 122
  link_args: [
    '-Wl,--version-script,@0@'.format(linker_script),
  ],
  link_depends: linker_script,
123
  install: true
124 125 126
)

libnm_util_dep = declare_dependency(
127 128 129
  sources: libnm_utils_enum[1],
  include_directories: libnm_util_inc,
  link_with: libnm_util
130 131 132 133 134
)

pkg.generate(
  libraries: libnm_util,
  version: nm_version,
135
  name: libnm_util_name,
136
  description: 'Convenience library for clients of NetworkManager',
137
  filebase: libnm_util_name,
138 139
  subdirs: nm_name,
  requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
140
  variables: 'exec_prefix=${prefix}'
141 142 143
)

if enable_introspection
144
  gir_sources = sources + headers + libnm_utils_enum
145 146 147 148 149 150 151 152 153 154 155 156 157

  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(),
158
    export_packages: libnm_util_name,
159
    includes: gir_includes,
160
    install: true
161 162 163
  )

  libnm_util_gir_dep = declare_dependency(
164 165
    sources: libnm_util_gir,
    link_with: libnm_util
166 167 168
  )
endif

169
test(
170
  'check-local-exports-' + libnm_util_name,
171 172
  check_exports,
  args: [libnm_util.full_path(), linker_script],
173 174 175 176 177 178 179 180 181
)

sources = files(
  'crypto.c',
  'crypto_' + crypto + '.c'
)

deps = [
  crypto_dep,
182
  shared_dep
183 184 185 186 187 188 189 190 191 192 193 194
]

libtest_crypto = static_library(
  'test-crypto',
  sources: sources,
  dependencies: deps,
  c_args: cflags
)

if enable_tests
  subdir('tests')
endif