Skip to content

Commit

Permalink
Fix various build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Jan 17, 2022
1 parent 7593d5a commit 09a6f9e
Show file tree
Hide file tree
Showing 14 changed files with 387 additions and 299 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
ARCH: [x86_64, i386]

name: AppImage ${{ matrix.ARCH }}
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
env:
ARCH: ${{ matrix.ARCH }}
DIST: bionic
Expand Down
7 changes: 6 additions & 1 deletion ci/Dockerfile.i386
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ RUN apt-get update && \
apt-get install -y qt515base qt515wayland libgl1 libdrm-dev mesa-common-dev \
build-essential libssl-dev autoconf automake libtool \
wget vim-common desktop-file-utils pkgconf \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev wget && \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev && \
wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.22.1-ubuntu_xenial-$ARCH.tar.gz | tar xzv -C/ --strip-components=1

COPY libgcrypt.pc /usr/lib/i386-linux-gnu/pkgconfig/libgcrypt.pc
RUN sed -i 's|x86_64|i386|g' /usr/lib/i386-linux-gnu/pkgconfig/libgcrypt.pc

COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

ENV APPIMAGE_EXTRACT_AND_RUN=1

ENV DOCKER=1
8 changes: 6 additions & 2 deletions ci/Dockerfile.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ ARG DIST

RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:beineri/opt-qt-5.15.2-${DIST} && \
add-apt-repository -y ppa:beineri/opt-qt-5.15.2-"${DIST}" && \
apt-get update && \
apt-get install -y qt515base qt515wayland libgl1 libdrm-dev mesa-common-dev \
build-essential libssl-dev autoconf automake libtool \
wget vim-common desktop-file-utils pkgconf \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev wget && \
libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev git libcurl4-openssl-dev argagg-dev libgcrypt20-dev && \
wget -qO- https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.22.1-ubuntu_xenial-$ARCH.tar.gz | tar xzv -C/ --strip-components=1

COPY libgcrypt.pc /usr/lib/x86_64-linux-gnu/pkgconfig/libgcrypt.pc

COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

ENV APPIMAGE_EXTRACT_AND_RUN=1

ENV DOCKER=1
6 changes: 3 additions & 3 deletions ci/build-appimages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pushd "$BUILD_DIR"

export ARCH=${ARCH:-"$(uname -m)"}

if [ "$ARCH" == "i386" ]; then
if [ "$ARCH" == "i386" && "$DOCKER" == "" ]; then
EXTRA_CMAKE_ARGS=("-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT/cmake/toolchains/i386-linux-gnu.cmake")
fi

Expand Down Expand Up @@ -64,7 +64,7 @@ fi
# remove unnecessary binaries from AppDirs
rm AppImageUpdate.AppDir/usr/bin/appimageupdatetool
rm appimageupdatetool.AppDir/usr/bin/AppImageUpdate
rm appimageupdatetool.AppDir/usr/lib/*qt*.so*
rm appimageupdatetool.AppDir/usr/lib/*/libappimageupdate-qt.so


# remove other unnecessary data
Expand Down Expand Up @@ -97,7 +97,7 @@ for app in appimageupdatetool AppImageUpdate; do
export OUTPUT="$app"-"$ARCH".AppImage

# bundle application
./linuxdeploy-"$ARCH".AppImage --appdir "$app".AppDir --output appimage "${EXTRA_FLAGS[@]}" -d "$REPO_ROOT"/resources/"$app".desktop -i "$REPO_ROOT"/resources/appimage.png
./linuxdeploy-"$ARCH".AppImage -v0 --appdir "$app".AppDir --output appimage "${EXTRA_FLAGS[@]}" -d "$REPO_ROOT"/resources/"$app".desktop -i "$REPO_ROOT"/resources/appimage.png
done

# move AppImages to old cwd
Expand Down
2 changes: 1 addition & 1 deletion ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if [ ! -f "$repo_root"/ci/"$dockerfile" ]; then
fi

# building local image to "cache" installed dependencies for subsequent builds
docker build -t "$image" -f "$repo_root"/ci/"$dockerfile" --no-cache --build-arg DIST="$DIST" "$repo_root"/ci
docker build -t "$image" -f "$repo_root"/ci/"$dockerfile" --build-arg DIST="$DIST" "$repo_root"/ci

# run the build with the current user to
# a) make sure root is not required for builds
Expand Down
13 changes: 13 additions & 0 deletions ci/libgcrypt.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${prefix}/lib/x86_64-linux-gnu
host=x86_64-pc-linux-gnu

Name: libgcrypt
Description: General purpose cryptographic library
Requires.private: gpg-error
Version: 1.8.1
Cflags:
Libs: -lgcrypt
URL: https://www.gnupg.org/software/libgcrypt/index.html
21 changes: 15 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ else()
set(LIBAPPIMAGE_LINK_TYPE PRIVATE)
endif()

if(USE_SYSTEM_ZSYNC2)
set(ZSYNC2_LIBRARY_NAME libzsync2)
set(ZSYNC2_LINK_TYPE PUBLIC)
else()
set(ZSYNC2_LIBRARY_NAME libzsync2_static)
set(ZSYNC2_LINK_TYPE PRIVATE)
endif()

# core library
add_library(libappimageupdate SHARED
${PROJECT_SOURCE_DIR}/include/appimage/update.h
Expand All @@ -42,16 +50,14 @@ target_link_libraries(libappimageupdate
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
PRIVATE ${CPR_LIBRARIES}
PRIVATE util
PUBLIC libzsync2
${ZSYNC2_LINK_TYPE} ${ZSYNC2_LIBRARY_NAME}
)
# include directories, publicly
target_include_directories(libappimageupdate PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
# FIXME: works for now, but should be possible without these workaround
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/zsync2/lib/cpr/include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/zsync2/include>
)
set_target_properties(libappimageupdate PROPERTIES INSTALL_RPATH "\$ORIGIN/")


# core library
Expand All @@ -72,7 +78,7 @@ target_link_libraries(libappimageupdate_static
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
PRIVATE ${CPR_LIBRARIES}
PRIVATE util
PUBLIC libzsync2
${ZSYNC2_LINK_TYPE} ${ZSYNC2_LIBRARY_NAME}
)
# include directories, publicly
target_include_directories(libappimageupdate_static PUBLIC
Expand All @@ -85,10 +91,13 @@ target_include_directories(libappimageupdate_static PUBLIC
add_executable(appimageupdatetool main.cpp)
# link to core lib
target_link_libraries(appimageupdatetool libappimageupdate util)
if(NOT USE_SYSTEM_ZSYNC2)
target_link_libraries(appimageupdatetool ${ZSYNC2_LIBRARY_NAME})
endif()

# set up rpath
set_target_properties(libappimageupdate libappimageupdate_static PROPERTIES INSTALL_RPATH "\$ORIGIN")
set_target_properties(appimageupdatetool PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
set_target_properties(appimageupdatetool PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")

# install targets
install(
Expand Down
2 changes: 2 additions & 0 deletions src/appimage.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <fstream>
#include <utility>

// library headers
#include <zshash.h>
#include <appimage/appimage_shared.h>

namespace appimage::update {
using namespace updateinformation;
Expand Down
19 changes: 12 additions & 7 deletions src/qt-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ target_include_directories(libappimageupdate-qt
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libappimageupdate-qt PRIVATE -DQT_UI)
set_target_properties(libappimageupdate-qt PROPERTIES INSTALL_RPATH "\$ORIGIN/")

# library with the Qt UI classes (for static linking, see #110)
add_library(libappimageupdate-qt_static STATIC qt-updater.cpp spoiler.cpp ${PROJECT_SOURCE_DIR}/include/appimage/update/qt-ui.h)
Expand All @@ -40,9 +41,13 @@ target_include_directories(libappimageupdate-qt_static
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libappimageupdate-qt_static PRIVATE -DQT_UI)
set_target_properties(libappimageupdate-qt_static PROPERTIES INSTALL_RPATH "\$ORIGIN/")

# Qt GUI application
add_executable(AppImageUpdate main.cpp)
if(NOT USE_SYSTEM_ZSYNC2)
target_link_libraries(AppImageUpdate ${ZSYNC2_LIBRARY_NAME})
endif()

if (ENABLE_SANITIZERS)
# add support for sanitizers. Partially broken: fix at https://github.com/arsenm/sanitizers-cmake/pull/18
Expand All @@ -59,21 +64,21 @@ target_compile_definitions(AppImageUpdate PRIVATE -DQT_UI)
# set up rpath
set_target_properties(libappimageupdate-qt PROPERTIES INSTALL_RPATH "\$ORIGIN")
set_target_properties(libappimageupdate-qt_static PROPERTIES INSTALL_RPATH "\$ORIGIN")
set_target_properties(AppImageUpdate PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
set_target_properties(AppImageUpdate PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")

# install targets
install(
TARGETS libappimageupdate-qt
EXPORT AppImageUpdateTargets
LIBRARY DESTINATION lib COMPONENT LIBAPPIMAGEUPDATE-QT
PUBLIC_HEADER DESTINATION include/appimage/update COMPONENT LIBAPPIMAGEUPDATE-QT-DEV
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT LIBAPPIMAGEUPDATE-QT
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/appimage/update COMPONENT LIBAPPIMAGEUPDATE-QT-DEV
)
install(
TARGETS libappimageupdate-qt libappimageupdate-qt_static
ARCHIVE DESTINATION lib COMPONENT LIBAPPIMAGEUPDATE-QT
PUBLIC_HEADER DESTINATION include/appimage/update COMPONENT LIBAPPIMAGEUPDATE-QT-DEV
TARGETS libappimageupdate-qt_static
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT LIBAPPIMAGEUPDATE-QT
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/appimage/update COMPONENT LIBAPPIMAGEUPDATE-QT-DEV
)
install(
TARGETS AppImageUpdate
RUNTIME DESTINATION bin COMPONENT APPIMAGEUPDATE
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT APPIMAGEUPDATE
)
4 changes: 3 additions & 1 deletion src/updateinformation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ add_library(updateinformation INTERFACE
updateinformation.h
factory.h
)
target_include_directories(updateinformation INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(updateinformation INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_link_libraries(updateinformation INTERFACE util)
1 change: 1 addition & 0 deletions src/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <mutex>
#include <string>
#include <thread>
#include <unistd.h>

// library headers
#include <zsclient.h>
Expand Down
8 changes: 6 additions & 2 deletions src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# INTERFACE library with source files requires CMake 3.19
cmake_minimum_required(VERSION 3.19)

add_library(util INTERFACE
add_library(util STATIC
util.cpp
util.h
)
target_include_directories(util INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(util PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_link_libraries(util PRIVATE libappimage_shared libzsync2_static)
Loading

0 comments on commit 09a6f9e

Please sign in to comment.