Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit cd45f36

Browse files
committed
Add build definitions for flac.
1 parent 9e2857b commit cd45f36

File tree

5 files changed

+353
-0
lines changed

5 files changed

+353
-0
lines changed

config.h.meson

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
/* config.h.in. Generated from configure.ac by autoheader. */
2+
3+
/* Define if building universal (internal helper macro) */
4+
#mesondefine AC_APPLE_UNIVERSAL_BUILD
5+
6+
/* Target processor is big endian. */
7+
#mesondefine CPU_IS_BIG_ENDIAN
8+
9+
/* Target processor is little endian. */
10+
#mesondefine CPU_IS_LITTLE_ENDIAN
11+
12+
/* Set FLAC__BYTES_PER_WORD to 8 (4 is the default) */
13+
#mesondefine ENABLE_64_BIT_WORDS
14+
15+
/* define to align allocated memory on 32-byte boundaries */
16+
#mesondefine FLAC__ALIGN_MALLOC_DATA
17+
18+
/* define if you have docbook-to-man or docbook2man */
19+
#mesondefine FLAC__HAS_DOCBOOK_TO_MAN
20+
21+
/* define if you are compiling for x86 and have the NASM assembler */
22+
#mesondefine FLAC__HAS_NASM
23+
24+
/* define if you have the ogg library */
25+
#mesondefine OGG_FOUND
26+
#define FLAC__HAS_OGG OGG_FOUND
27+
28+
/* define if compiler has __attribute__((target("cpu=power8"))) support */
29+
#mesondefine FLAC__HAS_TARGET_POWER8
30+
31+
/* define if compiler has __attribute__((target("cpu=power9"))) support */
32+
#mesondefine FLAC__HAS_TARGET_POWER9
33+
34+
/* Set to 1 if <x86intrin.h> is available. */
35+
#mesondefine FLAC__HAS_X86INTRIN
36+
37+
/* define if building for Darwin / MacOS X */
38+
#mesondefine FLAC__SYS_DARWIN
39+
40+
/* define if building for Linux */
41+
#mesondefine FLAC__SYS_LINUX
42+
43+
/* define to enable use of Altivec instructions */
44+
#mesondefine FLAC__USE_ALTIVEC
45+
46+
/* define to enable use of AVX instructions */
47+
#mesondefine WITH_AVX
48+
#define FLAC__USE_AVX WITH_AVX
49+
50+
/* define to enable use of VSX instructions */
51+
#mesondefine FLAC__USE_VSX
52+
53+
/* Compiler has the __builtin_bswap16 intrinsic */
54+
#mesondefine HAVE_BSWAP16
55+
56+
/* Compiler has the __builtin_bswap32 intrinsic */
57+
#mesondefine HAVE_BSWAP32
58+
59+
/* Define to 1 if you have the <byteswap.h> header file. */
60+
#mesondefine HAVE_BYTESWAP_H
61+
62+
/* define if you have clock_gettime */
63+
#mesondefine HAVE_CLOCK_GETTIME
64+
65+
/* Define to 1 if you have the <cpuid.h> header file. */
66+
#mesondefine HAVE_CPUID_H
67+
68+
/* Define to 1 if C++ supports variable-length arrays. */
69+
#mesondefine HAVE_CXX_VARARRAYS
70+
71+
/* Define to 1 if C supports variable-length arrays. */
72+
#mesondefine HAVE_C_VARARRAYS
73+
74+
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
75+
#mesondefine HAVE_FSEEKO
76+
77+
/* Define to 1 if you have the `getopt_long' function. */
78+
#mesondefine HAVE_GETOPT_LONG
79+
80+
/* Define if you have the iconv() function and it works. */
81+
#mesondefine HAVE_ICONV
82+
83+
/* Define to 1 if you have the <inttypes.h> header file. */
84+
#mesondefine HAVE_INTTYPES_H
85+
86+
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
87+
#mesondefine HAVE_LANGINFO_CODESET
88+
89+
/* lround support */
90+
#mesondefine HAVE_LROUND
91+
92+
/* Define to 1 if you have the <memory.h> header file. */
93+
#mesondefine HAVE_MEMORY_H
94+
95+
/* Define to 1 if the system has the type `socklen_t'. */
96+
#mesondefine HAVE_SOCKLEN_T
97+
98+
/* Define to 1 if you have the <stdint.h> header file. */
99+
#mesondefine HAVE_STDINT_H
100+
101+
/* Define to 1 if you have the <stdlib.h> header file. */
102+
#mesondefine HAVE_STDLIB_H
103+
104+
/* Define to 1 if you have the <string.h> header file. */
105+
#mesondefine HAVE_STRING_H
106+
107+
/* Define to 1 if you have the <sys/ioctl.h> header file. */
108+
#mesondefine HAVE_SYS_IOCTL_H
109+
110+
/* Define to 1 if you have the <sys/param.h> header file. */
111+
#mesondefine HAVE_SYS_PARAM_H
112+
113+
/* Define to 1 if you have the <sys/stat.h> header file. */
114+
#mesondefine HAVE_SYS_STAT_H
115+
116+
/* Define to 1 if you have the <sys/types.h> header file. */
117+
#mesondefine HAVE_SYS_TYPES_H
118+
119+
/* Define to 1 if you have the <termios.h> header file. */
120+
#mesondefine HAVE_TERMIOS_H
121+
122+
/* Define to 1 if typeof works with your compiler. */
123+
#mesondefine HAVE_TYPEOF
124+
125+
/* Define to 1 if you have the <unistd.h> header file. */
126+
#mesondefine HAVE_UNISTD_H
127+
128+
/* Define to 1 if you have the <x86intrin.h> header file. */
129+
#mesondefine HAVE_X86INTRIN_H
130+
131+
/* Define as const if the declaration of iconv() needs const. */
132+
#mesondefine ICONV_CONST
133+
134+
/* Define if debugging is disabled */
135+
#mesondefine NDEBUG
136+
137+
/* Name of package */
138+
#mesondefine PACKAGE
139+
140+
/* Define to the address where bug reports for this package should be sent. */
141+
#mesondefine PACKAGE_BUGREPORT
142+
143+
/* Define to the full name of this package. */
144+
#mesondefine PACKAGE_NAME
145+
146+
/* Define to the full name and version of this package. */
147+
#mesondefine PACKAGE_STRING
148+
149+
/* Define to the one symbol short name of this package. */
150+
#mesondefine PACKAGE_TARNAME
151+
152+
/* Define to the home page for this package. */
153+
#mesondefine PACKAGE_URL
154+
155+
/* Define to the version of this package. */
156+
#define PACKAGE_VERSION "@PROJECT_VERSION@"
157+
158+
/* The size of `off_t', as computed by sizeof. */
159+
#mesondefine SIZEOF_OFF_T
160+
161+
/* The size of `void*', as computed by sizeof. */
162+
#mesondefine SIZEOF_VOIDP
163+
164+
/* Define to 1 if you have the ANSI C header files. */
165+
#mesondefine STDC_HEADERS
166+
167+
/* Enable extensions on AIX 3, Interix. */
168+
#ifndef _ALL_SOURCE
169+
#define _ALL_SOURCE
170+
#endif
171+
172+
/* Enable GNU extensions on systems that have them. */
173+
#ifndef _GNU_SOURCE
174+
#define _GNU_SOURCE
175+
#endif
176+
177+
#ifndef _FORTIFY_SOURCE
178+
#define DODEFINE_FORTIFY_SOURCE 2
179+
#define _FORTIFY_SOURCE DODEFINE_FORTIFY_SOURCE
180+
#endif
181+
182+
#ifndef _XOPEN_SOURCE
183+
#define DODEFINE_XOPEN_SOURCE 500
184+
#define _XOPEN_SOURCE DODEFINE_XOPEN_SOURCE
185+
#endif
186+
187+
/* Enable threading extensions on Solaris. */
188+
#ifndef _POSIX_PTHREAD_SEMANTICS
189+
#define _POSIX_PTHREAD_SEMANTICS
190+
#endif
191+
/* Enable extensions on HP NonStop. */
192+
#ifndef _TANDEM_SOURCE
193+
#mesondefine _TANDEM_SOURCE
194+
#endif
195+
/* Enable general extensions on Solaris. */
196+
#ifndef __EXTENSIONS__
197+
#define DODEFINE_EXTENSIONS
198+
#define __EXTENSIONS__ DODEFINE_EXTENSIONS
199+
#endif
200+
201+
202+
/* Target processor is big endian. */
203+
#define WORDS_BIGENDIAN CPU_IS_BIG_ENDIAN
204+
205+
/* Enable large inode numbers on Mac OS X 10.5. */
206+
#ifndef _DARWIN_USE_64_BIT_INODE
207+
# define _DARWIN_USE_64_BIT_INODE 1
208+
#endif
209+
210+
/* Number of bits in a file offset, on hosts where this is settable. */
211+
#ifndef _FILE_OFFSET_BITS
212+
# define _FILE_OFFSET_BITS 64
213+
#endif
214+
215+
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
216+
#ifndef _LARGEFILE_SOURCE
217+
# define _LARGEFILE_SOURCE
218+
#endif
219+
220+
/* Define for large files, on AIX-style hosts. */
221+
#mesondefine _LARGE_FILES
222+
223+
/* Define to 1 if on MINIX. */
224+
#mesondefine _MINIX
225+
226+
/* Define to 2 if the system does not provide POSIX.1 features except with
227+
this defined. */
228+
#mesondefine _POSIX_1_SOURCE
229+
230+
/* Define to 1 if you need to in order for `stat' and other things to work. */
231+
#mesondefine _POSIX_SOURCE
232+
233+
/* Define to __typeof__ if your compiler spells it that way. */
234+
#mesondefine typeof

meson.build

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
project('flac', 'c', version: '1.3.3')
2+
3+
cc = meson.get_compiler('c')
4+
5+
add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
6+
7+
ogg_dep = dependency('ogg')
8+
m_dep = cc.find_library('m', required: false)
9+
10+
cdata = configuration_data()
11+
12+
check_headers = [
13+
['HAVE_BYTESWAP_H', 'byteswap.h'],
14+
['HAVE_CPUID_H', 'cpuid.h'],
15+
['HAVE_INTTYPES_H', 'inttypes.h'],
16+
['HAVE_MEMORY_H', 'memory.h'],
17+
['HAVE_STDINT_H', 'stdint.h'],
18+
['HAVE_STDLIB_H', 'stdlib.h'],
19+
['HAVE_STRING_H', 'string.h'],
20+
['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'],
21+
['HAVE_SYS_PARAM_H', 'sys/param.h'],
22+
['HAVE_SYS_STAT_H', 'sys/stat.h'],
23+
['HAVE_SYS_TYPES_H', 'sys/types.h'],
24+
['HAVE_TERMIOS_H', 'termios.h'],
25+
['HAVE_UNISTD_H', 'unistd.h'],
26+
['HAVE_X86INTRIN_H', 'x86intrin.h'],
27+
]
28+
29+
foreach h : check_headers
30+
if cc.has_header(h.get(1))
31+
cdata.set(h.get(0), 1)
32+
endif
33+
endforeach
34+
35+
cdata.set('CPU_IS_BIG_ENDIAN', 0)
36+
cdata.set('CPU_IS_LITTLE_ENDIAN', 1)
37+
cdata.set10('OGG_FOUND', ogg_dep.found())
38+
cdata.set10('FLAC__HAS_X86INTRIN', cc.has_header('x86intrin.h'))
39+
cdata.set('FLAC__SYS_DARWIN', host_machine.system() == 'darein')
40+
cdata.set('FLAC__SYS_LINUX', host_machine.system() == 'linux')
41+
cdata.set10('HAVE_CLOCK_GETTIME', cc.has_function('clock_gettime', prefix: '#include<time.h>'))
42+
cdata.set10('HAVE_FSEEKO', cc.has_function('fseeko', prefix: '#include<stdio.h>'))
43+
cdata.set10('HAVE_GETOPT_LONG', cc.has_function('getopt_long', prefix: '#include<getopt.h>'))
44+
cdata.set10('HAVE_LROUND', cc.has_function('lround', prefix: '#include<math.h>'))
45+
46+
cdata.set('SIZEOF_OFF_T', cc.sizeof('off_t'))
47+
cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
48+
49+
configure_file(input: 'config.h.meson',
50+
output: 'config.h',
51+
configuration: cdata)
52+
53+
main_inc = include_directories('include', '.')
54+
55+
subdir('src')
56+
57+
flac_dep = declare_dependency(include_directories: 'include',
58+
link_with: flac_lib)

src/libFLAC/meson.build

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
if host_machine.system() == 'windows'
2+
system_sources = files('windows_unicode_filenames.c')
3+
else
4+
system_sources = []
5+
endif
6+
7+
if get_option('default_library') == 'shared'
8+
extra_args = ['-DFLAC_API_EXPORTS', '-DFLAC__USE_VISIBILITY_ATTR']
9+
else
10+
extra_args = ['-DFLAC__NO_DLL']
11+
endif
12+
13+
flac_lib = library('FLAC',
14+
'bitmath.c',
15+
'bitreader.c',
16+
'bitwriter.c',
17+
'cpu.c',
18+
'crc.c',
19+
'fixed.c',
20+
'fixed_intrin_sse2.c',
21+
'fixed_intrin_ssse3.c',
22+
'float.c',
23+
'format.c',
24+
'lpc.c',
25+
'lpc_intrin_sse.c',
26+
'lpc_intrin_sse2.c',
27+
'lpc_intrin_sse41.c',
28+
'lpc_intrin_avx2.c',
29+
'lpc_intrin_vsx.c',
30+
'md5.c',
31+
'memory.c',
32+
'metadata_iterators.c',
33+
'metadata_object.c',
34+
'stream_decoder.c',
35+
'stream_encoder.c',
36+
'stream_encoder_intrin_sse2.c',
37+
'stream_encoder_intrin_ssse3.c',
38+
'stream_encoder_intrin_avx2.c',
39+
'stream_encoder_framing.c',
40+
'window.c',
41+
'ogg_decoder_aspect.c',
42+
'ogg_encoder_aspect.c',
43+
'ogg_helper.c',
44+
'ogg_mapping.c',
45+
system_sources,
46+
include_directories: [main_inc, 'include'],
47+
c_args: extra_args,
48+
version: '8.3.0',
49+
soversion: '8',
50+
dependencies: [ogg_dep, m_dep],
51+
)

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
subdir('libFLAC')

upstream.wrap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[wrap-file]
2+
directory = flac-1.3.3
3+
4+
source_url = https://github.com/xiph/flac/archive/refs/tags/1.3.3.tar.gz
5+
source_filename = 1.3.3.tar.gz
6+
source_hash = 668cdeab898a7dd43cf84739f7e1f3ed6b35ece2ef9968a5c7079fe9adfe1689
7+
8+
[provide]
9+
flac = flac_dep

0 commit comments

Comments
 (0)