Skip to content

Commit

Permalink
+ucl
Browse files Browse the repository at this point in the history
  • Loading branch information
jhheider committed Mar 11, 2025
1 parent b88ea01 commit b5ff5aa
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions projects/oberhumer.com/ucl/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
distributable:
url: https://www.oberhumer.com/opensource/ucl/download/ucl-{{ version.raw }}.tar.gz
strip-components: 1

versions:
url: https://www.oberhumer.com/opensource/ucl/download
match: /ucl-\d+(\.\d+)+\.tar\.gz/
strip:
- /ucl-/
- /.tar.gz/

build:
dependencies:
gnu.org/automake: '*'
script:
# very old config.* files
- cp -a {{deps.gnu.org/automake.prefix}}/share/automake-*/config.{sub,guess} acconfig/
- ./configure $ARGS
- make install
- run:
- mv ucl/* .
- rmdir ucl
- ln -s . ucl
working-directory: ${{prefix}}/include
env:
ARGS:
- --prefix={{prefix}}
- --disable-debug
- --disable-dependency-tracking
CFLAGS:
- -Wno-implicit-function-declaration

test:
- run: cc $FIXTURE -o test -lucl
fixture:
extname: c
contents: |
// simplified version of
// https://github.com/korczis/ucl/blob/HEAD/examples/simple.c
#include <stdio.h>
#include <ucl/ucl.h>
#include <ucl/uclconf.h>
#define IN_LEN (128*1024L)
#define OUT_LEN (IN_LEN + IN_LEN / 8 + 256)
int main(int argc, char *argv[]) {
int r;
ucl_byte *in, *out;
ucl_uint in_len, out_len, new_len;
if (ucl_init() != UCL_E_OK) { return 4; }
in = (ucl_byte *) ucl_malloc(IN_LEN);
out = (ucl_byte *) ucl_malloc(OUT_LEN);
if (in == NULL || out == NULL) { return 3; }
in_len = IN_LEN;
ucl_memset(in,0,in_len);
r = ucl_nrv2b_99_compress(in,in_len,out,&out_len,NULL,5,NULL,NULL);
if (r != UCL_E_OK) { return 2; }
if (out_len >= in_len) { return 0; }
r = ucl_nrv2b_decompress_8(out,out_len,in,&new_len,NULL);
if (r != UCL_E_OK && new_len == in_len) { return 1; }
ucl_free(out);
ucl_free(in);
return 0;
}
- ./test

0 comments on commit b5ff5aa

Please sign in to comment.