summary refs log tree commit diff stats
path: root/libotr/HOWTOBUILD.md
blob: 09106a0a9d978c71f77024aa095e79d0354095b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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`)