How to build (wasm)
===================
For libgpg-error
----------------
First create `src/syscfg/lock-obj-pub.wasm32-unknown-none.h` with the below:
```
## lock-obj-pub.wasm32-unknown-emscripten.h
## File created by gen-posix-lock-obj - DO NOT EDIT
## To be included by mkheader into gpg-error.h
typedef struct
{
long _vers;
union {
volatile char _priv[28];
long _x_align;
long *_xp_align;
} u;
} gpgrt_lock_t;
#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
0,0,0,0,0,0,0,0, \
0,0,0,0,0,0,0,0, \
0,0,0,0}}}
##
## Local Variables:
## mode: c
## buffer-read-only: t
## End:
##
```
(source: <https://code.videolan.org/b1ue/vlc/-/blob/81ca8d4f0a86c39f363ad5a07781a3f488a3af64/contrib/src/gpg-error/emscripten.patch>)
Then do:
```
emconfigure ./configure CFLAGS='-s PURE_WASI=1' --host=wasm32-unknown-none --prefix="$(cd ../buildenv; pwd)" --build=$YOURSYS
emmake make
emmake make install
```
(replace `$YOURSYS` with the system you're building on, e.g. `x86_64-pc-linux-gnu`)
For libgcrypt
-------------
First do libgpg-error, then just do:
```
emconfigure ./configure CFLAGS='-s PURE_WASI=1' --host=wasm32-unknown-none --build=$YOURSYS --prefix="$(cd ../buildenv; pwd)" --with-gpg-error-prefix="$(cd ../buildenv; pwd)"
emmake make
emmake make install
```
(replace `$YOURSYS` with the system you're building on, e.g. `x86_64-pc-linux-gnu`)
For libotr
----------
First do libgcrypt, then just do:
```
emconfigure ./configure CFLAGS='-s PURE_WASI=1' --host=wasm32-unknown-none --build=$YOURSYS --prefix="$(cd ../buildenv; pwd)" --with-libgcrypt-prefix="$(cd ../buildenv; pwd)" --disable-gcc-hardening
emmake make
emmake make install
```
(replace `$YOURSYS` with the system you're building on, e.g. `x86_64-pc-linux-gnu`)