From 9c1f133118180cc2eb7b8618f2771e14cdd7a3cc Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Thu, 24 Oct 2024 19:14:15 +0200 Subject: [PATCH] Package cpp-httplib Intended as replacment for mongoose, which due to license change can't be updated anymore. Signed-off-by: Ralph Sennhauser --- .gitignore | 1 + libraries/source/cpp-httplib/build.sh | 70 +++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100755 libraries/source/cpp-httplib/build.sh diff --git a/.gitignore b/.gitignore index 4b10a3065c..31c72f265d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ libraries/macos libraries/win32 libraries/win64 +libraries/source/cpp-httplib/* libraries/source/cxxtest-4.4/* libraries/source/fcollada/* libraries/source/nvtt/* diff --git a/libraries/source/cpp-httplib/build.sh b/libraries/source/cpp-httplib/build.sh new file mode 100755 index 0000000000..9bdab7f292 --- /dev/null +++ b/libraries/source/cpp-httplib/build.sh @@ -0,0 +1,70 @@ +#!/bin/sh +set -e + +: "${TAR:=tar}" + +cd "$(dirname "$0")" + +PV=0.30.1 +LIB_VERSION=${PV}+wfg0 + +fetch() +{ + curl -fLo "cpp-httplib-${PV}.tar.gz" \ + "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v${PV}.tar.gz" +} + +while [ "$#" -gt 0 ]; do + case "$1" in + --fetch-only) + fetch + exit + ;; + --force-rebuild) rm -f .already-built ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac + shift +done + +echo "Building cpp-httplib..." +if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then + echo "Skipping - already built (use --force-rebuild to override)" + exit +fi + +# fetch +if [ ! -e "cpp-httplib-${PV}.tar.gz" ]; then + fetch +fi + +# unpack +rm -Rf "cpp-httplib-${PV}" +"${TAR}" -xf "cpp-httplib-${PV}.tar.gz" + +# configure +rm -Rf build +cmake -B build -S "cpp-httplib-${PV}" \ + -DBUILD_SHARED_LIBS=NO \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_INSTALL_PREFIX="$(realpath .)" \ + -DHTTPLIB_COMPILE=YES \ + -DHTTPLIB_REQUIRE_BROTLI=NO \ + -DHTTPLIB_REQUIRE_OPENSSL=NO \ + -DHTTPLIB_REQUIRE_ZLIB=NO \ + -DHTTPLIB_USE_BROTLI_IF_AVAILABLE=NO \ + -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=NO \ + -DHTTPLIB_USE_ZLIB_IF_AVAILABLE=NO \ + -DHTTPLIB_USE_ZSTD_IF_AVAILABLE=NO + +# build +cmake --build build + +# install +rm -Rf include lib share +cmake --install build + +echo "${LIB_VERSION}" >.already-built