new file: projects/duktape.org/package.yml

new file:   projects/duktape.org/test.c
new file:   projects/duktape.org/test.js
This commit is contained in:
Andrii Riabchenko 2023-10-02 22:26:23 +03:00 committed by Jacob Heider
parent 6503b1b827
commit d5a7f8c394
3 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,20 @@
distributable:
url: https://github.com/svaarala/duktape/releases/download/v{{version}}/duktape-{{version}}.tar.xz
strip-components: 1
versions:
github: svaarala/duktape
build:
script:
- make -f Makefile.sharedlibrary install
- make -f Makefile.cmdline
- mkdir -p {{prefix}}/bin
- install duk {{prefix}}/bin/
env:
INSTALL_PREFIX: "{{prefix}}"
provides:
- bin/duk
test:
script:
- duk test.js | grep "Hello World!"
- cc test.c -o test -lduktape -lm
- ./test

View file

@ -0,0 +1,10 @@
#include <stdio.h>
#include "duktape.h"
int main(int argc, char *argv[]) {
duk_context *ctx = duk_create_heap_default();
duk_eval_string(ctx, "1 + 2");
printf("1 + 2 = %d\\n", (int) duk_get_int(ctx, -1));
duk_destroy_heap(ctx);
return 0;
}

View file

@ -0,0 +1 @@
console.log('Hello World!');