Find dependencies at the top

This commit is contained in:
Theodore Dubois 2017-10-29 18:10:27 -07:00
parent 831528ae92
commit 37d0d3f337

View File

@ -17,6 +17,24 @@ endif
includes = [include_directories('.')]
cc = meson.get_compiler('c')
threads = dependency('threads')
librt = cc.find_library('rt', required: false)
softfloat = subproject('softfloat').get_variable('softfloat_dep')
# this is annoying af
if host_machine.system() == 'darwin'
# no need to link to anything, berkeley db and its ndbm shim is part of the C library
dbm = []
elif host_machine.system() == 'linux'
# we're going to use gdbm
dbm = [cc.find_library('gdbm'), cc.find_library('gdbm_compat')]
if not cc.has_header('ndbm.h') and cc.has_header('gdbm-ndbm.h')
# slight problem: on debian the header is called gdbm-ndbm.h for some reason
add_global_arguments('-DGDBM_NDBM=1', language: 'c')
endif
endif
subdir('vdso') # ish depends on the vdso
cify = executable('tools/cify', ['tools/cify.c'], native: true)
@ -72,24 +90,6 @@ src = [
cified_vdso,
]
cc = meson.get_compiler('c')
threads = dependency('threads')
librt = cc.find_library('rt', required: false)
softfloat = subproject('softfloat').get_variable('softfloat_dep')
# this is annoying af
if host_machine.system() == 'darwin'
# no need to link to anything, berkeley db and its ndbm shim is part of the C library
dbm = []
elif host_machine.system() == 'linux'
# we're going to use gdbm
dbm = [cc.find_library('gdbm'), cc.find_library('gdbm_compat')]
if not cc.has_header('ndbm.h') and cc.has_header('gdbm-ndbm.h')
# slight problem: on debian the header is called gdbm-ndbm.h for some reason
add_global_arguments('-DGDBM_NDBM=1', language: 'c')
endif
endif
libish = library('ish', src,
include_directories: includes,
dependencies: [librt, threads, softfloat, dbm])