+libiconv (#782)

* +libiconv

* fix linux test
This commit is contained in:
Marc Seitz 2023-03-16 02:12:06 +01:00 committed by GitHub
parent e78914f3f8
commit 028997a004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,32 @@
distributable:
url: https://ftp.gnu.org/gnu/libiconv/libiconv-{{version.marketing}}.tar.gz
strip-components: 1
versions:
- 1.17.0 # fix
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |
./configure $ARGS
make --jobs {{ hw.concurrency }}
make install
env:
ARGS:
- --prefix="{{prefix}}"
- --disable-debug
- --disable-dependency-tracking
- --enable-extra-encodings
- --enable-static
provides:
- bin/iconv
test:
dependencies:
tea.xyz/gx/cc: c99
script: |
g++ -std=c++11 test.cc -liconv
./a.out

View file

@ -0,0 +1,22 @@
#include <iostream>
#include <fstream>
#include <iconv.h>
int main(int argc, char *argv[])
{
char src[] = "abcčde";
char dst[100];
size_t srclen = 6;
size_t dstlen = 12;
fprintf(stderr,"in: %s\n",src);
char * pIn = src;
char * pOut = ( char*)dst;
iconv_t conv = iconv_open("UTF-8","CP1250");
iconv(conv, &pIn, &srclen, &pOut, &dstlen);
iconv_close(conv);
fprintf(stderr,"out: %s\n",dst);
}