summaryrefslogtreecommitdiffstats
path: root/manual tests/2 multiwrap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /manual tests/2 multiwrap
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--manual tests/2 multiwrap/meson.build12
-rw-r--r--manual tests/2 multiwrap/prog.c66
-rw-r--r--manual tests/2 multiwrap/subprojects/libpng.wrap10
-rw-r--r--manual tests/2 multiwrap/subprojects/lua.wrap11
-rw-r--r--manual tests/2 multiwrap/subprojects/zlib.wrap10
5 files changed, 109 insertions, 0 deletions
diff --git a/manual tests/2 multiwrap/meson.build b/manual tests/2 multiwrap/meson.build
new file mode 100644
index 0000000..a4c42f4
--- /dev/null
+++ b/manual tests/2 multiwrap/meson.build
@@ -0,0 +1,12 @@
+project('multiwrap', 'c',
+ default_options : 'c_std=c99')
+
+# Using multiple downloaded projects for great justice.
+
+cc = meson.get_compiler('c')
+
+luadep = dependency('lua', fallback : ['lua', 'lua_dep'])
+pngdep = dependency('libpng', fallback : ['libpng', 'png_dep'])
+
+executable('prog', 'prog.c',
+ dependencies : [pngdep, luadep])
diff --git a/manual tests/2 multiwrap/prog.c b/manual tests/2 multiwrap/prog.c
new file mode 100644
index 0000000..dd0349e
--- /dev/null
+++ b/manual tests/2 multiwrap/prog.c
@@ -0,0 +1,66 @@
+#include<lua.h>
+#include<stdio.h>
+#include<stdlib.h>
+#include<png.h>
+#include<string.h>
+#if !defined(_MSC_VER)
+#include<unistd.h>
+#endif
+
+static void *l_alloc (void *ud, void *ptr, size_t osize,
+ size_t nsize) {
+ (void)ud;
+ (void)osize;
+ if (nsize == 0) {
+ free(ptr);
+ return NULL;
+ } else {
+ return realloc(ptr, nsize);
+ }
+}
+
+void open_image(const char *fname) {
+ png_image image;
+
+ memset(&image, 0, (sizeof image));
+ image.version = PNG_IMAGE_VERSION;
+
+ if(png_image_begin_read_from_file(&image, fname) != 0) {
+ png_bytep buffer;
+
+ image.format = PNG_FORMAT_RGBA;
+ buffer = malloc(PNG_IMAGE_SIZE(image));
+
+ if(png_image_finish_read(&image, NULL, buffer, 0, NULL) != 0) {
+ printf("Image %s read failed: %s\n", fname, image.message);
+ }
+// png_free_image(&image);
+ free(buffer);
+ } else {
+ printf("Image %s open failed: %s", fname, image.message);
+ }
+}
+
+int printer(lua_State *l) {
+ if(!lua_isstring(l, 1)) {
+ fprintf(stderr, "Incorrect call.\n");
+ return 0;
+ }
+ open_image(lua_tostring(l, 1));
+ return 0;
+}
+
+
+int main(int argc, char **argv) {
+ lua_State *l = lua_newstate(l_alloc, NULL);
+ if(!l) {
+ printf("Lua state allocation failed.\n");
+ return 1;
+ }
+ lua_register(l, "printer", printer);
+ lua_getglobal(l, "printer");
+ lua_pushliteral(l, "foobar.png");
+ lua_call(l, 1, 0);
+ lua_close(l);
+ return 0;
+}
diff --git a/manual tests/2 multiwrap/subprojects/libpng.wrap b/manual tests/2 multiwrap/subprojects/libpng.wrap
new file mode 100644
index 0000000..283775c
--- /dev/null
+++ b/manual tests/2 multiwrap/subprojects/libpng.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = libpng-1.6.34
+
+source_url = ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.xz
+source_filename = libpng-1.6.34.tar.xz
+source_hash = 2f1e960d92ce3b3abd03d06dfec9637dfbd22febf107a536b44f7a47c60659f6
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/libpng/1.6.34/1/get_zip
+patch_filename = libpng-1.6.34-1-wrap.zip
+patch_hash = 2123806eba8180c164e33a210f2892bbeb2473b69e56aecc786574e9221e6f20
diff --git a/manual tests/2 multiwrap/subprojects/lua.wrap b/manual tests/2 multiwrap/subprojects/lua.wrap
new file mode 100644
index 0000000..c1a179a
--- /dev/null
+++ b/manual tests/2 multiwrap/subprojects/lua.wrap
@@ -0,0 +1,11 @@
+[wrap-file]
+directory = lua-5.3.0
+
+source_url = http://www.lua.org/ftp/lua-5.3.0.tar.gz
+source_filename = lua-5.3.0.tar.gz
+source_hash = ae4a5eb2d660515eb191bfe3e061f2b8ffe94dce73d32cfd0de090ddcc0ddb01
+
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/lua/5.3.0/5/get_zip
+patch_filename = lua-5.3.0-5-wrap.zip
+patch_hash = 439038309a0700adfb67d764b3fe935ed8601b31f819fc369e1438c6e79334dd
diff --git a/manual tests/2 multiwrap/subprojects/zlib.wrap b/manual tests/2 multiwrap/subprojects/zlib.wrap
new file mode 100644
index 0000000..6d5896f
--- /dev/null
+++ b/manual tests/2 multiwrap/subprojects/zlib.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = zlib-1.2.8
+
+source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz
+source_filename = zlib-1.2.8.tar.gz
+source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip
+patch_filename = zlib-1.2.8-8-wrap.zip
+patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60