| 143 | == Linux AppImage == |
| 144 | |
| 145 | After you've built 0ad, you can use these steps to create an [https://appimage.org/ AppImage]: |
| 146 | |
| 147 | |
| 148 | {{{ |
| 149 | #!/bin/sh |
| 150 | set -ev # exit on error, be verbose |
| 151 | |
| 152 | #ABS_PATH_SRC_ROOT=/0ad |
| 153 | |
| 154 | if [ -z "${ABS_PATH_SRC_ROOT}" ]; then |
| 155 | echo "set the source root!" |
| 156 | exit 1 |
| 157 | fi |
| 158 | |
| 159 | cd $ABS_PATH_SRC_ROOT |
| 160 | |
| 161 | install -s binaries/system/pyrogenesis -Dt $HOME/AppRun/usr/bin |
| 162 | install -s binaries/system/ActorEditor -Dt $HOME/AppRun/usr/bin |
| 163 | |
| 164 | # This loop uses 'patchelf', which may not be installed on some distros. |
| 165 | |
| 166 | # TODO: add code here to check for the existence of 'patchelf' |
| 167 | |
| 168 | cd $HOME/AppRun/usr/bin |
| 169 | |
| 170 | for lib in libmozjs78-ps-release.so \ |
| 171 | libnvcore.so \ |
| 172 | libnvimage.so \ |
| 173 | libnvmath.so \ |
| 174 | libnvtt.so |
| 175 | do |
| 176 | patchelf --set-rpath $lib:${ABS_PATH_SRC_ROOT}/binaries/system pyrogenesis |
| 177 | done |
| 178 | |
| 179 | patchelf --set-rpath libAtlasUI.so:${ABS_PATH_SRC_ROOT}/binaries/system ActorEditor |
| 180 | |
| 181 | cd $ABS_PATH_SRC_ROOT |
| 182 | |
| 183 | install binaries/system/libCollada.so -Dt $HOME/AppRun/usr/lib |
| 184 | install build/resources/0ad.appdata.xml -Dt $HOME/AppRun/usr/share/appdata |
| 185 | install build/resources/0ad.desktop -Dt $HOME/AppRun/usr/share/applications |
| 186 | install build/resources/0ad.png -Dt $HOME/AppRun/usr/share/pixmaps |
| 187 | |
| 188 | mkdir -p $HOME/AppRun/usr/data/config |
| 189 | cp -a binaries/data/config/default.cfg $HOME/AppRun/usr/data/config |
| 190 | |
| 191 | cp -a binaries/data/l10n $HOME/AppRun/usr/data |
| 192 | |
| 193 | # IMPORTANT: If you're creating the image from a distribution archive, this should copy |
| 194 | # 'binaries/data/mods/mod/mod.zip', 'binaries/data/mods/public/public.zip', and |
| 195 | # 'binaries/data/mods/public/mod.json' |
| 196 | # If you're using the svn/git version, you'll need to use the pyrogenesis |
| 197 | # pyromod archive builder. It's recommended to create the two zip files |
| 198 | # in a directory outside of the AppRun folder, in case you need to remove |
| 199 | # the AppRun folder, and then copy them to $HOME/AppRun/usr/data |
| 200 | # see https://trac.wildfiregames.com/wiki/Modding_Guide#Distributingyourmods |
| 201 | # |
| 202 | cp -a binaries/data/mods $HOME/AppRun/usr/data |
| 203 | |
| 204 | # Remove any symlinks to mods that may be in binaries/data/mods (this will cause 0ad to crash |
| 205 | # when the appimage is run). If you're creating the image from a clean 0ad archive, then |
| 206 | # there won't be any symlinks of course |
| 207 | }}} |
| 208 | |
| 209 | Note that binaries/system{libmoz*,libnv*} will be moved into the AppRun folder automatically when linuxdeploy is run below. |
| 210 | |
| 211 | Change the Exec line in $HOME/AppRun/usr/share/applications/0ad.desktop to pyrogenesis and also change the Exec line for Atlas. |
| 212 | |
| 213 | Get a copy of [https://github.com/linuxdeploy/linuxdeploy/releases linuxdeploy] (you can use `wget` to get the desired release/arch). |
| 214 | |
| 215 | {{{ |
| 216 | cd $HOME |
| 217 | |
| 218 | linuxdeploy -d AppRun/usr/share/applications/0ad.desktop \ |
| 219 | --icon-file=AppRun/usr/share/pixmaps/0ad.png \ |
| 220 | --icon-filename=0ad \ |
| 221 | --executable AppRun/usr/bin/pyrogenesis \ |
| 222 | --appdir AppRun \ |
| 223 | --output appimage |
| 224 | }}} |
| 225 | |
| 226 | Other Notes: |
| 227 | |
| 228 | To test any changes you might want to make to the appimage, or for debugging, after extraction you can move things around or do whatever, then cd back to the squashfs-root dir, and enter `./AppRun`. |
| 229 | |
| 230 | To use the --writableRoot option with the 0ad appimage, it must be extracted by providing the --appimage-extract option. Then cd into squashfs-root, and type in `./AppRun --writableRoot` |
| 231 | |