Files
diy-layout-creator/diylc/diylc-swing/appimage.xml
T
Bane Stojkovic dd6dd7daf8 fix appimage
2025-03-07 23:06:12 +01:00

114 lines
4.2 KiB
XML

<project name="diylc-swing-appimage" basedir=".">
<import file="build.xml"/>
<property name="appdir" value="build/AppDir" />
<property name="appimagetool" value="${basedir}/tools/appimagetool-x86_64.AppImage" />
<property name="wsl.command" value="wsl bash -c"/>
<target name="setup-wsl">
<!-- Install necessary Linux dependencies inside WSL -->
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;sudo apt update &amp;&amp; sudo apt install -y wget libfuse2 fuse&quot;" />
</exec>
<!-- Download AppImageTool into WSL -->
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;wget -O ~/appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage &amp;&amp; chmod +x ~/appimagetool&quot;" />
</exec>
</target>
<target name="build-appimage">
<mkdir dir="${appdir}/usr/bin" />
<mkdir dir="${appdir}/usr/share/icons/hicolor/512x512/apps" />
<mkdir dir="${appdir}/usr/share/metainfo" />
<!-- Copy app files -->
<copy file="${jar.dir}/diylc.jar" todir="${appdir}/usr/lib" />
<copy todir="${appdir}/usr/lib/lib">
<fileset dir="${jar.dir}/lib">
<include name="*"/>
</fileset>
</copy>
<copy todir="${appdir}/usr/lib/library">
<fileset dir="${jar.dir}/library">
<include name="*"/>
</fileset>
</copy>
<copy todir="${appdir}/usr/bin/templates">
<fileset dir="${basedir}/templates">
<include name="*"/>
</fileset>
</copy>
<copy todir="${appdir}/usr/bin/themes">
<fileset dir="${basedir}/themes">
<include name="*"/>
</fileset>
</copy>
<copy todir="${appdir}/usr/bin/fonts">
<fileset dir="${basedir}/fonts">
<include name="*"/>
</fileset>
</copy>
<copy todir="${appdir}/usr/bin/lang">
<fileset dir="${basedir}/lang">
<include name="*"/>
</fileset>
</copy>
<copy file="appimage/diylc.sh" tofile="${appdir}/usr/bin/diylc.sh" />
<copy file="appimage/AppRun" tofile="${appdir}/AppRun" />
<copy file="deploy/splash.png" todir="${appdir}/usr/bin" />
<chmod file="${appdir}/AppRun" perm="755" />
<!-- Copy icons and desktop file -->
<copy file="icons/icon_512x512.png" tofile="${appdir}/usr/share/icons/hicolor/512x512/apps/com.diy_fever.DIYLayoutCreator.png" />
<copy file="icons/icon_512x512.png" tofile="${appdir}/com.diy_fever.DIYLayoutCreator.png" />
<!--<copy file="appimage/com.diy_fever.DIYLayoutCreator.desktop" todir="${appdir}/usr/share/applications" />-->
<copy file="appimage/com.diy_fever.DIYLayoutCreator.desktop" todir="${appdir}" />
<copy file="appimage/com.diy_fever.DIYLayoutCreator.metainfo.xml" todir="${appdir}/usr/share/metainfo" />
<exec executable="cmd.exe" failonerror="true">
<arg line="/c wsl echo 'WSL is available'"/>
</exec>
<exec executable="cmd.exe">
<arg line="/c wsl rm -rf /tmp/AppDir"/>
</exec>
<exec executable="cmd.exe">
<arg line="/c wsl cp -r &quot;$(wslpath -u '${appdir}')&quot; /tmp/AppDir"/>
</exec>
<!--<exec executable="cmd.exe" failonerror="true">
<arg line="/c wsl tree /tmp/AppDir"/>
</exec>-->
<!-- Convert to Unix line endings -->
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;sed -i 's/\r$//' /tmp/AppDir/com.diy_fever.DIYLayoutCreator.desktop&quot;"/>
</exec>
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;sed -i 's/\r$//' /tmp/AppDir/AppRun&quot;"/>
</exec>
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;sed -i 's/\r$//' /tmp/AppDir/usr/bin/diylc.sh&quot;"/>
</exec>
<echo message="Starting AppImage build process using WSL..."/>
<exec executable="cmd.exe" failonerror="true">
<arg line="/c ${wsl.command} &quot;cd /tmp &amp;&amp; ~/appimagetool /tmp/AppDir /tmp/${appimage.output.file}&quot;"/>
</exec>
<echo message="AppImage created successfully in WSL! Copying back to Windows..."/>
<exec executable="cmd.exe" failonerror="true">
<arg line="/c wsl bash -c &quot;cp /tmp/${appimage.output.file} $(wslpath -u 'build\\${appimage.output.file}')&quot;"/>
</exec>
<echo message="AppImage build completed successfully! Output: ${appimage.output.file}"/>
</target>
</project>