Skip to content

Commit

Permalink
meson: add support for building static libsystemd and libudev
Browse files Browse the repository at this point in the history
  • Loading branch information
davide125 committed Apr 20, 2018
1 parent 4f4ef6a commit 7307563
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
43 changes: 40 additions & 3 deletions meson.build
Expand Up @@ -1312,8 +1312,11 @@ subdir('src/systemd')
subdir('src/basic')
subdir('src/libsystemd')
subdir('src/libsystemd-network')
subdir('src/libudev')
subdir('src/journal')
subdir('src/login')
subdir('src/shared')
subdir('src/udev')

libjournal_core = static_library(
'journal-core',
Expand Down Expand Up @@ -1342,16 +1345,50 @@ libsystemd = shared_library(
install : true,
install_dir : rootlibdir)

static_libsystemd = get_option('static-libsystemd')
static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'

install_libsystemd_static = static_library(
'systemd',
libsystemd_sources,
journal_client_sources,
basic_sources,
include_directories : includes,
link_with : libbasic,
build_by_default : static_libsystemd != 'false',
install : static_libsystemd != 'false',
install_dir : rootlibdir,
pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
dependencies : [threads,
librt,
libmount],
c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))

static_libudev = get_option('static-libudev')
static_libudev_pic = static_libudev == 'true' or static_libudev == 'pic'
install_libudev_static = static_library(
'udev',
libudev_sources,
basic_sources,
include_directories : includes,
link_with : [libshared_static,
libsystemd_static],
build_by_default : static_libudev != 'false',
install : static_libudev != 'false',
install_dir : rootlibdir,
link_depends : libudev_sym,
dependencies : [threads,
libmount],
c_args : static_libudev_pic ? [] : ['-fno-PIC'],
pic : static_libudev == 'true' or static_libudev == 'pic')

############################################################

# binaries that have --help and are intended for use by humans,
# usually, but not always, installed in /bin.
public_programs = []

subdir('src/libudev')
subdir('src/shared')
subdir('src/core')
subdir('src/udev')
subdir('src/network')

subdir('src/analyze')
Expand Down
6 changes: 6 additions & 0 deletions meson_options.txt
Expand Up @@ -13,6 +13,12 @@ option('rootprefix', type : 'string',
description : '''override the root prefix''')
option('link-udev-shared', type : 'boolean',
description : 'link systemd-udev and its helpers to libsystemd-shared.so')
option('static-libsystemd', type : 'combo',
choices : ['false', 'true', 'pic', 'no-pic'],
description : '''install a static library for libsystemd''')
option('static-libudev', type : 'combo',
choices : ['false', 'true', 'pic', 'no-pic'],
description : '''install a static library for libudev''')

option('sysvinit-path', type : 'string', value : '/etc/init.d',
description : 'the directory where the SysV init scripts are located')
Expand Down
6 changes: 4 additions & 2 deletions src/libsystemd/meson.build
Expand Up @@ -82,15 +82,17 @@ libsystemd_sources = files('''
sd-utf8/sd-utf8.c
'''.split()) + id128_sources + sd_daemon_c + sd_event_c + sd_login_c

libsystemd_c_args = ['-fvisibility=default']

libsystemd_static = static_library(
'systemd',
'systemd_static',
libsystemd_sources,
install : false,
include_directories : includes,
link_with : libbasic,
dependencies : [threads,
librt],
c_args : ['-fvisibility=default'])
c_args : libsystemd_c_args)

libsystemd_sym = 'src/libsystemd/libsystemd.sym'

Expand Down
2 changes: 1 addition & 1 deletion src/udev/meson.build
Expand Up @@ -111,7 +111,7 @@ libudev_basic = static_library(
c_args : ['-fvisibility=default'])

libudev_static = static_library(
'udev',
'udev_static',
'udev.h',
include_directories : includes,
link_with : udev_link_with,
Expand Down

0 comments on commit 7307563

Please sign in to comment.