diff --git a/.gitmodules b/.gitmodules index a5daa46d..9c36da2a 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 219f4b75..a7510828 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 896e3a8d..a1af5946 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) +# FetchContent_MakeAvailable() is only available in CMake 3.14 or newer +cmake_minimum_required(VERSION 3.14) + +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/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 + # 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) +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 9ca1144b..00000000 --- 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 9c1fae80..00000000 --- a/lib/libappimage +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9c1fae809dedbb3015e9cd5b46e2b5aab06df36e diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f2247b40..16b53e11 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 6f27020e..d70913bf 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 dc971750..3657f955 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 7e8ce30c..4a38db73 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;