Add a Lua PDF generator
All checks were successful
Alpine 3.20 Success
Arch Linux AUR Success

Publishing my old invoice layouter in a reusable scripting-based form,
rather than an annoyingly fixed binary.

Because Lua compiled for C++ might be hard to find, we provide a wrap.
Curiously, only GitHub releases seem to contain onelua.c,
which is a very handy file.

We could have also subprojected libqr, which is in the public domain,
however the other main dependencies are also LGPL like libqrencode is.
And it is likely to be installed.

The user manual also serves as a test.
This commit is contained in:
2025-01-08 10:54:40 +01:00
parent 147b880524
commit e8752e53ac
12 changed files with 1512 additions and 5 deletions

View File

@@ -0,0 +1,10 @@
[wrap-file]
directory = lua-5.4.7
source_url = https://github.com/lua/lua/archive/refs/tags/v5.4.7.tar.gz
source_filename = lua-5.4.7.tar.gz
source_hash = 5c39111b3fc4c1c9e56671008955a1730f54a15b95e1f1bd0752b868b929d8e3
patch_directory = lua-5.4.7
[provide]
lua++-5.4 = lua_dep
lua++ = lua_dep

View File

@@ -0,0 +1,20 @@
Copyright (c) 2025 Přemysl Eric Janouch <p@janouch.name>
Copyright (c) 2021 The Meson development team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,50 @@
project(
'lua-5.4',
'cpp',
license : 'MIT',
meson_version : '>=0.49.2',
version : '5.4.7',
default_options : ['c_std=c99', 'warning_level=2'],
)
cxx = meson.get_compiler('cpp')
# Skip bogus warning.
add_project_arguments(cxx.get_supported_arguments(
'-Wno-string-plus-int', '-Wno-stringop-overflow'), language : 'cpp')
# Platform-specific defines.
is_posix = host_machine.system() in ['cygwin', 'darwin', 'dragonfly', 'freebsd',
'gnu', 'haiku', 'linux', 'netbsd', 'openbsd', 'sunos']
if is_posix
add_project_arguments('-DLUA_USE_POSIX', language : 'cpp')
endif
# Library dependencies.
lua_lib_deps = [cxx.find_library('m', required : false)]
if meson.version().version_compare('>= 0.62')
dl_dep = dependency('dl', required : get_option('loadlib'))
else
dl_dep = cxx.find_library('dl', required : get_option('loadlib'))
endif
if dl_dep.found()
lua_lib_deps += dl_dep
add_project_arguments('-DLUA_USE_DLOPEN', language : 'cpp')
endif
# Targets.
add_project_arguments('-DMAKE_LIB', language : 'cpp')
lua_lib = static_library(
'lua',
'onelua.cpp',
dependencies : lua_lib_deps,
implicit_include_directories : false,
)
inc = include_directories('.')
lua_dep = declare_dependency(
link_with : lua_lib,
include_directories : inc,
)

View File

@@ -0,0 +1,4 @@
option(
'loadlib', type : 'feature',
description : 'Allow Lua to "require" C extension modules'
)

View File

@@ -0,0 +1 @@
#include "onelua.c"