dir_libfdisk,
dir_libuuid] # XXX: should this be declared along with the lib?
-lib_fdisk = both_libraries(
- 'fdisk',
- list_h,
+lib__fdisk = static_library(
+ '_fdisk',
lib_fdisk_sources,
include_directories : lib_fdisk_includes,
+ dependencies : build_libfdisk ? [] : disabler())
+
+lib_fdisk_static = static_library(
+ 'fdisk',
+ link_whole : lib__fdisk,
+ link_with : [lib_common,
+ lib_blkid.get_static_lib(),
+ lib_uuid.get_static_lib()],
+ install : false)
+
+lib_fdisk = library(
+ 'fdisk',
+ link_whole : lib__fdisk,
link_depends : libfdisk_sym,
version : libfdisk_version,
link_args : ['-Wl,--version-script=@0@'.format(libfdisk_sym_path)],
link_with : [lib_common,
lib_blkid,
lib_uuid],
- dependencies : build_libfdisk ? [] : disabler(),
install : build_libfdisk)
pkgconfig.generate(lib_fdisk,
conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
+static_programs = get_option('static-programs')
+need_static_libs = static_programs.length() > 0 # a rough estimate...
+summary('static programs', static_programs)
+
LINUX = host_machine.system() in ['linux']
BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
'tinfo',
required : get_option('tinfo'))
+lib_tinfo_static = dependency(
+ 'tinfo',
+ static : true,
+ required : need_static_libs ? get_option('tinfo') : disabler())
+
lib_ncursesw = dependency(
'ncursesw',
required : get_option('ncursesw'))
required : get_option('readline'))
conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
+lib_readline_static = dependency(
+ 'readline',
+ static : true,
+ required : need_static_libs ? get_option('readline') : disabler())
+
lib_pcre = dependency(
'libpcre2-8',
required : get_option('libpcre'))
exes += exe
endif
+opt = opt and 'losetup' in static_programs
+exe = executable(
+ 'losetup.static',
+ losetup_sources,
+ include_directories : includes,
+ link_args : ['--static'],
+ link_with : [lib_common,
+ lib_smartcols.get_static_lib()],
+ install_dir : sbindir,
+ install : opt,
+ build_by_default : opt)
+if opt and not is_disabler(exe)
+ exes += exe
+endif
+
opt = not get_option('build-zramctl').disabled()
exe = executable(
'zramctl',
install_man(mount_man)
endif
+opt2 = opt and 'mount' in static_programs
+exe = executable(
+ 'mount.static',
+ mount_sources,
+ include_directories : includes,
+ link_args : ['--static'],
+ link_with : [lib_common,
+ lib_smartcols_static,
+ lib_mount_static],
+ install : opt2,
+ build_by_default : opt2)
+if opt2 and not is_disabler(exe)
+ exes += exe
+endif
+
+opt2 = opt and 'umount' in static_programs
+exe = executable(
+ 'umount.static',
+ umount_sources,
+ include_directories : includes,
+ link_args : ['--static'],
+ link_with : [lib_common,
+ lib_mount_static],
+ install : opt2,
+ build_by_default : opt2)
+if opt2 and not is_disabler(exe)
+ exes += exe
+endif
+
# setuid?
exe = executable(
install_man('sys-utils/unshare.1')
endif
+opt = opt and 'unshare' in static_programs
+exe = executable(
+ 'unshare.static',
+ unshare_sources,
+ include_directories : includes,
+ link_with : [lib_common],
+ install_dir : usrbin_exec_dir,
+ install : opt,
+ build_by_default : opt)
+if opt and not is_disabler(exe)
+ exes += exe
+endif
+
opt = not get_option('build-nsenter').disabled()
exe = executable(
'nsenter',
install_man('sys-utils/nsenter.1')
endif
+opt = opt and 'nsenter' in static_programs
+exe = executable(
+ 'nsenter.static',
+ nsenter_sources,
+ include_directories : includes,
+ link_with : [lib_common],
+ dependencies : [lib_selinux],
+ install_dir : usrbin_exec_dir,
+ install : opt,
+ build_by_default : opt)
+if opt and not is_disabler(exe)
+ exes += exe
+endif
+
opt = not get_option('build-setpriv').disabled()
exe = executable(
'setpriv',
exes += exe
endif
-# XXX: fdisk-static
+opt2 = opt and 'fdisk' in static_programs
+exe = executable(
+ 'fdisk.static',
+ fdisk_sources,
+ link_args : ['--static'],
+ include_directories : includes,
+ link_with : [lib_common,
+ lib_tcolors,
+ lib_fdisk_static,
+ lib_smartcols.get_static_lib()],
+ dependencies : [lib_readline_static],
+ install_dir : sbindir,
+ install : opt2,
+ build_by_default : opt2)
+if opt2 and not is_disabler(exe)
+ exes += exe
+endif
exe = executable(
'sfdisk',
exes += exe
endif
-# XXX: sfdisk-static
+opt2 = opt and 'sfdisk' in static_programs
+exe = executable(
+ 'sfdisk.static',
+ sfdisk_sources,
+ include_directories : includes,
+ link_with : [lib_common,
+ lib_tcolors,
+ lib_fdisk_static,
+ lib_smartcols.get_static_lib()],
+ dependencies : [lib_readline_static],
+ install_dir : sbindir,
+ install : opt2,
+ build_by_default : opt2)
+if opt2 and not is_disabler(exe)
+ exes += exe
+endif
exe = executable(
'cfdisk',
install_man('misc-utils/blkid.8')
endif
-# XXX: blkid.static
+opt = opt and 'blkid' in static_programs
+exe = executable(
+ 'blkid.static',
+ blkid_sources,
+ include_directories : includes,
+ link_with : [lib_common,
+ lib_blkid_static],
+ install_dir : sbindir,
+ install : opt,
+ build_by_default : opt)
+if opt and not is_disabler(exe)
+ exes += exe
+endif
exe = executable(
'sample-mkfs',
libfdisk_tests_cflags = ['-DTEST_PROGRAM',
'-Wno-unused']
-libfdisk_tests_ldadd = [lib_fdisk.get_static_lib(), lib_uuid, lib_blkid]
+libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
exe = executable(
'test_fdisk_ask',