update docs to include needed deps

This commit is contained in:
ading2210 2024-01-28 23:32:58 -05:00
parent 717331bfc1
commit 23d1651383
3 changed files with 11 additions and 2 deletions

View file

@ -18,12 +18,16 @@ git clone https://github.com/ading2210/libcurl.js --recursive
cd libcurl.js/client
./build.sh
```
Make sure you have emscripten, git, and the various C build tools installed. The build script will generate `client/out/libcurl.js` as well as `client/out/libcurl_module.mjs`, which is an ES6 module.
Make sure you have emscripten, git, and the various C build tools installed. The only OS supported for building libcurl.js is Linux. On Debian-based systems, you can run the following command to install all the dependencies:
```
sudo apt install make cmake emscripten autoconf automake libtool pkg-config wget xxd
```
You can supply the following arguments to the build script to control the build:
The build script will generate `client/out/libcurl.js` as well as `client/out/libcurl_module.mjs`, which is an ES6 module. You can supply the following arguments to the build script to control the build:
- `release` - Use all optimizations.
- `single_file` - Include the WASM binary in the outputted JS using base64.
## Javascript API:
### Importing the Library:

View file

@ -1,6 +1,10 @@
//everything is wrapped in a function to prevent emscripten from polluting the global scope
window.libcurl = (function() {
if (typeof window === "undefined") {
throw new Error("NodeJS is not supported. This only works inside the browser.");
}
//emscripten compiled code is inserted here
/* __emscripten_output__ */

View file

@ -2,6 +2,7 @@
#build all deps
set -e
mkdir -p build
OPENSSL_PREFIX=$(realpath build/openssl-wasm)