# IT4Innovations
# LK 2025

easyblock = 'ConfigureMake'

name = 'util-linux'
version = '2.40'

homepage = 'https://www.kernel.org/pub/linux/utils/util-linux'

description = "Set of Linux utilities"

toolchain = {'name': 'GCCcore', 'version': '14.2.0'}
toolchainopts = {'pic': True}

source_urls = ['%s/v%%(version_major_minor)s' % homepage]
sources = [SOURCELOWER_TAR_GZ]
checksums = ['2a51d08cb71fd8e491e0cf633032c928f9a2848417f8441cb8cf7ef9971de916']

builddependencies = [
    ('binutils', '2.42'),
    ('Autotools', '20231222'),  # for fix_waitpid patch
    ('pkgconf', '2.3.0'),  # for fix_waitpid patch
]

dependencies = [
    ('ncurses', '6.5'),
    ('zlib', '1.3.1'),
    ('SQLite', '3.47.2'),
]

# disable account related utilities (they need OS dependent pam-devel files)
# disable wall and friends (requires group changing permissions for install user)
# install systemd service files in install dir
# install bash completion files in install dir
configopts = "--disable-chfn-chsh --disable-login --disable-su --disable-rfkill "
configopts += "--disable-wall --disable-use-tty-group "
configopts += "--disable-makeinstall-chown --disable-makeinstall-setuid "
configopts += "--with-systemdsystemunitdir='${prefix}/systemd' "
configopts += "--with-bashcompletiondir='${prefix}/share/bash-completion/completions' "
# disable building Python bindings (since we don't include Python as a dep)
configopts += "--without-python "

sanity_check_paths = {
    'files': ['lib/lib%s.a' % x for x in ['blkid', 'mount', 'uuid']],
    'dirs': ['include', 'bin', 'share', 'sbin'],
}

moduleclass = 'tools'