1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[meson] static option

For static binary, set CFLAGS="-static".
For js build: CXXFLAGS="-static" LDFLAGS="-static-libstdc++"
This commit is contained in:
Witold Filipczyk 2022-01-06 16:07:04 +01:00
parent 2cf17a731f
commit d974da9160
2 changed files with 29 additions and 26 deletions

View File

@ -182,14 +182,16 @@ conf_data.set('HAVE_STDALIGN_H', compiler.has_header('stdalign.h'))
conf_data.set('HAVE_TERM_H', compiler.has_header('term.h')) conf_data.set('HAVE_TERM_H', compiler.has_header('term.h'))
st = get_option('static')
deps = [] deps = []
if conf_data.get('CONFIG_GZIP') if conf_data.get('CONFIG_GZIP')
zdeps = dependency('zlib') zdeps = dependency('zlib', static: st)
deps += zdeps deps += zdeps
endif endif
if conf_data.get('CONFIG_TRE') if conf_data.get('CONFIG_TRE')
tredeps = dependency('tre') tredeps = dependency('tre', static: st)
deps += tredeps deps += tredeps
endif endif
@ -198,12 +200,12 @@ if conf_data.get('CONFIG_LIBEV')
conf_data.set('HAVE_LIBEV_EVENT_H', compiler.has_header('libev/event.h')) conf_data.set('HAVE_LIBEV_EVENT_H', compiler.has_header('libev/event.h'))
conf_data.set('HAVE_LIBEV', true) conf_data.set('HAVE_LIBEV', true)
eh = '#include <libev/event.h>' eh = '#include <libev/event.h>'
eventdeps = compiler.find_library('ev') eventdeps = compiler.find_library('ev', static: st)
deps += eventdeps deps += eventdeps
conf_data.set('CONFIG_LIBEVENT', false) conf_data.set('CONFIG_LIBEVENT', false)
elif conf_data.get('CONFIG_LIBEVENT') elif conf_data.get('CONFIG_LIBEVENT')
eh = '#include <event.h>' eh = '#include <event.h>'
eventdeps = dependency('libevent') eventdeps = dependency('libevent', static: st)
deps += eventdeps deps += eventdeps
conf_data.set('HAVE_LIBEVENT', true) conf_data.set('HAVE_LIBEVENT', true)
else else
@ -214,82 +216,82 @@ gnutlsdeps = []
ssldeps = [] ssldeps = []
if conf_data.get('CONFIG_OPENSSL') if conf_data.get('CONFIG_OPENSSL')
ssldeps = dependency('openssl') ssldeps = dependency('openssl', static: st)
deps += ssldeps deps += ssldeps
conf_data.set('USE_OPENSSL', true) conf_data.set('USE_OPENSSL', true)
conf_data.set('CONFIG_GNUTLS', false) conf_data.set('CONFIG_GNUTLS', false)
elif conf_data.get('CONFIG_GNUTLS') elif conf_data.get('CONFIG_GNUTLS')
gnutlsdeps = dependency('gnutls') gnutlsdeps = dependency('gnutls', static: st)
libgcryptdeps = dependency('libgcrypt') libgcryptdeps = dependency('libgcrypt', static: st)
deps += gnutlsdeps deps += gnutlsdeps
deps += libgcryptdeps deps += libgcryptdeps
endif endif
if conf_data.get('CONFIG_BROTLI') if conf_data.get('CONFIG_BROTLI')
brotlideps = dependency('libbrotlidec') brotlideps = dependency('libbrotlidec', static: st)
deps += brotlideps deps += brotlideps
endif endif
if conf_data.get('CONFIG_ZSTD') if conf_data.get('CONFIG_ZSTD')
zstddeps = dependency('libzstd') zstddeps = dependency('libzstd', static: st)
deps += zstddeps deps += zstddeps
endif endif
if conf_data.get('CONFIG_LZMA') if conf_data.get('CONFIG_LZMA')
lzmadeps = dependency('liblzma') lzmadeps = dependency('liblzma', static: st)
deps += lzmadeps deps += lzmadeps
endif endif
if conf_data.get('CONFIG_IDN') if conf_data.get('CONFIG_IDN')
idndeps = dependency('libidn') idndeps = dependency('libidn', static: st)
deps += idndeps deps += idndeps
endif endif
conf_data.set('HAVE_X11', false) conf_data.set('HAVE_X11', false)
if conf_data.get('CONFIG_X') if conf_data.get('CONFIG_X')
x11deps = dependency('x11') x11deps = dependency('x11', static: st)
deps += x11deps deps += x11deps
conf_data.set('HAVE_X11', compiler.has_header('X11/Xlib.h')) conf_data.set('HAVE_X11', compiler.has_header('X11/Xlib.h'))
endif endif
if conf_data.get('CONFIG_BZIP2') if conf_data.get('CONFIG_BZIP2')
bz2deps = dependency('bzip2') bz2deps = dependency('bzip2', static: st)
deps += bz2deps deps += bz2deps
endif endif
if conf_data.get('CONFIG_ECMASCRIPT_SMJS') if conf_data.get('CONFIG_ECMASCRIPT_SMJS')
mozjsdeps = dependency('mozjs-78') mozjsdeps = dependency('mozjs-78', static: st)
deps += mozjsdeps deps += mozjsdeps
endif endif
if conf_data.get('CONFIG_ECMASCRIPT') if conf_data.get('CONFIG_ECMASCRIPT')
sqlite3deps = dependency('sqlite3') sqlite3deps = dependency('sqlite3', static: st)
deps += sqlite3deps deps += sqlite3deps
conf_data.set('CONFIG_XML', true) conf_data.set('CONFIG_XML', true)
endif endif
if conf_data.get('CONFIG_SCRIPTING_LUA') if conf_data.get('CONFIG_SCRIPTING_LUA')
luadeps = dependency(luapkg) luadeps = dependency(luapkg, static: st)
deps += luadeps deps += luadeps
endif endif
if conf_data.get('CONFIG_XBEL_BOOKMARKS') if conf_data.get('CONFIG_XBEL_BOOKMARKS')
expatdeps = dependency('expat') expatdeps = dependency('expat', static: st)
deps += expatdeps deps += expatdeps
endif endif
if conf_data.get('CONFIG_GPM') if conf_data.get('CONFIG_GPM')
libgpmdeps = compiler.find_library('gpm') libgpmdeps = compiler.find_library('gpm', static: st)
deps += libgpmdeps deps += libgpmdeps
endif endif
if conf_data.get('CONFIG_XML') if conf_data.get('CONFIG_XML')
xmlplusplusdeps = dependency('libxml++-5.0') xmlplusplusdeps = dependency('libxml++-5.0', static: st)
deps += xmlplusplusdeps deps += xmlplusplusdeps
endif endif
if conf_data.get('CONFIG_SCRIPTING_PYTHON') if conf_data.get('CONFIG_SCRIPTING_PYTHON')
python3deps = dependency('python3-embed') python3deps = dependency('python3-embed', static: st)
deps += python3deps deps += python3deps
endif endif
@ -311,18 +313,18 @@ endif
rubydeps = [] rubydeps = []
if conf_data.get('CONFIG_SCRIPTING_RUBY') if conf_data.get('CONFIG_SCRIPTING_RUBY')
rubydeps = dependency('ruby') rubydeps = dependency('ruby', static: st)
deps += rubydeps deps += rubydeps
endif endif
guiledeps = [] guiledeps = []
if conf_data.get('CONFIG_SCRIPTING_GUILE') if conf_data.get('CONFIG_SCRIPTING_GUILE')
guiledeps = dependency('guile-3.0') guiledeps = dependency('guile-3.0', static: st)
deps += guiledeps deps += guiledeps
endif endif
if conf_data.get('CONFIG_FSP') if conf_data.get('CONFIG_FSP')
fspdeps = compiler.find_library('fsplib') fspdeps = compiler.find_library('fsplib', static: st)
deps += fspdeps deps += fspdeps
endif endif
@ -336,11 +338,11 @@ if not compiler.links('''#include <stdint.h>
return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
}''', }''',
name: 'GCC atomic builtins required -latomic') name: 'GCC atomic builtins required -latomic')
dep_atomic = compiler.find_library('atomic') dep_atomic = compiler.find_library('atomic', static: st)
endif endif
if conf_data.get('CONFIG_QUICKJS') if conf_data.get('CONFIG_QUICKJS')
quickjsdeps = compiler.find_library('quickjs/libquickjs', static : true) quickjsdeps = compiler.find_library('quickjs/libquickjs', static: true)
deps += quickjsdeps deps += quickjsdeps
deps += dep_atomic deps += dep_atomic
endif endif
@ -353,7 +355,7 @@ else
endif endif
if conf_data.get('CONFIG_TERMINFO') if conf_data.get('CONFIG_TERMINFO')
terminfodeps = dependency('ncursesw') terminfodeps = dependency('ncursesw', static: st)
deps += terminfodeps deps += terminfodeps
endif endif

View File

@ -64,3 +64,4 @@ option('xml', type: 'boolean', value: false, description: 'libxml++')
option('gemini', type: 'boolean', value: false, description: 'gemini protocol support') option('gemini', type: 'boolean', value: false, description: 'gemini protocol support')
option('gettext', type: 'boolean', value: false, description: 'use external gettext library') option('gettext', type: 'boolean', value: false, description: 'use external gettext library')
option('quickjs', type: 'boolean', value: false, description: 'use quickjs library') option('quickjs', type: 'boolean', value: false, description: 'use quickjs library')
option('static', type: 'boolean', value: false, description: 'link static binary')