mirror of https://github.com/WerWolv/ImHex.git
build: Added AppImage builder (#355)
* Docker files to create an AppImage * Using ENTRYPOINT is a bit nicer here * typo * put with other dist files
This commit is contained in:
parent
278d46ccd7
commit
be1c5f5d1d
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
SELF=$(readlink -f "$0")
|
||||
HERE=${SELF%/*}
|
||||
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
|
||||
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
|
||||
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
|
||||
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
|
||||
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
|
||||
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
|
||||
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
|
||||
exec "${EXEC}" "$@"
|
|
@ -0,0 +1,61 @@
|
|||
FROM debian:bullseye-slim
|
||||
LABEL maintainer Example <example@example.com>
|
||||
|
||||
ARG TAG=master
|
||||
|
||||
USER root
|
||||
|
||||
# Bring packages up to date
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get install -y \
|
||||
git \
|
||||
cmake \
|
||||
curl \
|
||||
libfuse2 \
|
||||
file
|
||||
|
||||
# Fetch source and dependencies
|
||||
RUN mkdir -p /source \
|
||||
&& cd /source \
|
||||
&& git clone https://github.com/WerWolv/ImHex.git \
|
||||
&& cd ImHex \
|
||||
&& git checkout $TAG \
|
||||
&& git submodule update --init --recursive \
|
||||
&& cd /source/ImHex/dist \
|
||||
&& ./get_deps_debian.sh
|
||||
|
||||
ARG CXX=g++-10
|
||||
|
||||
# Build ImHex
|
||||
RUN mkdir -p /source/ImHex/build \
|
||||
&& cd /source/ImHex/build \
|
||||
&& cmake --install-prefix /usr -DCMAKE_BUILD_TYPE=Release .. \
|
||||
&& make -j
|
||||
|
||||
# Prepare for AppImage
|
||||
RUN mkdir -p /source/ImHex.AppDir/usr/bin \
|
||||
&& mkdir -p /source/ImHex.AppDir/usr/lib \
|
||||
&& mkdir -p /source/ImHex.AppDir/usr/share/imhex/plugins \
|
||||
&& cp /source/ImHex/build/imhex /source/ImHex.AppDir/usr/bin/imhex \
|
||||
&& cp /source/ImHex/build/plugins/builtin/builtin.hexplug /source/ImHex.AppDir/usr/share/imhex/plugins
|
||||
|
||||
COPY AppRun ImHex.desktop imhex.png /source/ImHex.AppDir/
|
||||
#RUN inkscape -z -o /source/ImHex.AppDir/imhex.png -w 128 -h 128 /source/ImHex/res/icon.svg
|
||||
|
||||
# Gather the needed libraries
|
||||
RUN chmod a+x /source/ImHex.AppDir/AppRun \
|
||||
&& ldd /source/ImHex/build/imhex | awk '/ => /{print $3}' | xargs -I '{}' cp '{}' /source/ImHex.AppDir/usr/lib
|
||||
|
||||
# Package the prepared AppDir
|
||||
RUN cd /source \
|
||||
&& curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage -o appimagetool-x86_64.AppImage \
|
||||
&& chmod a+x appimagetool-x86_64.AppImage
|
||||
|
||||
# All that remains is the following. However, due to docker limitations with fuse
|
||||
# this cannot be done in a build container.
|
||||
#
|
||||
# /source/appimagetool-x86_64.AppImage ImHex.AppDir
|
||||
|
||||
ENTRYPOINT sh -c '/source/appimagetool-x86_64.AppImage /source/ImHex.AppDir; sleep 60'
|
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Name=ImHex
|
||||
Exec=imhex
|
||||
Icon=imhex
|
||||
Type=Application
|
||||
Categories=Utility;
|
|
@ -0,0 +1,3 @@
|
|||
The environment variable TAG can be set to build for a specific git tag. Without the master branch is build.
|
||||
|
||||
First run `build.sh` to create a docker image. Then run `extract.sh` to get an AppImage.
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the TAG environment variable to build a specific tag
|
||||
|
||||
# Make sure we're in the same direcotry as this script
|
||||
pushd $(dirname "$(realpath "$0")")
|
||||
|
||||
if [ -z "$TAG" ]; then
|
||||
docker build -t imhex-appimage-build .
|
||||
else
|
||||
docker build --build-arg=TAG=$TAG -t imhex-appimage-build-$TAG .
|
||||
fi
|
||||
|
||||
popd
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the TAG environment variable to move to a versioned name while extracting
|
||||
|
||||
# Make sure we're in the same direcotry as this script
|
||||
pushd $(dirname "$(realpath "$0")")
|
||||
|
||||
# Remove old containers
|
||||
docker rm imhex 2>&1 > /dev/null
|
||||
|
||||
# AppImage uses FUSE, which makes --device /dev/fuse --cap-add SYS_ADMIN necessary here
|
||||
# on Debian --security-opt apparmor:unconfined is also needed
|
||||
if [ -z "$TAG" ]; then
|
||||
docker run -d --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --name imhex imhex-appimage-build
|
||||
else
|
||||
docker run -d --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --name imhex imhex-appimage-build-$TAG
|
||||
fi
|
||||
sleep 10
|
||||
docker cp imhex:/ImHex-x86_64.AppImage .
|
||||
|
||||
# Move to tagged name if $TAG set
|
||||
if [ -n "$TAG" ]; then
|
||||
mv ImHex-x86_64.AppImage ImHex-${TAG}-x86_64.AppImage
|
||||
fi
|
||||
|
||||
popd
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
Reference in New Issue