Changes between Version 65 and Version 66 of BuildAndDeploymentEnvironment


Ignore:
Timestamp:
Aug 31, 2022, 4:08:44 PM (21 months ago)
Author:
Andy Alt
Comment:

appimage:revise script

Legend:

Unmodified
Added
Removed
Modified
  • BuildAndDeploymentEnvironment

    v65 v66  
    157157{{{
    158158#!/bin/sh
    159 # install.sh
     159# install.sh: Installs files to prepare for building an AppImage
     160# Copyright 2022 The 0ad project
     161#
    160162set -ev # exit on error, be verbose
    161163
    162 #WORK_DIR=
     164
     165#ABS_PATH_WORK_DIR=
    163166#ABS_PATH_SRC_ROOT=/0ad
    164167
    165 if [ -z "${WORK_DIR}" ]; then
    166   echo "set the work dir!"
     168if [ ! -d "${ABS_PATH_WORK_DIR}" ]; then
     169  echo "The work dir must be an absolute path to an existing directory."
    167170  exit 1
    168171fi
    169172
    170 if [ -z "${ABS_PATH_SRC_ROOT}" ]; then
     173if [ ! -r "${ABS_PATH_SRC_ROOT}/binaries/source/main.cpp" ]; then
    171174  echo "set the source root!"
    172175  exit 1
    173176fi
    174177
    175 cd $ABS_PATH_SRC_ROOT
    176 
    177 install -s binaries/system/pyrogenesis -Dt ${WORK_DIR}/AppRun/usr/bin
    178 install -s binaries/system/ActorEditor -Dt ${WORK_DIR}/AppRun/usr/bin
     178APPDIR=${ABS_PATH_WORK_DIR}/AppDir
     179
     180cd ${ABS_PATH_SRC_ROOT}
     181
     182install -s binaries/system/pyrogenesis -Dt ${APPDIR}/usr/bin
     183install -s binaries/system/ActorEditor -Dt ${APPDIR}/usr/bin
    179184
    180185# This loop uses 'patchelf', which may not be installed on some distros.
     
    182187# TODO: add code here to check for the existence of 'patchelf'
    183188
    184 cd ${WORK_DIR}/AppRun/usr/bin
     189cd ${APPDIR}/usr/bin
    185190
    186191for lib in libmozjs78-ps-release.so \
     
    195200patchelf --set-rpath libAtlasUI.so:${ABS_PATH_SRC_ROOT}/binaries/system ActorEditor
    196201
    197 cd $ABS_PATH_SRC_ROOT
    198 
    199 install binaries/system/libCollada.so -Dt ${WORK_DIR}/AppRun/usr/lib
    200 install build/resources/0ad.appdata.xml -Dt ${WORK_DIR}/AppRun/usr/share/appdata
    201 install build/resources/0ad.desktop -Dt ${WORK_DIR}/AppRun/usr/share/applications
    202 install build/resources/0ad.png -Dt ${WORK_DIR}/AppRun/usr/share/pixmaps
    203 
    204 mkdir -p ${WORK_DIR}/AppRun/usr/data/config
    205 cp -a binaries/data/config/default.cfg ${WORK_DIR}/AppRun/usr/data/config
    206 
    207 cp -a binaries/data/l10n ${WORK_DIR}/AppRun/usr/data
     202cd ${ABS_PATH_SRC_ROOT}
     203
     204install binaries/system/libCollada.so -Dt ${APPDIR}/usr/lib
     205install build/resources/0ad.appdata.xml -Dt ${APPDIR}/usr/share/appdata
     206install build/resources/0ad.desktop -Dt ${APPDIR}/usr/share/applications
     207install build/resources/0ad.png -Dt ${APPDIR}/usr/share/pixmaps
     208
     209mkdir -p ${APPDIR}/usr/data/config
     210cp -a binaries/data/config/default.cfg ${APPDIR}/usr/data/config
     211
     212cp -a binaries/data/l10n ${APPDIR}/usr/data
    208213
    209214# IMPORTANT: If you're creating the image from a distribution archive, this should copy
     
    212217# If you're using the svn/git version, you'll need to use the pyrogenesis
    213218# pyromod archive builder. It's recommended to create the two zip files
    214 # in a directory outside of the AppRun folder, in case you need to remove
    215 # the AppRun folder, and then copy them to ${WORK_DIR}/AppRun/usr/data
     219# in a directory outside of the ${APPDIR} folder (in case you need to remove
     220# the ${APPDIR} folder later) and then copy them to ${APPDIR}/usr/data
    216221# see https://trac.wildfiregames.com/wiki/Modding_Guide#Distributingyourmods
    217222#
    218 cp -a binaries/data/mods ${WORK_DIR}/AppRun/usr/data
     223cp -a binaries/data/mods ${APPDIR}/usr/data
    219224
    220225# Remove any symlinks to mods that may be in binaries/data/mods (this will cause 0ad to crash
     
    223228}}}
    224229
    225 Note that binaries/system{libmoz*,libnv*} will be moved into the ${WORK_DIR}/AppRun folder automatically when linuxdeploy is run below.
    226 
    227 Change the Exec line in ${WORK_DIR}/AppRun/usr/share/applications/0ad.desktop to `pyrogenesis` and also change the Exec line for Atlas.
     230Note that binaries/system{libmoz*,libnv*} will be moved into the ${APPDIR} folder automatically when linuxdeploy is run below.
     231
     232Change the Exec line in ${APPDIR}/usr/share/applications/0ad.desktop to `pyrogenesis` and also change the Exec line for Atlas.
    228233
    229234Get a copy of [https://github.com/linuxdeploy/linuxdeploy/releases linuxdeploy] (you can use `wget` to get the desired release/arch).
     
    232237
    233238{{{
    234 cd ${WORK_DIR}
    235 
    236 linuxdeploy -d AppRun/usr/share/applications/0ad.desktop \
    237   --icon-file=AppRun/usr/share/pixmaps/0ad.png \
     239cd ${ABS_PATH_WORK_DIR}
     240
     241linuxdeploy -d ${APPDIR}/usr/share/applications/0ad.desktop \
     242  --icon-file=${APPDIR}/usr/share/pixmaps/0ad.png \
    238243  --icon-filename=0ad \
    239   --executable AppRun/usr/bin/pyrogenesis \
    240   --appdir AppRun \
     244  --executable ${APPDIR}/usr/bin/pyrogenesis \
     245  --appdir ${APPDIR} \
    241246  --output appimage
    242247}}}
     
    244249Other Notes:
    245250
    246 To test any changes you want to make to the appimage, or for debugging, you can make changes inside the '${WORK_DIR}/AppRun' folder, then cd back to '${WORK_DIR}/AppRun' and enter `./AppRun`. When satisfied, repeat the "Create image" step above.
     251To test any changes you want to make to the appimage, or for debugging, you can make changes inside the '${APPDIR}' folder, then cd back to '${APPDIR}' and enter `./AppRun`. When satisfied, repeat the "Create image" step above.
    247252
    248253To use the --writableRoot option with the 0ad appimage, it must be extracted by providing the --appimage-extract option to the 0ad appimage. Then cd into squashfs-root, and type in `./AppRun --writableRoot`.