> **NOTE:** You may need to compile libwebsockets from source for ubuntu versions old than 16.04, since they have outdated `libwebsockets-dev` package ([Issue #6][9]).
+## Install on Windows
+
+ttyd can be built with [MSYS2][10] on windows, [follow the instructions here](msys2).
+
+> **NOTE:** Native windows console programs may not work correctly due to [pty incompatibility issues][11].
+ As a workaround, you can use [winpty][12] as a wrapper to invoke the windows program, eg: `ttyd winpty cmd`.
+
## Install on OpenWrt/LEDE
```bash
[7]: http://brew.sh
[8]: https://chromium.googlesource.com/apps/libapps/+/HEAD/hterm
[9]: https://github.com/tsl0922/ttyd/issues/6
+ [10]: http://msys2.github.io
+ [11]: https://github.com/mintty/mintty/blob/master/wiki/Tips.md#inputoutput-interaction-with-alien-programs
+ [12]: https://github.com/rprichard/winpty
-### Build the inlined html
+# Building the inlined html
install [Yarn](https://yarnpkg.com), then run the following commands:
--- /dev/null
+# Building ttyd with [MSYS2][1]
+
+1. Download and install the **latest** version of [MSYS2][1], make sure you've updated the package database.
+2. Build json-c and libwebsockets: cd to package dir and run `makepkg -s && pacman -U *.pkg.tar.xz`.
+3. Build ttyd: cd to ttyd dir and run `makepkg --skipchecksums`.
+
+ [1]: http://msys2.github.io
\ No newline at end of file
--- /dev/null
+# Maintainer: Shuanglei Tao <tsl0922@gmail.com>
+
+pkgname=json-c
+pkgver=0.12.1
+pkgrel=1
+pkgdesc="A JSON implementation in C"
+arch=('any')
+url="https://github.com/json-c/json-c"
+license=('MIT')
+makedepends=('gcc' 'make' 'autoconf')
+source=("https://s3.amazonaws.com/json-c_releases/releases/${pkgname}-${pkgver}.tar.gz")
+sha256sums=('2a136451a7932d80b7d197b10441e26e39428d67b1443ec43bbba824705e1123')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ ./configure \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-static
+ make
+}
+
+package() {
+ options=('staticlibs')
+ cd ${srcdir}/${pkgname}-${pkgver}
+ make DESTDIR="$pkgdir" install
+}
\ No newline at end of file
--- /dev/null
+# Maintainer: Shuanglei Tao <tsl0922@gmail.com>
+
+pkgname="libwebsockets"
+pkgver=2.1.0
+pkgrel=1
+pkgdesc="A lightweight pure C library for websockets (msys)"
+arch=('any')
+url="http://libwebsockets.org"
+license=('LGPL 2.1')
+makedepends=('gcc' 'cmake' 'zlib-devel' 'openssl-devel')
+source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/warmcat/${pkgname}/archive/v${pkgver}.tar.gz")
+sha256sums=('bcc96aaa609daae4d3f7ab1ee480126709ef4f6a8bf9c85de40aae48e38cce66')
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+}
+
+build() {
+ mkdir -p "${srcdir}/build-${CARCH}"
+ cd "${srcdir}/build-${CARCH}"
+
+ cmake \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DLWS_USE_BUNDLED_ZLIB=OFF \
+ -DLWS_WITHOUT_TESTAPPS=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ ../${pkgname}-${pkgver}
+
+ make
+}
+
+package() {
+ depends=('zlib-devel' 'openssl-devel')
+ options=('staticlibs')
+ cd "${srcdir}/build-${CARCH}"
+ make DESTDIR=${pkgdir} install
+}
\ No newline at end of file
--- /dev/null
+# Maintainer: Shuanglei Tao <tsl0922@gmail.com>
+
+pkgname="ttyd"
+pkgver=master
+pkgrel=1
+pkgdesc="A command-line tool for sharing terminal over the web"
+arch=('any')
+url="https://github.com/tsl0922/ttyd"
+license=('MIT')
+makedepends=('gcc' 'cmake' 'json-c' 'libwebsockets')
+source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/tsl0922/${pkgname}/archive/${pkgver}.tar.gz")
+sha256sums=('6f4f5e30d92ea1694ce528bdebb892a92aac5dda1ce13ea3b1ce7b865b971f85')
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+}
+
+build() {
+ mkdir -p "${srcdir}/build-${CARCH}"
+ cd "${srcdir}/build-${CARCH}"
+
+ cmake \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=Release \
+ ../${pkgname}-${pkgver}
+
+ make
+}
+
+package() {
+ options=('staticlibs' 'strip')
+ cd "${srcdir}/build-${CARCH}"
+ make DESTDIR=${pkgdir} install
+}
\ No newline at end of file