Skip to content

Commit

Permalink
Remove libappimage git submodule
Browse files Browse the repository at this point in the history
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 AppImageCommunity/libappimage#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 #1165
  • Loading branch information
lalten committed Apr 3, 2022
1 parent 9a13f09 commit 8749879
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 22 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
31 changes: 25 additions & 6 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -52,9 +70,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" <SOURCE_DIR>/squashfs-tools/Makefile
COMMAND ${SED} -i "/INSTALL_MANPAGES_DIR/d" <SOURCE_DIR>/squashfs-tools/Makefile
COMMAND ${SED} -i "s|LIBS += -llzma|LIBS += -Bstatic ${mksquashfs_ldflags}|g" <SOURCE_DIR>/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
Expand Down
1 change: 0 additions & 1 deletion lib/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/libappimage
Submodule libappimage deleted from 13f401
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ target_compile_definitions(appimagetool
PRIVATE -DENABLE_BINRELOC
)

target_include_directories(appimagetool
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
INTERFACE $<INSTALL_INTERFACE:include/>
)

if(AUXILIARY_FILES_DESTINATION)
message(STATUS "Installing auxiliary files in path: ${AUXILIARY_FILES_DESTINATION}")
Expand Down
2 changes: 1 addition & 1 deletion src/appimagetool.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include <limits.h>
#include <stdbool.h>

#include "appimage/appimage.h"
#include <appimage/appimage_shared.h>

#ifdef __linux__
#define HAVE_BINARY_RUNTIME
Expand Down
4 changes: 2 additions & 2 deletions src/build-runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <fcntl.h>
#include <sys/mman.h>

#include "appimage/appimage.h"
#include "appimage/appimage_shared.h"
#include <appimage/appimage_shared.h>

#include "light_elf.h"

typedef unsigned char byte;
Expand Down

0 comments on commit 8749879

Please sign in to comment.