This repository has been archived on 2020-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
tdlib-fork/example/web/README.md
levlam 45ae774bf9 Add README to tdweb package.
GitOrigin-RevId: 448a7a5f54a1cf5b08bb2062c38cde5c47b6f832
2019-04-28 02:38:43 +03:00

30 lines
1.4 KiB
Markdown

# TDLib Web example
This is an example of building `TDLib` for browsers using [Emscripten](https://github.com/kripken/emscripten).
These scripts build `TDLib` and creates an [NPM](https://www.npmjs.com/) package [tdweb](https://www.npmjs.com/package/@arseny30/tdweb).
You need Unix shell with `sed`, `tar` and `wget` utilities to run provided scripts.
## Building tdweb NPM package
* Install latest [emsdk](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). Do not use system-provided `emscripten` package, because it contains too old version.
* Install all `TDLib` build dependencies as described in [Building](https://github.com/tdlib/td#building).
* Run `source ./emsdk_env.sh` from `emsdk` directory to set up correct build environment.
* On `macOS` install `coreutils` [Homebrew](https://brew.sh) package and replace `realpath` usages in scripts with `grealpath`:
```
brew install coreutils
sed -i.bak 's/[(]realpath/(grealpath/g' build-tdlib.sh
```
* Run build scripts in the following order:
```
cd <path to TDLib sources>/example/web
./build-openssl.sh
./build-tdlib.sh
./copy-tdlib.sh
./build-tdweb.sh
```
* The built package is now located in `tdweb` directory.
## Using tdweb NPM package
See [tdweb](https://www.npmjs.com/package/@arseny30/tdweb) or [README.md](https://github.com/tdlib/td/tree/master/example/web/tdweb/README.md) for the package documentation.