From 0b200115d33257ea0ceab1d03cc25f5b52c6ad77 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Fri, 3 Mar 2023 19:58:26 +0100 Subject: [PATCH] Fetch zsync2 using FetchContent --- .gitmodules | 3 --- CMakeLists.txt | 17 ++++++++++++----- ci/Dockerfile.i386 | 3 +++ ci/Dockerfile.x86_64 | 3 +++ ci/install-gtest.sh | 21 +++++++++++++++++++++ lib/CMakeLists.txt | 3 --- lib/zsync2 | 1 - 7 files changed, 39 insertions(+), 12 deletions(-) create mode 100755 ci/install-gtest.sh delete mode 100644 lib/CMakeLists.txt delete mode 160000 lib/zsync2 diff --git a/.gitmodules b/.gitmodules index c931016..8a991c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "lib/zsync2"] - path = lib/zsync2 - url = https://github.com/AppImage/zsync2 [submodule "lib/fltk"] path = lib/fltk url = https://github.com/TheAssassin/fltk-1.3.4 diff --git a/CMakeLists.txt b/CMakeLists.txt index d4726f0..d5a121d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,8 @@ option(ENABLE_SANITIZERS "Enable builds using sanitizers" off) # install into proper dirs on Linux include(GNUInstallDirs) +include(FetchContent) + option(USE_SYSTEM_ZSYNC2 OFF "Use existing libzsync2 installed on system (or inside CMAKE_PREFIX_PATH)") if(USE_SYSTEM_ZSYNC2) set(USE_SYSTEM_CPR ON) @@ -46,6 +48,16 @@ if(USE_SYSTEM_ZSYNC2) # note: find_package calls must be made in the same or a parent scope find_package(zsync2 REQUIRED) +else() + function(import_zsync2) + FetchContent_Declare(zsync2 + GIT_REPOSITORY https://github.com/AppImageCommunity/zsync2 + GIT_TAG 2.0.0-alpha-1-20230304 + ) + FetchContent_MakeAvailable(zsync2) + endfunction() + + import_zsync2() endif() option(USE_SYSTEM_LIBAPPIMAGE OFF "Use existing libappimage installed on system (or inside CMAKE_PREFIX_PATH)") @@ -54,8 +66,6 @@ if(USE_SYSTEM_LIBAPPIMAGE) find_package(libappimage REQUIRED) else() function(import_libappimage) - include(FetchContent) - FetchContent_Declare(libappimage GIT_REPOSITORY https://github.com/AppImageCommunity/libappimage GIT_TAG 3467b20 @@ -77,9 +87,6 @@ if(NOT BUILD_LIBAPPIMAGEUPDATE_ONLY) endif() endif() -# include external libraries -add_subdirectory(lib) - # core source directory, contains its own CMakeLists.txt add_subdirectory(src) diff --git a/ci/Dockerfile.i386 b/ci/Dockerfile.i386 index 7e3b8c0..e55f84e 100644 --- a/ci/Dockerfile.i386 +++ b/ci/Dockerfile.i386 @@ -16,6 +16,9 @@ RUN apt-get update && \ libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev libboost-dev && \ wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.24.0-ubuntu_"$DIST"-"$ARCH".tar.gz | tar xzv -C/usr --strip-components=1 +COPY ./install-gtest.sh / +RUN bash /install-gtest.sh + COPY pkgconfig/*.pc /usr/lib/i386-linux-gnu/pkgconfig/ RUN sed -i 's|x86_64|i386|g' /usr/lib/i386-linux-gnu/pkgconfig/*.pc diff --git a/ci/Dockerfile.x86_64 b/ci/Dockerfile.x86_64 index a0ceac6..0d84915 100644 --- a/ci/Dockerfile.x86_64 +++ b/ci/Dockerfile.x86_64 @@ -16,6 +16,9 @@ RUN apt-get update && \ libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev libboost-dev && \ wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.24.0-ubuntu_"$DIST"-"$ARCH".tar.gz | tar xzv -C/usr --strip-components=1 +COPY ./install-gtest.sh / +RUN bash /install-gtest.sh + COPY pkgconfig/*.pc /usr/lib/x86_64-linux-gnu/pkgconfig/ COPY entrypoint.sh / diff --git a/ci/install-gtest.sh b/ci/install-gtest.sh new file mode 100755 index 0000000..14bc862 --- /dev/null +++ b/ci/install-gtest.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +set -euxo pipefail + +tempdir="$(mktemp -d)" + +_cleanup() { + [[ -d "$tempdir" ]] && rm -r "$tempdir" +} +trap _cleanup EXIT + +cd "$tempdir" + +git clone https://github.com/google/googletest -b v1.13.0 . + +mkdir build +cd build + +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make -j6 +make install diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index bf3149d..0000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -if(NOT USE_SYSTEM_ZSYNC2) - add_subdirectory(zsync2 EXCLUDE_FROM_ALL) -endif() diff --git a/lib/zsync2 b/lib/zsync2 deleted file mode 160000 index 4e549b6..0000000 --- a/lib/zsync2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4e549b676bee6455c7557c26ca4b5a10217eb4d9