Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:upgrade to 5.103 #1

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.4)

project(libappimage)

set(V_MAJOR 1)
set(V_MINOR 0)
set(V_PATCH 3)
set(V_SUFFIX "")

set(libappimage_VERSION ${V_MAJOR}.${V_MINOR}.${V_PATCH}${V_SUFFIX})

# more versioning
set(libappimage_SOVERSION ${V_MAJOR}.${V_MINOR})

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Optimize for size in release builds
set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG -Wl,--gc-sections")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

include(cmake/reproducible_builds.cmake)

option(LIBAPPIMAGE_DESKTOP_INTEGRATION_ENABLED "Enable desktop integration functions" On)
option(LIBAPPIMAGE_THUMBNAILER_ENABLED "Enable thumbnailer functions" On)
option(LIBAPPIMAGE_STANDALONE "Statically embbed dependencies" Off)
option(LIBAPPIMAGE_SHARED_ONLY "Build and distribute shared and hashlib only (for use with AppImageKit and AppImageUpdate)" Off)
option(ENABLE_COVERAGE "Enable tests code coverate target" Off)

# some dependencies are only checked when testing is enabled
include(CTest)

include(cmake/tools.cmake)
include(cmake/dependencies.cmake)

if(ENABLE_COVERAGE)
message("Configuring project for code coverage mesurement")
include(CodeCoverage)
append_coverage_compiler_flags()
endif()

# used by e.g., Debian packaging infrastructure
include(GNUInstallDirs)

add_subdirectory(lib)
add_subdirectory(src)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
MIT License

If not stated otherwise within the individual file or subdirectory, the
original source code in this repository is licensed as below. This does not
necessarily apply for all dependencies. For the sake of clarity, this license
does NOT apply to the contents of AppImages that anyone may create.
Software contained inside an AppImage may be licensed under any license at the
discretion of the respecive rights holder(s).

Copyright (c) 2004-19 Simon Peter and the AppImage team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
# template-repository
# libappimage ![CI](https://github.com/AppImage/libappimage/workflows/CI/badge.svg) [![irc](https://img.shields.io/badge/IRC-%23AppImage%20on%20libera.chat-blue.svg)](https://web.libera.chat/#AppImage)

This library is part of the [AppImage](https://github.com/AppImage/appimagekit/) project. It implements functionality for dealing with AppImage files. It is written in C++ and is using Boost.

## Availablility

libappimage is available in the following distributions:
https://repology.org/project/libappimage/versions

## Usage

As a user, you normally do not need to deal with this library. Tools that use it (like [the optional `appimaged` daemon](https://github.com/AppImage/appimaged)) usually come with a bundled copy of it.

## API documentation

As a developer interested in using libappimage in your projects, please find the API documentation here:
https://docs.appimage.org/api/libappimage/. Please note that if you are using libappimage in your project, we recommend bundling your private copy or linking statically to it, since the versions provided by distributions may be outdated.

## Building

If for some reason you need to do a local development build, on a deb-based system (tested on Ubuntu xenial) do:

```
sudo apt-get -y install automake cmake libtool libcairo-dev libfuse-dev git
git clone https://github.com/AppImage/libappimage --recursive
cd ./libappimage/
mkdir build
cd build
cmake .. -DBUILD_TESTING:bool=False
make
sudo make install
cd ..
```

## Contributing

Your contributions are welcome.

If you make or suggest changes to this code, please test that the resulting executables (like [the `appimaged` daemon](https://github.com/AppImage/appimaged)) are still working properly.


If you have questions, AppImage developers are on #AppImage on irc.libera.chat.
11 changes: 11 additions & 0 deletions ci/Dockerfile.bionic-i386
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM i386/ubuntu:bionic

ENV ARCH=i386 DIST=bionic CI=1

COPY ./install-deps.sh /
RUN bash -xe install-deps.sh

# create unprivileged user for non-build-script use of this image
# build-in-docker.sh will likely not use this one, as it enforces the caller's uid inside the container
RUN adduser --system --group build
USER build
11 changes: 11 additions & 0 deletions ci/Dockerfile.bionic-x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:bionic

ENV ARCH=x86_64 DIST=bionic CI=1

COPY ./install-deps.sh /
RUN bash -xe install-deps.sh

# create unprivileged user for non-build-script use of this image
# build-in-docker.sh will likely not use this one, as it enforces the caller's uid inside the container
RUN adduser --system --group build
USER build
11 changes: 11 additions & 0 deletions ci/Dockerfile.xenial-i386
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM i386/ubuntu:xenial

ENV ARCH=i386 DIST=xenial CI=1

COPY ./install-deps.sh /
RUN bash -xe install-deps.sh

# create unprivileged user for non-build-script use of this image
# build-in-docker.sh will likely not use this one, as it enforces the caller's uid inside the container
RUN adduser --system --group build
USER build
11 changes: 11 additions & 0 deletions ci/Dockerfile.xenial-x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:xenial

ENV ARCH=x86_64 DIST=xenial CI=1

COPY ./install-deps.sh /
RUN bash -xe install-deps.sh

# create unprivileged user for non-build-script use of this image
# build-in-docker.sh will likely not use this one, as it enforces the caller's uid inside the container
RUN adduser --system --group build
USER build
59 changes: 59 additions & 0 deletions ci/build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /bin/bash

set -e
set -x

# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
fi

BUILD_DIR="$(mktemp -d -p "$TEMP_BASE" libappimage-build-XXXXXX)"

cleanup () {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
}

trap cleanup EXIT

# store repo root as variable
REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")"
OLD_CWD="$(readlink -f .)"

pushd "$BUILD_DIR"

EXTRA_CMAKE_ARGS=()
if [[ "$LIBAPPIMAGE_SHARED_ONLY" != "" ]]; then
# shared only builds do not provide any tests
EXTRA_CMAKE_ARGS+=("-DLIBAPPIMAGE_SHARED_ONLY=ON" "-DBUILD_TESTING=OFF")
fi

# configure build
if [ "$BUILD_TYPE" == "coverage" ]; then
cmake "$REPO_ROOT" -DCMAKE_INSTALL_LIBDIR=lib -DENABLE_COVERAGE=On "${EXTRA_CMAKE_ARGS[@]}"
make -j"$(nproc)" coverage
else
cmake "$REPO_ROOT" -DCMAKE_INSTALL_LIBDIR=lib "${EXTRA_CMAKE_ARGS[@]}"

# build binaries
make -j"$(nproc)"

# run all unit tests
ctest -V
fi

# install libappimage
DESTDIR="$BUILD_DIR"/libappimage make install

if [[ "$LIBAPPIMAGE_SHARED_ONLY" == "" ]]; then
# do integration test
mkdir "$BUILD_DIR"/client_app_build
pushd "$BUILD_DIR"/client_app_build
cmake -DCMAKE_PREFIX_PATH="$BUILD_DIR"/libappimage/usr/local/lib/cmake/libappimage "$REPO_ROOT"/tests/client_app/ "${EXTRA_CMAKE_ARGS[@]}"
make
./client_app
fi
40 changes: 40 additions & 0 deletions ci/build-docker-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash

if [[ "$DIST" == "" ]] || [[ "$ARCH" == "" ]]; then
echo "Usage: env ARCH=... DIST=... bash $0"
exit 1
fi

set -x
set -e

# the other script sources this script, therefore we have to support that use case
if [[ "${BASH_SOURCE[*]}" != "" ]]; then
this_dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
else
this_dir="$(readlink -f "$(dirname "$0")")"
fi

# needed to keep user ID in and outside Docker in sync to be able to write to workspace directory
image=quay.io/appimage/libappimage-build:"$DIST"-"$ARCH"
dockerfile="$this_dir"/Dockerfile."$DIST"-"$ARCH"

if [ ! -f "$dockerfile" ]; then
echo "Error: $dockerfile could not be found"
exit 1
fi

# speed up build by pulling last built image from quay.io and building the docker file using the old image as a base
docker pull "$image" || true
# if the image hasn't changed, this should be a no-op
docker build --pull --cache-from "$image" -t "$image" -f "$dockerfile" "$this_dir"

# push built image as cache for future builds to registry
# we can do that immediately once the image has been built successfully; if its definition ever changes it will be
# rebuilt anyway
# credentials shall only be available on (protected) master branch
set +x
if [[ "$DOCKER_USERNAME" != "" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin quay.io
docker push "$image"
fi
45 changes: 45 additions & 0 deletions ci/build-in-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#! /bin/bash

if [[ "$DIST" == "" ]] || [[ "$ARCH" == "" ]]; then
echo "Usage: env ARCH=... DIST=... bash $0"
exit 1
fi

set -x
set -e

cd "$(readlink -f "$(dirname "$0")")"

if [[ "$DIST" != appimagebuild* ]]; then
# sets variables $image, $dockerfile
source build-docker-image.sh
else
image=quay.io/appimage/appimagebuild:centos7-"$ARCH"
docker pull "$image"
fi

DOCKER_OPTS=()
# fix for https://stackoverflow.com/questions/51195528/rcc-error-in-resource-qrc-cannot-find-file-png
if [ "$CI" != "" ]; then
DOCKER_OPTS+=("--security-opt" "seccomp:unconfined")
fi

# only if there's more than 3G of free space in RAM, we can build in a RAM disk
if [[ "$GITHUB_ACTIONS" != "" ]]; then
echo "Building on GitHub actions, which does not support --tmpfs flag -> building on regular disk"
elif [[ "$(free -m | grep "Mem:" | awk '{print $4}')" -gt 3072 ]]; then
echo "Host system has enough free memory -> building in RAM disk"
DOCKER_OPTS+=("--tmpfs /docker-ramdisk:exec,mode=777")
else
echo "Host system does not have enough free memory -> building on regular disk"
fi

# run the build with the current user to
# a) make sure root is not required for builds
# b) allow the build scripts to "mv" the binaries into the /out directory
uid="$(id -u)"
# run build
docker run -e LIBAPPIMAGE_SHARED_ONLY -e DIST -e ARCH -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ID -e BUILD_TYPE --rm -i --user "$uid" \
"${DOCKER_OPTS[@]}" -v "$(readlink -f ..):/ws" \
"$image" \
bash -xc "export CI=1 && cd /ws && source ci/build-and-test.sh"
70 changes: 70 additions & 0 deletions ci/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#! /bin/bash

set -e

if [[ "$ARCH" == "" ]]; then
echo "Usage: env ARCH=... bash $0"
exit 2
fi

if [[ "$CI" == "" ]]; then
echo "Caution: this script is supposed to run inside a (disposable) CI environment"
echo "It will alter a system, and should not be run on workstations or alike"
echo "You can export CI=1 to prevent this error from being shown again"
exit 3
fi

case "$ARCH" in
x86_64|i386|armhf|arm64)
;;
*)
echo "Error: unsupported architecture: $ARCH"
exit 4
;;
esac

case "$DIST" in
xenial|bionic)
;;
*)
echo "Error: unsupported distribution: $DIST"
exit 5
;;
esac

set -x

packages=(
libfuse-dev
desktop-file-utils
ca-certificates
gcc-multilib
g++-multilib
make
build-essential
git
automake
autoconf
libtool
patch
wget
vim-common
desktop-file-utils
pkg-config
libarchive-dev
librsvg2-dev
librsvg2-bin
liblzma-dev
cmake
lcov
gcovr
)

apt-get update
apt-get -y --no-install-recommends install "${packages[@]}"

# install more recent CMake version
wget https://artifacts.assassinate-you.net/prebuilt-cmake/continuous/cmake-v3.19.1-ubuntu_"$DIST"-"$ARCH".tar.gz -qO- | \
tar xz -C/usr/local --strip-components=1


Loading