149 lines
4.5 KiB
Meson
149 lines
4.5 KiB
Meson
|
project('desksanity', 'c',
|
||
|
version : '1.1.99',
|
||
|
license : 'BSD 2 clause',
|
||
|
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
|
||
|
meson_version : '>= 0.40.0')
|
||
|
|
||
|
add_global_arguments('-DHAVE_CONFIG_H=1', language: 'c')
|
||
|
dir_prefix = get_option('prefix')
|
||
|
dir_bin = join_paths(dir_prefix, get_option('bindir'))
|
||
|
dir_sysconf = get_option('sysconfdir')
|
||
|
dir_data = join_paths(dir_prefix, get_option('datadir'))
|
||
|
dir_include = join_paths(dir_prefix, get_option('includedir'))
|
||
|
dir_include_e = join_paths(dir_include, meson.project_name())
|
||
|
dir_lib = join_paths(dir_prefix, get_option('libdir'))
|
||
|
|
||
|
|
||
|
pkgconfig = import('pkgconfig')
|
||
|
cc = meson.get_compiler('c')
|
||
|
|
||
|
# disable for release builds
|
||
|
dev_cflags = []
|
||
|
dev_cflags_try = [
|
||
|
'-Wall',
|
||
|
'-W',
|
||
|
'-Wpointer-arith',
|
||
|
'-Wshadow',
|
||
|
'-Wno-missing-field-initializers',
|
||
|
'-Wfloat-equal',
|
||
|
'-Wuninitialized',
|
||
|
'-Wundef',
|
||
|
'-Wcast-align',
|
||
|
'-Wformat=2',
|
||
|
'-Wno-format-y2k',
|
||
|
]
|
||
|
|
||
|
foreach cf: dev_cflags_try
|
||
|
if cc.has_argument(cf) == true
|
||
|
dev_cflags += cf
|
||
|
endif
|
||
|
endforeach
|
||
|
add_global_arguments(dev_cflags, language: 'c')
|
||
|
|
||
|
release = 'ver-0.22'
|
||
|
host_os = host_machine.system()
|
||
|
if host_os == 'linux'
|
||
|
if cc.has_header_symbol('features.h', '__UCLIBC__')
|
||
|
host_os = 'linux-uclibc'
|
||
|
elif cc.has_header_symbol('features.h', '__dietlibc__')
|
||
|
host_os = 'linux-dietlibc'
|
||
|
else
|
||
|
host_os = 'linux-gnu'
|
||
|
endif
|
||
|
endif
|
||
|
|
||
|
module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
|
||
|
|
||
|
config_h = configuration_data()
|
||
|
config_h.set('_GNU_SOURCE' , '1')
|
||
|
config_h.set('_ALL_SOURCE' , '1')
|
||
|
config_h.set('_POSIX_PTHREAD_SEMANTICS', '1')
|
||
|
config_h.set('_TANDEM_SOURCE' , '1')
|
||
|
config_h.set('__EXTENSIONS__' , '1')
|
||
|
|
||
|
config_h.set_quoted('MODULE_ARCH' , module_arch)
|
||
|
config_h.set_quoted('PACKAGE' , meson.project_name())
|
||
|
config_h.set_quoted('PACKAGE_VERSION' , meson.project_version())
|
||
|
config_h.set_quoted('VERSION' , meson.project_version())
|
||
|
config_h.set_quoted('PACKAGE_NAME' , meson.project_name())
|
||
|
config_h.set_quoted('BINDIR' , dir_bin)
|
||
|
config_h.set_quoted('DATADIR' , dir_data)
|
||
|
|
||
|
if cc.has_function('setenv') == true
|
||
|
config_h.set('HAVE_SETENV' , '1')
|
||
|
endif
|
||
|
if cc.has_function('unsetenv') == true
|
||
|
config_h.set('HAVE_UNSETENV' , '1')
|
||
|
endif
|
||
|
if cc.has_function('clearenv') == true
|
||
|
config_h.set('HAVE_CLEARENV' , '1')
|
||
|
endif
|
||
|
if cc.has_header('features.h') == true
|
||
|
config_h.set('HAVE_FEATURES_H' , '1')
|
||
|
endif
|
||
|
if cc.has_header('sys/ptrace.h') == true
|
||
|
config_h.set('HAVE_SYS_PTRACE_H' , '1')
|
||
|
endif
|
||
|
if cc.has_header('arpa/inet.h') == true
|
||
|
config_h.set('HAVE_ARPA_INET_H' , '1')
|
||
|
endif
|
||
|
if cc.has_header('netinet/in.h') == true
|
||
|
config_h.set('HAVE_NETINET_IN_H' , '1')
|
||
|
endif
|
||
|
if cc.has_header('execinfo.h') == true
|
||
|
config_h.set('HAVE_EXECINFO_H' , '1')
|
||
|
elif cc.has_function('backtrace_symbols_fd', dependencies: 'execinfo') == false
|
||
|
execinfo_dep = dependency('execinfo', required: false)
|
||
|
endif
|
||
|
|
||
|
if cc.has_header('fnmatch.h') == false
|
||
|
error('fnmatch.h not found')
|
||
|
endif
|
||
|
|
||
|
if cc.has_function('fnmatch') == false
|
||
|
dep_fnmatch = dependency('fnmatch', required: true)
|
||
|
endif
|
||
|
|
||
|
add_global_arguments('-DPACKAGE_BIN_DIR="@0@"'.format(dir_bin), language: 'c')
|
||
|
add_global_arguments('-DPACKAGE_LIB_DIR="@0@"'.format(dir_lib), language: 'c')
|
||
|
add_global_arguments('-DPACKAGE_DATA_DIR="@0@"'.format(join_paths(dir_data, meson.project_name())), language: 'c')
|
||
|
add_global_arguments('-DPACKAGE_SYSCONF_DIR="@0@"'.format(dir_sysconf), language: 'c')
|
||
|
|
||
|
dep_efl_wl = dependency('efl-wl', required: false)
|
||
|
dep_e = dependency('enlightenment')
|
||
|
|
||
|
dir_module_e = join_paths([dep_e.get_pkgconfig_variable('modules'), 'desksanity'])
|
||
|
edje_cc = find_program('edje_cc')
|
||
|
|
||
|
install_data(['e-module-desksanity.edj', 'module.desktop'],
|
||
|
install_dir: dir_module_e)
|
||
|
|
||
|
build_files = [
|
||
|
'src/e_mod_main.h',
|
||
|
'src/e_mod_main.c',
|
||
|
'src/ds_config.c',
|
||
|
'src/maximize.c',
|
||
|
'src/moveresize.c',
|
||
|
'src/pip.c',
|
||
|
'src/zoom.c',
|
||
|
'src/magnify.c',
|
||
|
'src/desksanity.c'
|
||
|
]
|
||
|
|
||
|
configure_file(output : 'config.h',
|
||
|
install : false,
|
||
|
configuration: config_h)
|
||
|
|
||
|
if dep_efl_wl.found() == true
|
||
|
build_files += 'src/runner.c'
|
||
|
endif
|
||
|
|
||
|
shared_module('desksanity', build_files,
|
||
|
include_directories: include_directories(['src']),
|
||
|
name_prefix: '',
|
||
|
dependencies: [dep_e, dep_efl_wl],
|
||
|
install_dir: join_paths([dir_module_e, module_arch]),
|
||
|
install: true)
|
||
|
|
||
|
meson.add_install_script('meson_modules.sh', join_paths([dir_module_e, module_arch, 'desksanity.so']))
|