summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/cross-build.sh16
-rw-r--r--scripts/mingw-build.sh40
2 files changed, 52 insertions, 4 deletions
diff --git a/scripts/cross-build.sh b/scripts/cross-build.sh
index 848aef5..4070ca8 100755
--- a/scripts/cross-build.sh
+++ b/scripts/cross-build.sh
@@ -14,7 +14,7 @@ ZLIB_VERSION="${ZLIB_VERSION:-1.2.11}"
JSON_C_VERSION="${JSON_C_VERSION:-0.15}"
MBEDTLS_VERSION="${MBEDTLS_VERSION:-2.16.8}"
LIBUV_VERSION="${LIBUV_VERSION:-1.40.0}"
-LIBWEBSOCKETS_VERSION="${LIBWEBSOCKETS_VERSION:-4.1.6}"
+LIBWEBSOCKETS_VERSION="${LIBWEBSOCKETS_VERSION:-4.2.1}"
build_zlib() {
echo "=== Building zlib-${ZLIB_VERSION} (${TARGET})..."
@@ -106,7 +106,6 @@ build_libwebsockets() {
-DLWS_WITH_LEJP=OFF \
-DLWS_WITH_LEJP_CONF=OFF \
-DLWS_WITH_LWSAC=OFF \
- -DLWS_WITH_CUSTOM_HEADERS=OFF \
-DLWS_WITH_SEQUENCER=OFF \
..
make -j"$(nproc)" install
@@ -154,15 +153,24 @@ build() {
}
case ${BUILD_TARGET} in
- i686|x86_64|aarch64|mips|mipsel|mips64|mips64el)
+ amd64) BUILD_TARGET="x86_64" ;;
+ arm64) BUILD_TARGET="aarch64" ;;
+ armv7) BUILD_TARGET="armv7l" ;;
+esac
+
+case ${BUILD_TARGET} in
+ i686|x86_64|aarch64|mips|mipsel|mips64|mips64el|s390x)
build "${BUILD_TARGET}-linux-musl" "${BUILD_TARGET}"
;;
arm)
- build arm-linux-musleabi "${BUILD_TARGET}"
+ build "${BUILD_TARGET}-linux-musleabi" "${BUILD_TARGET}"
;;
armhf)
build arm-linux-musleabihf "${BUILD_TARGET}"
;;
+ armv7l)
+ build armv7l-linux-musleabihf "${BUILD_TARGET}"
+ ;;
*)
echo "unknown cross target: ${BUILD_TARGET}" && exit 1
esac
diff --git a/scripts/mingw-build.sh b/scripts/mingw-build.sh
new file mode 100644
index 0000000..8b74cdb
--- /dev/null
+++ b/scripts/mingw-build.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -eo pipefail
+
+TMPDIR="${TMPDIR:-/tmp}"
+JSON_C_VERSION="${JSON_C_VERSION:-0.15}"
+LIBWEBSOCKETS_VERSION="${LIBWEBSOCKETS_VERSION:-4.2.1}"
+
+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
+ popd
+}
+
+build_libwebsockets
+
+rm -rf build && mkdir -p build && cd build
+cmake -G"MSYS Makefiles" \
+ -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