]> prime8.dev >> repos - ttyd.git/commitdiff
OK to build ttyd on MSYS2 (#30)
authorShuanglei Tao <tsl0922@gmail.com>
Sun, 25 Dec 2016 16:30:55 +0000 (00:30 +0800)
committerGitHub <noreply@github.com>
Sun, 25 Dec 2016 16:30:55 +0000 (00:30 +0800)
README.md
html/README.md
msys2/README.md [new file with mode: 0644]
msys2/json-c/PKGBUILD [new file with mode: 0644]
msys2/libwebsockets/PKGBUILD [new file with mode: 0644]
msys2/ttyd/PKGBUILD [new file with mode: 0644]

index 2af0df9f2c8ec8ae43fdb2d3e909e3c7df7a7a1f..d0c79cf21345042fb881c2006afadd285fef882d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
@@ -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
index 7791a0b57cd3e32dd7b83e7b5fc5ea11ad35807f..681e3d6b3476de2f15a467ced8a72dfefb558455 100644 (file)
@@ -1,4 +1,4 @@
-### Build the inlined html
+# Building the inlined html
 
 install [Yarn](https://yarnpkg.com), then run the following commands:
 
diff --git a/msys2/README.md b/msys2/README.md
new file mode 100644 (file)
index 0000000..17ec3a5
--- /dev/null
@@ -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
\ No newline at end of file
diff --git a/msys2/json-c/PKGBUILD b/msys2/json-c/PKGBUILD
new file mode 100644 (file)
index 0000000..13b847f
--- /dev/null
@@ -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
+}
\ No newline at end of file
diff --git a/msys2/libwebsockets/PKGBUILD b/msys2/libwebsockets/PKGBUILD
new file mode 100644 (file)
index 0000000..c3d5f99
--- /dev/null
@@ -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
+}
\ No newline at end of file
diff --git a/msys2/ttyd/PKGBUILD b/msys2/ttyd/PKGBUILD
new file mode 100644 (file)
index 0000000..143900c
--- /dev/null
@@ -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
+}
\ No newline at end of file