aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-06-19 17:31:36 -0400
committerAdam Harrison <adamdharrison@gmail.com>2023-06-19 17:31:36 -0400
commit7aaf54bb4e4b2e774da00f213aa9bcc94121c972 (patch)
tree17d895b987aa07bf2b8d817023157f9c3dfeaa0d
parent43a0e9a2d7f0f2cd18360be04f763f4a2b11ecbe (diff)
parentb7584e25f57bef9f41956b7d28e1edc1053e8f6a (diff)
downloadlite-xl-plugin-manager-7aaf54bb4e4b2e774da00f213aa9bcc94121c972.tar.gz
lite-xl-plugin-manager-7aaf54bb4e4b2e774da00f213aa9bcc94121c972.zip
Merge branch 'master' of github.com:adamharrison/lite-xl-plugin-manager
-rw-r--r--meson.build58
-rw-r--r--meson_options.txt1
2 files changed, 59 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b4a8a04
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,58 @@
+project('lpm',
+ ['c'],
+ version : '1.0.4',
+ license : 'LPM',
+ meson_version : '>= 0.56',
+)
+
+cc = meson.get_compiler('c')
+
+zlib_dep = dependency('zlib')
+mbedtls_dep = dependency('mbedtls', required: false)
+libgit2_dep = dependency('libgit2')
+libzip_dep = dependency('libzip')
+lua_dep = dependency('lua')
+microtar_dep = dependency('microtar', required: false)
+
+if not mbedtls_dep.found()
+ mbedtls_dep = [
+ cc.find_library('mbedtls'),
+ cc.find_library('mbedx509'),
+ cc.find_library('mbedcrypto'),
+ ]
+endif
+
+if not microtar_dep.found()
+ microtar_lib = static_library('microtar', files('lib/microtar/src/microtar.c'))
+
+ microtar_dep = declare_dependency(
+ link_whole: [microtar_lib],
+ include_directories: ['lib/microtar/src']
+ )
+
+ message('Using git module for microtar')
+endif
+
+lpm_source = files('src/lpm.c')
+cargs = []
+if get_option('static')
+ lua_exe = find_program('lua')
+ xxd_exe = find_program('xxd')
+
+ lpm_luac = configure_file(
+ capture: false,
+ command: [lua_exe, '-e', 'io.open("@OUTPUT0@", "wb"):write(string.dump(assert(loadfile("@INPUT0@"))))'],
+ input: files('src/lpm.lua'),
+ output: 'lpm.luac'
+ )
+
+ lpm_source += configure_file(
+ capture: true,
+ command: [xxd_exe, '-i', '@INPUT@'],
+ input: lpm_luac,
+ output: 'lpm.lua.c'
+ )
+
+endif
+
+executable('lpm', lpm_source, dependencies: [zlib_dep, mbedtls_dep, libgit2_dep, libzip_dep, lua_dep, microtar_dep]) \ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..068c37b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('static', type : 'boolean', value : false, description: 'Build the pre-packaged lua file into the executable.')