Skip to content

Commit

Permalink
OK to build ttyd on MSYS2 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Dec 25, 2016
1 parent 70cb376 commit 41b64be
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ make && make install

> **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
Expand Down Expand Up @@ -147,3 +154,6 @@ Docker containers are jailed environments which are more secure, this is useful
[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
2 changes: 1 addition & 1 deletion html/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Build the inlined html
# Building the inlined html

install [Yarn](https://yarnpkg.com), then run the following commands:

Expand Down
7 changes: 7 additions & 0 deletions msys2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 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
27 changes: 27 additions & 0 deletions msys2/json-c/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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
}
37 changes: 37 additions & 0 deletions msys2/libwebsockets/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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
}
34 changes: 34 additions & 0 deletions msys2/ttyd/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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
}

0 comments on commit 41b64be

Please sign in to comment.