:: commit f4e83a81a9f7b1c9d9052316e063eddbaee00003

Kamila Szewczyk <kspalaiologos@gmail.com> — 2022-10-24 20:46

parents: b27b6592d3

update the porting tips

diff --git a/PORTING.md b/PORTING.md
index 9d3c2b3..486969e 100644
--- a/PORTING.md
+++ b/PORTING.md
@@ -4,16 +4,29 @@ Cross-compiling Windows binaries is supported:
 
 ```console
 # For x86_64 (64bit)
-$ ./configure CC=x86_64-w64-mingw32-gcc --host x86_64-w64-mingw32
+$ ./configure CC=x86_64-w64-mingw32-gcc --host x86_64-w64-mingw32 --enable-static-exe
 $ make
 
 # For i686 (32bit)
-$ ./configure CC=i866-w64-mingw32-gcc --host i686-w64-mingw32
+$ ./configure CC=i866-w64-mingw32-gcc --host i686-w64-mingw32 --enable-static-exe
 $ make
 ```
 
-If building a dynamic library is desired, change `PUBLIC_API` in `include/common.h` to `__declspec(dllexport)` or `__attribute__((visibility("default")))` depending on your compiler.
+Static builds are recommended to avoid the pthread dynamic linking issue. If a dynamic library is desired, consider defining `BZIP3_DLL_EXPORT` or `BZIP3_DLL_IMPORT`.
 
 ## M1 MacOS
 
-Clang doesn't support `-march=native -mtune=native`, so you should remove them.
+Make sure that you run `./configure` with `--disable-arch-native`.
+
+## Emscripten
+
+Assuming that asm.js code is desired:
+
+```
+emconfigure ./configure --without-pthread --host none-none-none CC=emcc "CFLAGS=-O2 -DBZIP3_VISIBLE=\"__attribute__((used))\""
+make src/bzip3-libbz3.o
+emcc -O2 src/bzip3-libbz3.o -o libbz3.js -sWASM=0 --memory-init-file 0 -sFILESYSTEM=0 -sALLOW_MEMORY_GROWTH
+```
+
+asm.js code size: 118KB (v1.1.7), 34K gzipped.
+wasm+js stub code size: 76KB (v1.1.7), 26K gzipped.
tab: 248 wrap: offon