1# SPDX-License-Identifier: LGPL-2.1-or-later 2# Copyright (C) 2021 Iñigo Martinez <inigomartinez@gmail.com> 3 4project( 5 'gnome-autoar', 'c', 6 version: '0.4.1', 7 license: 'LGPL2.1+', 8 default_options: 'buildtype=debugoptimized', 9 meson_version: '>= 0.56.0', 10) 11 12gnome_autoar_name = meson.project_name() 13 14gnome_autoar_version = meson.project_version() 15version_array = gnome_autoar_version.split('.') 16gnome_autoar_major_version = version_array[0].to_int() 17gnome_autoar_minor_version = version_array[1].to_int() 18gnome_autoar_micro_version = version_array[2].to_int() 19 20# Before making a release, the libversion string should be modified. 21# 22# * Bump the first component if binary compatibility has been broken; or 23# * Bump the second component if new APIs are added; or 24# * Bump the third component otherwise. 25# 26# When bumping the first component version, set the second and third components 27# to 0. When bumping the second version, set the third one to zero. 28gnome_autoar_libversion = '0.1.1' 29 30gnome_autoar_api_version = 0 31 32gnome_autoar_api_prefix = 'Autoar' 33gnome_autoar_api_ns_version = '0.1' 34 35gnome_autoar_prefix = get_option('prefix') 36gnome_autoar_datadir = get_option('datadir') 37gnome_autoar_includedir = get_option('includedir') 38 39gnome = import('gnome') 40pkg = import('pkgconfig') 41 42source_root = meson.current_source_dir() 43 44top_inc = include_directories('.') 45 46cc = meson.get_compiler('c') 47 48config_h = configuration_data() 49 50# functions 51check_functions = [ 52 'getgrnam', 53 'getpwnam', 54 'link', 55 'mkfifo', 56 'mknod', 57 'stat', 58] 59 60foreach func: check_functions 61 config_h.set('HAVE_' + func.to_upper(), cc.has_function(func)) 62endforeach 63 64common_flags = ['-DHAVE_CONFIG_H'] 65 66compiler_flags = [] 67if get_option('buildtype').contains('debug') 68 compiler_flags += cc.get_supported_arguments([ 69 '-Werror=format=2', 70 '-Werror=implicit-function-declaration', 71 '-Werror=init-self', 72 '-Werror=missing-prototypes', 73 '-Werror=missing-include-dirs', 74 '-Werror=pointer-arith', 75 '-Werror=return-type', 76 '-Wnested-externs', 77 '-Wstrict-prototypes', 78 ]) 79endif 80 81add_project_arguments(common_flags + compiler_flags, language: 'c') 82 83glib_req_version = '>= 2.35.6' 84gio_dep = dependency('gio-2.0', version: glib_req_version) 85glib_dep = dependency('glib-2.0', version: glib_req_version) 86gobject_dep = dependency('gobject-2.0', version: glib_req_version) 87 88libarchive_dep = dependency('libarchive', version: '>= 3.4.0') 89if not libarchive_dep.found() 90 libarchive_dep = cc.find_library('archive') 91 cc.has_function('archive_entry_is_encrypted', dependencies: libarchive_dep) 92endif 93 94gtk_req_version = '>= 3.2' 95gtk_dep = dependency( 96 'gtk+-3.0', 97 version: gtk_req_version, 98 required: get_option('gtk'), 99 not_found_message: 'GTK+ support requested but gtk+-3.0 @0@ could not be found'.format(gtk_req_version), 100) 101enable_gtk = gtk_dep.found() 102 103enable_introspection = dependency('gobject-introspection-1.0', version: '>= 1.30.0', required: get_option('introspection')).found() 104 105enable_vapi = get_option('vapi') 106assert(not enable_vapi or enable_introspection, 'GObject introspection support must be enabled to build VALA bindings') 107 108subdir('gnome-autoar') 109 110enable_tests = get_option('tests') 111if enable_tests 112 subdir('tests') 113endif 114 115enable_gtk_doc = get_option('gtk_doc') 116if enable_gtk_doc 117 assert(enable_gtk, 'GTK+ widgets support must be enabled to build API documentation.') 118 subdir('docs/reference') 119endif 120 121configure_file( 122 output: 'config.h', 123 configuration: config_h, 124) 125 126summary( 127 { 128 'Source code location': source_root, 129 'Prefix': gnome_autoar_prefix, 130 'Compiler': cc.get_id(), 131 'CFLAGS': compiler_flags, 132 }, 133 section: 'Configuration', 134) 135summary( 136 { 137 'Build API documentation': enable_gtk_doc, 138 'GTK+ widgets': enable_gtk, 139 'Introspection': enable_introspection, 140 'VALA bindings': enable_vapi, 141 'Tests': enable_tests, 142 }, 143 section: 'Optional features', 144) 145