]> prime8.dev >> repos - ttyd.git/commitdiff
scripts: update mingw-build.sh
authorShuanglei Tao <tsl0922@gmail.com>
Tue, 11 Oct 2022 13:09:49 +0000 (21:09 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Tue, 11 Oct 2022 14:45:41 +0000 (22:45 +0800)
.github/workflows/backend.yml
.github/workflows/release.yml
scripts/mingw-build.sh

index 55b60e0aaaec902c4a08e7e8fdcd00e6d579716c..9dff62321c75a63972e9302e432ebd0884a58c60 100644 (file)
@@ -67,7 +67,8 @@ jobs:
         with:
           msystem: MINGW64
           install: >-
-            make
+            base-devel
+            subversion
             mingw64/mingw-w64-x86_64-gcc
             mingw64/mingw-w64-x86_64-cmake
             mingw64/mingw-w64-x86_64-zlib
index fa028aafd3b72cd0031a058e43ffbce85cf1a2e1..a0ea6bfe2298541119308ba1b0119dec75991c5e 100644 (file)
@@ -57,7 +57,8 @@ jobs:
         with:
           msystem: MINGW64
           install: >-
-            make
+            base-devel
+            subversion
             mingw64/mingw-w64-x86_64-gcc
             mingw64/mingw-w64-x86_64-cmake
             mingw64/mingw-w64-x86_64-zlib
index 48f5dd8847505776daa92a4fe14500b73c787587..6366dcbbb08a30d9047affcbaa635d7b66d91632 100644 (file)
@@ -2,39 +2,26 @@
 
 set -eo pipefail
 
-TMPDIR="${TMPDIR:-/tmp}"
-JSON_C_VERSION="${JSON_C_VERSION:-0.15}"
-LIBWEBSOCKETS_VERSION="${LIBWEBSOCKETS_VERSION:-4.3.2}"
-
 build_libwebsockets() {
-  curl -sLo- "https://github.com/warmcat/libwebsockets/archive/v${LIBWEBSOCKETS_VERSION}.tar.gz" | tar xz -f - -C "${TMPDIR}"
-  pushd "${TMPDIR}/libwebsockets-${LIBWEBSOCKETS_VERSION}"
-      sed -i 's/ websockets_shared//g' cmake/libwebsockets-config.cmake.in
-      sed -i '/PC_OPENSSL/d' lib/tls/CMakeLists.txt
-      rm -rf build && mkdir -p build && cd build
-      MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
-      cmake -G"MSYS Makefiles" \
-          -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-          -DCMAKE_BUILD_TYPE=RELEASE \
-          -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
-          -DCMAKE_EXE_LINKER_FLAGS="-static" \
-          -DLWS_WITH_MBEDTLS=ON \
-          -DLWS_WITH_DIR=OFF \
-          -DLWS_WITHOUT_DAEMONIZE=ON \
-          -DLWS_WITHOUT_TESTAPPS=ON \
-          -DLWS_WITH_LIBUV=ON \
-          ..
-      make -j"$(nproc)" install
+  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 /mingw64/lib/libuv_a.a /mingw64/lib/libuv.a
+
 rm -rf build && mkdir -p build && cd build
-cmake -G"MSYS Makefiles" \
+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" \
-    -DCMAKE_BUILD_TYPE=RELEASE \
     ..
-make install
+cmake --build .