meson.build 2.1 KB
Newer Older
1
headers = files(
2 3
  'gepub-archive.h',
  'gepub-doc.h',
4 5
  'gepub-text-chunk.h',
  'gepub-widget.h',
6
  'gepub.h'
7
)
8 9 10 11 12 13

install_headers(
  headers,
  subdir: gepub_pkgincludedir
)

14
private_headers = files(
15
  'gepub-utils.h'
16
)
17

18
sources = files(
19 20
  'gepub-archive.c',
  'gepub-doc.c',
21 22 23 24
  'gepub-text-chunk.c',
  'gepub-utils.c',
  'gepub-widget.c'
)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

ldflags = [
  '-no-undefined',
  '-export-symbols-regex "^gepub_*"'
]

gepub_ldflags = []

if host_machine.system().contains('linux')
  foreach ldflag: ldflags
    if cc.has_argument(ldflag)
      gepub_ldflags += ldflag
    endif
  endforeach
endif

41 42 43 44 45 46 47 48 49 50 51
libgepub = library(
  'gepub',
  sources: sources,
  version: libversion,
  soversion: soversion,
  include_directories: top_inc,
  dependencies: gepub_deps,
  link_args: gepub_ldflags,
  install: true,
  install_dir: gepub_libdir
)
52 53 54 55

libgepub_dep = declare_dependency(
  link_with: libgepub,
  include_directories: include_directories('.'),
56
  dependencies: gepub_deps
57 58 59 60 61 62 63 64 65 66 67 68 69
)

pkg.generate(
  libraries: libgepub,
  version: gepub_version,
  name: meson.project_name(),
  description: 'epub Documents library',
  filebase: meson.project_name(),
  subdirs: meson.project_name(),
  requires: 'gio-2.0',
  requires_private: [
    'libxml-2.0',
    'libarchive'
70 71 72 73 74
  ],
  variables: [
    'exec_prefix=' + gepub_libexecdir
  ],
  install_dir: join_paths(gepub_libdir, 'pkgconfig')
75 76
)

77
if get_option('enable-introspection') and get_option('default_library') == 'shared'
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
  gir_inc = [
    'GObject-2.0',
    'libxml2-2.0',
    'WebKit2-4.0'
  ]

  gir_extra_args = [
    '--warn-all'
  ]

  gir_dir = join_paths(gepub_datadir, '@0@-@1@'.format('gir', gepub_gir_version))
  typelib_dir = join_paths(gepub_libdir, '@0@-@1@'.format('girepository', gepub_gir_version))

  gnome.generate_gir(
    libgepub,
    sources: sources + headers + private_headers,
    namespace: gepub_gir_ns,
    nsversion: gepub_version,
    identifier_prefix: gepub_gir_ns,
    symbol_prefix: gepub_gir_ns.to_lower(),
    includes: gir_inc,
    include_directories: top_inc,
    install: true,
    install_dir_gir: gir_dir,
    install_dir_typelib: typelib_dir,
    extra_args: gir_extra_args
  )
endif