Skip to content

Commit 9e377dc

Browse files
laltenTheAssassin
authored andcommitted
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 e30750f commit 9e377dc

8 files changed

+30
-22
lines changed

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
@@ -52,9 +70,10 @@ if(NOT USE_SYSTEM_MKSQUASHFS)
5270

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

lib/CMakeLists.txt

-1
This file was deleted.

lib/libappimage

Submodule libappimage deleted from 13f401a

src/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ target_compile_definitions(appimagetool
4747
PRIVATE -DENABLE_BINRELOC
4848
)
4949

50-
target_include_directories(appimagetool
51-
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
52-
INTERFACE $<INSTALL_INTERFACE:include/>
53-
)
5450

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

src/appimagetool.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#include <limits.h>
5454
#include <stdbool.h>
5555

56-
#include "appimage/appimage.h"
56+
#include <appimage/appimage_shared.h>
5757

5858
#ifdef __linux__
5959
#define HAVE_BINARY_RUNTIME

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)