Update scripts, packaging, and example mod for playtest-20201213.

This commit is contained in:
Paul Chote 2021-01-24 13:52:03 +00:00 committed by abcdefg30
parent 136e19de5d
commit 71bbf8c13c
27 changed files with 569 additions and 657 deletions

51
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Continuous Integration
on:
push:
pull_request:
jobs:
linux-mono:
name: Linux (mono)
runs-on: ubuntu-20.04
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
make check
make check-packaging-scripts
- name: Check Mod
run: |
sudo apt-get install lua5.1
make check-scripts
make test
windows:
name: Windows (Framework 4.7)
runs-on: windows-2019
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Check Code
shell: powershell
run: |
dotnet nuget locals all --clear
.\make.ps1 check
- name: Check Mods
run: |
chocolatey install lua --version 5.1.5.52
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
.\make.ps1 check-scripts
.\make.ps1 test

94
.github/workflows/packaging.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: Release Packaging
on:
push:
tags:
- '*'
jobs:
linux:
name: Linux AppImages
runs-on: ubuntu-20.04
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
- name: Package AppImage
run: |
make engine
mkdir -p build/linux
./packaging/linux/buildpackage.sh "${GIT_TAG}" "${PWD}/build/linux"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/linux/*
macos:
name: macOS Disk Images
runs-on: macos-10.15
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
- name: Package Disk Images
env:
MACOS_DEVELOPER_IDENTITY: ${{ secrets.MACOS_DEVELOPER_IDENTITY }}
MACOS_DEVELOPER_CERTIFICATE_BASE64: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_BASE64 }}
MACOS_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_PASSWORD }}
MACOS_DEVELOPER_USERNAME: ${{ secrets.MACOS_DEVELOPER_USERNAME }}
MACOS_DEVELOPER_PASSWORD: ${{ secrets.MACOS_DEVELOPER_PASSWORD }}
run: |
make engine
mkdir -p build/macos
./packaging/macos/buildpackage.sh "${GIT_TAG}" "${PWD}/build/macos"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/macos/*
windows:
name: Windows Installers
runs-on: ubuntu-20.04
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Prepare Environment
run: |
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
sudo apt-get update
sudo apt-get install nsis
- name: Package Installers
run: |
make engine
mkdir -p build/windows
./packaging/windows/buildpackage.sh "${GIT_TAG}" "${PWD}/build/windows"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/windows/*

View File

@ -1,51 +0,0 @@
# Travis-CI Build for OpenRAModSDK
# see travis-ci.org for details
language: csharp
mono: 6.4.0
jobs:
include:
- os: linux
dist: xenial
- os: osx
if: tag IS present
osx_image: xcode10
addons:
apt:
packages:
- dpkg
- liblua5.1-0
- imagemagick
script:
- make
- |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; travis_terminate 1);
if [ "${TRAVIS_TEST_MOD}" == "True" ]; then
make test || travis_terminate 1;
fi;
if [ "${TRAVIS_OS_NAME}" == "linux" ] && ( [ "${TRAVIS_TEST_PACKAGING}" == "True" ] || [ -n "${TRAVIS_TAG}" ] ); then
wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/n/nsis/nsis-common_3.04-1_all.deb || travis_terminate 1;
wget https://mirrors.edge.kernel.org/ubuntu/pool/universe/n/nsis/nsis_3.04-1_amd64.deb || travis_terminate 1;
sudo dpkg -i nsis-common_3.04-1_all.deb || travis_terminate 1;
sudo dpkg -i nsis_3.04-1_amd64.deb || travis_terminate 1;
fi
if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "${TRAVIS_TEST_PACKAGING}" == "True" ] && [ -z "${TRAVIS_TAG}" ]; then
make check-packaging-scripts && ./packaging/package-all.sh test-0 || travis_terminate 1;
fi
before_deploy:
- mkdir build
- make check-packaging-scripts && cd build && ../packaging/package-all.sh ${TRAVIS_TAG} ${PWD} && cd ..
deploy:
provider: releases
api_key: ${GH_DEPLOY_API_KEY}
file_glob: true
file: build/*
skip_cleanup: true
on:
tags: true

View File

@ -20,7 +20,7 @@
# make check-sdk-scripts # make check-sdk-scripts
# make check-packaging-scripts # make check-packaging-scripts
.PHONY: utility stylecheck build clean engine version check check-scripts check-sdk-scripts check-packaging-scripts check-variables .PHONY: check-sdk-scripts check-packaging-scripts check-variables engine all clean version check-scripts check test
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
PYTHON = $(shell command -v python3 2> /dev/null) PYTHON = $(shell command -v python3 2> /dev/null)
@ -48,8 +48,19 @@ MOD_SOLUTION_FILES = $(shell find . -maxdepth 1 -iname '*.sln' 2> /dev/null)
MSBUILD = msbuild -verbosity:m -nologo MSBUILD = msbuild -verbosity:m -nologo
# Enable 32 bit builds while generating the windows installer ifndef TARGETPLATFORM
WIN32 = false UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Darwin)
TARGETPLATFORM = osx-x64
else
ifeq ($(UNAME_M),x86_64)
TARGETPLATFORM = linux-x64
else
TARGETPLATFORM = unix-generic
endif
endif
endif
check-sdk-scripts: check-sdk-scripts:
@awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n"; exit 1) @awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n"; exit 1)
@ -110,43 +121,25 @@ check-variables:
exit 1; \ exit 1; \
fi fi
engine-dependencies: check-variables check-sdk-scripts
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make dependencies WIN32=$(WIN32)
engine: check-variables check-sdk-scripts engine: check-variables check-sdk-scripts
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1) @./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make core WIN32=$(WIN32) @cd $(ENGINE_DIRECTORY) && make TARGETPLATFORM=$(TARGETPLATFORM) all
utility: engine-dependencies engine all: engine
@test -f "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" || (printf "OpenRA.Utility.exe not found!\n"; exit 1) @command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
core:
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","") ifneq ("$(MOD_SOLUTION_FILES)","")
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:restore \; @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Release -p:TargetPlatform=$(TARGETPLATFORM) \;
ifeq ($(WIN32), $(filter $(WIN32),true yes y on 1))
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration="Release-x86" \;
else
@$(MSBUILD) -t:build -p:Configuration=Release
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration=Release \;
endif endif
endif
all: engine-dependencies engine core
clean: engine clean: engine
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1) @command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","") ifneq ("$(MOD_SOLUTION_FILES)","")
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \; @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \;
endif endif
@cd $(ENGINE_DIRECTORY) && make clean @cd $(ENGINE_DIRECTORY) && make clean
@printf "The engine has been cleaned.\n"
version: check-variables version: check-variables
@awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $(MANIFEST_PATH) > $(MANIFEST_PATH).tmp && \ @sh -c '. $(ENGINE_DIRECTORY)/packaging/functions.sh; set_mod_version $(VERSION) $(MANIFEST_PATH)'
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $(MANIFEST_PATH).tmp > $(MANIFEST_PATH) && \
rm $(MANIFEST_PATH).tmp
@printf "Version changed to $(VERSION).\n" @printf "Version changed to $(VERSION).\n"
check-scripts: check-variables check-scripts: check-variables
@ -159,18 +152,18 @@ ifneq ("$(LUA_FILES)","")
@luac -p $(LUA_FILES) @luac -p $(LUA_FILES)
endif endif
check: utility check: engine
ifneq ("$(MOD_SOLUTION_FILES)","") ifneq ("$(MOD_SOLUTION_FILES)","")
@echo "Compiling in debug mode..." @echo "Compiling in debug mode..."
@$(MSBUILD) -t:build -p:Configuration=Debug @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Debug -p:TargetPlatform=$(TARGETPLATFORM) \;
endif endif
@echo "Checking runtime assemblies..." @echo "Checking runtime assemblies..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES) @./utility.sh --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
@echo "Checking for explicit interface violations..." @echo "Checking for explicit interface violations..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-explicit-interfaces @./utility.sh --check-explicit-interfaces
@echo "Checking for incorrect conditional trait interface overrides..." @echo "Checking for incorrect conditional trait interface overrides..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-conditional-trait-interface-overrides @./utility.sh --check-conditional-trait-interface-overrides
test: utility test: all
@echo "Testing $(MOD_ID) mod MiniYAML..." @echo "Testing $(MOD_ID) mod MiniYAML..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-yaml @./utility.sh --check-yaml

View File

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net461</TargetFramework> <TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<LangVersion>5</LangVersion> <LangVersion>7.3</LangVersion>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<OutputPath>../mods/example</OutputPath> <OutputPath>../engine/bin</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
@ -21,10 +21,6 @@
<Optimize>false</Optimize> <Optimize>false</Optimize>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Eluant">
<HintPath>../engine/thirdparty/download/Eluant.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="../engine/OpenRA.Game/OpenRA.Game.csproj"> <ProjectReference Include="../engine/OpenRA.Game/OpenRA.Game.csproj">
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
@ -32,6 +28,7 @@
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" /> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<AdditionalFiles Include="../engine/stylecop.json" /> <AdditionalFiles Include="../engine/stylecop.json" />
</ItemGroup> </ItemGroup>
<Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'"> <Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'">

View File

@ -28,12 +28,12 @@ if "!MOD_ID!" == "" goto badconfig
if "!ENGINE_VERSION!" == "" goto badconfig if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY% cd %ENGINE_DIRECTORY%
:loop :loop
OpenRA.Server.exe Game.Mod=%MOD_ID% Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Engine.SupportDir=%SupportDir% bin\OpenRA.Server.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Engine.SupportDir=%SupportDir%
goto loop goto loop
:noengine :noengine

View File

@ -66,7 +66,7 @@ fi
cd "${ENGINE_DIRECTORY}" cd "${ENGINE_DIRECTORY}"
while true; do while true; do
MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug OpenRA.Server.exe Game.Mod="${LAUNCH_MOD}" \ MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug bin/OpenRA.Server.exe Engine.EngineDir=".." Game.Mod="${LAUNCH_MOD}" \
Server.Name="${NAME}" Server.ListenPort="${LISTEN_PORT}" \ Server.Name="${NAME}" Server.ListenPort="${LISTEN_PORT}" \
Server.AdvertiseOnline="${ADVERTISE_ONLINE}" \ Server.AdvertiseOnline="${ADVERTISE_ONLINE}" \
Server.Password="${PASSWORD}" \ Server.Password="${PASSWORD}" \

View File

@ -12,11 +12,11 @@ if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig
set TEMPLATE_DIR=%CD% set TEMPLATE_DIR=%CD%
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY% cd %ENGINE_DIRECTORY%
OpenRA.Game.exe Game.Mod=%MOD_ID% Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*" bin\OpenRA.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*"
set ERROR=%errorlevel% set ERROR=%errorlevel%
cd %TEMPLATE_DIR% cd %TEMPLATE_DIR%

View File

@ -36,11 +36,11 @@ fi
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
cd "${TEMPLATE_ROOT}" cd "${TEMPLATE_ROOT}"
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
echo "Required engine files not found." echo "Required engine files not found."
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
exit 1 exit 1
fi fi
cd "${ENGINE_DIRECTORY}" cd "${ENGINE_DIRECTORY}"
mono OpenRA.Game.exe Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@" mono --debug bin/OpenRA.exe Engine.EngineDir=".." Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@"

View File

@ -39,27 +39,9 @@ function Clean-Command
} }
dotnet clean /nologo dotnet clean /nologo
rm *.dll Remove-Item ./*/obj -Recurse -ErrorAction Ignore
rm mods/*/*.dll Remove-Item env:ENGINE_DIRECTORY/bin -Recurse -ErrorAction Ignore
rm *.dll.config Remove-Item env:ENGINE_DIRECTORY/*/obj -Recurse -ErrorAction Ignore
rm *.pdb
rm mods/*/*.pdb
rm *.exe
rm ./*/bin -r
rm ./*/obj -r
rm $env:ENGINE_DIRECTORY/*.dll
rm $env:ENGINE_DIRECTORY/mods/*/*.dll
rm env:ENGINE_DIRECTORY/*.config
rm env:ENGINE_DIRECTORY/*.pdb
rm mods/*/*.pdb
rm env:ENGINE_DIRECTORY/*.exe
rm env:ENGINE_DIRECTORY/*/bin -r
rm env:ENGINE_DIRECTORY/*/obj -r
if (Test-Path env:ENGINE_DIRECTORY/thirdparty/download/)
{
rmdir env:ENGINE_DIRECTORY/thirdparty/download -Recurse -Force
}
Write-Host "Clean complete." -ForegroundColor Green Write-Host "Clean complete." -ForegroundColor Green
} }
@ -117,7 +99,7 @@ function Test-Command
} }
Write-Host "Testing $modID mod MiniYAML..." -ForegroundColor Cyan Write-Host "Testing $modID mod MiniYAML..." -ForegroundColor Cyan
Invoke-Expression "$utilityPath $modID --check-yaml" InvokeCommand "$utilityPath $modID --check-yaml"
} }
function Check-Command function Check-Command
@ -137,11 +119,14 @@ function Check-Command
if ((CheckForUtility) -eq 0) if ((CheckForUtility) -eq 0)
{ {
Write-Host "Checking runtime assemblies..." -ForegroundColor Cyan
InvokeCommand "$utilityPath $modID --check-runtime-assemblies $env:WHITELISTED_OPENRA_ASSEMBLIES $env:WHITELISTED_THIRDPARTY_ASSEMBLIES $env:WHITELISTED_CORE_ASSEMBLIES $env:WHITELISTED_MOD_ASSEMBLIES"
Write-Host "Checking for explicit interface violations..." -ForegroundColor Cyan Write-Host "Checking for explicit interface violations..." -ForegroundColor Cyan
Invoke-Expression "$utilityPath $modID --check-explicit-interfaces" InvokeCommand "$utilityPath $modID --check-explicit-interfaces"
Write-Host "Checking for incorrect conditional trait interface overrides..." -ForegroundColor Cyan Write-Host "Checking for incorrect conditional trait interface overrides..." -ForegroundColor Cyan
Invoke-Expression "$utilityPath $modID --check-conditional-trait-interface-overrides" InvokeCommand "$utilityPath $modID --check-conditional-trait-interface-overrides"
} }
} }
@ -170,9 +155,9 @@ function Docs-Command
} }
./make.ps1 version ./make.ps1 version
Invoke-Expression "$utilityPath $modID --docs | Out-File -Encoding 'UTF8' DOCUMENTATION.md" InvokeCommand "$utilityPath $modID --docs | Out-File -Encoding 'UTF8' DOCUMENTATION.md"
Invoke-Expression "$utilityPath $modID --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md" InvokeCommand "$utilityPath $modID --weapon-docs | Out-File -Encoding "UTF8" WEAPONS.md"
Invoke-Expression "$utilityPath $modID --lua-docs | Out-File -Encoding 'UTF8' Lua-API.md" InvokeCommand "$utilityPath $modID --lua-docs | Out-File -Encoding 'UTF8' Lua-API.md"
echo "Docs generated." -ForegroundColor Green echo "Docs generated." -ForegroundColor Green
} }
@ -223,7 +208,9 @@ function ReadConfigLine($line, $name)
function ParseConfigFile($fileName) function ParseConfigFile($fileName)
{ {
$names = @("MOD_ID", "ENGINE_VERSION", "AUTOMATIC_ENGINE_MANAGEMENT", "AUTOMATIC_ENGINE_SOURCE", $names = @("MOD_ID", "ENGINE_VERSION", "AUTOMATIC_ENGINE_MANAGEMENT", "AUTOMATIC_ENGINE_SOURCE",
"AUTOMATIC_ENGINE_EXTRACT_DIRECTORY", "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME", "ENGINE_DIRECTORY") "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY", "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME", "ENGINE_DIRECTORY",
"WHITELISTED_OPENRA_ASSEMBLIES", "WHITELISTED_THIRDPARTY_ASSEMBLIES", "WHITELISTED_CORE_ASSEMBLIES",
"WHITELISTED_MOD_ASSEMBLIES")
$reader = [System.IO.File]::OpenText($fileName) $reader = [System.IO.File]::OpenText($fileName)
while($null -ne ($line = $reader.ReadLine())) while($null -ne ($line = $reader.ReadLine()))
@ -257,6 +244,20 @@ function ParseConfigFile($fileName)
} }
} }
function InvokeCommand
{
param($expression)
# $? is the return value of the called expression
# Invoke-Expression itself will always succeed, even if the invoked expression fails
# So temporarily store the return value in $success
$expression += '; $success = $?'
Invoke-Expression $expression
if ($success -eq $False)
{
exit 1
}
}
############################################################### ###############################################################
############################ Main ############################# ############################ Main #############################
############################################################### ###############################################################
@ -304,9 +305,10 @@ if (Test-Path "user.config")
$modID = $env:MOD_ID $modID = $env:MOD_ID
$env:MOD_SEARCH_PATHS = (Get-Item -Path ".\" -Verbose).FullName + "\mods,./mods" $env:MOD_SEARCH_PATHS = (Get-Item -Path ".\" -Verbose).FullName + "\mods,./mods"
$env:ENGINE_DIR = ".."
# Run the same command on the engine's make file # Fetch the engine if required
if ($command -eq "all" -or $command -eq "clean") if ($command -eq "all" -or $command -eq "clean" -or $command -eq "check")
{ {
$versionFile = $env:ENGINE_DIRECTORY + "/VERSION" $versionFile = $env:ENGINE_DIRECTORY + "/VERSION"
$currentEngine = "" $currentEngine = ""
@ -384,8 +386,7 @@ if ($command -eq "all" -or $command -eq "clean")
} }
} }
$utilityPath = $env:ENGINE_DIRECTORY + "/OpenRA.Utility.exe" $utilityPath = $env:ENGINE_DIRECTORY + "/bin/OpenRA.Utility.exe"
$styleCheckPath = $env:ENGINE_DIRECTORY + "/OpenRA.StyleCheck.exe"
$execute = $command $execute = $command
if ($command.Length -gt 1) if ($command.Length -gt 1)

View File

@ -9,26 +9,11 @@
MOD_ID="example" MOD_ID="example"
# The OpenRA engine version to use for this project. # The OpenRA engine version to use for this project.
ENGINE_VERSION="release-20200503" ENGINE_VERSION="playtest-20201213"
# .dll filenames compiled by the mod solution for use by the runtime assembly check # .dll filenames compiled by the mod solution for use by the runtime assembly check
WHITELISTED_MOD_ASSEMBLIES="OpenRA.Mods.Example.dll" WHITELISTED_MOD_ASSEMBLIES="OpenRA.Mods.Example.dll"
##############################################################################
# Continuous Integration
#
# Settings controlling the behaviour of Travis CI
# (if it has been enabled on your GitHub repository)
##############################################################################
# Enable tests for common errors when a new commit is pushed to the GitHub repository
# Accepts values "True" or "False".
TRAVIS_TEST_MOD="True"
# Perform a dry run of the installer generation when a new commit is pushed to the GitHub repository
# Accepts values "True" or "False".
TRAVIS_TEST_PACKAGING="False"
############################################################################## ##############################################################################
# Packaging # Packaging
# #
@ -68,8 +53,27 @@ PACKAGING_FAQ_URL="http://wiki.openra.net/FAQ"
# - Windows "Add/Remove Programs" list # - Windows "Add/Remove Programs" list
PACKAGING_AUTHORS="Example Mod authors" PACKAGING_AUTHORS="Example Mod authors"
# Space delimited list of dll files compiled by the mod, which
# should be copied from the bin directory into your installers
PACKAGING_COPY_MOD_BINARIES="OpenRA.Mods.Example.dll"
# If your mod depends on OpenRA.Mods.Cnc.dll from the engine set
# this to "True" to package the dll in your installers.
# Accepts values "True" or "False".
PACKAGING_COPY_CNC_DLL="False"
# If your mod depends on OpenRA.Mods.D2k.dll from the engine set
# this to "True" to package the dll in your installers.
# Accepts values "True" or "False".
PACKAGING_COPY_D2K_DLL="False"
# If you wish to enable Discord integration, register an
# application at https://discord.com/developers/applications
# and define the client id here and in your mod.yaml
PACKAGING_DISCORD_APPID=""
# The git tag to use for the macOS Launcher files. # The git tag to use for the macOS Launcher files.
PACKAGING_OSX_LAUNCHER_TAG="osx-launcher-20200316" PACKAGING_OSX_MONO_TAG="osx-launcher-20200830"
# The macOS disk image icon positions, matched to the background artwork # The macOS disk image icon positions, matched to the background artwork
PACKAGING_OSX_DMG_MOD_ICON_POSITION="190, 210" PACKAGING_OSX_DMG_MOD_ICON_POSITION="190, 210"
@ -90,10 +94,10 @@ PACKAGING_WINDOWS_REGISTRY_KEY="OpenRAExampleMod"
PACKAGING_WINDOWS_LICENSE_FILE="./COPYING" PACKAGING_WINDOWS_LICENSE_FILE="./COPYING"
# The git tag to use for the AppImage dependencies. # The git tag to use for the AppImage dependencies.
PACKAGING_APPIMAGE_DEPENDENCIES_TAG="20200222" PACKAGING_APPIMAGE_DEPENDENCIES_TAG="20200328"
# Space delimited list of additional files/directories to copy from the engine directory # Space delimited list of additional files/directories to copy from the engine directory
# when packaging your mod. e.g. "./mods/modcontent" or "./mods/d2k/OpenRA.Mods.D2k.dll" # when packaging your mod. e.g. "./mods/modcontent"
PACKAGING_COPY_ENGINE_FILES="" PACKAGING_COPY_ENGINE_FILES=""
# Overwrite the version in mod.yaml with the tag used for the SDK release # Overwrite the version in mod.yaml with the tag used for the SDK release
@ -119,25 +123,24 @@ 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. # The url to download the OpenRA macOS mono runtime.
PACKAGING_OSX_LAUNCHER_SOURCE="https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${PACKAGING_OSX_LAUNCHER_TAG}/launcher.zip" PACKAGING_OSX_MONO_SOURCE="https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${PACKAGING_OSX_MONO_TAG}/mono.zip"
# Temporary file name used when downloading the OpenRA macOS launcher files. # Temporary file name used when downloading the OpenRA macOS launcher files.
PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME="launcher.zip" PACKAGING_OSX_MONO_TEMP_ARCHIVE_NAME="mono.zip"
# The url to download the OpenRA AppImage dependencies. # The url to download the OpenRA AppImage dependencies.
PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE="https://github.com/OpenRA/AppImageSupport/releases/download/${PACKAGING_APPIMAGE_DEPENDENCIES_TAG}/libs.tar.bz2" PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE="https://github.com/OpenRA/AppImageSupport/releases/download/${PACKAGING_APPIMAGE_DEPENDENCIES_TAG}/mono.tar.bz2"
# Temporary file name used when downloading the OpenRA AppImage dependencies. # Temporary file name used when downloading the OpenRA AppImage dependencies.
PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME="libs.tar.bz2" PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME="mono.tar.bz2"
# List of .NET assemblies that we can guarantee exist # List of .NET assemblies that we can guarantee exist
# OpenRA.Game.dll is a harmless false positive that we can ignore WHITELISTED_OPENRA_ASSEMBLIES="OpenRA.exe OpenRA.Utility.exe OpenRA.Server.exe OpenRA.Platforms.Default.dll OpenRA.Game.dll OpenRA.Mods.Common.dll OpenRA.Mods.Cnc.dll OpenRA.Mods.D2k.dll"
WHITELISTED_OPENRA_ASSEMBLIES="OpenRA.Game.exe OpenRA.Utility.exe OpenRA.Platforms.Default.dll OpenRA.Mods.Common.dll OpenRA.Game.dll"
# These are explicitly shipped alongside our core files by the packaging script # These are explicitly shipped alongside our core files by the packaging script
WHITELISTED_THIRDPARTY_ASSEMBLIES="ICSharpCode.SharpZipLib.dll FuzzyLogicLibrary.dll MaxMind.Db.dll Eluant.dll rix0rrr.BeaconLib.dll Open.Nat.dll SDL2-CS.dll OpenAL-CS.dll" WHITELISTED_THIRDPARTY_ASSEMBLIES="ICSharpCode.SharpZipLib.dll FuzzyLogicLibrary.dll Eluant.dll BeaconLib.dll Open.Nat.dll SDL2-CS.dll OpenAL-CS.Core.dll DiscordRPC.dll Newtonsoft.Json.dll"
# These are shipped in our custom minimal mono runtime and also available in the full system-installed .NET/mono stack # These are shipped in our custom minimal mono runtime and also available in the full system-installed .NET/mono stack
# This list *must* be kept in sync with the files packaged by the AppImageSupport and OpenRALauncherOSX repositories # This list *must* be kept in sync with the files packaged by the AppImageSupport and OpenRALauncherOSX repositories
WHITELISTED_CORE_ASSEMBLIES="mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll" WHITELISTED_CORE_ASSEMBLIES="mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll netstandard.dll"

View File

@ -6,3 +6,4 @@ Speech:
Sounds: Sounds:
DefaultVariant: .wav DefaultVariant: .wav
Notifications: Notifications:
ClickSound:

View File

@ -3,9 +3,9 @@ Metadata:
Version: {DEV_VERSION} Version: {DEV_VERSION}
Packages: Packages:
. ^EngineDir
$example: example $example: example
./mods/common: common ^EngineDir|mods/common: common
example|bits example|bits
MapFolders: MapFolders:
@ -24,8 +24,8 @@ Chrome:
example|chrome.yaml example|chrome.yaml
Assemblies: Assemblies:
common|OpenRA.Mods.Common.dll ^BinDir|OpenRA.Mods.Common.dll
example|OpenRA.Mods.Example.dll ^BinDir|OpenRA.Mods.Example.dll
ChromeLayout: ChromeLayout:
example|mainmenu.yaml example|mainmenu.yaml

View File

@ -13,14 +13,14 @@ require_variables() {
eval check="\$$i" eval check="\$$i"
[ -z "${check}" ] && missing="${missing} ${i}\n" [ -z "${check}" ] && missing="${missing} ${i}\n"
done done
if [ ! -z "${missing}" ]; then if [ -n "${missing}" ]; then
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}"
exit 1 exit 1
fi fi
} }
if [ $# -eq "0" ]; then if [ $# -eq "0" ]; then
echo "Usage: `basename $0` version [outputdir]" echo "Usage: $(basename "$0") version [outputdir]"
exit 1 exit 1
fi fi
@ -36,7 +36,7 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
. "${TEMPLATE_ROOT}/user.config" . "${TEMPLATE_ROOT}/user.config"
fi fi
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \ require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \
"PACKAGING_APPIMAGE_DEPENDENCIES_TAG" "PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE" "PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME" \ "PACKAGING_APPIMAGE_DEPENDENCIES_TAG" "PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE" "PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME" \
"PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION" "PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION"
@ -47,59 +47,53 @@ else
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))") OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))")
fi fi
BUILTDIR="${PACKAGING_DIR}/${PACKAGING_INSTALLER_NAME}.appdir" APPDIR="${PACKAGING_DIR}/${PACKAGING_INSTALLER_NAME}.appdir"
# Set the working dir to the location of this script # Set the working dir to the location of this script
cd "${PACKAGING_DIR}" cd "${PACKAGING_DIR}"
pushd "${TEMPLATE_ROOT}" > /dev/null if [ ! -f "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/Makefile" ]; then
if [ ! -f "${ENGINE_DIRECTORY}/Makefile" ]; then
echo "Required engine files not found." echo "Required engine files not found."
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
exit 1 exit 1
fi fi
. "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh"
if [ ! -d "${OUTPUTDIR}" ]; then if [ ! -d "${OUTPUTDIR}" ]; then
echo "Output directory '${OUTPUTDIR}' does not exist."; echo "Output directory '${OUTPUTDIR}' does not exist.";
exit 1 exit 1
fi fi
echo "Building core files" echo "Building core files"
install_assemblies_mono "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${APPDIR}/usr/lib/openra" "linux-x64" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}"
MOD_VERSION=$(grep 'Version:' mods/${MOD_ID}/mod.yaml | awk '{print $2}') install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${APPDIR}/usr/lib/openra"
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then
make version VERSION="${TAG}"
else
echo "Mod version ${MOD_VERSION} will remain unchanged.";
fi
pushd "${ENGINE_DIRECTORY}" > /dev/null
make clean
# linux-dependencies target will trigger the lua detection script, which we don't want during packaging
make cli-dependencies
sed "s/@LIBLUA51@/liblua5.1.so.0/" thirdparty/Eluant.dll.config.in > Eluant.dll.config
make core
make version VERSION="${ENGINE_VERSION}"
make install-engine prefix="usr" DESTDIR="${BUILTDIR}/"
make install-common-mod-files prefix="usr" DESTDIR="${BUILTDIR}/"
for f in ${PACKAGING_COPY_ENGINE_FILES}; do for f in ${PACKAGING_COPY_ENGINE_FILES}; do
mkdir -p "${BUILTDIR}/usr/lib/openra/$(dirname "${f}")" mkdir -p "${APPDIR}/usr/lib/openra/$(dirname "${f}")"
cp -r "${f}" "${BUILTDIR}/usr/lib/openra/${f}" cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${APPDIR}/usr/lib/openra/${f}"
done done
popd > /dev/null
echo "Building mod files" echo "Building mod files"
make core pushd "${TEMPLATE_ROOT}" > /dev/null
cp -Lr mods/* "${BUILTDIR}/usr/lib/openra/mods" make all
popd > /dev/null popd > /dev/null
cp -Lr "${TEMPLATE_ROOT}/mods/"* "${APPDIR}/usr/lib/openra/mods"
for f in ${PACKAGING_COPY_MOD_BINARIES}; do
mkdir -p "${APPDIR}/usr/lib/openra/$(dirname "${f}")"
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/bin/${f}" "${APPDIR}/usr/lib/openra/${f}"
done
set_engine_version "${ENGINE_VERSION}" "${APPDIR}/usr/lib/openra"
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then
set_mod_version "${TAG}" "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml"
else
MOD_VERSION=$(grep 'Version:' "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml" | awk '{print $2}')
echo "Mod version ${MOD_VERSION} will remain unchanged.";
fi
# Add native libraries # Add native libraries
echo "Downloading dependencies" echo "Downloading dependencies"
if command -v curl >/dev/null 2>&1; then if command -v curl >/dev/null 2>&1; then
@ -110,63 +104,68 @@ else
wget -cq https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 wget -cq https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3
fi fi
tar xf "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}"
chmod a+x appimagetool-x86_64.AppImage
echo "Building AppImage" echo "Building AppImage"
install -d "${BUILTDIR}/usr/bin" tar xf "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" -C "${APPDIR}"
install -d "${BUILTDIR}/etc/mono/4.5" chmod 0755 "${APPDIR}/usr/bin/mono"
install -d "${BUILTDIR}/usr/lib/mono/4.5" chmod 0644 "${APPDIR}/etc/mono/config"
chmod 0644 "${APPDIR}/etc/mono/4.5/machine.config"
chmod 0644 "${APPDIR}/usr/lib/mono/4.5/Facades/"*.dll
chmod 0644 "${APPDIR}/usr/lib/mono/4.5/"*.dll "${APPDIR}/usr/lib/mono/4.5/"*.exe
chmod 0755 "${APPDIR}/usr/lib/"*.so
install -Dm 0755 usr/bin/mono "${BUILTDIR}/usr/bin/" rm -rf "${PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE}"
install -Dm 0644 /etc/mono/config "${BUILTDIR}/etc/mono/"
install -Dm 0644 /etc/mono/4.5/machine.config "${BUILTDIR}/etc/mono/4.5"
for f in $(ls usr/lib/mono/4.5/*.dll usr/lib/mono/4.5/*.exe); do install -Dm 0644 "$f" "${BUILTDIR}/usr/lib/mono/4.5/"; done
for f in $(ls usr/lib/*.so usr/lib/*.so.*); do install -Dm 0755 "$f" "${BUILTDIR}/usr/lib/"; done
rm -rf libs libs.tar.bz2
# Add launcher and icons # Add launcher and icons
sed "s/{MODID}/${MOD_ID}/g" include/AppRun.in | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" > AppRun.temp sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/AppRun.in" | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" > "${APPDIR}/AppRun"
install -m 0755 AppRun.temp "${BUILTDIR}/AppRun" chmod 0755 "${APPDIR}/AppRun"
sed "s/{MODID}/${MOD_ID}/g" include/mod.desktop.in | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{TAG}/${TAG}/g" > temp.desktop if [ -n "${PACKAGING_DISCORD_APPID}" ]; then
install -Dm 0755 temp.desktop "${BUILTDIR}/usr/share/applications/openra-${MOD_ID}.desktop" sed "s/{DISCORDAPPID}/${PACKAGING_DISCORD_APPID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.desktop.discord.in" > temp.desktop.in
install -m 0755 temp.desktop "${BUILTDIR}/openra-${MOD_ID}.desktop" sed "s/{DISCORDAPPID}/${PACKAGING_DISCORD_APPID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-mimeinfo.xml.discord.in" > temp.xml.in
else
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.desktop.in" temp.desktop.in
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-mimeinfo.xml.in" temp.xml.in
fi
sed "s/{MODID}/${MOD_ID}/g" include/mod-mimeinfo.xml.in | sed "s/{TAG}/${TAG}/g" > temp.xml mkdir -p "${APPDIR}/usr/share/applications"
install -Dm 0755 temp.xml "${BUILTDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml" chmod 0755 temp.desktop.in
sed "s/{MODID}/${MOD_ID}/g" temp.desktop.in | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{TAG}/${TAG}/g" > "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop"
cp "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop" "${APPDIR}/openra-${MOD_ID}.desktop"
rm temp.desktop.in
if [ -f "${PACKAGING_DIR}/mod_scalable.svg" ]; then mkdir -p "${APPDIR}/usr/share/mime/packages"
install -Dm644 "${PACKAGING_DIR}/mod_scalable.svg" "${BUILTDIR}/usr/share/icons/hicolor/scalable/apps/openra-${MOD_ID}.svg" chmod 0644 temp.xml.in
sed "s/{MODID}/${MOD_ID}/g" temp.xml.in | sed "s/{TAG}/${TAG}/g" > "${APPDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml"
rm temp.xml.in
if [ -f "${ARTWORK_DIR}/icon_scalable.svg" ]; then
install -Dm644 "${ARTWORK_DIR}/icon_scalable.svg" "${APPDIR}/usr/share/icons/hicolor/scalable/apps/openra-${MOD_ID}.svg"
fi fi
for i in 16x16 32x32 48x48 64x64 128x128 256x256 512x512 1024x1024; do for i in 16x16 32x32 48x48 64x64 128x128 256x256 512x512 1024x1024; do
if [ -f "${ARTWORK_DIR}/icon_${i}.png" ]; then if [ -f "${ARTWORK_DIR}/icon_${i}.png" ]; then
install -Dm644 "${ARTWORK_DIR}/icon_${i}.png" "${BUILTDIR}/usr/share/icons/hicolor/${i}/apps/openra-${MOD_ID}.png" install -Dm644 "${ARTWORK_DIR}/icon_${i}.png" "${APPDIR}/usr/share/icons/hicolor/${i}/apps/openra-${MOD_ID}.png"
install -m644 "${ARTWORK_DIR}/icon_${i}.png" "${BUILTDIR}/openra-${MOD_ID}.png" install -m644 "${ARTWORK_DIR}/icon_${i}.png" "${APPDIR}/openra-${MOD_ID}.png"
fi fi
done done
install -d "${BUILTDIR}/usr/bin" install -d "${APPDIR}/usr/bin"
sed "s/{MODID}/${MOD_ID}/g" include/mod.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{MODINSTALLERNAME}/${PACKAGING_INSTALLER_NAME}/g" | sed "s|{MODFAQURL}|${PACKAGING_FAQ_URL}|g" > openra-mod.temp sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.appimage.in" | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{MODINSTALLERNAME}/${PACKAGING_INSTALLER_NAME}/g" | sed "s|{MODFAQURL}|${PACKAGING_FAQ_URL}|g" > "${APPDIR}/usr/bin/openra-${MOD_ID}"
install -m 0755 openra-mod.temp "${BUILTDIR}/usr/bin/openra-${MOD_ID}" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}"
sed "s/{MODID}/${MOD_ID}/g" include/mod-server.in > openra-mod-server.temp sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-server.appimage.in" > "${APPDIR}/usr/bin/openra-${MOD_ID}-server"
install -m 0755 openra-mod-server.temp "${BUILTDIR}/usr/bin/openra-${MOD_ID}-server" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-server"
sed "s/{MODID}/${MOD_ID}/g" include/mod-utility.in > openra-mod-utility.temp sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-utility.appimage.in" > "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
install -m 0755 openra-mod-utility.temp "${BUILTDIR}/usr/bin/openra-${MOD_ID}-utility" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
install -m 0755 include/gtk-dialog.py "${BUILTDIR}/usr/bin/gtk-dialog.py" install -m 0755 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/gtk-dialog.py" "${APPDIR}/usr/bin/gtk-dialog.py"
install -m 0755 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/restore-environment.sh" "${APPDIR}/usr/bin/restore-environment.sh"
# travis-ci doesn't support mounting FUSE filesystems so extract and run the contents manually chmod a+x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --appimage-extract ARCH=x86_64 ./appimagetool-x86_64.AppImage "${APPDIR}" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-x86_64.AppImage"
ARCH=x86_64 ./squashfs-root/AppRun "${BUILTDIR}" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-x86_64.AppImage"
# Clean up # Clean up
rm -rf openra-mod.temp openra-mod-server.temp openra-mod-utility.temp temp.desktop temp.xml AppRun.temp appimagetool-x86_64.AppImage squashfs-root "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" "${BUILTDIR}" rm -rf appimagetool-x86_64.AppImage "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" "${APPDIR}"

View File

@ -1,34 +0,0 @@
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
# Override runtime paths
export PATH="${HERE}/usr/bin:${PATH}"
export XDG_DATA_DIRS="${HERE}/usr/share:${XDG_DATA_DIRS}"
export DYLD_LIBRARY_PATH="${HERE}/usr/lib:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${HERE}/usr/lib:$LD_LIBRARY_PATH"
export MONO_PATH="${HERE}/usr/lib/mono/4.5"
export MONO_CFG_DIR="${HERE}/etc"
export MONO_CONFIG="${HERE}/etc/mono/config"
# Update/create the mono certificate store to enable https web queries
if [ -f "/etc/pki/tls/certs/ca-bundle.crt" ]; then
mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/pki/tls/certs/ca-bundle.crt
elif [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/ssl/certs/ca-certificates.crt
else
echo "WARNING: Unable to sync system certificate store - https requests will fail"
fi
# Run the game or server
if [ -n "$1" ] && [ "$1" = "--server" ]; then
# Drop the --server argument
shift
exec "openra-{MODID}-server" "$@"
elif [ -n "$1" ] && [ "$1" = "--utility" ]; then
# Drop the --utility argument
shift
exec "openra-{MODID}-utility" "$@"
else
exec "openra-{MODID}" "$@"
fi

View File

@ -1,48 +0,0 @@
#!/usr/bin/python
"""A simple GTK3 graphical dialog helper that can be used as a fallback if zenity is not available
Compatible with python 2 or 3 with the gi bindings.
Three modes are available:
test: accepts no arguments, returns 0 if the python dependencies are available, or 1 if not
error: show a gtk-3 error dialog
accepts arguments --title and --text
question: show a gtk-3 question dialog
accepts arguments --title and --text
returns 0 on Yes, or 1 on No
"""
import sys
try:
import argparse
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
except ImportError:
sys.exit(1)
class Error():
def __init__(self, title, text):
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, title)
dialog.format_secondary_text(text)
dialog.run()
dialog.destroy()
class Question():
def __init__(self, title, text):
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, title)
dialog.format_secondary_text(text)
response = dialog.run()
dialog.destroy()
sys.exit(0 if response == Gtk.ResponseType.YES else 1)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('type', choices=['error', 'question', 'test'])
parser.add_argument('--title', type=str, required=False, default='')
parser.add_argument('--text', type=str, required=False, default='')
args = parser.parse_args()
if args.type == 'question':
Question(args.title, args.text.replace('\\n', '\n'))
elif args.type == 'error':
Error(args.title, args.text.replace('\\n', '\n'))

View File

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="x-scheme-handler/openra-{MODID}-{TAG}">
<generic-icon name="applications-games"/>
<comment>Join OpenRA server</comment>
<glob weight="60" pattern="openra-{MODID}-{TAG}://*"/>
</mime-type>
</mime-info>

View File

@ -1,6 +0,0 @@
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
cd "${HERE}/../lib/openra" || exit 1
mono --debug OpenRA.Server.exe Game.Mod={MODID} "$@"

View File

@ -1,5 +0,0 @@
#!/bin/sh
# OpenRA.Utility relies on keeping the original working directory, so don't change directory
HERE="$(dirname "$(readlink -f "${0}")")"
mono --debug "${HERE}/../lib/openra/OpenRA.Utility.exe" {MODID} "$@"

View File

@ -1,11 +0,0 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=OpenRA - {MODNAME}
GenericName=Real Time Strategy Game
Icon=openra-{MODID}
Exec=openra-{MODID} %u
Terminal=false
Categories=Game;StrategyGame;
StartupWMClass=openra-{MODID}-{TAG}
MimeType=x-scheme-handler/openra-{MODID}-{TAG};

View File

@ -1,54 +0,0 @@
#!/bin/sh
LAUNCHER=$(readlink -f "${0}")
HERE="$(dirname "${LAUNCHER}")"
cd "${HERE}/../lib/openra" || exit 1
# APPIMAGE is an environment variable set by the runtime
# defining the absolute path to the .AppImage file
if [ ! -z "${APPIMAGE}" ]; then
LAUNCHER=${APPIMAGE}
# appimaged doesn't update the mime or icon caches when registering AppImages.
# Run update-desktop-database and gtk-update-icon-cache ourselves if we detect
# that the desktop file has been installed but the handler is not cached
if command -v update-desktop-database > /dev/null; then
APPIMAGEID=$(printf "file://%s" "${APPIMAGE}" | md5sum | cut -d' ' -f1)
LAUNCHER_NAME="appimagekit_${APPIMAGEID}-openra-{MODID}.desktop"
LAUNCHER_PATH="${HOME}/.local/share/applications/${LAUNCHER_NAME}"
MIMECACHE_PATH="${HOME}/.local/share/applications/mimeinfo.cache"
SCHEME="x-scheme-handler/openra-{MODID}-{TAG}"
if [ -f "${LAUNCHER_PATH}" ] && ! grep -qs "${SCHEME}=" "${MIMECACHE_PATH}"; then
update-desktop-database "${HOME}/.local/share/applications"
if command -v gtk-update-icon-cache > /dev/null; then
gtk-update-icon-cache ~/.local/share/icons/hicolor/ -t
fi
fi
fi
fi
# Search for server connection
PROTOCOL_PREFIX="openra-{MODID}-{TAG}://"
JOIN_SERVER=""
if [ "${1#${PROTOCOL_PREFIX}}" != "${1}" ]; then
JOIN_SERVER="Launch.Connect=${1#${PROTOCOL_PREFIX}}"
fi
# Run the game
export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}"
mono --debug OpenRA.Game.exe Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" "${JOIN_SERVER}" "$@"
# Show a crash dialog if something went wrong
if [ $? != 0 ] && [ $? != 1 ]; then
ERROR_MESSAGE="{MODNAME} has encountered a fatal error.\nPlease refer to the crash logs and FAQ for more information.\n\nLog files are located in ~/.openra/Logs\nThe FAQ is available at {MODFAQURL}"
if command -v zenity > /dev/null; then
zenity --no-wrap --error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
elif command -v kdialog > /dev/null; then
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}"
elif "${HERE}/gtk-dialog.py" test > /dev/null; then
"${HERE}/gtk-dialog.py" error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
else
printf "${ERROR_MESSAGE}\n"
fi
exit 1
fi

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# OpenRA Mod SDK packaging script for macOS # OpenRA Mod SDK packaging script for macOS
# #
# The application bundles will be signed if the following environment variable is defined: # The application bundles will be signed if the following environment variables are defined:
# MACOS_DEVELOPER_IDENTITY: Certificate name, of the form `Developer\ ID\ Application:\ <name with escaped spaces>` # MACOS_DEVELOPER_IDENTITY: The alphanumeric identifier listed in the certificate name ("Developer ID Application: <your name> (<identity>)")
# or as Team ID in your Apple Developer account Membership Details.
# If the identity is not already in the default keychain, specify the following environment variables to import it: # If the identity is not already in the default keychain, specify the following environment variables to import it:
# MACOS_DEVELOPER_CERTIFICATE_BASE64: base64 content of the exported .p12 developer ID certificate. # MACOS_DEVELOPER_CERTIFICATE_BASE64: base64 content of the exported .p12 developer ID certificate.
# Generate using `base64 certificate.p12 | pbcopy` # Generate using `base64 certificate.p12 | pbcopy`
@ -28,14 +29,14 @@ require_variables() {
eval check="\$$i" eval check="\$$i"
[ -z "${check}" ] && missing="${missing} ${i}\n" [ -z "${check}" ] && missing="${missing} ${i}\n"
done done
if [ ! -z "${missing}" ]; then if [ -n "${missing}" ]; then
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}"
exit 1 exit 1
fi fi
} }
if [ $# -eq "0" ]; then if [ $# -eq "0" ]; then
echo "Usage: `basename $0` version [outputdir]" echo "Usage: $(basename "$0") version [outputdir]"
exit 1 exit 1
fi fi
@ -51,11 +52,19 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
. "${TEMPLATE_ROOT}/user.config" . "${TEMPLATE_ROOT}/user.config"
fi fi
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \ require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \
"PACKAGING_OSX_LAUNCHER_TAG" "PACKAGING_OSX_LAUNCHER_SOURCE" "PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME" \ "PACKAGING_OSX_MONO_TAG" "PACKAGING_OSX_MONO_SOURCE" "PACKAGING_OSX_MONO_TEMP_ARCHIVE_NAME" \
"PACKAGING_OSX_DMG_MOD_ICON_POSITION" "PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION" "PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION" \ "PACKAGING_OSX_DMG_MOD_ICON_POSITION" "PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION" "PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION" \
"PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION" "PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION"
if [ ! -f "${TEMPLATE_ROOT}/${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
. "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh"
# Import code signing certificate # Import code signing certificate
if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
echo "Importing signing certificate" echo "Importing signing certificate"
@ -75,6 +84,11 @@ else
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))") OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))")
fi fi
if [ ! -d "${OUTPUTDIR}" ]; then
echo "Output directory '${OUTPUTDIR}' does not exist.";
exit 1
fi
BUILTDIR="${PACKAGING_DIR}/build" BUILTDIR="${PACKAGING_DIR}/build"
PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app" PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app"
@ -85,102 +99,109 @@ modify_plist() {
sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3" sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3"
} }
echo "Building launcher" build_platform() {
curl -s -L -o "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}" -O "${PACKAGING_OSX_LAUNCHER_SOURCE}" || exit 3 PLATFORM="${1}"
unzip -qq -d "${BUILTDIR}" "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}" DMG_NAME="${2}"
rm "${PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME}" LAUNCHER_DIR="${BUILTDIR}/${PACKAGING_OSX_APP_NAME}"
LAUNCHER_CONTENTS_DIR="${LAUNCHER_DIR}/Contents"
LAUNCHER_MACOS_DIR="${LAUNCHER_CONTENTS_DIR}/MacOS"
LAUNCHER_RESOURCES_DIR="${LAUNCHER_CONTENTS_DIR}/Resources"
modify_plist "{DEV_VERSION}" "${TAG}" "${BUILTDIR}/OpenRA.app/Contents/Info.plist" echo "Building launcher (${PLATFORM})"
modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
pushd "${TEMPLATE_ROOT}" > /dev/null mkdir -p "${LAUNCHER_RESOURCES_DIR}"
mkdir -p "${LAUNCHER_CONTENTS_DIR}/MacOS"
echo "APPL????" > "${LAUNCHER_CONTENTS_DIR}/PkgInfo"
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/Info.plist.in" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
if [ ! -f "${ENGINE_DIRECTORY}/Makefile" ]; then modify_plist "{DEV_VERSION}" "${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
echo "Required engine files not found." modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; modify_plist "{MOD_ID}" "${MOD_ID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
exit 1 modify_plist "{MOD_NAME}" "${PACKAGING_DISPLAY_NAME}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
fi modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
if [ ! -d "${OUTPUTDIR}" ]; then if [ -n "${DISCORD_APPID}" ]; then
echo "Output directory '${OUTPUTDIR}' does not exist."; modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
exit 1 else
fi modify_plist "<string>{DISCORD_URL_SCHEME}</string>" "" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
fi
MOD_VERSION=$(grep 'Version:' mods/${MOD_ID}/mod.yaml | awk '{print $2}') if [ "${PLATFORM}" = "compat" ]; then
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.9" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
clang -m64 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher-mono.m" -o "${LAUNCHER_MACOS_DIR}/OpenRA" -framework AppKit -mmacosx-version-min=10.9
else
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.13" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
clang -m64 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_MACOS_DIR}/OpenRA" -framework AppKit -mmacosx-version-min=10.13
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then curl -s -L -o "${PACKAGING_OSX_MONO_TEMP_ARCHIVE_NAME}" -O "${PACKAGING_OSX_MONO_SOURCE}" || exit 3
make version VERSION="${TAG}" unzip -qq -d "${BUILTDIR}" "${PACKAGING_OSX_MONO_TEMP_ARCHIVE_NAME}"
else rm "${PACKAGING_OSX_MONO_TEMP_ARCHIVE_NAME}"
mv "${BUILTDIR}/mono" "${LAUNCHER_MACOS_DIR}"
mv "${BUILTDIR}/etc" "${LAUNCHER_RESOURCES_DIR}"
mv "${BUILTDIR}/lib" "${LAUNCHER_RESOURCES_DIR}"
fi
echo "Building core files"
install_assemblies_mono "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_RESOURCES_DIR}" "osx-x64" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}"
install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_RESOURCES_DIR}"
for f in ${PACKAGING_COPY_ENGINE_FILES}; do
mkdir -p "${LAUNCHER_RESOURCES_DIR}/$(dirname "${f}")"
cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${LAUNCHER_RESOURCES_DIR}/${f}"
done
echo "Building mod files"
pushd "${TEMPLATE_ROOT}" > /dev/null
make all
popd > /dev/null
cp -LR "${TEMPLATE_ROOT}mods/"* "${LAUNCHER_RESOURCES_DIR}/mods"
for f in ${PACKAGING_COPY_MOD_BINARIES}; do
mkdir -p "${LAUNCHER_RESOURCES_DIR}/$(dirname "${f}")"
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/bin/${f}" "${LAUNCHER_RESOURCES_DIR}/${f}"
done
set_engine_version "${ENGINE_VERSION}" "${LAUNCHER_RESOURCES_DIR}"
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then
set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml"
else
MOD_VERSION=$(grep 'Version:' "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" | awk '{print $2}')
echo "Mod version ${MOD_VERSION} will remain unchanged."; echo "Mod version ${MOD_VERSION} will remain unchanged.";
fi fi
pushd "${ENGINE_DIRECTORY}" > /dev/null # Assemble multi-resolution icon
echo "Building core files" mkdir "${BUILTDIR}/mod.iconset"
cp "${ARTWORK_DIR}/icon_16x16.png" "${BUILTDIR}/mod.iconset/icon_16x16.png"
cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_16x16@2.png"
cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_32x32.png"
cp "${ARTWORK_DIR}/icon_64x64.png" "${BUILTDIR}/mod.iconset/icon_32x32@2x.png"
cp "${ARTWORK_DIR}/icon_128x128.png" "${BUILTDIR}/mod.iconset/icon_128x128.png"
cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_128x128@2x.png"
cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_256x256.png"
cp "${ARTWORK_DIR}/icon_512x512.png" "${BUILTDIR}/mod.iconset/icon_256x256@2x.png"
iconutil --convert icns "${BUILTDIR}/mod.iconset" -o "${LAUNCHER_RESOURCES_DIR}/${MOD_ID}.icns"
rm -rf "${BUILTDIR}/mod.iconset"
make clean # Sign binaries with developer certificate
make osx-dependencies if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
make core codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/entitlements.plist" "${LAUNCHER_RESOURCES_DIR}/"*.dylib
make version VERSION="${ENGINE_VERSION}" codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/entitlements.plist" --deep "${LAUNCHER_DIR}"
make install-engine gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app" fi
make install-common-mod-files gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
for f in ${PACKAGING_COPY_ENGINE_FILES}; do echo "Packaging disk image"
mkdir -p "${BUILTDIR}/OpenRA.app/Contents/Resources/$(dirname "${f}")" hdiutil create "${PACKAGING_DIR}/${DMG_NAME}" -format UDRW -volname "${PACKAGING_DISPLAY_NAME}" -fs HFS+ -srcfolder "${BUILTDIR}"
cp -r "${f}" "${BUILTDIR}/OpenRA.app/Contents/Resources/${f}" DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${PACKAGING_DIR}/${DMG_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
done sleep 2
popd > /dev/null # Background image is created from source svg in artsrc repository
mkdir "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/"
tiffutil -cathidpicheck "${ARTWORK_DIR}/macos-background.png" "${ARTWORK_DIR}/macos-background-2x.png" -out "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/background.tiff"
echo "Building mod files" cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns"
make core
cp -LR mods/* "${BUILTDIR}/OpenRA.app/Contents/Resources/mods"
popd > /dev/null echo '
pushd "${BUILTDIR}" > /dev/null
mv "OpenRA.app" "${PACKAGING_OSX_APP_NAME}"
# Assemble multi-resolution icon
mkdir mod.iconset
cp "${ARTWORK_DIR}/icon_16x16.png" "mod.iconset/icon_16x16.png"
cp "${ARTWORK_DIR}/icon_32x32.png" "mod.iconset/icon_16x16@2.png"
cp "${ARTWORK_DIR}/icon_32x32.png" "mod.iconset/icon_32x32.png"
cp "${ARTWORK_DIR}/icon_64x64.png" "mod.iconset/icon_32x32@2x.png"
cp "${ARTWORK_DIR}/icon_128x128.png" "mod.iconset/icon_128x128.png"
cp "${ARTWORK_DIR}/icon_256x256.png" "mod.iconset/icon_128x128@2x.png"
cp "${ARTWORK_DIR}/icon_256x256.png" "mod.iconset/icon_256x256.png"
cp "${ARTWORK_DIR}/icon_512x512.png" "mod.iconset/icon_256x256@2x.png"
iconutil --convert icns "mod.iconset" -o "${PACKAGING_OSX_APP_NAME}/Contents/Resources/${MOD_ID}.icns"
rm -rf mod.iconset
# 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"
# Sign binaries with developer certificate
if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${PACKAGING_DIR}/entitlements.plist" "${PACKAGING_OSX_APP_NAME}/Contents/Resources/"*.dylib
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${PACKAGING_DIR}/entitlements.plist" --deep "${PACKAGING_OSX_APP_NAME}"
fi
if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
security delete-keychain build.keychain
fi
echo "Packaging disk image"
hdiutil create build.dmg -format UDRW -volname "${PACKAGING_DISPLAY_NAME}" -fs HFS+ -srcfolder "${BUILTDIR}"
DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}')
sleep 2
# Background image is created from source svg in artsrc repository
mkdir "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/"
tiffutil -cathidpicheck "${ARTWORK_DIR}/macos-background.png" "${ARTWORK_DIR}/macos-background-2x.png" -out "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/background.tiff"
cp "${BUILTDIR}/${PACKAGING_OSX_APP_NAME}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns"
echo '
tell application "Finder" tell application "Finder"
tell disk "'${PACKAGING_DISPLAY_NAME}'" tell disk "'${PACKAGING_DISPLAY_NAME}'"
open open
@ -203,53 +224,56 @@ echo '
close close
end tell end tell
end tell end tell
' | osascript ' | osascript
# HACK: Copy the volume icon again - something in the previous step seems to delete it...? # HACK: Copy the volume icon again - something in the previous step seems to delete it...?
cp "${BUILTDIR}/${PACKAGING_OSX_APP_NAME}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns"
SetFile -c icnC "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" SetFile -c icnC "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns"
SetFile -a C "/Volumes/${PACKAGING_DISPLAY_NAME}" SetFile -a C "/Volumes/${PACKAGING_DISPLAY_NAME}"
chmod -Rf go-w "/Volumes/${PACKAGING_DISPLAY_NAME}" chmod -Rf go-w "/Volumes/${PACKAGING_DISPLAY_NAME}"
sync sync
sync sync
hdiutil detach "${DMG_DEVICE}" hdiutil detach "${DMG_DEVICE}"
rm -rf "${BUILTDIR}"
}
# Submit for notarization notarize_package() {
if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ]; then DMG_PATH="${1}"
echo "Submitting disk image for notarization" NOTARIZE_DMG_PATH="${DMG_PATH%.*}"-notarization.dmg
echo "Submitting ${DMG_PATH} for notarization"
# Reset xcode search path to fix xcrun not finding altool # Reset xcode search path to fix xcrun not finding altool
sudo xcode-select -r sudo xcode-select -r
# Create a temporary read-only dmg for submission (notarization service rejects read/write images) # Create a temporary read-only dmg for submission (notarization service rejects read/write images)
hdiutil convert build.dmg -format UDZO -imagekey zlib-level=9 -ov -o notarization.dmg hdiutil convert "${DMG_PATH}" -format UDZO -imagekey zlib-level=9 -ov -o "${NOTARIZE_DMG_PATH}"
NOTARIZATION_UUID=$(xcrun altool --notarize-app --primary-bundle-id "net.openra.modsdk" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" --file notarization.dmg 2>&1 | awk -F' = ' '/RequestUUID/ { print $2; exit }') NOTARIZATION_UUID=$(xcrun altool --notarize-app --primary-bundle-id "net.openra.modsdk" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" --file "${NOTARIZE_DMG_PATH}" 2>&1 | awk -F' = ' '/RequestUUID/ { print $2; exit }')
if [ -z "${NOTARIZATION_UUID}" ]; then if [ -z "${NOTARIZATION_UUID}" ]; then
echo "Submission failed" echo "Submission failed"
exit 1 exit 1
fi fi
echo "Submission UUID is ${NOTARIZATION_UUID}" echo "${DMG_PATH} submission UUID is ${NOTARIZATION_UUID}"
rm notarization.dmg rm "${NOTARIZE_DMG_PATH}"
while :; do while :; do
sleep 30 sleep 30
NOTARIZATION_RESULT=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/Status/ { print $2; exit }') NOTARIZATION_RESULT=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/Status/ { print $2; exit }')
echo "Submission status: ${NOTARIZATION_RESULT}" echo "${DMG_PATH}: ${NOTARIZATION_RESULT}"
if [ "${NOTARIZATION_RESULT}" == "invalid" ]; then if [ "${NOTARIZATION_RESULT}" == "invalid" ]; then
NOTARIZATION_LOG_URL=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/LogFileURL/ { print $2; exit }') NOTARIZATION_LOG_URL=$(xcrun altool --notarization-info "${NOTARIZATION_UUID}" -u "${MACOS_DEVELOPER_USERNAME}" -p "${MACOS_DEVELOPER_PASSWORD}" 2>&1 | awk -F': ' '/LogFileURL/ { print $2; exit }')
echo "Notarization failed with error:" echo "${NOTARIZATION_UUID} failed notarization with error:"
curl -s "${NOTARIZATION_LOG_URL}" -w "\n" curl -s "${NOTARIZATION_LOG_URL}" -w "\n"
exit 1 exit 1
fi fi
if [ "${NOTARIZATION_RESULT}" == "success" ]; then if [ "${NOTARIZATION_RESULT}" == "success" ]; then
echo "Stapling notarization ticket" echo "${DMG_PATH}: Stapling tickets"
DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_PATH}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
sleep 2 sleep 2
xcrun stapler staple "/Volumes/${PACKAGING_DISPLAY_NAME}/${PACKAGING_OSX_APP_NAME}" xcrun stapler staple "/Volumes/${PACKAGING_DISPLAY_NAME}/${PACKAGING_OSX_APP_NAME}"
@ -261,11 +285,29 @@ if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ];
break break
fi fi
done done
}
finalize_package() {
DMG_PATH="${1}"
OUTPUT_PATH="${2}"
hdiutil convert "${DMG_PATH}" -format UDZO -imagekey zlib-level=9 -ov -o "${OUTPUT_PATH}"
rm "${DMG_PATH}"
}
build_platform "standard" "build.dmg"
build_platform "compat" "build-compat.dmg"
if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
security delete-keychain build.keychain
fi fi
hdiutil convert build.dmg -format UDZO -imagekey zlib-level=9 -ov -o "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}.dmg" if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ]; then
# Parallelize processing
(notarize_package "build.dmg") &
(notarize_package "build-compat.dmg") &
wait
fi
popd > /dev/null finalize_package "build.dmg" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}.dmg"
finalize_package "build-compat.dmg" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-compat.dmg"
# Clean up
rm -rf "${BUILTDIR}"

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>

View File

@ -1,4 +1,4 @@
; Copyright 2007-2019 OpenRA developers (see AUTHORS) ; Copyright 2007-2021 OpenRA developers (see AUTHORS)
; This file is part of OpenRA. ; This file is part of OpenRA.
; ;
; OpenRA is free software: you can redistribute it and/or modify ; OpenRA is free software: you can redistribute it and/or modify
@ -20,7 +20,7 @@
!include "WordFunc.nsh" !include "WordFunc.nsh"
Name "${PACKAGING_DISPLAY_NAME}" Name "${PACKAGING_DISPLAY_NAME}"
OutFile "OpenRA.Setup.exe" OutFile "${OUTFILE}"
ManifestDPIAware true ManifestDPIAware true
@ -79,36 +79,29 @@ Section "-Reg" Reg
WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" 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" WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe Launch.URI=%1"
!ifdef USE_DISCORDID
WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "" "URL:Run game ${USE_DISCORDID} protocol"
WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "URL Protocol" ""
WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0"
WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe"
!endif
SectionEnd SectionEnd
Section "Game" GAME Section "Game" GAME
SectionIn RO SectionIn RO
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File /r "${SRCDIR}\mods" File "${SRCDIR}\*.exe"
File "${SRCDIR}\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" File "${SRCDIR}\*.exe.config"
File "${SRCDIR}\OpenRA.Game.exe" File "${SRCDIR}\*.dll"
File "${SRCDIR}\OpenRA.Game.exe.config" File "${SRCDIR}\*.ico"
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}\VERSION"
File "${SRCDIR}\AUTHORS" File "${SRCDIR}\AUTHORS"
File "${SRCDIR}\COPYING" File "${SRCDIR}\COPYING"
File "${SRCDIR}\${MOD_ID}.ico"
File "${SRCDIR}\SDL2-CS.dll"
File "${SRCDIR}\OpenAL-CS.dll"
File "${SRCDIR}\global mix database.dat" File "${SRCDIR}\global mix database.dat"
File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP" File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP"
File "${SRCDIR}\eluant.dll" File /r "${SRCDIR}\mods"
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 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
@ -150,9 +143,9 @@ Section "-DotNet" DotNet
; https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed ; https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release" ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
IfErrors error 0 IfErrors error 0
IntCmp $0 394254 done error done IntCmp $0 461808 done error done
error: error:
MessageBox MB_OK ".NET Framework v4.6.1 or later is required to run OpenRA." MessageBox MB_OK ".NET Framework v4.7.2 or later is required to run OpenRA."
Abort Abort
done: done:
SectionEnd SectionEnd
@ -182,34 +175,24 @@ Function ${UN}Clean
RMDir /r $INSTDIR\maps RMDir /r $INSTDIR\maps
RMDir /r $INSTDIR\glsl RMDir /r $INSTDIR\glsl
RMDir /r $INSTDIR\lua RMDir /r $INSTDIR\lua
Delete "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" Delete $INSTDIR\*.exe
Delete $INSTDIR\OpenRA.Game.exe Delete $INSTDIR\*.exe.config
Delete $INSTDIR\OpenRA.Game.exe.config Delete $INSTDIR\*.dll
Delete $INSTDIR\OpenRA.Utility.exe Delete $INSTDIR\*.ico
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\VERSION Delete $INSTDIR\VERSION
Delete $INSTDIR\AUTHORS Delete $INSTDIR\AUTHORS
Delete $INSTDIR\COPYING Delete $INSTDIR\COPYING
Delete $INSTDIR\${MOD_ID}.ico
Delete "$INSTDIR\global mix database.dat" Delete "$INSTDIR\global mix database.dat"
Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
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\rix0rrr.BeaconLib.dll
RMDir /r $INSTDIR\Support RMDir /r $INSTDIR\Support
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}"
DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}"
!ifdef USE_DISCORDID
DeleteRegKey HKLM "Software\Classes\discord-${DISCORD_APP_ID}"
!endif
Delete $INSTDIR\uninstaller.exe Delete $INSTDIR\uninstaller.exe
RMDir $INSTDIR RMDir $INSTDIR

View File

@ -10,14 +10,14 @@ require_variables() {
eval check="\$$i" eval check="\$$i"
[ -z "${check}" ] && missing="${missing} ${i}\n" [ -z "${check}" ] && missing="${missing} ${i}\n"
done done
if [ ! -z "${missing}" ]; then if [ -n "${missing}" ]; then
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}"
exit 1 exit 1
fi fi
} }
if [ $# -eq "0" ]; then if [ $# -eq "0" ]; then
echo "Usage: `basename $0` version [outputdir]" echo "Usage: $(basename "$0") version [outputdir]"
exit 1 exit 1
fi fi
@ -33,7 +33,7 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
. "${TEMPLATE_ROOT}/user.config" . "${TEMPLATE_ROOT}/user.config"
fi fi
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \ require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \
"PACKAGING_WINDOWS_LAUNCHER_NAME" "PACKAGING_WINDOWS_REGISTRY_KEY" "PACKAGING_WINDOWS_INSTALL_DIR_NAME" \ "PACKAGING_WINDOWS_LAUNCHER_NAME" "PACKAGING_WINDOWS_REGISTRY_KEY" "PACKAGING_WINDOWS_INSTALL_DIR_NAME" \
"PACKAGING_WINDOWS_LICENSE_FILE" "PACKAGING_FAQ_URL" "PACKAGING_WEBSITE_URL" "PACKAGING_AUTHORS" "PACKAGING_OVERWRITE_MOD_VERSION" "PACKAGING_WINDOWS_LICENSE_FILE" "PACKAGING_FAQ_URL" "PACKAGING_WEBSITE_URL" "PACKAGING_AUTHORS" "PACKAGING_OVERWRITE_MOD_VERSION"
@ -49,96 +49,77 @@ BUILTDIR="${PACKAGING_DIR}/build"
# Set the working dir to the location of this script # Set the working dir to the location of this script
cd "${PACKAGING_DIR}" cd "${PACKAGING_DIR}"
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe" if [ ! -f "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/Makefile" ]; then
pushd ${TEMPLATE_ROOT} > /dev/null
if [ ! -f "${ENGINE_DIRECTORY}/Makefile" ]; then
echo "Required engine files not found." echo "Required engine files not found."
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
exit 1 exit 1
fi fi
. "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh"
if [ ! -d "${OUTPUTDIR}" ]; then if [ ! -d "${OUTPUTDIR}" ]; then
echo "Output directory '${OUTPUTDIR}' does not exist."; echo "Output directory '${OUTPUTDIR}' does not exist.";
exit 1 exit 1
fi fi
MOD_VERSION=$(grep 'Version:' mods/${MOD_ID}/mod.yaml | awk '{print $2}')
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then
make version VERSION="${TAG}"
else
echo "Mod version ${MOD_VERSION} will remain unchanged.";
fi
popd > /dev/null
function build_platform() function build_platform()
{ {
if [ "$1" = "x86" ]; then PLATFORM="${1}"
IS_WIN32="WIN32=true" if [ "${PLATFORM}" = "x86" ]; then
USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true" USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true"
else else
IS_WIN32="WIN32=false"
USE_PROGRAMFILES32="" USE_PROGRAMFILES32=""
fi fi
pushd ${TEMPLATE_ROOT} > /dev/null if [ -n "${PACKAGING_DISCORD_APPID}" ]; then
USE_DISCORDID="-DUSE_DISCORDID=${PACKAGING_DISCORD_APPID}"
else
USE_DISCORDID=""
fi
echo "Building core files ($1)" echo "Building core files (${PLATFORM})"
pushd ${ENGINE_DIRECTORY} > /dev/null install_assemblies_mono "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}" "win-${PLATFORM}" "False" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}"
install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}"
SRC_DIR="$(pwd)"
make clean
make windows-dependencies "${IS_WIN32}"
make core "${IS_WIN32}"
make version VERSION="${ENGINE_VERSION}"
make install-engine gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-common-mod-files gameinstalldir="" DESTDIR="${BUILTDIR}"
for f in ${PACKAGING_COPY_ENGINE_FILES}; do for f in ${PACKAGING_COPY_ENGINE_FILES}; do
mkdir -p "${BUILTDIR}/$(dirname "${f}")" mkdir -p "${BUILTDIR}/$(dirname "${f}")"
cp -r "${f}" "${BUILTDIR}/${f}" cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${BUILTDIR}/${f}"
done done
echo "Building mod files (${PLATFORM})"
pushd "${TEMPLATE_ROOT}" > /dev/null
make all
popd > /dev/null popd > /dev/null
echo "Building mod files ($1)" cp -Lr "${TEMPLATE_ROOT}/mods/"* "${BUILTDIR}/mods"
make core
cp -Lr mods/* "${BUILTDIR}/mods" for f in ${PACKAGING_COPY_MOD_BINARIES}; do
mkdir -p "${BUILTDIR}/$(dirname "${f}")"
cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/bin/${f}" "${BUILTDIR}/${f}"
done
popd > /dev/null set_engine_version "${ENGINE_VERSION}" "${BUILTDIR}"
if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then
set_mod_version "${TAG}" "${BUILTDIR}/mods/${MOD_ID}/mod.yaml"
else
MOD_VERSION=$(grep 'Version:' "mods/${MOD_ID}/mod.yaml" | awk '{print $2}')
echo "Mod version ${MOD_VERSION} will remain unchanged.";
fi
# Create multi-resolution icon # Create multi-resolution icon
convert "${ARTWORK_DIR}/icon_16x16.png" "${ARTWORK_DIR}/icon_24x24.png" "${ARTWORK_DIR}/icon_32x32.png" "${ARTWORK_DIR}/icon_48x48.png" "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/${MOD_ID}.ico" convert "${ARTWORK_DIR}/icon_16x16.png" "${ARTWORK_DIR}/icon_24x24.png" "${ARTWORK_DIR}/icon_32x32.png" "${ARTWORK_DIR}/icon_48x48.png" "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/${MOD_ID}.ico"
cp "${SRC_DIR}/OpenRA.Game.exe.config" "${BUILTDIR}"
# We need to set the loadFromRemoteSources flag for the launcher, but only for the "portable" zip package. echo "Compiling Windows launcher (${PLATFORM})"
# Windows automatically un-trusts executables that are extracted from a downloaded zip file install_windows_launcher "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${PACKAGING_WINDOWS_LAUNCHER_NAME}" "${PACKAGING_DISPLAY_NAME}" "${BUILTDIR}/${MOD_ID}.ico" "${PACKAGING_FAQ_URL}"
cp "${SRC_DIR}/OpenRA.Game.exe.config" "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe.config"
echo "Compiling Windows launcher ($1)" echo "Building Windows setup.exe (${PLATFORM})"
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"
csc "${BUILTDIR}/WindowsLauncher.cs" -nologo -warn:4 -warnaserror -platform:"$1" -out:"${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" -t:winexe ${LAUNCHER_LIBS} -win32icon:"${BUILTDIR}/${MOD_ID}.ico"
rm "${BUILTDIR}/WindowsLauncher.cs"
mono "${SRC_DIR}/OpenRA.PostProcess.exe" "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" -LAA > /dev/null
echo "Building Windows setup.exe ($1)"
pushd "${PACKAGING_DIR}" > /dev/null pushd "${PACKAGING_DIR}" > /dev/null
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}" -DPACKAGING_WINDOWS_LICENSE_FILE="${TEMPLATE_ROOT}/${PACKAGING_WINDOWS_LICENSE_FILE}" ${USE_PROGRAMFILES32} buildpackage.nsi makensis -V2 -DSRCDIR="${BUILTDIR}" -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}" -DPACKAGING_WINDOWS_LICENSE_FILE="${TEMPLATE_ROOT}/${PACKAGING_WINDOWS_LICENSE_FILE}" -DOUTFILE="${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-${PLATFORM}.exe" ${USE_PROGRAMFILES32} ${USE_DISCORDID} buildpackage.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-${1}.exe"
fi
popd > /dev/null popd > /dev/null
echo "Packaging zip archive ($1)" echo "Packaging zip archive (${PLATFORM})"
pushd "${BUILTDIR}" > /dev/null pushd "${BUILTDIR}" > /dev/null
find "${SRC_DIR}/thirdparty/download/windows/" -name '*.dll' -exec cp '{}' '.' ';' zip "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-${PLATFORM}-winportable.zip" -r -9 ./* --quiet
zip "${PACKAGING_INSTALLER_NAME}-${TAG}-${1}-winportable.zip" -r -9 * --quiet
mv "${PACKAGING_INSTALLER_NAME}-${TAG}-${1}-winportable.zip" "${OUTPUTDIR}"
popd > /dev/null popd > /dev/null
# Cleanup # Cleanup

View File

@ -4,7 +4,7 @@ setlocal EnableDelayedExpansion
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
set MOD_SEARCH_PATHS=%~dp0mods,./mods set MOD_SEARCH_PATHS=%~dp0mods,./mods
set ENGINE_DIR=..
if "!MOD_ID!" == "" goto badconfig if "!MOD_ID!" == "" goto badconfig
if "!ENGINE_VERSION!" == "" goto badconfig if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig
@ -12,7 +12,7 @@ if "!ENGINE_DIRECTORY!" == "" goto badconfig
title OpenRA.Utility.exe %MOD_ID% title OpenRA.Utility.exe %MOD_ID%
set TEMPLATE_DIR=%CD% set TEMPLATE_DIR=%CD%
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY% cd %ENGINE_DIRECTORY%
@ -30,7 +30,7 @@ echo.
echo ---------------------------------------- echo ----------------------------------------
echo. echo.
echo OpenRA.Utility.exe %MOD_ID% %command% echo OpenRA.Utility.exe %MOD_ID% %command%
call OpenRA.Utility.exe %MOD_ID% %command% call bin\OpenRA.Utility.exe %MOD_ID% %command%
goto loop goto loop
:noengine :noengine

View File

@ -43,11 +43,11 @@ require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
LAUNCH_MOD="${Mod:-"${MOD_ID}"}" LAUNCH_MOD="${Mod:-"${MOD_ID}"}"
cd "${TEMPLATE_ROOT}" cd "${TEMPLATE_ROOT}"
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.Utility.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
echo "Required engine files not found." echo "Required engine files not found."
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
exit 1 exit 1
fi fi
cd "${ENGINE_DIRECTORY}" cd "${ENGINE_DIRECTORY}"
MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug OpenRA.Utility.exe "${LAUNCH_MOD}" "$@" MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe "${LAUNCH_MOD}" "$@"