diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-08-26 15:32:04 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-08-26 15:32:04 +0100 |
commit | 0c8970576eee9580603bd1d97d1f46dfd7f964fa (patch) | |
tree | 070322149691af21deea036877de470aed8f6c8e | |
parent | ffb70dce4ec24d66d682a2ea3d2743f3eb384f95 (diff) | |
parent | d7f6ff441a72196ab849856609cf92c523aeb7b1 (diff) |
Merge branch 'cygwin-patches-for-1.20' into cygwin-release-1.20xserver-cygwin-1.20.9-1cygwin-release-1.20
-rw-r--r-- | hw/xwin/winclipboard/meson.build | 1 | ||||
-rw-r--r-- | include/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 92 | ||||
-rw-r--r-- | meson_options.txt | 2 |
4 files changed, 93 insertions, 4 deletions
diff --git a/hw/xwin/winclipboard/meson.build b/hw/xwin/winclipboard/meson.build index c239f5325..89be28dd6 100644 --- a/hw/xwin/winclipboard/meson.build +++ b/hw/xwin/winclipboard/meson.build @@ -27,6 +27,7 @@ srcs_xwinclip = [ executable( 'xwinclip', srcs_xwinclip, + dependencies: dependency('xcb'), link_with: xwin_clipboard, link_args: ['-lgdi32', '-lpthread'], install: true, diff --git a/include/meson.build b/include/meson.build index ac2415327..c398fc4ed 100644 --- a/include/meson.build +++ b/include/meson.build @@ -201,7 +201,7 @@ conf_data.set('XV', build_xv) conf_data.set('XvExtension', build_xv) conf_data.set('XvMCExtension', build_xvmc) -conf_data.set('HAVE_SHA1_IN_LIBNETTLE', '1') # XXX +conf_data.set('HAVE_SHA1_IN_' + sha1.to_upper(), '1', description: 'Use @0@ SHA1 functions'.format(sha1)) conf_data.set('HAVE_APM', build_apm or build_acpi) conf_data.set('HAVE_ACPI', build_acpi) diff --git a/meson.build b/meson.build index e3cfe988d..aa76e1c15 100644 --- a/meson.build +++ b/meson.build @@ -90,7 +90,6 @@ libbsd_dep = dependency('libbsd', required: false) xkbcomp_dep = dependency('xkbcomp', required: false) xkbfile_dep = dependency('xkbfile') xfont2_dep = dependency('xfont2', version: '>= 2.0') -nettle_dep = dependency('nettle') dbus_required = get_option('systemd_logind') == 'true' dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required) @@ -298,8 +297,95 @@ else build_eglstream = false endif -# XXX: Add more sha1 options, because Linux is about choice -sha1_dep = nettle_dep +# Lots of sha1 options, because Linux is about choice :) + +# The idea behind the ordering here is that we should first prefer system +# builtin providers, and then smaller implementations of over larger ones. +test_sha1 = [ + 'libc', # libmd API is in libc on some BSDs + 'CommonCrypto', # darwin API + 'CryptoAPI', # windows API + 'libmd', # other BSDs & Solaris + 'libsha1', # "a tiny library providing a SHA1 implementation, created for facilitating X server compilation on embedded devices where larger libraries containing SHA1 implementations are not needed" + 'libnettle', + 'libgcrypt', # in debian base system + 'libcrypto', +] + +if get_option('sha1') != 'auto' + test_sha1 = [get_option('sha1')] +endif + +sha1_found = false +foreach t : test_sha1 + if t == 'libc' + if cc.has_function('SHA1Init') + sha1_found = true + sha1_dep = dependency('', required: false) + endif + elif t == 'CommonCrypto' + if cc.has_function('CC_SHA1_Init') + sha1_found = true + sha1_dep = dependency('', required: false) + endif + elif t == 'CryptoAPI' + if cc.has_header('wincrypt.h') + sha1_found = true + sha1_dep = dependency('', required: false) + endif + elif t == 'libmd' + md_dep = cc.find_library('md', required: false) + if md_dep.found() + sha1_found = true + sha1_dep = md_dep + endif + elif t == 'libsha1' + libsha1_dep = dependency('libsha1', required: false) + if libsha1_dep.found() + sha1_found = true + sha1_dep = libsha1_dep + endif + elif t == 'libnettle' + nettle_dep = dependency('nettle', required: false) + if nettle_dep.found() + sha1_found = true + sha1_dep = nettle_dep + endif + elif t == 'libgcrypt' + gcrypt_dep = dependency('libgcrypt', required: false) + if gcrypt_dep.found() + sha1_found = true + sha1_dep = gcrypt_dep + endif + elif t == 'libcrypto' + # we don't need all of OpenSSL, just libcrypto + libcrypto_dep = cc.find_library('crypto', required: false) + openssl_dep = dependency('openssl', required: false) + if libcrypto_dep.found() or openssl_dep.found() + sha1_found = true + if libcrypto_dep.found() + sha1_dep = libcrypto_dep + else + sha1_dep = openssl_dep + endif + endif + endif + + if sha1_found + sha1 = t + break + endif +endforeach + +if sha1_found + message('Using @0@ SHA1 functions'.format(sha1)) +else + if get_option('sha1') != 'auto' + error('@0@ SHA1 requested, but not found'.format(get_option('sha1'))) + else + error('No suitable SHA1 implementation found') + endif +endif xdmcp_dep = dependency('', required : false) if get_option('xdmcp') diff --git a/meson_options.txt b/meson_options.txt index 3453b8df5..707ba5c52 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -94,6 +94,8 @@ option('linux_acpi', type: 'boolean', value: true, description: 'ACPI support on Linux') option('mitshm', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'SHM extension') +option('sha1', type: 'combo', choices: ['libc', 'CommonCrypto', 'CryptoAPI', 'libmd', 'libsha1', 'libnettle', 'libgcrypt', 'libcrypto', 'auto'], value: 'auto', + description: 'SHA1 implementation') option('dri1', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI1 extension (default: auto)') option('dri2', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI2 extension (default: auto)') |