Skip to content

Commit f1c9ab2

Browse files
committed
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 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
1 parent 4bcfe23 commit f1c9ab2

9 files changed

+32
-27
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "cmake/sanitizers-cmake"]
22
path = cmake/sanitizers-cmake
33
url = https://github.com/arsenm/sanitizers-cmake
4-
[submodule "lib/libappimage"]
5-
path = lib/libappimage
6-
url = https://github.com/AppImage/libappimage.git

CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6464
##########################
6565

6666
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
67-
68-
# configure dependencies
69-
add_subdirectory(lib)
70-
71-
include(lib/libappimage/cmake/tools.cmake)
7267
include(cmake/dependencies.cmake)
7368

7469

cmake/dependencies.cmake

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1-
# >= 3.2 required for ExternalProject_Add_StepDependencies
2-
cmake_minimum_required(VERSION 3.2)
3-
4-
5-
include(${PROJECT_SOURCE_DIR}/lib/libappimage/cmake/scripts.cmake)
1+
# >= 3.11 required for FetchContent
2+
cmake_minimum_required(VERSION 3.11)
3+
4+
include(FetchContent)
5+
6+
# Need this patch until https://github.com/AppImage/libappimage/pull/160 is resolved
7+
FetchContent_Declare(libappimage_patch
8+
URL https://github.com/AppImage/libappimage/commit/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch
9+
DOWNLOAD_NO_EXTRACT TRUE
10+
)
11+
FetchContent_MakeAvailable(libappimage_patch)
12+
13+
FetchContent_Declare(libappimage
14+
# We can not use a URL source with a github-generated source archive: libappimage's gtest submodule would be missing
15+
GIT_REPOSITORY https://github.com/AppImage/libappimage
16+
GIT_TAG 1d4d57622de2c7d39f7cc6c4980144c713cc59ca # latest as of 2022-04-03
17+
# The patch command has || true to prevent the build from failing if the patch has already been applied
18+
PATCH_COMMAND patch -p 1 < ${libappimage_patch_SOURCE_DIR}/b3398bb496e47947864b4b8bc2999c8427f86a9a.patch || true
19+
)
20+
FetchContent_MakeAvailable(libappimage)
21+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${libappimage_SOURCE_DIR}/cmake)
22+
include(${libappimage_SOURCE_DIR}/cmake/scripts.cmake)
23+
include(${libappimage_SOURCE_DIR}/cmake/tools.cmake)
624

725

826
# the names of the targets need to differ from the library filenames
@@ -53,9 +71,10 @@ if(NOT USE_SYSTEM_MKSQUASHFS)
5371

5472
ExternalProject_Add(mksquashfs
5573
GIT_REPOSITORY https://github.com/plougher/squashfs-tools/
56-
GIT_TAG 4.4
74+
GIT_TAG 4.5.1
5775
UPDATE_COMMAND "" # Make sure CMake won't try to fetch updates unnecessarily and hence rebuild the dependency every time
5876
CONFIGURE_COMMAND ${SED} -i "s|CFLAGS += -DXZ_SUPPORT|CFLAGS += ${mksquashfs_cflags}|g" <SOURCE_DIR>/squashfs-tools/Makefile
77+
COMMAND ${SED} -i "/INSTALL_MANPAGES_DIR/d" <SOURCE_DIR>/squashfs-tools/Makefile
5978
COMMAND ${SED} -i "s|LIBS += -llzma|LIBS += -Bstatic ${mksquashfs_ldflags}|g" <SOURCE_DIR>/squashfs-tools/Makefile
6079
COMMAND ${SED} -i "s|install: mksquashfs unsquashfs|install: mksquashfs|g" squashfs-tools/Makefile
6180
COMMAND ${SED} -i "/cp unsquashfs/d" squashfs-tools/Makefile

lib/CMakeLists.txt

-1
This file was deleted.

lib/libappimage

-1
This file was deleted.

src/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ target_compile_definitions(appimagetool
5757
PRIVATE -DENABLE_BINRELOC
5858
)
5959

60-
target_include_directories(appimagetool
61-
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
62-
INTERFACE $<INSTALL_INTERFACE:include/>
63-
)
6460

6561
if(AUXILIARY_FILES_DESTINATION)
6662
message(STATUS "Installing auxiliary files in path: ${AUXILIARY_FILES_DESTINATION}")

src/appimagetool.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#include <sys/stat.h>
4646
#include <sys/wait.h>
4747

48-
#include "binreloc.h"
49-
5048
#include <libgen.h>
5149

5250
#include <unistd.h>
@@ -56,7 +54,9 @@
5654
#include <gpgme.h>
5755
#include <assert.h>
5856

59-
#include "appimage/appimage.h"
57+
#include <appimage/appimage_shared.h>
58+
59+
#include "binreloc.h"
6060
#include "appimagetool_sign.h"
6161

6262
#ifdef __linux__

src/build-runtime.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ set(runtime_cflags
2727
-DGIT_COMMIT=\\"${GIT_COMMIT}\\"
2828
-I${squashfuse_INCLUDE_DIRS}
2929
-I${PROJECT_SOURCE_DIR}/include
30-
-I${PROJECT_SOURCE_DIR}/lib/libappimage/include
31-
-I${PROJECT_SOURCE_DIR}/lib/libappimage/src/libappimage_hashlib/include
30+
-I${libappimage_SOURCE_DIR}/include
31+
-I${libappimage_SOURCE_DIR}/src/libappimage_hashlib/include
3232
${DEPENDENCIES_CFLAGS}
3333
)
3434
# must not include -Wl,--gc-sections in the following flags, otherwise the data sections will be stripped out

src/validate.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include <fcntl.h>
1313
#include <sys/mman.h>
1414

15-
#include "appimage/appimage.h"
16-
#include "appimage/appimage_shared.h"
15+
#include <appimage/appimage_shared.h>
16+
1717
#include "light_elf.h"
1818

1919
typedef unsigned char byte;

0 commit comments

Comments
 (0)