Skip to content

Commit 7fd1a6d

Browse files
committed
Merge branch 'master' into fix-app-icon-lookup
# Conflicts: # src/core/appdir.cpp # tests/core/CMakeLists.txt # tests/core/test_appdir.cpp # tests/core/test_linuxdeploy.cpp
2 parents 71524fa + 2d8eaf1 commit 7fd1a6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1147
-862
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
# build at least once a month
9+
- cron: '0 0 1 * *'
410

511
jobs:
612
build-and-test:
@@ -26,17 +32,22 @@ jobs:
2632
if: matrix.ARCH == 'x86_64'
2733
run: |
2834
sudo apt-get update
29-
sudo apt-get install -y libmagic-dev libjpeg-dev libpng-dev cimg-dev
35+
sudo apt-get install -y gcovr libmagic-dev libjpeg-dev libpng-dev cimg-dev
3036
3137
- name: Install dependencies (i386)
3238
if: matrix.ARCH == 'i386'
3339
run: |
3440
sudo dpkg --add-architecture i386
3541
sudo apt-get update
36-
sudo apt-get install -y libmagic-dev:i386 libjpeg-dev:i386 libpng-dev:i386 cimg-dev gcc-multilib g++-multilib libfuse2:i386
42+
sudo apt-get install -y gcovr libmagic-dev:i386 libjpeg-dev:i386 libpng-dev:i386 cimg-dev gcc-multilib g++-multilib libfuse2:i386
3743
38-
- name: Build and test
44+
- name: Test coverage
45+
run: bash -ex ci/test-coverage.sh
46+
if: matrix.BUILD_TYPE == 'coverage'
47+
48+
- name: Build, test and build AppImage
3949
run: bash -ex ci/build.sh
50+
if: matrix.BUILD_TYPE != 'coverage'
4051

4152
- name: Archive artifacts
4253
uses: actions/upload-artifact@v2

.gitmodules

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,12 @@
11
[submodule "lib/args"]
22
path = lib/args
33
url = https://github.com/Taywee/args.git
4-
[submodule "lib/boost-filesystem"]
5-
path = lib/boost-filesystem
6-
url = https://github.com/boostorg/filesystem.git
7-
[submodule "lib/boost-regex"]
8-
path = lib/boost-regex
9-
url = https://github.com/boostorg/regex.git
10-
[submodule "lib/boost-system"]
11-
path = lib/boost-system
12-
url = https://github.com/boostorg/system.git
13-
[submodule "lib/boost-config"]
14-
path = lib/boost-config
15-
url = https://github.com/boostorg/config.git
16-
[submodule "lib/boost-utility"]
17-
path = lib/boost-utility
18-
url = https://github.com/boostorg/utility.git
19-
[submodule "lib/boost-predef"]
20-
path = lib/boost-predef
21-
url = https://github.com/boostorg/predef.git
22-
[submodule "lib/boost-assert"]
23-
path = lib/boost-assert
24-
url = https://github.com/boostorg/assert.git
25-
[submodule "lib/boost-core"]
26-
path = lib/boost-core
27-
url = https://github.com/boostorg/core.git
28-
[submodule "lib/boost-type_traits"]
29-
path = lib/boost-type_traits
30-
url = https://github.com/boostorg/type_traits.git
31-
[submodule "lib/boost-iterator"]
32-
path = lib/boost-iterator
33-
url = https://github.com/boostorg/iterator.git
34-
[submodule "lib/boost-mpl"]
35-
path = lib/boost-mpl
36-
url = https://github.com/boostorg/mpl.git
37-
[submodule "lib/boost-preprocessor"]
38-
path = lib/boost-preprocessor
39-
url = https://github.com/boostorg/preprocessor.git
40-
[submodule "lib/boost-static_assert"]
41-
path = lib/boost-static_assert
42-
url = https://github.com/boostorg/static_assert.git
43-
[submodule "lib/boost-detail"]
44-
path = lib/boost-detail
45-
url = https://github.com/boostorg/detail.git
46-
[submodule "lib/boost-smart_ptr"]
47-
path = lib/boost-smart_ptr
48-
url = https://github.com/boostorg/smart_ptr.git
494
[submodule "lib/boost-exception"]
505
path = lib/boost-exception
516
url = https://github.com/boostorg/exception.git
52-
[submodule "lib/boost-throw_exception"]
53-
path = lib/boost-throw_exception
54-
url = https://github.com/boostorg/throw_exception.git
55-
[submodule "lib/boost-io"]
56-
path = lib/boost-io
57-
url = https://github.com/boostorg/io.git
58-
[submodule "lib/boost-functional"]
59-
path = lib/boost-functional
60-
url = https://github.com/boostorg/functional.git
61-
[submodule "lib/boost-container_hash"]
62-
path = lib/boost-container_hash
63-
url = https://github.com/boostorg/container_hash.git
64-
[submodule "lib/boost-range"]
65-
path = lib/boost-range
66-
url = https://github.com/boostorg/range.git
67-
[submodule "lib/boost-integer"]
68-
path = lib/boost-integer
69-
url = https://github.com/boostorg/integer.git
70-
[submodule "lib/CImg"]
71-
path = lib/CImg
72-
url = https://github.com/dtschump/CImg.git
73-
[submodule "lib/googletest"]
74-
path = lib/googletest
75-
url = https://github.com/google/googletest
76-
[submodule "lib/boost-container"]
77-
path = lib/boost-container
78-
url = https://github.com/boostorg/container
797
[submodule "lib/linuxdeploy-desktopfile"]
808
path = lib/linuxdeploy-desktopfile
819
url = https://github.com/linuxdeploy/linuxdeploy-desktopfile
10+
[submodule "lib/cmake-scripts"]
11+
path = lib/cmake-scripts
12+
url = https://github.com/linuxdeploy/cmake-scripts.git

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
include(FetchContent)
2+
13
cmake_minimum_required(VERSION 3.2)
24

35
project(linuxdeploy C CXX)
46

5-
set(CMAKE_CXX_STANDARD 11)
7+
set(CMAKE_CXX_STANDARD 17)
68
set(CMAKE_CXX_STANDARD_REQUIRED ON)
79

810
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
911

10-
set(USE_SYSTEM_BOOST OFF CACHE BOOL "Set to ON to use system boost libraries instead of building up to date boost libraries from source")
11-
set(USE_SYSTEM_CIMG ON CACHE BOOL "Set to OFF to use CImg library bundled in lib directory")
12+
find_program(PATCHELF patchelf REQUIRED)
1213

1314
# support for ccache
1415
# call CMake with -DUSE_CCACHE=ON to make use of it
@@ -43,11 +44,17 @@ if(ENABLE_COVERAGE)
4344
setup_target_for_coverage_gcovr_text(NAME coverage_text EXECUTABLE "${command}")
4445
endif()
4546

47+
include(CTest)
48+
49+
if(BUILD_TESTING)
50+
# including this before including lib/ makes sure that the top level project's gtest is used everywhere
51+
include(${PROJECT_SOURCE_DIR}/lib/cmake-scripts/include-or-build-gtest.cmake)
52+
endif()
53+
4654
add_subdirectory(lib)
4755

4856
add_subdirectory(src)
4957

50-
include(CTest)
5158
if(BUILD_TESTING)
5259
enable_testing()
5360
add_subdirectory(tests)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ linuxdeploy does not change any environment variables such as `$PATH`. Your appl
6464

6565
## Contact
6666

67-
The easiest way to get in touch with the developers is to join the IRC chatroom [#AppImage](https://webchat.freenode.net/?channels=appimage) on FreeNode. This is the preferred way for general feedback or questions how to use this application.
67+
The easiest way to get in touch with the developers is to join the IRC chatroom [#AppImage](https://web.libera.chat/#appimage) on [https://libera.chat](Libera.Chat). This is the preferred way for general feedback or questions how to use this application.
6868

69-
To report problems, please [create an issue](https://github.com/TheAssassin/linuxdeploy/issues/new) on GitHub.
69+
To report problems, please [create an issue](https://github.com/linuxdeploy/linuxdeploy/issues/new) on GitHub.
7070

7171
Contributions welcome! Please feel free to fork this repository and send us a pull request. Even small changes, e.g., in this README, are highly appreciated!

ci/build-static-patchelf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pushd "$BUILD_DIR"
4747
git clone https://github.com/NixOS/patchelf.git .
4848

4949
# cannot use -b since it's not supported in really old versions of git
50-
git checkout 0.8
50+
git checkout 0.15.0
5151

5252
# prepare configure script
5353
./bootstrap.sh

ci/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ cmake "$REPO_ROOT" -DSTATIC_BUILD=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_T
4646

4747
make -j"$(nproc)"
4848

49-
## Run Unit Tests
50-
ctest -V
51-
5249
# build patchelf
5350
"$REPO_ROOT"/ci/build-static-patchelf.sh "$(readlink -f out/)"
5451
patchelf_path="$(readlink -f out/usr/bin/patchelf)"
@@ -57,9 +54,12 @@ patchelf_path="$(readlink -f out/usr/bin/patchelf)"
5754
"$REPO_ROOT"/ci/build-static-binutils.sh "$(readlink -f out/)"
5855
strip_path="$(readlink -f out/usr/bin/strip)"
5956

60-
# use tools we just built for linuxdeploy run
57+
# use tools we just built for linuxdeploy test run
6158
export PATH="$(readlink -f out/usr/bin):$PATH"
6259

60+
## Run Unit Tests
61+
ctest -V
62+
6363
# args are used more than once
6464
LINUXDEPLOY_ARGS=("--appdir" "AppDir" "-e" "bin/linuxdeploy" "-i" "$REPO_ROOT/resources/linuxdeploy.png" "-d" "$REPO_ROOT/resources/linuxdeploy.desktop" "-e" "$patchelf_path" "-e" "$strip_path")
6565

@@ -69,7 +69,7 @@ bin/linuxdeploy "${LINUXDEPLOY_ARGS[@]}"
6969
# bundle AppImage plugin
7070
mkdir -p AppDir/plugins
7171

72-
wget https://github.com/TheAssassin/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-"$ARCH".AppImage
72+
wget https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-"$ARCH".AppImage
7373
chmod +x linuxdeploy-plugin-appimage-"$ARCH".AppImage
7474
./linuxdeploy-plugin-appimage-"$ARCH".AppImage --appimage-extract
7575
mv squashfs-root/ AppDir/plugins/linuxdeploy-plugin-appimage

cmake/Modules/FindCImg.cmake

Lines changed: 84 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,97 @@
1-
# required for PNG imported target
2-
cmake_minimum_required(VERSION 3.6)
1+
#[=======================================================================[.rst:
2+
FindCImg
3+
-------
34
4-
find_package(PkgConfig)
5-
pkg_check_modules(libpng REQUIRED IMPORTED_TARGET libpng)
5+
Finds the CImg library.
66
7-
# build custom static version of libjpeg for static builds
8-
if(STATIC_BUILD)
9-
include(ExternalProject)
7+
Imported Targets
8+
^^^^^^^^^^^^^^^^
109
11-
if($ENV{ARCH} MATCHES "i[356]86")
12-
set(configure_command_prefix env CFLAGS=-m32 CXXFLAGS=-m32)
13-
endif()
10+
This module provides the following imported targets, if found:
1411
15-
ExternalProject_Add(libjpeg_static_extproj
16-
URL https://www.ijg.org/files/jpegsrc.v9d.tar.gz
17-
URL_HASH SHA256=6c434a3be59f8f62425b2e3c077e785c9ce30ee5874ea1c270e843f273ba71ee
18-
BUILD_IN_SOURCE ON
19-
EXCLUDE_FROM_ALL ON
20-
CONFIGURE_COMMAND ${configure_command_prefix} ./configure --prefix=/usr
21-
INSTALL_COMMAND ""
22-
)
23-
24-
ExternalProject_Get_property(libjpeg_static_extproj SOURCE_DIR)
25-
add_library(libjpeg_static INTERFACE IMPORTED)
26-
set_property(TARGET libjpeg_static PROPERTY INTERFACE_LINK_LIBRARIES ${SOURCE_DIR}/.libs/libjpeg.a)
27-
add_dependencies(libjpeg_static libjpeg_static_extproj)
28-
29-
set(JPEG_LIBRARIES libjpeg_static)
30-
else()
31-
find_package(JPEG REQUIRED)
32-
endif()
12+
``CImg``
13+
The CImg library
14+
15+
Result Variables
16+
^^^^^^^^^^^^^^^^
17+
18+
This will define the following variables:
19+
20+
``CImg_FOUND``
21+
True if the system has the CImg library.
22+
``CImg_VERSION``
23+
The version of the CImg library which was found.
24+
``CImg_INCLUDE_DIRS``
25+
Include directories needed to use CImg.
26+
``CImg_LIBRARIES``
27+
Libraries needed to link to CImg.
28+
29+
Cache Variables
30+
^^^^^^^^^^^^^^^
31+
32+
The following cache variables may also be set:
33+
34+
``CImg_INCLUDE_DIR``
35+
The directory containing ``CImg.h``.
36+
37+
#]=======================================================================]
3338

34-
if(NOT USE_SYSTEM_CIMG)
35-
message(STATUS "Using bundled CImg library")
39+
# 3.6 required for PNG imported target
40+
# 3.9 required for CMAKE_MATCH_<n>
41+
cmake_minimum_required(VERSION 3.9)
3642

37-
set(CIMG_H_DIR "${PROJECT_SOURCE_DIR}/lib/CImg/")
43+
find_path(CIMG_H_DIR
44+
NAMES CImg.h
45+
HINTS ${CMAKE_INSTALL_PREFIX} ${CIMG_DIR}
46+
PATH_SUFFIXES include include/linux
47+
)
48+
49+
if(NOT CIMG_H_DIR)
50+
set(CImg_FOUND FALSE)
3851
else()
39-
message(STATUS "Searching for CImg")
52+
set(CImg_FOUND TRUE)
53+
54+
find_package(PkgConfig)
55+
56+
pkg_check_modules(libpng REQUIRED libpng)
57+
pkg_check_modules(libjpeg REQUIRED libjpeg)
4058

41-
find_path(CIMG_H_DIR
42-
NAMES CImg.h
43-
HINTS ${CMAKE_INSTALL_PREFIX}
44-
PATH_SUFFIXES include include/linux
45-
)
59+
set(PNG_INCLUDE_DIR ${libpng_INCLUDE_DIRS})
60+
set(JPEG_INCLUDE_DIR ${libjpeg_INCLUDE_DIRS})
4661

47-
if(NOT CIMG_H_DIR)
48-
message(FATAL_ERROR "CImg.h not found")
62+
if(STATIC_BUILD)
63+
set(PNG_LIBRARY ${libpng_STATIC_LIBRARIES})
64+
set(JPEG_LIBRARIES ${libjpeg_STATIC_LIBRARIES})
65+
else()
66+
set(PNG_LIBRARY ${libpng_LIBRARIES})
67+
set(JPEG_LIBRARIES ${libjpeg_LIBRARIES})
4968
endif()
50-
endif()
5169

52-
set(PNG_INCLUDE_DIR ${libpng_INCLUDE_DIRS})
53-
if(NOT STATIC_BUILD)
54-
set(PNG_LIBRARY ${libpng_LIBRARIES})
55-
else()
56-
set(PNG_LIBRARY ${libpng_STATIC_LIBRARIES})
57-
endif()
70+
set(CImg_INCLUDE_DIR ${CIMG_H_DIR} CACHE STRING "")
71+
set(CImg_INCLUDE_DIRS ${CImg_INCLUDE_DIR})
72+
set(CImg_LIBRARIES "${PNG_LIBRARY};${JPEG_LIBRARIES}")
73+
set(CImg_DEFINITIONS "cimg_display=0;cimg_use_png=1;cimg_use_jpeg=1")
74+
75+
file(READ "${CIMG_H_DIR}/CImg.h" header)
76+
string(REGEX MATCH "#define cimg_version ([0-9a-zA-Z\.]+)" _ "${header}")
77+
set(CImg_VERSION "${CMAKE_MATCH_1}")
78+
79+
# CImg_VERSION
5880

59-
#message(FATAL_ERROR "${PNG_LIBRARY}")
81+
if(NOT TARGET CImg)
82+
add_library(CImg INTERFACE)
83+
set_property(TARGET CImg PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CIMG_H_DIR};${PNG_INCLUDE_DIR};${JPEG_INCLUDE_DIR}")
84+
set_property(TARGET CImg PROPERTY INTERFACE_LINK_LIBRARIES "${CImg_LIBRARIES}")
85+
set_property(TARGET CImg PROPERTY INTERFACE_COMPILE_DEFINITIONS "${CImg_DEFINITIONS}")
86+
endif()
87+
endif()
6088

61-
add_library(CImg INTERFACE)
62-
set_property(TARGET CImg PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CIMG_H_DIR};${PNG_INCLUDE_DIR};${JPEG_INCLUDE_DIR}")
63-
set_property(TARGET CImg PROPERTY INTERFACE_LINK_LIBRARIES "${PNG_LIBRARY};${JPEG_LIBRARIES}")
64-
set_property(TARGET CImg PROPERTY INTERFACE_COMPILE_DEFINITIONS "cimg_display=0;cimg_use_png=1;cimg_use_jpeg=1")
89+
include(FindPackageHandleStandardArgs)
90+
find_package_handle_standard_args(CImg
91+
FOUND_VAR CImg_FOUND
92+
REQUIRED_VARS
93+
CImg_INCLUDE_DIRS
94+
CImg_LIBRARIES
95+
CImg_DEFINITIONS
96+
VERSION_VAR CImg_VERSION
97+
)

0 commit comments

Comments
 (0)