meson: use a convenience lib for curl-util.c
Previously we compiled curl-util.c at least two times, and then also shared it using the extract+object. Let's build a static "convenience lib" for it. (Using extract+object everywhere is not possible because the different places where it is used are conditionalized independently so we don't have a single "source" that is always available.)
This commit is contained in:
@@ -11,7 +11,8 @@ executables += [
|
||||
'sources' : files(
|
||||
'imdsd.c',
|
||||
'imds-util.c'
|
||||
) + curl_util_c,
|
||||
),
|
||||
'link_with' : [libcurlutil_static, libshared],
|
||||
'dependencies' : [libcurl],
|
||||
},
|
||||
libexec_template + {
|
||||
|
||||
@@ -33,8 +33,9 @@ executables += [
|
||||
'pull-oci.c',
|
||||
'pull-raw.c',
|
||||
'pull-tar.c',
|
||||
) + curl_util_c,
|
||||
),
|
||||
'objects' : ['systemd-importd'],
|
||||
'link_with' : [libcurlutil_static, libshared],
|
||||
'dependencies' : common_deps + [
|
||||
libopenssl,
|
||||
],
|
||||
|
||||
+15
-3
@@ -256,9 +256,6 @@ if get_option('tests') != 'false'
|
||||
shared_sources += files('tests.c')
|
||||
endif
|
||||
|
||||
# A small shared file that is is linked into a few places
|
||||
curl_util_c = files('curl-util.c')
|
||||
|
||||
syscall_list_inc = custom_target(
|
||||
input : syscall_list_txt,
|
||||
output : 'syscall-list.inc',
|
||||
@@ -458,3 +455,18 @@ libshared_fdisk = static_library(
|
||||
userspace],
|
||||
c_args : ['-fvisibility=default'],
|
||||
build_by_default : false)
|
||||
|
||||
# A small shared file that is linked into a few places.
|
||||
# It is not part of libshared because this code needs libcurl and
|
||||
# we don't want to link libshared to libcurl.
|
||||
if conf.get('HAVE_LIBCURL') == 1
|
||||
libcurlutil_static = static_library(
|
||||
'curl-util',
|
||||
'curl-util.c',
|
||||
implicit_include_directories : false,
|
||||
dependencies : [userspace, libcurl],
|
||||
include_directories : includes,
|
||||
build_by_default : false)
|
||||
else
|
||||
libcurlutil_static = []
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user