+def make_appimage(target, nice_name, internal_name, version):
+ nice_filename = nice_name.replace(' ', '_')
+ os.makedirs('build/%s.AppDir/usr/bin' % nice_filename)
+ target.command('cp %s/bin/%s build/%s.AppDir/usr/bin' % (target.directory, internal_name, nice_filename))
+ with open('build/%s.AppDir/AppRun' % nice_filename, 'w') as f:
+ print('#!/bin/bash', file=f)
+ print('export APPDIR="$(dirname "$(readlink -f "$0")")"', file=f)
+ print('export PATH=$APPDIR/usr/bin:$PATH', file=f)
+ print('export XDG_DATA_DIRS="$APPDIR/usr/share/:/usr/share/:$XDG_DATA_DIRS"', file=f)
+ print('"$APPDIR"/usr/bin/%s $@' % internal_name, file=f)
+ target.command('chmod a+rx build/%s.AppDir/AppRun' % nice_filename)
+ with open('build/%s.AppDir/%s.desktop' % (nice_filename, internal_name), 'w') as f:
+ print('[Desktop Entry]', file=f)
+ print('Type=Application', file=f)
+ print('Categories=AudioVideo;', file=f)
+ print('Name=%s' % nice_name, file=f)
+ print('Icon=%s' % internal_name, file=f)
+ target.command('cp graphics/linux/256/%s.png build/%s.AppDir' % (internal_name, nice_filename))
+ target.command('linuxdeploy-x86_64.AppImage --appdir build/%s.AppDir' % nice_filename)
+ target.command('appimagetool-x86_64.AppImage build/%s.AppDir' % nice_filename)
+ target.command('mv %s-x86_64.AppImage build/%s-%s-x86_64.AppImage' % (nice_filename, nice_filename, version))
+ return os.path.abspath('build/%s-%s-x86_64.AppImage' % (nice_filename, version))
+