2020-04-14 04:22:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# NOTE: Keep this script in the same directory as resources for AppImage creation
|
|
|
|
APPIMAGE_RESOURCES_DIR=$(dirname $(readlink -f $0))
|
|
|
|
echo "APPIMAGE_RESOURCES_DIR set to ${APPIMAGE_RESOURCES_DIR}"
|
|
|
|
|
|
|
|
if [[ "$#" -ne 1 ]]; then
|
|
|
|
echo "Wrong number of arguments (\$# = $# args) provided."
|
|
|
|
echo "Usage: create-appimage.sh <build_directory_path>"
|
|
|
|
exit 1
|
|
|
|
else
|
2020-04-15 04:12:13 +00:00
|
|
|
BUILD_DIR=$(readlink -f $1)
|
2020-04-14 04:22:32 +00:00
|
|
|
echo "BUILD_DIR set to ${BUILD_DIR}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Acquire linuxdeploy and linuxdeploy-plugin-qt
|
2020-04-15 04:12:13 +00:00
|
|
|
wget --timestamping --directory-prefix=${BUILD_DIR} \
|
|
|
|
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
|
|
chmod a+x ${BUILD_DIR}/linuxdeploy-x86_64.AppImage
|
|
|
|
|
|
|
|
wget --timestamping --directory-prefix=${BUILD_DIR} \
|
|
|
|
https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
|
|
|
|
chmod a+x ${BUILD_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage
|
2020-04-14 04:22:32 +00:00
|
|
|
|
|
|
|
# Copy icons into the <resolution>/<app_name>.<ext> directory structure that linuxdeploy nominally expects,
|
|
|
|
# e.g. 16x16/duckstation-qt.png, 32x32/duckstation-qt.png, etc.
|
|
|
|
FRONTENDS=("qt" "sdl")
|
|
|
|
ICONS_QT=()
|
|
|
|
ICONS_SDL=()
|
|
|
|
|
|
|
|
ICON_PNG_RESOLUTIONS=($(seq 16 16 64)) # 16, 32, 48, 64
|
|
|
|
for res in ${ICON_PNG_RESOLUTIONS[@]}; do
|
|
|
|
mkdir -p ${BUILD_DIR}/AppImage-icons/${res}x${res}
|
|
|
|
for frontend in ${FRONTENDS[@]}; do
|
|
|
|
# Copy icon to proper directory
|
|
|
|
cp ${APPIMAGE_RESOURCES_DIR}/icon-${res}px.png ${BUILD_DIR}/AppImage-icons/${res}x${res}/duckstation-${frontend}.png
|
|
|
|
# Append icon filepath to array that will later be passed to linuxdeploy
|
|
|
|
eval "ICONS_${frontend^^}+=(${BUILD_DIR}/AppImage-icons/${res}x${res}/duckstation-${frontend}.png)"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2020-05-16 12:35:07 +00:00
|
|
|
# Add data files into the AppDir
|
|
|
|
DATA_DIR=$(dirname $(realpath "${BASH_SOURCE[0]}"))/../data
|
|
|
|
echo "Data directory is: ${DATA_DIR}"
|
|
|
|
for frontend in ${FRONTENDS[@]}; do
|
|
|
|
CURRENT_APPDIR=${BUILD_DIR}/AppDir-duckstation-${frontend}
|
|
|
|
mkdir -p ${CURRENT_APPDIR}/usr/bin
|
|
|
|
cp -av ${DATA_DIR}/* ${CURRENT_APPDIR}/usr/bin
|
|
|
|
done
|
|
|
|
|
2020-07-28 09:16:12 +00:00
|
|
|
# Add translations into the AppDir.
|
|
|
|
TRANSLATIONS_DIR=${BUILD_DIR}/bin/translations
|
|
|
|
echo "Translation directory is: ${BUILD_DIR}"
|
|
|
|
for frontend in ${FRONTENDS[@]}; do
|
|
|
|
CURRENT_APPDIR=${BUILD_DIR}/AppDir-duckstation-${frontend}
|
|
|
|
mkdir -p ${CURRENT_APPDIR}/usr/bin
|
|
|
|
cp -av ${TRANSLATIONS_DIR} ${CURRENT_APPDIR}/usr/bin
|
|
|
|
done
|
|
|
|
|
2020-05-23 09:35:35 +00:00
|
|
|
# Pass UPDATE_INFORMATION and OUTPUT variables (used by linuxdeploy-plugin-appimage)
|
|
|
|
# to the environment of the linuxdeploy commands
|
2020-04-14 04:22:32 +00:00
|
|
|
|
2020-05-23 09:35:35 +00:00
|
|
|
UPDATE_INFORMATION="zsync|https://github.com/stenzek/duckstation/releases/download/latest/duckstation-qt-x64.AppImage.zsync" \
|
|
|
|
OUTPUT="duckstation-qt-x64.AppImage" \
|
2020-04-15 04:12:13 +00:00
|
|
|
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
|
|
|
--appdir=${BUILD_DIR}/AppDir-duckstation-qt \
|
2020-05-16 03:10:31 +00:00
|
|
|
--executable=${BUILD_DIR}/bin/duckstation-qt \
|
2020-04-14 04:22:32 +00:00
|
|
|
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-qt.desktop \
|
|
|
|
${ICONS_QT[@]/#/--icon-file=} \
|
|
|
|
--plugin=qt \
|
2020-05-23 09:35:35 +00:00
|
|
|
--output=appimage
|
2020-04-14 04:22:32 +00:00
|
|
|
|
2020-05-23 09:35:35 +00:00
|
|
|
UPDATE_INFORMATION="zsync|https://github.com/stenzek/duckstation/releases/download/latest/duckstation-sdl-x64.AppImage.zsync" \
|
|
|
|
OUTPUT="duckstation-sdl-x64.AppImage" \
|
2020-04-15 04:12:13 +00:00
|
|
|
${BUILD_DIR}/linuxdeploy-x86_64.AppImage \
|
|
|
|
--appdir=${BUILD_DIR}/AppDir-duckstation-sdl \
|
2020-05-16 03:10:31 +00:00
|
|
|
--executable=${BUILD_DIR}/bin/duckstation-sdl \
|
2020-04-14 04:22:32 +00:00
|
|
|
--desktop-file=${APPIMAGE_RESOURCES_DIR}/duckstation-sdl.desktop \
|
|
|
|
${ICONS_SDL[@]/#/--icon-file=} \
|
2020-05-23 09:35:35 +00:00
|
|
|
--output=appimage
|
2020-04-14 04:22:32 +00:00
|
|
|
|
2020-05-23 09:35:35 +00:00
|
|
|
# Resulting AppImages and zsync files will be created in the directory this script is called from;
|
2020-04-15 04:12:13 +00:00
|
|
|
# move them into the user's specified build directory
|