Add cmark wrap

This commit is contained in:
Nicolas Werner 2021-12-09 03:31:50 +01:00
parent cbe41e649e
commit 956dbb7230
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 112 additions and 7 deletions

21
.gitignore vendored
View file

@ -14,18 +14,19 @@ subprojects/Olm.wrap
subprojects/Olm/ subprojects/Olm/
subprojects/coeurl.wrap subprojects/coeurl.wrap
subprojects/coeurl/ subprojects/coeurl/
subprojects/curl-7.77.0/ subprojects/curl-*/
subprojects/curl.wrap subprojects/curl.wrap
subprojects/libevent-2.1.12-stable/ subprojects/libevent-*/
subprojects/libevent.wrap subprojects/libevent.wrap
subprojects/lmdb++/ subprojects/lmdb++/
subprojects/lmdb-LMDB_0.9.29/ subprojects/lmdb-LMDB_*/
subprojects/nlohmann_json-3.9.1/ subprojects/nlohmann_json-*/
subprojects/nlohmann_json.wrap subprojects/nlohmann_json.wrap
subprojects/openssl-1.1.1l/ subprojects/openssl-*/
subprojects/openssl.wrap subprojects/openssl.wrap
subprojects/packagecache/ subprojects/packagecache/
subprojects/spdlog-1.9.2/ subprojects/spdlog-*/
subprojects/cmark-*/
# GTAGS # GTAGS
GTAGS GTAGS
@ -143,3 +144,11 @@ package.dir
# Archives # Archives
*.bz2 *.bz2
# analyzer stuff
heaptrack.*
massif.out.*
*.dump
.cache/
.flatpak-builder/
.hunter-emscripen/

View file

@ -19,7 +19,7 @@ deps = [
dependency('blurhash'), dependency('blurhash'),
dependency('spdlog'), dependency('spdlog'),
dependency('cmark'), dependency('cmark'),
dependency('lmdb', fallback: ['lmdb', 'lmdb_dep']), dependency('lmdb'),
dependency('Qt5Keychain'), dependency('Qt5Keychain'),
dependency('threads'), dependency('threads'),
] ]

9
subprojects/cmark.wrap Normal file
View file

@ -0,0 +1,9 @@
[wrap-file]
directory = cmark-0.30.2
source_url = https://github.com/commonmark/cmark/archive/refs/tags/0.30.2.tar.gz
source_filename = cmark-0.30.2.tar.gz
source_hash = 6c7d2bcaea1433d977d8fed0b55b71c9d045a7cdf616e3cd2dce9007da753db3
patch_directory = cmark

View file

@ -0,0 +1,87 @@
project(
'cmark', 'c',
version: '0.30.2',
default_options: [
'warning_level=2'
],
meson_version: '>= 0.54.0'
)
sources = files(
'src/cmark.c',
'src/node.c',
'src/iterator.c',
'src/blocks.c',
'src/inlines.c',
'src/scanners.c',
#'src/scanners.re',
'src/utf8.c',
'src/buffer.c',
'src/references.c',
'src/render.c',
'src/man.c',
'src/xml.c',
'src/html.c',
'src/commonmark.c',
'src/latex.c',
'src/houdini_href_e.c',
'src/houdini_html_e.c',
'src/houdini_html_u.c',
'src/cmark_ctype.c'
)
compiler = meson.get_compiler('c')
conf_data = configuration_data()
conf_data.set('HAVE_STDBOOL_H', compiler.has_header('stdbool.h'))
conf_data.set('HAVE___BUILTIN_EXPECT', compiler.compiles('int main() { __builtin_expect(0,0); return 0; }'), name: 'Has __builtin_expect')
conf_data.set('HAVE___ATTRIBUTE__', compiler.compiles('''
int f(void) __attribute__ (());
int main() { return 0; }
''', name: 'Has __attribute__'))
config_file = configure_file(input: 'src/config.h.in',
output: 'config.h',
configuration: conf_data,
format: 'cmake',
)
split_version = meson.project_version().split('.')
version_file = configure_file(input: 'src/cmark_version.h.in',
output: 'cmark_version.h',
configuration: {
'PROJECT_VERSION_MAJOR': split_version[0].to_int(),
'PROJECT_VERSION_MINOR': split_version[1].to_int(),
'PROJECT_VERSION_PATCH': split_version[2].to_int(),
},
format: 'cmake@',
)
install_headers(
'src/cmark.h',
config_file,
version_file,
)
inc = include_directories('src')
cmark = library(
'cmark',
sources,
config_file,
version_file,
include_directories: inc,
)
cmark_dep = declare_dependency(
link_with: cmark,
include_directories: inc,
)
meson.override_dependency('cmark', cmark_dep)
# Generate pc file
pkg = import('pkgconfig')
pkg.generate(cmark,
name: 'cmark',
description: 'CommonMark parsing and rendering library and program in C')