summaryrefslogtreecommitdiffstats
path: root/scripts/mingw-build.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:54:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:54:31 +0000
commit3b4936b6f2b870f9f2444ebb6ce1ca2de3f49d9f (patch)
treec91ab0ac9447b25f91c05e901212c2142fb95953 /scripts/mingw-build.sh
parentInitial commit. (diff)
downloadttyd-3b4936b6f2b870f9f2444ebb6ce1ca2de3f49d9f.tar.xz
ttyd-3b4936b6f2b870f9f2444ebb6ce1ca2de3f49d9f.zip
Adding upstream version 1.7.4.upstream/1.7.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mingw-build.sh')
-rw-r--r--scripts/mingw-build.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/mingw-build.sh b/scripts/mingw-build.sh
new file mode 100644
index 0000000..750d147
--- /dev/null
+++ b/scripts/mingw-build.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -eo pipefail
+
+build_libwebsockets() {
+ svn co https://github.com/msys2/MINGW-packages/trunk/mingw-w64-libwebsockets
+ sed -i 's/openssl/mbedtls/' mingw-w64-libwebsockets/PKGBUILD
+ sed -i '/-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX}/a \ -DLWS_WITH_MBEDTLS=ON \\' mingw-w64-libwebsockets/PKGBUILD
+ sed -i '/-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX}/a \ -DLWS_WITH_LIBUV=ON \\' mingw-w64-libwebsockets/PKGBUILD
+ pushd mingw-w64-libwebsockets
+ makepkg-mingw --cleanbuild --syncdeps --force --noconfirm
+ pacman -U *.pkg.tar.zst --noconfirm
+ popd
+}
+
+build_libwebsockets
+
+# workaround for the lib name change
+cp ${MINGW_PREFIX}/lib/libuv_a.a ${MINGW_PREFIX}/lib/libuv.a
+
+rm -rf build && mkdir -p build && cd build
+cmake -DCMAKE_BUILD_TYPE=RELEASE \
+ -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
+ -DCMAKE_C_FLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto" \
+ -DCMAKE_EXE_LINKER_FLAGS="-static -no-pie -Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections" \
+ ..
+cmake --build .