Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
"binutils-dev"
]
},
"aklomp-base64": {
"_comment": "The test program has a bug that causes it to fail with a SIGILL on x86 platforms without avx512 (all CI runners)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been reported upstream? At minimum we should link to the issue report so it's possible to follow up. Is there any way to work around the bug from meson.build without patching the source?

"build_options": [
"aklomp-base64:tests=enabled"
],
"skip_tests": true
},
"blueprint-compiler": {
"_comment": "Tests require pygobject and Gtk4 typelib, and also they crash",
"skip_tests": true
Expand Down
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@
"1.0.0-1"
]
},
"aklomp-base64": {
"dependency_names": [
"base64"
],
"versions": [
"0.5.2-1"
]
},
"apache-orc": {
"dependency_names": [
"orc"
Expand Down
9 changes: 9 additions & 0 deletions subprojects/aklomp-base64.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[wrap-file]
directory = base64-0.5.2
source_url = https://github.com/aklomp/base64/archive/refs/tags/v0.5.2.tar.gz
source_filename = base64-0.5.2.tar.gz
source_hash = 723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d
patch_directory = aklomp-base64

[provide]
dependency_names = base64
182 changes: 182 additions & 0 deletions subprojects/packagefiles/aklomp-base64/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
project(
'aklomp-base64',
'c',
version: '0.5.2',
license: 'BSD-2-Clause',
meson_version: '>=0.59.0',

Check notice on line 6 in subprojects/packagefiles/aklomp-base64/meson.build

View workflow job for this annotation

GitHub Actions / Ubuntu (x86_64)

Minimum Meson version is 0.59.0

0.37.0: compiler.has_multi_arguments 0.38.0: build_by_default arg in executable 0.46.0: format arg in configure_file 0.47.0: dict 0.48.0: gnu_symbol_visibility arg in library 0.53.0: Dictionary entry using non literal key 0.54.0: meson.override_dependency 0.59.0: feature_option.allowed(), feature_option.disable_auto_if()
default_options: ['warning_level=3'],
)

cc = meson.get_compiler('c')
tests_opt = get_option('tests').disable_auto_if(meson.is_subproject())

c_args = ['-DBASE64_EXPORTS']
config = configuration_data()

if get_option('default_library') == 'static'
c_args += ['-DBASE64_STATIC_DEFINE']
endif

neon32_supported = host_machine.cpu_family() == 'arm' and cc.has_argument(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't arm and aarch64 use the arch_flags mechanism? I think the is_x86 check isn't actually necessary because the compiler should just fail to support the options that aren't relevant for this CPU.

'-mfpu=neon',
)

is_x86 = host_machine.cpu_family() in ['x86', 'x86_64']
config.set10('BASE64_WITH_NEON32', neon32_supported)
config.set10('BASE64_WITH_NEON64', host_machine.cpu_family() == 'aarch64')

present_flags = {}
arch_flags = {}

if cc.get_id() == 'msvc'
arch_flags += {
'SSSE3': [],
'SSE41': [],
'SSE42': [],
'AVX': ['/arch:AVX'],
'AVX2': ['/arch:AVX2'],
'AVX512': ['/arch:AVX512'],
}

present_flags += {
'SSSE3': true,
'SSE41': true,
'SSE42': true,
}

config.set10('BASE64_WITH_SSSE3', is_x86)
config.set10('BASE64_WITH_SSE41', is_x86)
config.set10('BASE64_WITH_SSE42', is_x86)
Comment on lines +47 to +49
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc.has_multi_arguments([]) evaluates to true, so these are redundant.

else
arch_flags += {
'SSSE3': ['-mssse3'],
'SSE41': ['-msse4.1'],
'SSE42': ['-msse4.2'],
'AVX': ['-mavx'],
'AVX2': ['-mavx2'],
'AVX512': ['-mavx512vl', '-mavx512vbmi'],
}
endif

foreach feature, flags : arch_flags
present = is_x86 and cc.has_multi_arguments(flags)
config.set10('BASE64_WITH_' + feature, present)
present_flags += {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify by removing present_flags entirely and doing arch_flags[feature] = [] if not present.

feature: present,
}
endforeach

cfg = configure_file(
input: 'cmake/config.h.in',
output: 'config.h',
configuration: config,
format: 'cmake',
)

codecs = []

codecs += [
static_library(
'aklomp-base64-generic',
'lib/arch/generic/codec.c',
'lib/tables/tables.c',
cfg,
c_args: c_args,
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-ssse3',
'lib/arch/ssse3/codec.c',
cfg,
c_args: c_args + (present_flags['SSSE3'] ? arch_flags['SSSE3'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-sse41',
'lib/arch/sse41/codec.c',
cfg,
c_args: c_args + (present_flags['SSE41'] ? arch_flags['SSE41'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-sse42',
'lib/arch/sse42/codec.c',
cfg,
c_args: c_args + (present_flags['SSE42'] ? arch_flags['SSE42'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-avx',
'lib/arch/avx/codec.c',
cfg,
c_args: c_args + (present_flags['AVX'] ? arch_flags['AVX'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-avx2',
'lib/arch/avx2/codec.c',
cfg,
c_args: c_args + (present_flags['AVX2'] ? arch_flags['AVX2'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-avx512',
'lib/arch/avx512/codec.c',
cfg,
c_args: c_args + (present_flags['AVX512'] ? arch_flags['AVX512'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-neon32',
'lib/arch/neon32/codec.c',
cfg,
c_args: c_args + (neon32_supported ? ['-mfpu=neon'] : []),
override_options: ['c_std=c99'],
),
static_library(
'aklomp-base64-neon64',
'lib/arch/neon64/codec.c',
cfg,
c_args: c_args,
override_options: ['c_std=c99'],
),
]

src = [cfg, 'lib/lib.c', 'lib/codec_choose.c']

inc = include_directories('include')

libbase64 = library(
'base64',
src,
c_args: c_args,
include_directories: inc,
link_with: codecs,
install: true,
version: meson.project_version(),
override_options: ['c_std=c99'],
gnu_symbol_visibility: 'hidden',
)

base64_dep = declare_dependency(
include_directories: inc,
link_with: libbase64,
)

install_headers('include/libbase64.h')

meson.override_dependency('base64', base64_dep)

if tests_opt.allowed()
test_src = files('test/codec_supported.c', 'test/test_base64.c')

test_exe = executable(
'base64-test',
test_src,
include_directories: inc,
link_with: libbase64,
override_options: ['c_std=c99'],
build_by_default: false,
)
test('base64', test_exe)
endif
5 changes: 5 additions & 0 deletions subprojects/packagefiles/aklomp-base64/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
option(
'tests',
type: 'feature',
description: 'Build base64 test cases',
)
Loading