xserver-multidpi/os/meson.build

109 lines
2.5 KiB
Meson
Raw Normal View History

srcs_os = [
'WaitFor.c',
'access.c',
'auth.c',
'backtrace.c',
'client.c',
'connection.c',
'inputthread.c',
'io.c',
'mitauth.c',
'oscolor.c',
'osinit.c',
'ospoll.c',
'utils.c',
'xdmauth.c',
'xsha1.c',
'xstrans.c',
'xprintf.c',
'log.c',
]
# Wrapper code for missing C library functions. Note that conf_data contains either '1' or false.
srcs_libc = []
if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0
srcs_libc += 'reallocarray.c'
endif
if conf_data.get('HAVE_STRCASECMP').to_int() == 0
srcs_libc += 'strcasecmp.c'
endif
if conf_data.get('HAVE_STRCASESTR').to_int() == 0
srcs_libc += 'strcasestr.c'
endif
if conf_data.get('HAVE_STRLCAT').to_int() == 0
srcs_libc += 'strlcat.c'
endif
if conf_data.get('HAVE_STRLCPY').to_int() == 0
srcs_libc += 'strlcpy.c'
endif
if conf_data.get('HAVE_STRNDUP').to_int() == 0
srcs_libc += 'strndup.c'
endif
if conf_data.get('HAVE_TIMINGSAFE_MEMCMP').to_int() == 0
srcs_libc += 'timingsafe_memcmp.c'
endif
if conf_data.get('HAVE_POLL').to_int() == 0
srcs_os += 'xserver_poll.c'
endif
if conf_data.get('BUSFAULT').to_int() != 0
srcs_os += 'busfault.c'
endif
if get_option('xdmcp')
srcs_os += 'xdmcp.c'
endif
rpc_dep = []
if get_option('secure-rpc')
# prefer libtirpc (if available), otherwise ensure RPC functions are
# provided by libc.
rpc_dep = dependency('libtirpc', required: false)
if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
endif
# XXX: also check if RPC library provides xdr_opaque_auth, authdes_(sec)create ???
srcs_os += 'rpcauth.c'
endif
os_dep = []
os_c_args = []
if get_option('xres')
# Only the XRes extension cares about the client ID.
os_c_args += '-DCLIENTIDS'
if host_machine.system() == 'openbsd'
os_dep += cc.find_library('kvm')
endif
endif
libxlibc = []
if srcs_libc.length() > 0
libxlibc = static_library('libxlibc',
srcs_libc,
include_directories: inc,
meson: Remove usage of pkg-config --variable=includedir Querying a pkg-config variable using the --variable option produces the value of the given variable as stored in the pkg-config file and should not be used to add directories to the include search path. The reason for this is that it breaks cross-compilation, because header files are installed relative to the host sysroot. pkg-config supports a PKG_CONFIG_SYSROOT_DIR environment variable that points to this sysroot and will prepend that to the path of directories in -I or -L options in pkg-config's Cflags, Libs or Libs.private keywords. However, because no context can be inferred from variable names, as opposed to the keywords with fixed meaning, the sysroot path will not be prepended to them. The build system is responsible for doing so if necessary since it is aware of the context in which the variable is used. Adding the include directory returned by pkg-config to the include path leaks build system information into the cross-build and break with very confusing errors such as this: In file included from include/misc.h:82:0, from dix/atom.c:55: /usr/include/pthread.h:682:6: warning: '__regparm__' attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ or this: In file included from include/misc.h:139:0, from dix/atom.c:55: /usr/include/stdlib.h:133:8: error: '_Float128' is not supported on this target extern _Float128 strtof128 (const char *__restrict __nptr, ^~~~~~~~~ Fix this by replacing the include directory with the appropriate xproto dependency required to add the correct include directory to the compile command for subdirectories that are missing the dependency. As detailed above, this gives pkg-config the opportunity to prepend the sysroot for all paths in -I compiler options. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-03-29 13:07:54 +02:00
dependencies: [
xproto_dep,
],
)
endif
if enable_input_thread
os_dep += cc.find_library('pthread')
endif
libxserver_os = static_library('libxserver_os',
srcs_os,
include_directories: inc,
dependencies: [
2019-08-27 21:54:42 +02:00
dtrace_dep,
common_dep,
dl_dep,
sha1_dep,
rpc_dep,
os_dep,
dependency('xau')
],
c_args: os_c_args,
link_with: libxlibc,
)