build: add option to build apk.static binary
parent
7375327fbd
commit
1bbdc8eb37
15
meson.build
15
meson.build
|
@ -10,19 +10,24 @@ pkgc = import('pkgconfig')
|
|||
apk_confdir = get_option('sysconfdir') / 'apk'
|
||||
apk_libdir = get_option('libdir')
|
||||
|
||||
zlib_dep = dependency('zlib')
|
||||
openssl_dep = dependency('openssl')
|
||||
lua_bin = find_program('lua' + get_option('lua_version'), required: get_option('help'))
|
||||
lua_dep = dependency('lua' + get_option('lua_version'), required: get_option('lua'))
|
||||
scdoc_dep = dependency('scdoc', version: '>=1.10', required: get_option('docs'))
|
||||
|
||||
shared_deps = [
|
||||
dependency('zlib'),
|
||||
dependency('openssl'),
|
||||
]
|
||||
|
||||
static_deps = [
|
||||
dependency('openssl', static: true),
|
||||
dependency('zlib', static: true),
|
||||
]
|
||||
|
||||
add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
||||
|
||||
# If we're a subproject we only want the static lib and not files
|
||||
subproject = meson.is_subproject()
|
||||
if get_option('default_library') == 'static'
|
||||
add_project_arguments('-DOPENSSL_NO_ENGINE', language: 'c')
|
||||
endif
|
||||
|
||||
subdir('doc')
|
||||
subdir('libfetch')
|
||||
|
|
|
@ -2,3 +2,4 @@ option('docs', description: 'Build manpages with scdoc', type: 'feature', value:
|
|||
option('help', description: 'Build help into apk binaries, needs lua and lua-zlib', type: 'feature', value: 'auto')
|
||||
option('lua', description: 'Build luaapk (lua bindings)', type: 'feature', value: 'auto')
|
||||
option('lua_version', description: 'Lua version to build against', type: 'string', value: '5.3')
|
||||
option('static_apk', description: 'Also build apk.static', type: 'boolean', value: true)
|
||||
|
|
|
@ -82,26 +82,36 @@ apk_cargs = [
|
|||
'-D_ATFILE_SOURCE',
|
||||
]
|
||||
|
||||
libapk = library(
|
||||
libapk_shared = shared_library(
|
||||
'apk',
|
||||
libapk_src,
|
||||
version: meson.project_version(),
|
||||
install: true,
|
||||
install: not subproject,
|
||||
dependencies: [
|
||||
libfetch_dep,
|
||||
zlib_dep,
|
||||
openssl_dep,
|
||||
shared_deps,
|
||||
],
|
||||
c_args: apk_cargs,
|
||||
)
|
||||
|
||||
libapk_static = static_library(
|
||||
'apk',
|
||||
libapk_src,
|
||||
install: not subproject,
|
||||
dependencies: [
|
||||
libfetch_dep,
|
||||
static_deps,
|
||||
],
|
||||
c_args: [apk_cargs, '-DOPENSSL_NO_ENGINE'],
|
||||
)
|
||||
|
||||
libapk_dep = declare_dependency(
|
||||
link_with: libapk,
|
||||
link_with: libapk_shared,
|
||||
)
|
||||
|
||||
if not subproject
|
||||
pkgc.generate(
|
||||
libapk,
|
||||
libapk_shared,
|
||||
name: 'apk',
|
||||
version: meson.project_version(),
|
||||
)
|
||||
|
@ -133,9 +143,23 @@ apk_exe = executable(
|
|||
install: not subproject,
|
||||
dependencies: [
|
||||
libapk_dep,
|
||||
zlib_dep,
|
||||
openssl_dep,
|
||||
shared_deps,
|
||||
libfetch_dep.partial_dependency(includes: true),
|
||||
],
|
||||
c_args: apk_cargs,
|
||||
)
|
||||
|
||||
if get_option('static_apk')
|
||||
apk_static_exe = executable(
|
||||
'apk.static',
|
||||
apk_src,
|
||||
install: not subproject,
|
||||
dependencies: [
|
||||
static_deps,
|
||||
libfetch_dep.partial_dependency(includes: true),
|
||||
],
|
||||
link_with: libapk_static,
|
||||
c_args: [apk_cargs, '-DOPENSSL_NO_ENGINE'],
|
||||
link_args: '-static',
|
||||
)
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue