Files
LuaCsForBarotraumaEP/Libraries/MonoGame.Framework/Src/Installers/default.build
2019-06-25 16:00:44 +03:00

217 lines
12 KiB
XML

<?xml version="1.0"?>
<project name="Installer Build Script" default="build" basedir=".">
<description>Default Installer Automated Build script</description>
<property name="os" value="${operating-system::get-platform(environment::get-operating-system())}" />
<!-- The build version number we can get from the environment variable -->
<property name="buildNumber" value="0.0.0.0"/>
<if test="${environment::variable-exists('BUILD_NUMBER')}">
<property name="buildNumber" value="${environment::get-variable('BUILD_NUMBER')}"/>
</if>
<target name="_checkos">
<property name="os" value="${operating-system::get-platform(environment::get-operating-system())}"/>
<if test="${os == 'Unix'}">
<if test="${directory::exists('/Applications') and directory::exists('/Library')}">
<property name="os" value="MacOS"/>
</if>
</if>
<echo message="Detected : ${os}"/>
</target>
<target name="build" description="Build Installers" depends="_checkos">
<!-- Windows Installer -->
<if test="${os == 'Win32NT'}">
<if test="${file::exists('C:\Program Files (x86)\NSIS\makensis.exe')}">
<echo append="false" file="Windows/header.nsh">
!define FrameworkPath "${project::get-base-directory()}"
!define VERSION "3.0"
!define INSTALLERVERSION "${buildNumber}"
</echo>
<exec program="makensis" workingdir="Windows" basedir="C:\Program Files (x86)\NSIS">
<arg value="MonoGame.nsi"/>
</exec>
</if>
</if>
<!-- Mac Installers -->
<if test="${os == 'MacOS'}">
<!-- Build Pipeline.Installer.pkg -->
<delete failonerror="false">
<fileset>
<include name="${project::get-base-directory()}\*.pkg"/>
<include name="${project::get-base-directory()}\..\Tools\Pipeline\bin\MacOS\AnyCPU\Release\*.pkg" />
</fileset>
</delete>
<mkdir dir="root/tmp" />
<!-- Build Addin .pkg -->
<copy file="../IDE/MonoDevelop/MonoDevelop.MonoGame_${buildNumber}.mpack" tofile="./root/tmp/MonoDevelop.MonoGame_${buildNumber}.mpack" overwrite="true"/>
<copy file="../IDE/VisualStudioForMac/bin/Debug/net461/MonoDevelop.MonoGame_IDE_VisualStudioForMac_${buildNumber}.mpack" tofile="./root/tmp/MonoDevelop.MonoGame_IDE_VisualStudioForMac_${buildNumber}.mpack" overwrite="true"/>
<copy todir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release/Pipeline.app/Contents/MonoBundle">
<fileset basedir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release">
<include name="ff*"/>
<include name="*.dylib"/>
</fileset>
</copy>
<!-- Correct the id of the dylibs -->
<foreach item="File" property="dylibname">
<in>
<items basedir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release/Pipeline.app/Contents/MonoBundle/">
<include name="*.dylib" />
</items>
</in>
<do>
<echo message="${path::get-file-name(dylibname)}" />
<exec program="install_name_tool" workingdir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release/Pipeline.app/Contents/MonoBundle" commandline=' -id "@executable_path/../MonoBundle/${path::get-file-name(dylibname)}" ${path::get-file-name(dylibname)}' />
</do>
</foreach>
<exec program="pkgbuild" workingdir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release" commandline=" --component ./Pipeline.app --identifier com.monogame.pipeline --version ${buildNumber} --scripts ${project::get-base-directory()}/MacOS/Scripts/Pipeline --install-location /Applications ${project::get-base-directory()}/Pipeline.MacOS.pkg" />
<exec program="pkgbuild" workingdir="." commandline=" --root ./root --identifier com.monogame.xsaddin --version ${buildNumber} --scripts ${project::get-base-directory()}/MacOS/Scripts/Addin ${project::get-base-directory()}/MonoGame.XamarinStudio.Addin.pkg" />
<!-- Build Framework .pkg -->
<delete dir="./root/tmp" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Tools" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/iOS" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/tvOS" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/Android" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/MacOSX" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/Linux" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL/x86" />
<mkdir dir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL/x64" />
<!-- Copy the Files over for the framework -->
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Tools">
<fileset basedir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release">
<include name="*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}">
<fileset basedir="../MonoGame.Framework.Content.Pipeline">
<include name="MonoGame.Content.Builder.targets"/>
<include name="MonoGame.Common.props"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}">
<fileset basedir="../Tools/Pipeline/bin/MacOS/AnyCPU/Release">
<include name="MonoGame.Build.Tasks.dll"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/iOS">
<fileset basedir="../MonoGame.Framework/bin/iOS/iPhoneSimulator/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/tvOS">
<fileset basedir="../MonoGame.Framework/bin/tvOS/iPhoneSimulator/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/Android">
<fileset basedir="../MonoGame.Framework/bin/Android/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/MacOSX">
<fileset basedir="../MonoGame.Framework/bin/MacOS/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/Linux">
<fileset basedir="../MonoGame.Framework/bin/Linux/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL">
<fileset basedir="../MonoGame.Framework/bin/Linux/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL/x86">
<fileset basedir="../MonoGame.Framework/bin/Linux/AnyCPU/Release/x86">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="root/Library/Frameworks/MonoGame.framework/v${buildNumber}/Assemblies/DesktopGL/x64">
<fileset basedir="../MonoGame.Framework/bin/Linux/AnyCPU/Release/x64">
<include name="*.*"/>
</fileset>
</copy>
<copy file="./MacOS/Scripts/Framework/postinstall.in" tofile="./MacOS/Scripts/Framework/postinstall" />
<echo append="true" file="./MacOS/Scripts/Framework/postinstall">
if [ -d '/Library/Frameworks/MonoGame.framework/v3.0' ]
then
rm /Library/Frameworks/MonoGame.framework/v3.0
fi
if [ -d '/Library/Frameworks/MonoGame.framework/Current' ]
then
rm /Library/Frameworks/MonoGame.framework/Current
fi
ln -sf /Library/Frameworks/MonoGame.framework/v${buildNumber} /Library/Frameworks/MonoGame.framework/v3.0
ln -sf /Library/Frameworks/MonoGame.framework/v${buildNumber} /Library/Frameworks/MonoGame.framework/Current
#fix permissions
chmod +x /Library/Frameworks/MonoGame.framework/Current/Tools/ffmpeg
chmod +x /Library/Frameworks/MonoGame.framework/Current/Tools/ffprobe
mkdir -p /Library/Frameworks/Mono.framework/External/xbuild
if [ -d '/Library/Frameworks/Mono.framework/External/xbuild' ]
then
ln -sf /Library/Frameworks/MonoGame.framework /Library/Frameworks/Mono.framework/External/xbuild/MonoGame
fi
</echo>
<exec program="pkgbuild" workingdir="." commandline=" --root ./root --identifier com.monogame.framework --version ${buildNumber} --scripts ${project::get-base-directory()}/MacOS/Scripts/Framework ${project::get-base-directory()}/MonoGame.framework.pkg" />
<copy tofile="./distribution.xml" file="./MacOS/distribution.xml" />
<copy tofile="./MacOS/Resources/LICENSE.html" file="./../LICENSE.txt" />
<xmlpoke file="./distribution.xml" xpath="/installer-gui-script/title" value="MonoGame ${buildNumber}" />
<exec program="productbuild" workingdir="${project::get-base-directory()}" commandline=" --distribution ./distribution.xml --resources ./MacOS/Resources --package-path ./ MonoGame.pkg" />
<delete dir="./root"/>
<delete file="./distribution.xml"/>
<delete file="./MacOS/Resources/LICENSE.html"/>
</if>
<!-- Linux Installer -->
<if test="${(os == 'Unix' or os == 'MacOS') and directory::exists('../Tools/Pipeline/bin/Linux/AnyCPU/Release')}">
<delete dir="Linux/tmp_run" failonerror="false"/>
<mkdir dir="Linux/tmp_run"/>
<copy todir="Linux/tmp_run/Main/">
<fileset basedir="Linux/Main"/>
</copy>
<copy file="../IDE/MonoDevelop/MonoDevelop.MonoGame_${buildNumber}.mpack" tofile="Linux/tmp_run/Main/MonoDevelop.MonoGame.mpack" overwrite="true"/>
<copy file="../IDE/VisualStudioForMac/bin/Debug/net461/MonoDevelop.MonoGame_IDE_VisualStudioForMac_${buildNumber}.mpack" tofile="Linux/tmp_run/Main/MonoDevelop.MonoGame_IDE_VisualStudioForMac.mpack" overwrite="true"/>
<copy file="../MonoGame.Framework.Content.Pipeline/MonoGame.Content.Builder.targets" tofile="Linux/tmp_run/MonoGameSDK/MonoGame.Content.Builder.targets"/>
<copy file="../MonoGame.Framework.Content.Pipeline/MonoGame.Common.props" tofile="Linux/tmp_run/MonoGameSDK/MonoGame.Common.props"/>
<copy file="../Tools/Pipeline/bin/Linux/AnyCPU/Release/MonoGame.Build.Tasks.dll" tofile="Linux/tmp_run/MonoGameSDK/MonoGame.Build.Tasks.dll"/>
<copy todir="Linux/tmp_run/MonoGameSDK/Tools">
<fileset basedir="../Tools/Pipeline/bin/Linux/AnyCPU/Release"/>
</copy>
<copy todir="Linux/tmp_run/MonoGameSDK/Assemblies/DesktopGL">
<fileset basedir="../MonoGame.Framework/bin/Linux/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="Linux/tmp_run/MonoGameSDK/Assemblies/Android">
<fileset basedir="../MonoGame.Framework/bin/Android/AnyCPU/Release">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="Linux/tmp_run">
<fileset basedir="Linux/RUN"/>
</copy>
<move file="Linux/tmp_run/uninstall.sh" tofile="Linux/tmp_run/MonoGameSDK/uninstall.sh" />
<exec program="../ThirdParty/Dependencies/makeself/makeself.sh" workingdir="Linux/">
<arg value="tmp_run/"/>
<arg value="monogame-sdk.run"/>
<arg value="Monogame Pipeline Installer"/>
<arg value="./postinstall.sh"/>
</exec>
<delete dir="Linux/tmp_run" failonerror="false"/>
</if>
</target>
</project>