Commit 1e9d9afd authored by Iñigo Martínez's avatar Iñigo Martínez Committed by Daniel García Moreno

Updated meson build system port

A few changes have been made which are as follows:
- The variable holding config.h data has been renamed to config_h.
- libexecdir has been added which is used on the pkgconfig file.
- test-gepub is not considered an unattended test anymore and the
  build file has been simplified.
- meson required version has been raised to 0.41.0.

https://bugzilla.gnome.org/show_bug.cgi?id=783735
parent c1fc28a9
headers = [ headers = files(
'gepub-widget.h',
'gepub-archive.h', 'gepub-archive.h',
'gepub-text-chunk.h',
'gepub-doc.h', 'gepub-doc.h',
'gepub-text-chunk.h',
'gepub-widget.h',
'gepub.h' 'gepub.h'
] )
install_headers( install_headers(
headers, headers,
subdir: gepub_pkgincludedir subdir: gepub_pkgincludedir
) )
private_headers = [ private_headers = files(
'gepub-utils.h' 'gepub-utils.h'
] )
sources = [ sources = files(
'gepub-widget.c',
'gepub-archive.c', 'gepub-archive.c',
'gepub-text-chunk.c',
'gepub-doc.c', 'gepub-doc.c',
'gepub-utils.c' 'gepub-text-chunk.c',
] 'gepub-utils.c',
'gepub-widget.c'
)
ldflags = [ ldflags = [
'-no-undefined', '-no-undefined',
...@@ -38,36 +38,22 @@ if host_machine.system().contains('linux') ...@@ -38,36 +38,22 @@ if host_machine.system().contains('linux')
endforeach endforeach
endif endif
libtype = get_option('default_library') libgepub = library(
'gepub',
if libtype == 'static' sources: sources,
libgepub = static_library( version: libversion,
'gepub', soversion: soversion,
sources: sources + headers + private_headers, include_directories: top_inc,
include_directories: top_inc, dependencies: gepub_deps,
dependencies: gepub_dep, link_args: gepub_ldflags,
link_args: gepub_ldflags, install: true,
install: true, install_dir: gepub_libdir
install_dir: gepub_libdir )
)
else
libgepub = shared_library(
'gepub',
sources: sources + headers + private_headers,
version: libversion,
soversion: soversion,
include_directories: top_inc,
dependencies: gepub_dep,
link_args: gepub_ldflags,
install: true,
install_dir: gepub_libdir
)
endif
libgepub_dep = declare_dependency( libgepub_dep = declare_dependency(
link_with: libgepub, link_with: libgepub,
include_directories: include_directories('.'), include_directories: include_directories('.'),
dependencies: gepub_dep dependencies: gepub_deps
) )
pkg.generate( pkg.generate(
...@@ -81,10 +67,14 @@ pkg.generate( ...@@ -81,10 +67,14 @@ pkg.generate(
requires_private: [ requires_private: [
'libxml-2.0', 'libxml-2.0',
'libarchive' 'libarchive'
] ],
variables: [
'exec_prefix=' + gepub_libexecdir
],
install_dir: join_paths(gepub_libdir, 'pkgconfig')
) )
if get_option('enable-introspection') and libtype == 'shared' if get_option('enable-introspection') and get_option('default_library') == 'shared'
gir_inc = [ gir_inc = [
'GObject-2.0', 'GObject-2.0',
'libxml2-2.0', 'libxml2-2.0',
......
...@@ -7,7 +7,7 @@ project( ...@@ -7,7 +7,7 @@ project(
'c_std=gnu99', 'c_std=gnu99',
'warning_level=1' 'warning_level=1'
], ],
meson_version: '>= 0.38.1' meson_version: '>= 0.41.0'
) )
gepub_version = meson.project_version() gepub_version = meson.project_version()
...@@ -21,6 +21,7 @@ gepub_gir_version = '1.0' ...@@ -21,6 +21,7 @@ gepub_gir_version = '1.0'
gepub_prefix = get_option('prefix') gepub_prefix = get_option('prefix')
gepub_datadir = join_paths(gepub_prefix, get_option('datadir')) gepub_datadir = join_paths(gepub_prefix, get_option('datadir'))
gepub_libdir = join_paths(gepub_prefix, get_option('libdir')) gepub_libdir = join_paths(gepub_prefix, get_option('libdir'))
gepub_libexecdir = join_paths(gepub_prefix, get_option('libexecdir'))
gepub_includedir = join_paths(gepub_prefix, get_option('includedir')) gepub_includedir = join_paths(gepub_prefix, get_option('includedir'))
gepub_pkgincludedir = join_paths(gepub_includedir, meson.project_name()) gepub_pkgincludedir = join_paths(gepub_includedir, meson.project_name())
...@@ -32,30 +33,30 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision) ...@@ -32,30 +33,30 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
conf = configuration_data() config_h = configuration_data()
# package # package
conf.set_quoted('PACKAGE', meson.project_name()) config_h.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_BUGREPORT', 'danigm@wadobo.com') config_h.set_quoted('PACKAGE_BUGREPORT', 'danigm@wadobo.com')
conf.set_quoted('PACKAGE_NAME', meson.project_name()) config_h.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gepub_version)) config_h.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gepub_version))
conf.set_quoted('PACKAGE_TARNAME', meson.project_name()) config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
conf.set_quoted('PACKAGE_URL', '') config_h.set_quoted('PACKAGE_URL', '')
conf.set_quoted('PACKAGE_VERSION', gepub_version) config_h.set_quoted('PACKAGE_VERSION', gepub_version)
conf.set_quoted('PACKAGE_API_VERSION', gepub_version) config_h.set_quoted('PACKAGE_API_VERSION', gepub_version)
conf.set_quoted('VERSION', gepub_version) config_h.set_quoted('VERSION', gepub_version)
# headers # headers
conf.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h')) config_h.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h'))
conf.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h')) config_h.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h'))
conf.set('HAVE_MEMORY_H', cc.has_header('memory.h')) config_h.set('HAVE_MEMORY_H', cc.has_header('memory.h'))
conf.set('HAVE_STDINT_H', cc.has_header('stdint.h')) config_h.set('HAVE_STDINT_H', cc.has_header('stdint.h'))
conf.set('HAVE_STDLIB_H', cc.has_header('stdlib.h')) config_h.set('HAVE_STDLIB_H', cc.has_header('stdlib.h'))
conf.set('HAVE_STRINGS_H', cc.has_header('strings.h')) config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
conf.set('HAVE_STRING_H', cc.has_header('string.h')) config_h.set('HAVE_STRING_H', cc.has_header('string.h'))
conf.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h')) config_h.set('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h'))
conf.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h')) config_h.set('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h'))
conf.set('HAVE_UNISTD_H', cc.has_header('unistd.h')) config_h.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
# Compiler flags # Compiler flags
test_cflags = [ test_cflags = [
...@@ -107,9 +108,9 @@ foreach cflag: test_cflags ...@@ -107,9 +108,9 @@ foreach cflag: test_cflags
endif endif
endforeach endforeach
add_global_arguments(common_flags, language: 'c') add_project_arguments(common_flags, language: 'c')
gepub_dep = [ gepub_deps = [
dependency('webkit2gtk-4.0'), dependency('webkit2gtk-4.0'),
dependency('libsoup-2.4'), dependency('libsoup-2.4'),
dependency('glib-2.0'), dependency('glib-2.0'),
...@@ -120,8 +121,8 @@ gepub_dep = [ ...@@ -120,8 +121,8 @@ gepub_dep = [
] ]
configure_file( configure_file(
output : 'config.h', output: 'config.h',
configuration : conf configuration: config_h
) )
gnome = import('gnome') gnome = import('gnome')
......
gepub_tests = [ test_gepub = 'test-gepub'
'test-gepub'
]
gepub_test_dep = [ executable(
gepub_dep, test_gepub,
libgepub_dep, test_gepub + '.c',
dependency('gtk+-3.0') include_directories: top_inc,
] dependencies: [
libgepub_dep,
foreach gepub_test: gepub_tests dependency('gtk+-3.0')
exe = executable( ]
gepub_test, )
'@0@.c'.format(gepub_test),
include_directories: top_inc,
dependencies: gepub_test_dep
)
test(gepub_test, exe)
endforeach
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment