Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickjs-ng: new wrap #1865

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3080,6 +3080,14 @@
"0.7.3-1"
]
},
"quickjs-ng": {
"dependency_names": [
"quickjs-ng"
],
"versions": [
"0.8.0-1"
]
},
"quill": {
"dependency_names": [
"quill"
Expand Down
2 changes: 2 additions & 0 deletions subprojects/packagefiles/quickjs-ng/include/quickjs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This is a dummy file provided by meson wrapdb to avoid exposing all internal header of quickjs-ng.
#include "../quickjs.h";
112 changes: 112 additions & 0 deletions subprojects/packagefiles/quickjs-ng/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
project('quickjs-ng', 'c', version: '0.8.0', default_options: ['c_std=c11'])

cc = meson.get_compiler('c')
dep_m = cc.find_library('m', required: false)
dep_threads = dependency('threads')
deps = [dep_m, dep_threads]

msvc_compat = cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'

add_project_arguments(
cc.get_supported_arguments(
'-Wno-implicit-fallthrough',
'-Wno-sign-compare',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-unused-but-set-variable',
'-Wno-array-bounds',
'-Wno-format-truncation',
'-funsigned-char',
),
language: 'c',
)

if msvc_compat
add_project_arguments(
cc.get_supported_arguments(
'-Wno-unsafe-buffer-usage',
'-Wno-sign-conversion',
'-Wno-nonportable-system-include-path',
'-Wno-implicit-int-conversion',
'-Wno-shorten-64-to-32',
'-Wno-reserved-macro-identifier',
'-Wno-reserved-identifier',
'-Wdeprecated-declarations',
'/experimental:c11atomics',
),
language: 'c',
)

add_project_arguments(
cc.get_supported_arguments(
'/wd4018', # -Wno-sign-conversion
'/wd4061', # -Wno-implicit-fallthrough
'/wd4100', # -Wno-unused-parameter
'/wd4200', # -Wno-zero-length-array
'/wd4242', # -Wno-shorten-64-to-32
'/wd4244', # -Wno-shorten-64-to-32
'/wd4245', # -Wno-sign-compare
'/wd4267', # -Wno-shorten-64-to-32
'/wd4388', # -Wno-sign-compare
'/wd4389', # -Wno-sign-compare
'/wd4710', # Function not inlined
'/wd4711', # Function was inlined
'/wd4820', # Padding added after construct
'/wd4996', # -Wdeprecated-declarations
'/wd5045', # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
),
language: 'c',
)

endif

if get_option('buildtype') == 'debug'
add_project_arguments(
cc.get_supported_arguments('-ggdb', '-fno-omit-frame-pointer'),
language: 'c',
)
endif

lib_src = files(
'cutils.c',
'libbf.c',
'libregexp.c',
'libunicode.c',
'quickjs-libc.c',
'quickjs.c',
)

c_defines = ['-D_GNU_SOURCE', '-DCONFIG_BIGNUM']

if host_machine.system() == 'windows'
c_defines += ['-DWIN32_LEAN_AND_MEAN', '-D_WIN32_WINNT=0x0602']
endif

add_project_arguments(c_defines, language: 'c')

# TODO: support shared libs
quickjs_lib = static_library(
'quickjs',
lib_src,
dependencies: deps,
include_directories: include_directories('.'),
)

quickjs_ng_dep = declare_dependency(
include_directories: include_directories('include'),
link_with: quickjs_lib,
dependencies: deps,
)

if not meson.is_subproject()
pkg = import('pkgconfig')
pkg.generate(
quickjs_ng_dep,
description: 'QuickJS, the Next Generation: a mighty JavaScript engine',
url: 'https://github.com/quickjs-ng/quickjs',
version: meson.project_version(),
)
endif


test('ctest', executable('ctest', 'ctest.c', dependencies: [quickjs_ng_dep],build_by_default: false))
9 changes: 9 additions & 0 deletions subprojects/quickjs-ng.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[wrap-file]
directory = quickjs-0.8.0
source_url = https://github.com/quickjs-ng/quickjs/archive/refs/tags/v0.8.0.tar.gz
source_filename = quickjs-ng-v0.8.0.tar.gz
source_hash = 7e60e1e0dcd07d25664331308a2f4aee2a88d60d85896e828d25df7c3d40204e
patch_directory = quickjs-ng

[provide]
quickjs-ng = quickjs_ng_dep
3 changes: 3 additions & 0 deletions tools/sanity_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
'get-version.py',
'process-zconf.py',
],
'quickjs-ng': [
'quickjs.h',
],
}
NO_TABS_FILES = ['meson.build', 'meson_options.txt']
PERMITTED_KEYS = {'versions', 'dependency_names', 'program_names'}
Expand Down
Loading