# IT4Innovations
# LK 2025

easyblock = 'CMakeMake'

name = 'libjpeg-turbo'
version = '3.0.1'

homepage = 'https://sourceforge.net/projects/libjpeg-turbo/'

description = """
 libjpeg-turbo is a fork of the original IJG libjpeg which uses SIMD to
 accelerate baseline JPEG compression and decompression. libjpeg is a library
 that implements JPEG image encoding, decoding and transcoding.
"""

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

source_urls = [SOURCEFORGE_SOURCE]
sources = [SOURCELOWER_TAR_GZ]
checksums = ['22429507714ae147b3acacd299e82099fce5d9f456882fc28e252e4579ba2a75']

builddependencies = [
    ('CMake', '3.31.3'),
    ('binutils', '2.42'),
]

dependencies = [
    ('NASM', '2.16.03'),
]

# make sure that libraries are installed to <prefix>/lib (instead of <prefix>/lib64),
# which helps with avoiding problems when libjpeg-turbo is a dependency that
# gets linked via RPATH and Meson/Ninja are involved,
# see https://github.com/easybuilders/easybuild-easyconfigs/issues/16256
configopts = ' -G"Unix Makefiles" -DWITH_JPEG8=1 -DCMAKE_INSTALL_LIBDIR:PATH=lib'

runtest = "test"

sanity_check_paths = {
    'files': ['bin/cjpeg', 'bin/djpeg', 'bin/jpegtran', 'bin/rdjpgcom',
              'bin/tjbench', 'bin/wrjpgcom', 'lib/libjpeg.a',
              'lib/libjpeg.%s' % SHLIB_EXT, 'lib/libturbojpeg.a',
              'lib/libturbojpeg.%s' % SHLIB_EXT],
    'dirs': ['include', 'share'],
}

moduleclass = 'lib'
