mirror of
https://github.com/kmod-project/kmod.git
synced 2026-01-26 07:37:54 +00:00
meson: Allow to set dlopen option for compression libraries
Add a dlopen option that allows toggling what libraries libkmod should attempt to dlopen. If -Ddlopen=foo is passed, it means that library is required to build, regardless of -Dfoo=*. However that library will only be linked in if it's not set as dlopen. Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com> [ with disagreement on the need to toggle each one individually, it'd be better to be all-or-nothing dlopen'ed ] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://github.com/kmod-project/kmod/pull/262
This commit is contained in:
parent
8d39823eeb
commit
bbab061e51
@ -119,6 +119,7 @@ AS_IF([test "x$with_zstd" != "xno"], [
|
|||||||
])
|
])
|
||||||
CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD])
|
CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD])
|
||||||
AM_CONDITIONAL([ENABLE_ZSTD], [test "x$with_zstd" != "xno"])
|
AM_CONDITIONAL([ENABLE_ZSTD], [test "x$with_zstd" != "xno"])
|
||||||
|
AC_DEFINE([ENABLE_ZSTD_DLOPEN], [0], [dlopen zstd])
|
||||||
|
|
||||||
AC_ARG_WITH([xz],
|
AC_ARG_WITH([xz],
|
||||||
AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
|
AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]),
|
||||||
@ -133,6 +134,7 @@ AS_IF([test "x$with_xz" != "xno"], [
|
|||||||
])
|
])
|
||||||
CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
|
CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
|
||||||
AM_CONDITIONAL([ENABLE_XZ], [test "x$with_xz" != "xno"])
|
AM_CONDITIONAL([ENABLE_XZ], [test "x$with_xz" != "xno"])
|
||||||
|
AC_DEFINE([ENABLE_XZ_DLOPEN], [0], [dlopen xz])
|
||||||
|
|
||||||
AC_ARG_WITH([zlib],
|
AC_ARG_WITH([zlib],
|
||||||
AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
|
AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
|
||||||
@ -147,6 +149,7 @@ AS_IF([test "x$with_zlib" != "xno"], [
|
|||||||
])
|
])
|
||||||
CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
|
CC_FEATURE_APPEND([with_features], [with_zlib], [ZLIB])
|
||||||
AM_CONDITIONAL([ENABLE_ZLIB], [test "x$with_zlib" != "xno"])
|
AM_CONDITIONAL([ENABLE_ZLIB], [test "x$with_zlib" != "xno"])
|
||||||
|
AC_DEFINE([ENABLE_ZLIB_DLOPEN], [0], [dlopen zlib])
|
||||||
|
|
||||||
AC_ARG_WITH([openssl],
|
AC_ARG_WITH([openssl],
|
||||||
AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
|
AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
* Copyright © 2024 Intel Corporation
|
* Copyright © 2024 Intel Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO: replace with build system define once supported */
|
#define DLSYM_LOCALLY_ENABLED ENABLE_XZ_DLOPEN
|
||||||
#define DLSYM_LOCALLY_ENABLED 0
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <lzma.h>
|
#include <lzma.h>
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
* Copyright © 2024 Intel Corporation
|
* Copyright © 2024 Intel Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO: replace with build system define once supported */
|
#define DLSYM_LOCALLY_ENABLED ENABLE_ZLIB_DLOPEN
|
||||||
#define DLSYM_LOCALLY_ENABLED 0
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
* Copyright © 2024 Intel Corporation
|
* Copyright © 2024 Intel Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO: replace with build system define once supported */
|
#define DLSYM_LOCALLY_ENABLED ENABLE_ZSTD_DLOPEN
|
||||||
#define DLSYM_LOCALLY_ENABLED 0
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
13
meson.build
13
meson.build
@ -176,6 +176,9 @@ module_signatures = ''
|
|||||||
features = []
|
features = []
|
||||||
dep_map = {}
|
dep_map = {}
|
||||||
|
|
||||||
|
# keep in sync with meson_options.txt
|
||||||
|
dlopen_all = get_option('dlopen').contains('all')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Directories
|
# Directories
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@ -299,10 +302,19 @@ foreach tuple : _compression
|
|||||||
pkg_dep = tuple[1]
|
pkg_dep = tuple[1]
|
||||||
pkg_dep_version = tuple[2]
|
pkg_dep_version = tuple[2]
|
||||||
|
|
||||||
|
dlopen = dlopen_all or get_option('dlopen').contains(opt)
|
||||||
|
if not dlopen_all and dlopen and get_option(opt).disabled()
|
||||||
|
error('Incompatiable options: dlopen=@0@ for disabled @0@'.format(opt))
|
||||||
|
endif
|
||||||
|
|
||||||
dep = dependency(pkg_dep, version : pkg_dep_version, required : get_option(opt))
|
dep = dependency(pkg_dep, version : pkg_dep_version, required : get_option(opt))
|
||||||
have = dep.found()
|
have = dep.found()
|
||||||
|
if have and dlopen
|
||||||
|
dep = dep.partial_dependency(compile_args : true, includes : true)
|
||||||
|
endif
|
||||||
|
|
||||||
cdata.set10('ENABLE_' + opt.to_upper(), have)
|
cdata.set10('ENABLE_' + opt.to_upper(), have)
|
||||||
|
cdata.set10('ENABLE_' + opt.to_upper() + '_DLOPEN', have and dlopen)
|
||||||
|
|
||||||
if have
|
if have
|
||||||
module_compressions += '@0@ '.format(opt)
|
module_compressions += '@0@ '.format(opt)
|
||||||
@ -567,6 +579,7 @@ summary({
|
|||||||
'build-tests' : get_option('build-tests'),
|
'build-tests' : get_option('build-tests'),
|
||||||
'manpages' : get_option('manpages'),
|
'manpages' : get_option('manpages'),
|
||||||
'docs' : get_option('docs'),
|
'docs' : get_option('docs'),
|
||||||
|
'dlopen' : get_option('dlopen'),
|
||||||
}, section : 'Options')
|
}, section : 'Options')
|
||||||
|
|
||||||
summary({
|
summary({
|
||||||
|
|||||||
@ -67,6 +67,14 @@ option(
|
|||||||
description : 'Build the tools - kmod, depmod, lsmod ... Default: true',
|
description : 'Build the tools - kmod, depmod, lsmod ... Default: true',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'dlopen',
|
||||||
|
type : 'array',
|
||||||
|
choices : ['zstd', 'xz', 'zlib', 'all'],
|
||||||
|
value : [],
|
||||||
|
description : 'Libraries to dlopen rather than linking. Use \'all\' to . Default: none',
|
||||||
|
)
|
||||||
|
|
||||||
option(
|
option(
|
||||||
'logging',
|
'logging',
|
||||||
type : 'boolean',
|
type : 'boolean',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user