From f1c9ab22bbfaf4c62862da39a4c35198c724fcf3 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 3 Apr 2022 16:29:21 +0200 Subject: [PATCH 1/3] Remove libappimage git submodule The submodule is replaced with CMake FetchContent commands, which fetch the source at configure time (We need to include scripts.cmake from libappimage. ExternalProject_Add only downloads at build time). Also update libappimage version to latest (otherwise the build fails on g++11) and patch in https://github.com/AppImage/libappimage/pull/160 (to allow using latest libappimage in AppImageKit. Also update squashfs-tools version to latest release (otherwise the build fails on g++11) Also related to https://github.com/AppImage/AppImageKit/issues/1165 --- .gitmodules | 3 --- CMakeLists.txt | 5 ----- cmake/dependencies.cmake | 31 +++++++++++++++++++++++++------ lib/CMakeLists.txt | 1 - lib/libappimage | 1 - src/CMakeLists.txt | 4 ---- src/appimagetool.c | 6 +++--- src/build-runtime.cmake | 4 ++-- src/validate.c | 4 ++-- 9 files changed, 32 insertions(+), 27 deletions(-) delete mode 100644 lib/CMakeLists.txt delete mode 160000 lib/libappimage diff --git a/.gitmodules b/.gitmodules index a5daa46d3..9c36da2a9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "cmake/sanitizers-cmake"] path = cmake/sanitizers-cmake url = https://github.com/arsenm/sanitizers-cmake -[submodule "lib/libappimage"] - path = lib/libappimage - url = https://github.com/AppImage/libappimage.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 219f4b75e..a75108281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,11 +64,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) ########################## set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) - -# configure dependencies -add_subdirectory(lib) - -include(lib/libappimage/cmake/tools.cmake) include(cmake/dependencies.cmake) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 896e3a8d9..2efadbdda 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -1,8 +1,26 @@ -# >= 3.2 required for ExternalProject_Add_StepDependencies -cmake_minimum_required(VERSION 3.2) - - -include(${PROJECT_SOURCE_DIR}/lib/libappimage/cmake/scripts.cmake) +# >= 3.11 required for FetchContent +cmake_minimum_required(VERSION 3.11) + +include(FetchContent) + +# Need this patch until https://github.com/AppImage/libappimage/pull/160 is resolved +FetchContent_Declare(libappimage_patch + URL https://github.com/AppImage/libappimage/commit/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch + DOWNLOAD_NO_EXTRACT TRUE +) +FetchContent_MakeAvailable(libappimage_patch) + +FetchContent_Declare(libappimage + # We can not use a URL source with a github-generated source archive: libappimage's gtest submodule would be missing + GIT_REPOSITORY https://github.com/AppImage/libappimage + GIT_TAG 1d4d57622de2c7d39f7cc6c4980144c713cc59ca # latest as of 2022-04-03 + # The patch command has || true to prevent the build from failing if the patch has already been applied + PATCH_COMMAND patch -p 1 < ${libappimage_patch_SOURCE_DIR}/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch || true +) +FetchContent_MakeAvailable(libappimage) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${libappimage_SOURCE_DIR}/cmake) +include(${libappimage_SOURCE_DIR}/cmake/scripts.cmake) +include(${libappimage_SOURCE_DIR}/cmake/tools.cmake) # the names of the targets need to differ from the library filenames @@ -53,9 +71,10 @@ if(NOT USE_SYSTEM_MKSQUASHFS) ExternalProject_Add(mksquashfs GIT_REPOSITORY https://github.com/plougher/squashfs-tools/ - GIT_TAG 4.4 + GIT_TAG 4.5.1 UPDATE_COMMAND "" # Make sure CMake won't try to fetch updates unnecessarily and hence rebuild the dependency every time CONFIGURE_COMMAND ${SED} -i "s|CFLAGS += -DXZ_SUPPORT|CFLAGS += ${mksquashfs_cflags}|g" /squashfs-tools/Makefile + COMMAND ${SED} -i "/INSTALL_MANPAGES_DIR/d" /squashfs-tools/Makefile COMMAND ${SED} -i "s|LIBS += -llzma|LIBS += -Bstatic ${mksquashfs_ldflags}|g" /squashfs-tools/Makefile COMMAND ${SED} -i "s|install: mksquashfs unsquashfs|install: mksquashfs|g" squashfs-tools/Makefile COMMAND ${SED} -i "/cp unsquashfs/d" squashfs-tools/Makefile diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index 9ca1144be..000000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(libappimage) diff --git a/lib/libappimage b/lib/libappimage deleted file mode 160000 index 9c1fae809..000000000 --- a/lib/libappimage +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9c1fae809dedbb3015e9cd5b46e2b5aab06df36e diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f2247b405..16b53e119 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,10 +57,6 @@ target_compile_definitions(appimagetool PRIVATE -DENABLE_BINRELOC ) -target_include_directories(appimagetool - PUBLIC $ - INTERFACE $ -) if(AUXILIARY_FILES_DESTINATION) message(STATUS "Installing auxiliary files in path: ${AUXILIARY_FILES_DESTINATION}") diff --git a/src/appimagetool.c b/src/appimagetool.c index 6f27020e0..d70913bfd 100644 --- a/src/appimagetool.c +++ b/src/appimagetool.c @@ -45,8 +45,6 @@ #include #include -#include "binreloc.h" - #include #include @@ -56,7 +54,9 @@ #include #include -#include "appimage/appimage.h" +#include + +#include "binreloc.h" #include "appimagetool_sign.h" #ifdef __linux__ diff --git a/src/build-runtime.cmake b/src/build-runtime.cmake index dc9717506..3657f9551 100644 --- a/src/build-runtime.cmake +++ b/src/build-runtime.cmake @@ -27,8 +27,8 @@ set(runtime_cflags -DGIT_COMMIT=\\"${GIT_COMMIT}\\" -I${squashfuse_INCLUDE_DIRS} -I${PROJECT_SOURCE_DIR}/include - -I${PROJECT_SOURCE_DIR}/lib/libappimage/include - -I${PROJECT_SOURCE_DIR}/lib/libappimage/src/libappimage_hashlib/include + -I${libappimage_SOURCE_DIR}/include + -I${libappimage_SOURCE_DIR}/src/libappimage_hashlib/include ${DEPENDENCIES_CFLAGS} ) # must not include -Wl,--gc-sections in the following flags, otherwise the data sections will be stripped out diff --git a/src/validate.c b/src/validate.c index 7e8ce30c6..4a38db734 100644 --- a/src/validate.c +++ b/src/validate.c @@ -12,8 +12,8 @@ #include #include -#include "appimage/appimage.h" -#include "appimage/appimage_shared.h" +#include + #include "light_elf.h" typedef unsigned char byte; From 2fc2a911967ec1ddbeb8ddeaf587f1c6e8e2cc92 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 18 Aug 2022 16:29:01 +0200 Subject: [PATCH 2/3] Update minimum CMake and libappimage pinning --- cmake/dependencies.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 2efadbdda..3f3de9709 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -1,5 +1,5 @@ -# >= 3.11 required for FetchContent -cmake_minimum_required(VERSION 3.11) +# FetchContent_MakeAvailable() is only available in CMake 3.14 or newer +cmake_minimum_required(VERSION 3.14) include(FetchContent) @@ -13,7 +13,7 @@ FetchContent_MakeAvailable(libappimage_patch) FetchContent_Declare(libappimage # We can not use a URL source with a github-generated source archive: libappimage's gtest submodule would be missing GIT_REPOSITORY https://github.com/AppImage/libappimage - GIT_TAG 1d4d57622de2c7d39f7cc6c4980144c713cc59ca # latest as of 2022-04-03 + GIT_TAG aa7d9fb03d3d64415c37120f20faa05412458e94 # latest as of 2022-08-18 # The patch command has || true to prevent the build from failing if the patch has already been applied PATCH_COMMAND patch -p 1 < ${libappimage_patch_SOURCE_DIR}/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch || true ) From 5d7f31498a33057dae1906f6fc8d08529e0949c4 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 18 Aug 2022 17:56:49 +0200 Subject: [PATCH 3/3] Update lib and patch to latest libappimage --- cmake/dependencies.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 3f3de9709..a1af59467 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -5,17 +5,17 @@ include(FetchContent) # Need this patch until https://github.com/AppImage/libappimage/pull/160 is resolved FetchContent_Declare(libappimage_patch - URL https://github.com/AppImage/libappimage/commit/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch + URL https://github.com/AppImage/libappimage/commit/ce0a186a5a3cd8f31f4afd216d5322410a0a8e26.patch DOWNLOAD_NO_EXTRACT TRUE ) FetchContent_MakeAvailable(libappimage_patch) FetchContent_Declare(libappimage # We can not use a URL source with a github-generated source archive: libappimage's gtest submodule would be missing - GIT_REPOSITORY https://github.com/AppImage/libappimage - GIT_TAG aa7d9fb03d3d64415c37120f20faa05412458e94 # latest as of 2022-08-18 - # The patch command has || true to prevent the build from failing if the patch has already been applied - PATCH_COMMAND patch -p 1 < ${libappimage_patch_SOURCE_DIR}/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch || true + # If you update the GIT_TAG and the patch does not apply anymore you need to rebase libappimage_patch (see above) +GIT_REPOSITORY https://github.com/AppImage/libappimage + GIT_TAG aa7d9fb03d3d64415c37120f20faa05412458e94 # Eventually we may want to use master, once that works reliably. + PATCH_COMMAND patch -p 1 --forward < ${libappimage_patch_SOURCE_DIR}/ce0a186a5a3cd8f31f4afd216d5322410a0a8e26.patch ) FetchContent_MakeAvailable(libappimage) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${libappimage_SOURCE_DIR}/cmake)