Skip to content

Commit fdf4b51

Browse files
committed
aklomp-base64: add 0.5.2
1 parent 2a1a273 commit fdf4b51

File tree

5 files changed

+211
-0
lines changed

5 files changed

+211
-0
lines changed

ci_config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
"binutils-dev"
7373
]
7474
},
75+
"aklomp-base64": {
76+
"_comment": "The test program has a bug that causes it to fail with a SIGILL on x86 platforms without avx512 (all CI runners)",
77+
"build_options": [
78+
"aklomp-base64:tests=enabled"
79+
],
80+
"skip_tests": true
81+
},
7582
"blueprint-compiler": {
7683
"_comment": "Tests require pygobject and Gtk4 typelib, and also they crash",
7784
"skip_tests": true

releases.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@
141141
"1.0.0-1"
142142
]
143143
},
144+
"aklomp-base64": {
145+
"dependency_names": [
146+
"base64"
147+
],
148+
"versions": [
149+
"0.5.2-1"
150+
]
151+
},
144152
"apache-orc": {
145153
"dependency_names": [
146154
"orc"

subprojects/aklomp-base64.wrap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[wrap-file]
2+
directory = base64-0.5.2
3+
source_url = https://github.com/aklomp/base64/archive/refs/tags/v0.5.2.tar.gz
4+
source_filename = base64-0.5.2.tar.gz
5+
source_hash = 723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d
6+
patch_directory = aklomp-base64
7+
8+
[provide]
9+
dependency_names = aklomp-base64
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
project(
2+
'aklomp-base64',
3+
'c',
4+
version: '0.5.2',
5+
license: 'BSD-2-Clause',
6+
meson_version: '>=0.59.0',
7+
default_options: ['warning_level=3'],
8+
)
9+
10+
cc = meson.get_compiler('c')
11+
tests_opt = get_option('tests').disable_auto_if(meson.is_subproject())
12+
13+
c_args = ['-DBASE64_EXPORTS']
14+
config = configuration_data()
15+
16+
if get_option('default_library') == 'static'
17+
c_args += ['-DBASE64_STATIC_DEFINE']
18+
endif
19+
20+
neon32_supported = host_machine.cpu_family() == 'arm' and cc.has_argument(
21+
'-mfpu=neon',
22+
)
23+
24+
is_x86 = host_machine.cpu_family() in ['x86', 'x86_64']
25+
config.set10('BASE64_WITH_NEON32', neon32_supported)
26+
config.set10('BASE64_WITH_NEON64', host_machine.cpu_family() == 'aarch64')
27+
28+
present_flags = {}
29+
arch_flags = {}
30+
31+
if cc.get_id() == 'msvc'
32+
arch_flags += {
33+
'SSSE3': [],
34+
'SSE41': [],
35+
'SSE42': [],
36+
'AVX': ['/arch:AVX'],
37+
'AVX2': ['/arch:AVX2'],
38+
'AVX512': ['/arch:AVX512'],
39+
}
40+
41+
present_flags += {
42+
'SSSE3': true,
43+
'SSE41': true,
44+
'SSE42': true,
45+
}
46+
47+
config.set10('BASE64_WITH_SSSE3', is_x86)
48+
config.set10('BASE64_WITH_SSE41', is_x86)
49+
config.set10('BASE64_WITH_SSE42', is_x86)
50+
else
51+
arch_flags += {
52+
'SSSE3': ['-mssse3'],
53+
'SSE41': ['-msse4.1'],
54+
'SSE42': ['-msse4.2'],
55+
'AVX': ['-mavx'],
56+
'AVX2': ['-mavx2'],
57+
'AVX512': ['-mavx512vl', '-mavx512vbmi'],
58+
}
59+
endif
60+
61+
foreach feature, flags : arch_flags
62+
present = is_x86 and cc.has_multi_arguments(flags)
63+
config.set10('BASE64_WITH_' + feature, present)
64+
present_flags += {
65+
feature: present,
66+
}
67+
endforeach
68+
69+
cfg = configure_file(
70+
input: 'cmake/config.h.in',
71+
output: 'config.h',
72+
configuration: config,
73+
format: 'cmake',
74+
)
75+
76+
codecs = []
77+
78+
codecs += [
79+
static_library(
80+
'aklomp-base64-generic',
81+
'lib/arch/generic/codec.c',
82+
'lib/tables/tables.c',
83+
cfg,
84+
c_args: c_args,
85+
override_options: ['c_std=c99'],
86+
),
87+
static_library(
88+
'aklomp-base64-ssse3',
89+
'lib/arch/ssse3/codec.c',
90+
cfg,
91+
c_args: c_args + (present_flags['SSSE3'] ? arch_flags['SSSE3'] : []),
92+
override_options: ['c_std=c99'],
93+
),
94+
static_library(
95+
'aklomp-base64-sse41',
96+
'lib/arch/sse41/codec.c',
97+
cfg,
98+
c_args: c_args + (present_flags['SSE41'] ? arch_flags['SSE41'] : []),
99+
override_options: ['c_std=c99'],
100+
),
101+
static_library(
102+
'aklomp-base64-sse42',
103+
'lib/arch/sse42/codec.c',
104+
cfg,
105+
c_args: c_args + (present_flags['SSE42'] ? arch_flags['SSE42'] : []),
106+
override_options: ['c_std=c99'],
107+
),
108+
static_library(
109+
'aklomp-base64-avx',
110+
'lib/arch/avx/codec.c',
111+
cfg,
112+
c_args: c_args + (present_flags['AVX'] ? arch_flags['AVX'] : []),
113+
override_options: ['c_std=c99'],
114+
),
115+
static_library(
116+
'aklomp-base64-avx2',
117+
'lib/arch/avx2/codec.c',
118+
cfg,
119+
c_args: c_args + (present_flags['AVX2'] ? arch_flags['AVX2'] : []),
120+
override_options: ['c_std=c99'],
121+
),
122+
static_library(
123+
'aklomp-base64-avx512',
124+
'lib/arch/avx512/codec.c',
125+
cfg,
126+
c_args: c_args + (present_flags['AVX512'] ? arch_flags['AVX512'] : []),
127+
override_options: ['c_std=c99'],
128+
),
129+
static_library(
130+
'aklomp-base64-neon32',
131+
'lib/arch/neon32/codec.c',
132+
cfg,
133+
c_args: c_args + (neon32_supported ? ['-mfpu=neon'] : []),
134+
override_options: ['c_std=c99'],
135+
),
136+
static_library(
137+
'aklomp-base64-neon64',
138+
'lib/arch/neon64/codec.c',
139+
cfg,
140+
c_args: c_args,
141+
override_options: ['c_std=c99'],
142+
),
143+
]
144+
145+
src = [cfg, 'lib/lib.c', 'lib/codec_choose.c']
146+
147+
inc = include_directories('include')
148+
149+
libbase64 = library(
150+
'base64',
151+
src,
152+
c_args: c_args,
153+
include_directories: inc,
154+
link_with: codecs,
155+
install: true,
156+
version: meson.project_version(),
157+
override_options: ['c_std=c99'],
158+
gnu_symbol_visibility: 'hidden',
159+
)
160+
161+
base64_dep = declare_dependency(
162+
include_directories: inc,
163+
link_with: libbase64,
164+
)
165+
166+
install_headers('include/libbase64.h')
167+
168+
meson.override_dependency('base64', base64_dep)
169+
170+
if tests_opt.allowed()
171+
test_src = files('test/codec_supported.c', 'test/test_base64.c')
172+
173+
test_exe = executable(
174+
'base64-test',
175+
test_src,
176+
include_directories: inc,
177+
link_with: libbase64,
178+
override_options: ['c_std=c99'],
179+
build_by_default: false,
180+
)
181+
test('base64', test_exe)
182+
endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
option(
2+
'tests',
3+
type: 'feature',
4+
description: 'Build base64 test cases',
5+
)

0 commit comments

Comments
 (0)