meson build - do a little tidying of the main meson.build in root

this will need further work. i want to try and trim this down as much
as i can and make it easy to read/follow and see mistakes (thus the
aligning or afgs in many places)
This commit is contained in:
Carsten Haitzler 2017-07-30 17:35:24 +09:00
parent 6ab9c576df
commit c87d70eb9a
1 changed files with 294 additions and 291 deletions

View File

@ -1,19 +1,22 @@
##### project
project('enlightenment', 'c', project('enlightenment', 'c',
version : '0.21.99', version : '0.21.99',
license : 'BSD 2 clause', license : 'BSD 2 clause',
default_options: [ 'c_std=gnu99', 'warning_level=2' ], default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version : '>= 0.40.0') meson_version : '>= 0.40.0')
##### convenience variables for later
proj = meson.project_name() proj = meson.project_name()
ver = meson.project_version() ver = meson.project_version()
chmod = join_paths(meson.source_root(), 'meson-chmod.sh') chmod = join_paths(meson.source_root(), 'meson-chmod.sh')
#### check for mixed autofoo and meson build tree mess
clean_check = run_command('meson/clean_check.sh') clean_check = run_command('meson/clean_check.sh')
if clean_check.returncode() == 0 if clean_check.returncode() == 0
error('Meson build requires a clean source tree') error('Meson build requires a clean source tree')
endif endif
e_version = meson.project_version().split('.') e_version = ver.split('.')
git_version = '0' git_version = '0'
git = find_program('git') git = find_program('git')
if git.found() == true if git.found() == true
@ -22,7 +25,8 @@ if git.found() == true
git_version = git_cmd.stdout().strip() git_version = git_cmd.stdout().strip()
endif endif
endif endif
e_version_rev = '.'.join([meson.project_version(), git_version])
e_version_rev = '.'.join([ver, git_version])
#e_version_rev = e_version #e_version_rev = e_version
efl_version = '>= 1.19.99' efl_version = '>= 1.19.99'
@ -95,6 +99,7 @@ if darwin == true
config_h.set('HAVE_ENVIRON', '1') config_h.set('HAVE_ENVIRON', '1')
endif endif
endif endif
openbsd = host_machine.system().startswith('openbsd') openbsd = host_machine.system().startswith('openbsd')
netbsd = host_machine.system().startswith('netbsd') netbsd = host_machine.system().startswith('netbsd')
freebsd = host_machine.system().startswith('freebsd') freebsd = host_machine.system().startswith('freebsd')
@ -123,24 +128,17 @@ if host_os == 'linux'
endif endif
module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release) module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
config_h.set_quoted('MODULE_ARCH', module_arch)
config_h.set_quoted('MODULE_ARCH' , module_arch)
config_h.set_quoted('PACKAGE' , proj) config_h.set_quoted('PACKAGE' , proj)
config_h.set_quoted('PACKAGE_VERSION' , e_version_rev) config_h.set_quoted('PACKAGE_VERSION' , e_version_rev)
config_h.set_quoted('VERSION' , e_version_rev) config_h.set_quoted('VERSION' , e_version_rev)
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, proj)), language: 'c')
add_global_arguments('-DPACKAGE_SYSCONF_DIR="@0@"'.format(dir_sysconf), language: 'c')
config_h.set_quoted('LOCALE_DIR' , join_paths([dir_prefix, 'share/locale'])) config_h.set_quoted('LOCALE_DIR' , join_paths([dir_prefix, 'share/locale']))
config_h.set_quoted('PACKAGE_URL' , 'https://www.enlightenment.org') config_h.set_quoted('PACKAGE_URL' , 'https://www.enlightenment.org')
config_h.set_quoted('PACKAGE_TARNAME' , proj) config_h.set_quoted('PACKAGE_TARNAME' , proj)
config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net') config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net')
config_h.set_quoted('PACKAGE_STRING' , proj + ' ' + e_version_rev) config_h.set_quoted('PACKAGE_STRING' , proj + ' ' + e_version_rev)
config_h.set_quoted('PACKAGE_NAME' , proj) config_h.set_quoted('PACKAGE_NAME' , proj)
config_h.set_quoted('BINDIR' , dir_bin) config_h.set_quoted('BINDIR' , dir_bin)
config_h.set_quoted('DATADIR' , dir_data) config_h.set_quoted('DATADIR' , dir_data)
@ -167,19 +165,23 @@ if cc.has_header('netinet/in.h') == true
endif endif
if cc.has_header('execinfo.h') == true if cc.has_header('execinfo.h') == true
config_h.set('HAVE_EXECINFO_H' , '1') config_h.set('HAVE_EXECINFO_H' , '1')
else elif cc.has_function('backtrace_symbols_fd', dependencies: 'execinfo') == false
if cc.has_function('backtrace_symbols_fd', dependencies: 'execinfo') == false
execinfo_dep = dependency('execinfo', required: false) execinfo_dep = dependency('execinfo', required: false)
endif endif
endif
if cc.has_header('fnmatch.h') == false if cc.has_header('fnmatch.h') == false
error('fnmatch.h not found') error('fnmatch.h not found')
endif endif
if cc.has_function('fnmatch') == false if cc.has_function('fnmatch') == false
dep_fnmatch = dependency('fnmatch', required: true) dep_fnmatch = dependency('fnmatch', required: true)
endif 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, proj)), language: 'c')
add_global_arguments('-DPACKAGE_SYSCONF_DIR="@0@"'.format(dir_sysconf), language: 'c')
if cc.has_header('CFBase.h', if cc.has_header('CFBase.h',
args: '-I/System/Library/Frameworks/CoreFoundation.framework/Headers') == true args: '-I/System/Library/Frameworks/CoreFoundation.framework/Headers') == true
add_global_arguments('-I/System/Library/Frameworks/CoreFoundation.framework/Headers', language: 'c') add_global_arguments('-I/System/Library/Frameworks/CoreFoundation.framework/Headers', language: 'c')
@ -187,7 +189,6 @@ if cc.has_header('CFBase.h',
add_global_link_arguments('-framework CoreFoundation', '-framework IOKit') add_global_link_arguments('-framework CoreFoundation', '-framework IOKit')
endif endif
if get_option('pam') == true if get_option('pam') == true
if cc.has_header('security/pam_appl.h') if cc.has_header('security/pam_appl.h')
config_h.set('HAVE_PAM', '1') config_h.set('HAVE_PAM', '1')
@ -278,7 +279,6 @@ if cc.has_function('eeze_disk_function', dependencies: dependency('eeze')) == tr
eeze_mount = true eeze_mount = true
endif endif
if get_option('files') == true if get_option('files') == true
config_h.set('ENABLE_FILES', '1') config_h.set('ENABLE_FILES', '1')
endif endif
@ -306,7 +306,7 @@ if get_option('mount-eeze') == true
endif endif
dep_rt = cc.find_library('rt', required: false) dep_rt = cc.find_library('rt', required: false)
dep_eina = dependency('eina', version: efl_version, required: true) dep_eina = dependency('eina' , required: true, version: efl_version)
dep_eet = dependency('eet' , required: true) dep_eet = dependency('eet' , required: true)
dep_ecore = dependency('ecore' , required: true) dep_ecore = dependency('ecore' , required: true)
dep_ecore_ipc = dependency('ecore-ipc' , required: true) dep_ecore_ipc = dependency('ecore-ipc' , required: true)
@ -331,8 +331,7 @@ if get_option('wayland') == true
wayland_protocols = dependency('wayland-protocols', version: '>= 1.7') wayland_protocols = dependency('wayland-protocols', version: '>= 1.7')
dir_wayland_protocols = wayland_protocols.get_pkgconfig_variable('pkgdatadir') dir_wayland_protocols = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
wayland_version = '>= 1.11.0' wayland_version = '>= 1.11.0'
dep_wayland = [ dep_wayland = [ dependency('ecore-wl2'),
dependency('ecore-wl2'),
dependency('wayland-server' , version: wayland_version), dependency('wayland-server' , version: wayland_version),
dependency('wayland-client' , version: wayland_version), dependency('wayland-client' , version: wayland_version),
wayland_protocols, wayland_protocols,
@ -346,8 +345,7 @@ if get_option('wayland') == true
requires_drm = 'ecore-drm2' requires_drm = 'ecore-drm2'
dep_wayland += dep_ecore_drm2 dep_wayland += dep_ecore_drm2
endif endif
requires_wayland = ' '.join([ requires_wayland = ' '.join([ 'wayland-protocols >= 1.7',
'wayland-protocols >= 1.7',
'ecore-wl2', 'ecore-wl2',
requires_drm, requires_drm,
' '.join(['wayland-server' , wayland_version]), ' '.join(['wayland-server' , wayland_version]),
@ -423,9 +421,12 @@ subdir('doc')
meson.add_install_script('meson/meson_inst.sh' , suid_exes) meson.add_install_script('meson/meson_inst.sh' , suid_exes)
meson.add_install_script('meson/meson_modules.sh', module_files) meson.add_install_script('meson/meson_modules.sh', module_files)
configure_file(output: 'config.h', install: false, configuration: config_h)
pkgconfig.generate( configure_file(output : 'config.h',
name: proj, install : false,
configuration: config_h)
pkgconfig.generate(name : proj,
description : 'Enlightenment Window Manager', description : 'Enlightenment Window Manager',
filebase : proj, filebase : proj,
subdirs : proj, subdirs : proj,
@ -434,8 +435,7 @@ pkgconfig.generate(
version : e_version_rev, version : e_version_rev,
libraries_private: '-lm', libraries_private: '-lm',
install_dir : dir_pkgconfig, install_dir : dir_pkgconfig,
variables: [ variables : [ 'exec_prefix=${prefix}',
'exec_prefix=${prefix}',
'datarootdir=@0@'.format(dir_data), 'datarootdir=@0@'.format(dir_data),
'datadir=${datarootdir}', 'datadir=${datarootdir}',
'modules=@0@/enlightenment/modules'.format(dir_lib), 'modules=@0@/enlightenment/modules'.format(dir_lib),
@ -446,4 +446,7 @@ pkgconfig.generate(
] ]
) )
install_data(['AUTHORS', 'COPYING'], install_dir: join_paths(dir_data, 'enlightenment')) install_data([ 'AUTHORS',
'COPYING'
],
install_dir: join_paths(dir_data, 'enlightenment'))