Add Windows and macOS packaging scripts.
This commit is contained in:
parent
04f8697e9f
commit
817bffb423
87
mod.config
87
mod.config
@ -1,20 +1,91 @@
|
|||||||
# The id of the mod to launch by default. This must exist as a directory in the mods directory
|
##############################################################################
|
||||||
|
# Core Configuration
|
||||||
|
#
|
||||||
|
# Basic settings that should be changed by all projects.
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# The id of the mod packaged by this project.
|
||||||
|
# This must exist as a directory in the mods directory.
|
||||||
MOD_ID="example"
|
MOD_ID="example"
|
||||||
|
|
||||||
|
# The OpenRA engine version to use for this project.
|
||||||
ENGINE_VERSION="1b0ae1e"
|
ENGINE_VERSION="1b0ae1e"
|
||||||
|
|
||||||
# Import the default OpenRA mods for use as external mod references
|
# Enable this to make the default OpenRA mods available for use in your mod.yaml
|
||||||
# in your mod.yaml. Accepts values "True" or "False".
|
# Packages list (via $mod references). Accepts values "True" or "False".
|
||||||
# WARNING: This setting is provided to simplify early mod development
|
# WARNING: This setting is provided to simplify early project development,
|
||||||
# and must be disabled before installers can be generated
|
# and must be disabled before you can package installers for your project!
|
||||||
INCLUDE_DEFAULT_MODS="False"
|
INCLUDE_DEFAULT_MODS="False"
|
||||||
|
|
||||||
# Automatically manage engine dependencies
|
##############################################################################
|
||||||
|
# Packaging Configuration
|
||||||
|
#
|
||||||
|
# Settings controlling the creation of installers.
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# The prefix used for the installer filenames.
|
||||||
|
# - Windows installers will be named as {PACKAGING_INSTALLER_NAME}-{TAG}.exe
|
||||||
|
# - macOS installers will be named as {PACKAGING_INSTALLER_NAME}-{TAG}.zip
|
||||||
|
PACKAGING_INSTALLER_NAME="ExampleMod"
|
||||||
|
|
||||||
|
# The human-readable name for this project.
|
||||||
|
# This is used in:
|
||||||
|
# - Crash dialogs (all platforms)
|
||||||
|
# - macOS .app bundle name
|
||||||
|
# - macOS menu bar
|
||||||
|
# - macOS "About" window
|
||||||
|
# - Windows installer
|
||||||
|
# - Windows start menu
|
||||||
|
# - Windows desktop shortcut
|
||||||
|
# - Windows "Programs and Features" list
|
||||||
|
PACKAGING_DISPLAY_NAME="Example Mod"
|
||||||
|
|
||||||
|
# The URL for the project homepage.
|
||||||
|
# This is used in:
|
||||||
|
# - Windows "Add/Remove Programs" list
|
||||||
|
PACKAGING_WEBSITE_URL="http://openra.net"
|
||||||
|
|
||||||
|
# The URL that is opened when a player presses the "FAQ" button in the crash dialog.
|
||||||
|
PACKAGING_FAQ_URL="http://wiki.openra.net/FAQ"
|
||||||
|
|
||||||
|
# The human-readable project authors.
|
||||||
|
# This is used in:
|
||||||
|
# - Windows "Add/Remove Programs" list
|
||||||
|
PACKAGING_AUTHORS="Example Mod authors"
|
||||||
|
|
||||||
|
# The git tag to use for the macOS Launcher files.
|
||||||
|
PACKAGING_OSX_LAUNCHER_TAG="osx-launcher-20170708"
|
||||||
|
|
||||||
|
# Filename to use for the launcher executable on Windows.
|
||||||
|
PACKAGING_WINDOWS_LAUNCHER_NAME="ExampleMod"
|
||||||
|
|
||||||
|
# The name of the Windows Program Files directory to install the project files to.
|
||||||
|
PACKAGING_WINDOWS_INSTALL_DIR_NAME="OpenRA Example Mod"
|
||||||
|
|
||||||
|
# The key prefix used for Windows registry metadata.
|
||||||
|
# This should not contain spaces or special characters.
|
||||||
|
PACKAGING_WINDOWS_REGISTRY_KEY="OpenRAExampleMod"
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Advanced Configuration
|
||||||
|
#
|
||||||
|
# Most projects will not need to modify these
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Automatic engine managment will treat the OpenRA engine files like a read-only dependency.
|
||||||
|
# Disable this if you would like to modify or manager your own engine files.
|
||||||
AUTOMATIC_ENGINE_MANAGEMENT="True"
|
AUTOMATIC_ENGINE_MANAGEMENT="True"
|
||||||
|
|
||||||
|
# The URL to download the engine files from when AUTOMATIC_ENGINE_MANAGEMENT is enabled.
|
||||||
AUTOMATIC_ENGINE_SOURCE="https://github.com/OpenRA/OpenRA/archive/${ENGINE_VERSION}.zip"
|
AUTOMATIC_ENGINE_SOURCE="https://github.com/OpenRA/OpenRA/archive/${ENGINE_VERSION}.zip"
|
||||||
|
|
||||||
# Temporary file/directory names used when automatically downloading the engine
|
# Temporary file/directory names used by automatic engine management.
|
||||||
AUTOMATIC_ENGINE_EXTRACT_DIRECTORY="./engine_temp"
|
AUTOMATIC_ENGINE_EXTRACT_DIRECTORY="./engine_temp"
|
||||||
AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME="engine.zip"
|
AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME="engine.zip"
|
||||||
|
|
||||||
ENGINE_DIRECTORY="./engine"
|
ENGINE_DIRECTORY="./engine"
|
||||||
|
|
||||||
|
# The url to download the OpenRA macOS launcher files.
|
||||||
|
PACKAGING_OSX_LAUNCHER_SOURCE="https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${PACKAGING_OSX_LAUNCHER_TAG}/launcher.zip"
|
||||||
|
|
||||||
|
# Temporary file name used when downloading the OpenRA macOS launcher files.
|
||||||
|
PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME="launcher.zip"
|
||||||
|
|||||||
90
packaging/osx/buildpackage.sh
Executable file
90
packaging/osx/buildpackage.sh
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# OpenRA packaging script for macOS
|
||||||
|
|
||||||
|
command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires make."; exit 1; }
|
||||||
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
|
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
||||||
|
|
||||||
|
if [ $# -ne "2" ]; then
|
||||||
|
echo "Usage: `basename $0` tag outputdir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||||
|
TEMPLATE_ROOT="${PACKAGING_DIR}/../../"
|
||||||
|
|
||||||
|
# shellcheck source=mod.config
|
||||||
|
. "${TEMPLATE_ROOT}/mod.config"
|
||||||
|
|
||||||
|
if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
||||||
|
# shellcheck source=user.config
|
||||||
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${INCLUDE_DEFAULT_MODS}" = "True" ]; then
|
||||||
|
echo "Cannot generate installers while INCLUDE_DEFAULT_MODS is enabled."
|
||||||
|
echo "Make sure that this setting is disabled in both your mod.config and user.config."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the working dir to the location of this script
|
||||||
|
cd "${PACKAGING_DIR}"
|
||||||
|
|
||||||
|
TAG="$1"
|
||||||
|
OUTPUTDIR="$2"
|
||||||
|
BUILTDIR="$(pwd)/build"
|
||||||
|
PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app"
|
||||||
|
|
||||||
|
modify_plist() {
|
||||||
|
sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Building launcher"
|
||||||
|
curl -s -L -o "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}" -O "${PACKAGING_OSX_LAUNCHER_SOURCE}" || exit 3
|
||||||
|
|
||||||
|
unzip -qq -d "${BUILTDIR}" "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}"
|
||||||
|
rm "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}"
|
||||||
|
|
||||||
|
modify_plist "{DEV_VERSION}" "${TAG}" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
|
||||||
|
modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
|
||||||
|
echo "Building core files"
|
||||||
|
|
||||||
|
pushd ${TEMPLATE_ROOT} > /dev/null
|
||||||
|
|
||||||
|
if [ ! -f "${ENGINE_DIRECTORY}/Makefile" ]; then
|
||||||
|
echo "Required engine files not found."
|
||||||
|
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make version VERSION="${TAG}"
|
||||||
|
|
||||||
|
pushd ${ENGINE_DIRECTORY} > /dev/null
|
||||||
|
make osx-dependencies
|
||||||
|
make core SDK="-sdk:4.5"
|
||||||
|
make install-engine gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
|
||||||
|
make install-common-mod-files gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Add mod files
|
||||||
|
cp -r "${TEMPLATE_ROOT}/mods/"* "${BUILTDIR}/OpenRA.app/Contents/Resources/mods"
|
||||||
|
cp "${MOD_ID}.icns" "${BUILTDIR}/OpenRA.app/Contents/Resources/"
|
||||||
|
|
||||||
|
pushd "${BUILTDIR}" > /dev/null
|
||||||
|
mv "OpenRA.app" "${PACKAGING_OSX_APP_NAME}"
|
||||||
|
|
||||||
|
# Copy macOS specific files
|
||||||
|
modify_plist "{MOD_ID}" "${MOD_ID}" "${PACKAGING_OSX_APP_NAME}/Contents/Info.plist"
|
||||||
|
modify_plist "{MOD_NAME}" "${PACKAGING_DISPLAY_NAME}" "${PACKAGING_OSX_APP_NAME}/Contents/Info.plist"
|
||||||
|
modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${PACKAGING_OSX_APP_NAME}/Contents/Info.plist"
|
||||||
|
|
||||||
|
echo "Packaging zip archive"
|
||||||
|
|
||||||
|
zip "${PACKAGING_INSTALLER_NAME}-${TAG}" -r -9 "${PACKAGING_OSX_APP_NAME}" --quiet --symlinks
|
||||||
|
mv "${PACKAGING_INSTALLER_NAME}-${TAG}.zip" ${OUTPUTDIR}
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf "${BUILTDIR}"
|
||||||
BIN
packaging/osx/example.icns
Normal file
BIN
packaging/osx/example.icns
Normal file
Binary file not shown.
27
packaging/package-all.sh
Executable file
27
packaging/package-all.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -ne "2" ]; then
|
||||||
|
echo "Usage: `basename $0` version outputdir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the working dir to the location of this script
|
||||||
|
cd "$(dirname $0)"
|
||||||
|
|
||||||
|
pushd windows >/dev/null
|
||||||
|
echo "Building Windows package"
|
||||||
|
./buildpackage.sh "$1" "$2"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Windows package build failed."
|
||||||
|
fi
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
pushd osx >/dev/null
|
||||||
|
echo "Building macOS package"
|
||||||
|
./buildpackage.sh "$1" "$2"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "macOS package build failed."
|
||||||
|
fi
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
echo "Package build done."
|
||||||
246
packaging/windows/buildpackage.nsi
Normal file
246
packaging/windows/buildpackage.nsi
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
; Copyright 2007-2015 OpenRA developers (see AUTHORS)
|
||||||
|
; This file is part of OpenRA.
|
||||||
|
;
|
||||||
|
; OpenRA is free software: you can redistribute it and/or modify
|
||||||
|
; it under the terms of the GNU General Public License as published by
|
||||||
|
; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
; (at your option) any later version.
|
||||||
|
;
|
||||||
|
; OpenRA is distributed in the hope that it will be useful,
|
||||||
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
; GNU General Public License for more details.
|
||||||
|
;
|
||||||
|
; You should have received a copy of the GNU General Public License
|
||||||
|
; along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
!include "MUI2.nsh"
|
||||||
|
!include "FileFunc.nsh"
|
||||||
|
!include "WordFunc.nsh"
|
||||||
|
|
||||||
|
Name "${PACKAGING_DISPLAY_NAME}"
|
||||||
|
OutFile "OpenRA.Setup.exe"
|
||||||
|
|
||||||
|
InstallDir "$PROGRAMFILES\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}"
|
||||||
|
InstallDirRegKey HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir"
|
||||||
|
|
||||||
|
SetCompressor lzma
|
||||||
|
RequestExecutionLevel admin
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
!insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}"
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||||
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenRA"
|
||||||
|
|
||||||
|
Var StartMenuFolder
|
||||||
|
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_COMPONENTS
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
!insertmacro MUI_UNPAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
;***************************
|
||||||
|
;Section Definitions
|
||||||
|
;***************************
|
||||||
|
Section "-Reg" Reg
|
||||||
|
|
||||||
|
; Installation directory
|
||||||
|
WriteRegStr HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" $INSTDIR
|
||||||
|
|
||||||
|
; Join server URL Scheme
|
||||||
|
WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "" "URL:Join OpenRA server"
|
||||||
|
WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "URL Protocol" ""
|
||||||
|
WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0"
|
||||||
|
WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe Launch.URI=%1"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Game" GAME
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File /r "${SRCDIR}\mods"
|
||||||
|
File "${SRCDIR}\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe"
|
||||||
|
File "${SRCDIR}\OpenRA.Game.exe"
|
||||||
|
File "${SRCDIR}\OpenRA.Game.exe.config"
|
||||||
|
File "${SRCDIR}\OpenRA.Utility.exe"
|
||||||
|
File "${SRCDIR}\OpenRA.Server.exe"
|
||||||
|
File "${SRCDIR}\OpenRA.Platforms.Default.dll"
|
||||||
|
File "${SRCDIR}\ICSharpCode.SharpZipLib.dll"
|
||||||
|
File "${SRCDIR}\FuzzyLogicLibrary.dll"
|
||||||
|
File "${SRCDIR}\Open.Nat.dll"
|
||||||
|
File "${SRCDIR}\VERSION"
|
||||||
|
File "${SRCDIR}\AUTHORS"
|
||||||
|
File "${SRCDIR}\COPYING"
|
||||||
|
File "${SRCDIR}\${MOD_ID}.ico"
|
||||||
|
File "${SRCDIR}\SharpFont.dll"
|
||||||
|
File "${SRCDIR}\SDL2-CS.dll"
|
||||||
|
File "${SRCDIR}\OpenAL-CS.dll"
|
||||||
|
File "${SRCDIR}\global mix database.dat"
|
||||||
|
File "${SRCDIR}\MaxMind.Db.dll"
|
||||||
|
File "${SRCDIR}\GeoLite2-Country.mmdb.gz"
|
||||||
|
File "${SRCDIR}\eluant.dll"
|
||||||
|
File "${SRCDIR}\SmarIrc4net.dll"
|
||||||
|
File "${SRCDIR}\rix0rrr.BeaconLib.dll"
|
||||||
|
File "${DEPSDIR}\soft_oal.dll"
|
||||||
|
File "${DEPSDIR}\SDL2.dll"
|
||||||
|
File "${DEPSDIR}\freetype6.dll"
|
||||||
|
File "${DEPSDIR}\lua51.dll"
|
||||||
|
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" $OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe "" \
|
||||||
|
"$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" ""
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
|
SetOutPath "$INSTDIR\lua"
|
||||||
|
File "${SRCDIR}\lua\*.lua"
|
||||||
|
|
||||||
|
SetOutPath "$INSTDIR\glsl"
|
||||||
|
File "${SRCDIR}\glsl\*.frag"
|
||||||
|
File "${SRCDIR}\glsl\*.vert"
|
||||||
|
|
||||||
|
; Estimated install size for the control panel properties
|
||||||
|
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||||
|
IntFmt $0 "0x%08X" $0
|
||||||
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "EstimatedSize" "$0"
|
||||||
|
|
||||||
|
SetShellVarContext all
|
||||||
|
CreateDirectory "$APPDATA\OpenRA\ModMetadata"
|
||||||
|
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --register-mod "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" system'
|
||||||
|
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --clear-invalid-mod-registrations system'
|
||||||
|
SetShellVarContext current
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Desktop Shortcut" DESKTOPSHORTCUT
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
CreateShortCut "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" $INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe "" \
|
||||||
|
"$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" ""
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
;***************************
|
||||||
|
;Dependency Sections
|
||||||
|
;***************************
|
||||||
|
Section "-DotNet" DotNet
|
||||||
|
ClearErrors
|
||||||
|
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" "Install"
|
||||||
|
IfErrors error 0
|
||||||
|
IntCmp $0 1 0 error 0
|
||||||
|
ClearErrors
|
||||||
|
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Install"
|
||||||
|
IfErrors error 0
|
||||||
|
IntCmp $0 1 done error done
|
||||||
|
error:
|
||||||
|
MessageBox MB_OK ".NET Framework v4.5 or later is required to run OpenRA."
|
||||||
|
Abort
|
||||||
|
done:
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
;***************************
|
||||||
|
;Uninstaller Sections
|
||||||
|
;***************************
|
||||||
|
Section "-Uninstaller"
|
||||||
|
WriteUninstaller $INSTDIR\uninstaller.exe
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayName" "${PACKAGING_DISPLAY_NAME}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\${MOD_ID}.ico"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "Publisher" "${PACKAGING_AUTHORS}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "URLInfoAbout" "${PACKAGING_WEBSITE_URL}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayVersion" "${TAG}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoModify" "1"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoRepair" "1"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
!macro Clean UN
|
||||||
|
Function ${UN}Clean
|
||||||
|
nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --unregister-mod system'
|
||||||
|
|
||||||
|
RMDir /r $INSTDIR\mods
|
||||||
|
RMDir /r $INSTDIR\maps
|
||||||
|
RMDir /r $INSTDIR\glsl
|
||||||
|
RMDir /r $INSTDIR\lua
|
||||||
|
Delete $INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe
|
||||||
|
Delete $INSTDIR\OpenRA.Game.exe
|
||||||
|
Delete $INSTDIR\OpenRA.Game.exe.config
|
||||||
|
Delete $INSTDIR\OpenRA.Utility.exe
|
||||||
|
Delete $INSTDIR\OpenRA.Server.exe
|
||||||
|
Delete $INSTDIR\OpenRA.Platforms.Default.dll
|
||||||
|
Delete $INSTDIR\ICSharpCode.SharpZipLib.dll
|
||||||
|
Delete $INSTDIR\FuzzyLogicLibrary.dll
|
||||||
|
Delete $INSTDIR\Open.Nat.dll
|
||||||
|
Delete $INSTDIR\SharpFont.dll
|
||||||
|
Delete $INSTDIR\VERSION
|
||||||
|
Delete $INSTDIR\AUTHORS
|
||||||
|
Delete $INSTDIR\COPYING
|
||||||
|
Delete $INSTDIR\${MOD_ID}.ico
|
||||||
|
Delete "$INSTDIR\global mix database.dat"
|
||||||
|
Delete $INSTDIR\MaxMind.Db.dll
|
||||||
|
Delete $INSTDIR\GeoLite2-Country.mmdb.gz
|
||||||
|
Delete $INSTDIR\KopiLua.dll
|
||||||
|
Delete $INSTDIR\soft_oal.dll
|
||||||
|
Delete $INSTDIR\SDL2.dll
|
||||||
|
Delete $INSTDIR\lua51.dll
|
||||||
|
Delete $INSTDIR\eluant.dll
|
||||||
|
Delete $INSTDIR\freetype6.dll
|
||||||
|
Delete $INSTDIR\SDL2-CS.dll
|
||||||
|
Delete $INSTDIR\OpenAL-CS.dll
|
||||||
|
Delete $INSTDIR\SmarIrc4net.dll
|
||||||
|
Delete $INSTDIR\rix0rrr.BeaconLib.dll
|
||||||
|
RMDir /r $INSTDIR\Support
|
||||||
|
|
||||||
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}"
|
||||||
|
DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}"
|
||||||
|
|
||||||
|
Delete $INSTDIR\uninstaller.exe
|
||||||
|
RMDir $INSTDIR
|
||||||
|
|
||||||
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||||
|
|
||||||
|
; Clean up start menu: Delete all our icons, and the OpenRA folder
|
||||||
|
; *only* if we were the only installed version
|
||||||
|
Delete "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk"
|
||||||
|
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||||
|
|
||||||
|
Delete "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk"
|
||||||
|
DeleteRegKey HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}"
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!insertmacro Clean ""
|
||||||
|
!insertmacro Clean "un."
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
Call un.Clean
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
;***************************
|
||||||
|
;Section Descriptions
|
||||||
|
;***************************
|
||||||
|
LangString DESC_GAME ${LANG_ENGLISH} "${PACKAGING_DISPLAY_NAME} game files."
|
||||||
|
LangString DESC_DESKTOPSHORTCUT ${LANG_ENGLISH} "Place shortcut on the Desktop."
|
||||||
|
|
||||||
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${GAME} $(DESC_GAME)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${DESKTOPSHORTCUT} $(DESC_DESKTOPSHORTCUT)
|
||||||
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
|
||||||
|
;***************************
|
||||||
|
;Callbacks
|
||||||
|
;***************************
|
||||||
|
|
||||||
|
Function .onInstFailed
|
||||||
|
Call Clean
|
||||||
|
FunctionEnd
|
||||||
78
packaging/windows/buildpackage.sh
Executable file
78
packaging/windows/buildpackage.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
|
||||||
|
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
||||||
|
|
||||||
|
if [ $# -ne "2" ]; then
|
||||||
|
echo "Usage: `basename $0` tag outputdir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||||
|
TEMPLATE_ROOT="${PACKAGING_DIR}/../../"
|
||||||
|
|
||||||
|
# shellcheck source=mod.config
|
||||||
|
. "${TEMPLATE_ROOT}/mod.config"
|
||||||
|
|
||||||
|
if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
||||||
|
# shellcheck source=user.config
|
||||||
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${INCLUDE_DEFAULT_MODS}" = "True" ]; then
|
||||||
|
echo "Cannot generate installers while INCLUDE_DEFAULT_MODS is enabled."
|
||||||
|
echo "Make sure that this setting is disabled in both your mod.config and user.config."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the working dir to the location of this script
|
||||||
|
cd "${PACKAGING_DIR}"
|
||||||
|
|
||||||
|
TAG="$1"
|
||||||
|
OUTPUTDIR="$2"
|
||||||
|
BUILTDIR="$(pwd)/build"
|
||||||
|
|
||||||
|
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe"
|
||||||
|
|
||||||
|
echo "Building core files"
|
||||||
|
|
||||||
|
pushd ${TEMPLATE_ROOT} > /dev/null
|
||||||
|
|
||||||
|
if [ ! -f "${ENGINE_DIRECTORY}/Makefile" ]; then
|
||||||
|
echo "Required engine files not found."
|
||||||
|
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make version VERSION="${TAG}"
|
||||||
|
|
||||||
|
pushd ${ENGINE_DIRECTORY} > /dev/null
|
||||||
|
SRC_DIR="$(pwd)"
|
||||||
|
make windows-dependencies
|
||||||
|
make core SDK="-sdk:4.5"
|
||||||
|
make install-engine gameinstalldir="" DESTDIR="${BUILTDIR}"
|
||||||
|
make install-common-mod-files gameinstalldir="" DESTDIR="${BUILTDIR}"
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Add mod files
|
||||||
|
cp -r "${TEMPLATE_ROOT}/mods/"* "${BUILTDIR}/mods"
|
||||||
|
cp "${MOD_ID}.ico" "${BUILTDIR}"
|
||||||
|
cp "${SRC_DIR}/OpenRA.Game.exe.config" "${BUILTDIR}"
|
||||||
|
|
||||||
|
echo "Compiling Windows launcher"
|
||||||
|
sed "s|DISPLAY_NAME|${PACKAGING_DISPLAY_NAME}|" "${SRC_DIR}/packaging/windows/WindowsLauncher.cs.in" | sed "s|MOD_ID|${MOD_ID}|" | sed "s|FAQ_URL|${PACKAGING_FAQ_URL}|" > "${BUILTDIR}/WindowsLauncher.cs"
|
||||||
|
mcs -sdk:4.5 "${BUILTDIR}/WindowsLauncher.cs" -warn:4 -codepage:utf8 -warnaserror -out:"${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" -t:winexe ${LAUNCHER_LIBS} -win32icon:"${MOD_ID}.ico"
|
||||||
|
rm "${BUILTDIR}/WindowsLauncher.cs"
|
||||||
|
mono "${SRC_DIR}/fixheader.exe" "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" > /dev/null
|
||||||
|
|
||||||
|
echo "Building Windows setup.exe"
|
||||||
|
makensis -V2 -DSRCDIR="${BUILTDIR}" -DDEPSDIR="${SRC_DIR}/thirdparty/download/windows" -DTAG="${TAG}" -DMOD_ID="${MOD_ID}" -DPACKAGING_WINDOWS_INSTALL_DIR_NAME="${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" -DPACKAGING_WINDOWS_LAUNCHER_NAME="${PACKAGING_WINDOWS_LAUNCHER_NAME}" -DPACKAGING_DISPLAY_NAME="${PACKAGING_DISPLAY_NAME}" -DPACKAGING_WEBSITE_URL="${PACKAGING_WEBSITE_URL}" -DPACKAGING_AUTHORS="${PACKAGING_AUTHORS}" -DPACKAGING_WINDOWS_REGISTRY_KEY="${PACKAGING_WINDOWS_REGISTRY_KEY}" buildpackage.nsi
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
mv OpenRA.Setup.exe "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-$TAG.exe"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm -rf "${BUILTDIR}"
|
||||||
BIN
packaging/windows/example.ico
Normal file
BIN
packaging/windows/example.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Loading…
Reference in New Issue
Block a user