Overhaul packaging scripts and helpers:

- Shared helpers extracted to functions.sh for use by upstream packaging,
  Mod SDK, and downstream packaging (via the Makefile targets).
- Assembly management separated from data and combined between engine
  and mods to prepare for pending .NET core requirements.
- Streamline Makefile targets.
- Clean up a lot of old technical debt.
This commit is contained in:
Paul Chote
2020-12-05 20:48:24 +00:00
committed by teinarss
parent f3ebe07540
commit b1560ae69c
12 changed files with 542 additions and 428 deletions

336
Makefile
View File

@@ -12,25 +12,18 @@
# to check the engine and official mod dlls for code style violations, run:
# make check
#
# to install, run:
# to compile and install Red Alert, Tiberian Dawn, and Dune 2000, run:
# make [prefix=/foo] [bindir=/bar/bin] install
#
# to install Linux startup scripts, desktop files and icons:
# make install-linux-shortcuts [DEBUG=false]
# to install Linux startup scripts, desktop files, icons, and MIME metadata
# make install-linux-shortcuts
#
# to install the engine and common mod files (omitting the default mods):
# make install-engine
# make install-dependencies
# make install-common-mod-files
#
# to uninstall, run:
# make uninstall
# to install Linux AppStream metadata
# make install-linux-appdata
#
# for help, run:
# make help
#
# to start the game, run:
# openra
############################## TOOLCHAIN ###############################
#
@@ -44,12 +37,9 @@ WHITELISTED_THIRDPARTY_ASSEMBLIES = ICSharpCode.SharpZipLib.dll FuzzyLogicLibrar
# 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 netstandard.dll
NUNIT_LIBS_PATH :=
NUNIT_LIBS := $(NUNIT_LIBS_PATH)nunit.framework.dll
######################### UTILITIES/SETTINGS ###########################
#
# install locations
# Install locations for local installs and downstream packaging
prefix ?= /usr/local
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
@@ -59,24 +49,21 @@ libdir ?= $(prefix)/lib
gameinstalldir ?= $(libdir)/openra
BIN_INSTALL_DIR = $(DESTDIR)$(bindir)
DATA_INSTALL_DIR = $(DESTDIR)$(gameinstalldir)
DATA_INSTALL_DIR = $(DESTDIR)$(datadir)
OPENRA_INSTALL_DIR = $(DESTDIR)$(gameinstalldir)
# install tools
# Toolchain
CWD = $(shell pwd)
MSBUILD = msbuild -verbosity:m -nologo
MONO = mono
RM = rm
RM_R = $(RM) -r
RM_F = $(RM) -f
RM_RF = $(RM) -rf
CP = cp
CP_R = $(CP) -r
INSTALL = install
INSTALL_DIR = $(INSTALL) -d
INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
# Toolchain
MSBUILD = msbuild -verbosity:m -nologo
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
# dependencies
# Detect target platform for dependencies if not given by the user
ifndef TARGETPLATFORM
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
@@ -91,49 +78,11 @@ endif
endif
endif
# program targets
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
OPENRA_UTILITY = ENGINE_DIR=".." $(MONO) --debug bin/OpenRA.Utility.exe
check-scripts:
@echo
@echo "Checking for Lua syntax errors..."
@luac -p $(shell find mods/*/maps/* -iname '*.lua')
@luac -p $(shell find lua/* -iname '*.lua')
@luac -p $(shell find mods/*/bits/scripts/* -iname '*.lua')
check:
@echo
@echo "Compiling in debug mode..."
@$(MSBUILD) -t:build -p:Configuration=Debug
@echo
@echo "Checking runtime assemblies..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe all --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES)
@echo
@echo "Checking for explicit interface violations..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe all --check-explicit-interfaces
@echo
@echo "Checking for incorrect conditional trait interface overrides..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe all --check-conditional-trait-interface-overrides
test: core
@echo
@echo "Testing Tiberian Sun mod MiniYAML..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe ts --check-yaml
@echo
@echo "Testing Dune 2000 mod MiniYAML..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe d2k --check-yaml
@echo
@echo "Testing Tiberian Dawn mod MiniYAML..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe cnc --check-yaml
@echo
@echo "Testing Red Alert mod MiniYAML..."
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe ra --check-yaml
########################## MAKE/INSTALL RULES ##########################
##################### DEVELOPMENT BUILDS AND TESTS #####################
#
all: core
core:
all:
@command -v $(firstword $(MSBUILD)) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
@$(MSBUILD) -t:Build -restore -p:Configuration=Release -p:TargetPlatform=$(TARGETPLATFORM)
ifeq ($(TARGETPLATFORM), unix-generic)
@@ -142,195 +91,60 @@ endif
@./fetch-geoip.sh
clean:
@-$(RM_F) *.config IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
@-$(RM_RF) ./bin ./*/bin ./*/obj
@ $(MSBUILD) -t:clean
@$(MSBUILD) -t:Clean
@-$(RM_F) IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
check:
@echo
@echo "Compiling in debug mode..."
@$(MSBUILD) -t:build -restore -p:Configuration=Debug
@echo
@echo "Checking runtime assemblies..."
@$(OPENRA_UTILITY) all --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES)
@echo
@echo "Checking for explicit interface violations..."
@$(OPENRA_UTILITY) all --check-explicit-interfaces
@echo
@echo "Checking for incorrect conditional trait interface overrides..."
@$(OPENRA_UTILITY) all --check-conditional-trait-interface-overrides
check-scripts:
@echo
@echo "Checking for Lua syntax errors..."
@luac -p $(shell find mods/*/maps/* -iname '*.lua')
@luac -p $(shell find lua/* -iname '*.lua')
@luac -p $(shell find mods/*/bits/scripts/* -iname '*.lua')
test: all
@echo
@echo "Testing Tiberian Sun mod MiniYAML..."
@$(OPENRA_UTILITY) ts --check-yaml
@echo
@echo "Testing Dune 2000 mod MiniYAML..."
@$(OPENRA_UTILITY) d2k --check-yaml
@echo
@echo "Testing Tiberian Dawn mod MiniYAML..."
@$(OPENRA_UTILITY) cnc --check-yaml
@echo
@echo "Testing Red Alert mod MiniYAML..."
@$(OPENRA_UTILITY) ra --check-yaml
############# LOCAL INSTALLATION AND DOWNSTREAM PACKAGING ##############
#
version: VERSION mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml
@echo "$(VERSION)" > VERSION
@for i in $? ; do \
awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $${i} > $${i}.tmp && \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp > $${i} && \
rm $${i}.tmp; \
done
@sh -c '. ./packaging/functions.sh; set_engine_version $(VERSION) .'
@sh -c '. ./packaging/functions.sh; set_mod_version $(VERSION) mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml'
install: core install-engine install-common-mod-files install-default-mods
@$(CP) *.sh "$(DATA_INSTALL_DIR)"
install:
@sh -c '. ./packaging/functions.sh; install_assemblies_mono $(CWD) $(OPENRA_INSTALL_DIR) $(TARGETPLATFORM) True True True'
@sh -c '. ./packaging/functions.sh; install_data $(CWD) $(OPENRA_INSTALL_DIR) cnc d2k ra'
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
install-dependencies:
ifeq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM),win-x86 win-x64))
@-echo "Installing OpenRA dependencies to $(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/soft_oal.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/SDL2.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/freetype6.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/lua51.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/libEGL.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/libGLESv2.dll "$(DATA_INSTALL_DIR)"
endif
ifeq ($(TARGETPLATFORM), linux-x64)
@-echo "Installing OpenRA dependencies to $(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/soft_oal.so "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/SDL2.so "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/freetype6.so "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/lua51.so "$(DATA_INSTALL_DIR)"
endif
ifeq ($(TARGETPLATFORM), osx-x64)
@-echo "Installing OpenRA dependencies to $(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/soft_oal.dylib "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/SDL2.dylib "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/freetype6.dylib "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/lua51.dylib "$(DATA_INSTALL_DIR)"
endif
install-engine:
@-echo "Installing OpenRA engine to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.Server.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.Utility.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.Game.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.Platforms.Default.dll "$(DATA_INSTALL_DIR)"
ifneq ($(TARGETPLATFORM), $(filter $(TARGETPLATFORM),win-x86 win-x64))
@$(INSTALL_DATA) bin/OpenRA.Platforms.Default.dll.config "$(DATA_INSTALL_DIR)"
endif
@$(INSTALL_DATA) VERSION "$(DATA_INSTALL_DIR)/VERSION"
@$(INSTALL_DATA) AUTHORS "$(DATA_INSTALL_DIR)/AUTHORS"
@$(INSTALL_DATA) COPYING "$(DATA_INSTALL_DIR)/COPYING"
@$(INSTALL_DATA) IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP "$(DATA_INSTALL_DIR)/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP"
@$(CP_R) glsl "$(DATA_INSTALL_DIR)"
@$(CP_R) lua "$(DATA_INSTALL_DIR)"
@$(CP) bin/SDL2-CS* "$(DATA_INSTALL_DIR)"
@$(CP) bin/OpenAL-CS* "$(DATA_INSTALL_DIR)"
@$(CP) bin/Eluant* "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/FuzzyLogicLibrary.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/Open.Nat.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/BeaconLib.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/DiscordRPC.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/Newtonsoft.Json.dll "$(DATA_INSTALL_DIR)"
install-common-mod-files:
@-echo "Installing OpenRA common mod files to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)/mods"
@$(CP_R) mods/common "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_PROGRAM) bin/OpenRA.Mods.Common.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) bin/OpenRA.Mods.Cnc.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
install-default-mods:
@-echo "Installing OpenRA default mods to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)/mods"
@$(CP_R) mods/cnc "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/ra "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/d2k "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_PROGRAM) bin/OpenRA.Mods.D2k.dll "$(DATA_INSTALL_DIR)"
@$(CP_R) mods/modcontent "$(DATA_INSTALL_DIR)/mods/"
install-linux-icons:
for SIZE in 16x16 32x32 48x48 64x64 128x128; do \
$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps"; \
$(INSTALL_DATA) packaging/artwork/ra_$$SIZE.png "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-ra.png"; \
$(INSTALL_DATA) packaging/artwork/cnc_$$SIZE.png "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-cnc.png"; \
$(INSTALL_DATA) packaging/artwork/d2k_$$SIZE.png "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-d2k.png"; \
done
$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/hicolor/scalable/apps"
$(INSTALL_DATA) packaging/artwork/ra_scalable.svg "$(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/openra-ra.svg"
$(INSTALL_DATA) packaging/artwork/cnc_scalable.svg "$(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/openra-cnc.svg"
install-linux-desktop:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@sed 's/{MODID}/ra/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Red Alert/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-ra.desktop
@$(INSTALL_DATA) packaging/linux/openra-ra.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MODID}/cnc/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Tiberian Dawn/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-cnc.desktop
@$(INSTALL_DATA) packaging/linux/openra-cnc.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MODID}/d2k/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Dune 2000/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-d2k.desktop
@$(INSTALL_DATA) packaging/linux/openra-d2k.desktop "$(DESTDIR)$(datadir)/applications"
@-$(RM) packaging/linux/openra-ra.desktop packaging/linux/openra-cnc.desktop packaging/linux/openra-d2k.desktop
install-linux-mime:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/mime/packages/"
@sed 's/{MODID}/ra/g' packaging/linux/openra-mimeinfo.xml.in | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-mimeinfo.xml
@$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra-ra.xml"
@sed 's/{MODID}/cnc/g' packaging/linux/openra-mimeinfo.xml.in | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-mimeinfo.xml
@$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra-cnc.xml"
@sed 's/{MODID}/d2k/g' packaging/linux/openra-mimeinfo.xml.in | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-mimeinfo.xml
@$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra-d2k.xml"
install-linux-shortcuts:
@sh -c '. ./packaging/functions.sh; install_linux_shortcuts $(CWD) $(OPENRA_INSTALL_DIR) $(BIN_INSTALL_DIR) $(DATA_INSTALL_DIR) $(VERSION) cnc d2k ra'
install-linux-appdata:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MODID}/ra/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Red Alert/g' | sed 's/{SCREENSHOT_RA}/ type="default"/g' | sed 's/{SCREENSHOT_CNC}//g' | sed 's/{SCREENSHOT_D2K}//g'> packaging/linux/openra-ra.appdata.xml
@$(INSTALL_DATA) packaging/linux/openra-ra.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MODID}/cnc/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Tiberian Dawn/g' | sed 's/{SCREENSHOT_RA}//g' | sed 's/{SCREENSHOT_CNC}/ type="default"/g' | sed 's/{SCREENSHOT_D2K}//g'> packaging/linux/openra-cnc.appdata.xml
@$(INSTALL_DATA) packaging/linux/openra-cnc.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MODID}/d2k/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Dune 2000/g' | sed 's/{SCREENSHOT_RA}//g' | sed 's/{SCREENSHOT_CNC}//g' | sed 's/{SCREENSHOT_D2K}/ type="default"/g'> packaging/linux/openra-d2k.appdata.xml
@$(INSTALL_DATA) packaging/linux/openra-d2k.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@-$(RM) packaging/linux/openra-ra.appdata.xml packaging/linux/openra-cnc.appdata.xml packaging/linux/openra-d2k.appdata.xml
install-man-page:
@$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man6/"
@ENGINE_DIR=".." mono --debug bin/OpenRA.Utility.exe all --man-page > openra.6
@$(INSTALL_DATA) openra.6 "$(DESTDIR)$(mandir)/man6/"
@-$(RM) openra.6
install-linux-scripts:
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
@sed 's/{DEBUG}//' packaging/linux/openra.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra.debug.in
@sed 's/{DEBUG}//' packaging/linux/openra-server.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra-server.debug.in
else
@sed 's/{DEBUG}/--debug/' packaging/linux/openra.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra.debug.in
@sed 's/{DEBUG}/--debug/' packaging/linux/openra-server.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra-server.debug.in
endif
@sed 's/{MODID}/ra/g' packaging/linux/openra.debug.in | sed 's/{TAG}/$(VERSION)/g' | sed 's/{MODNAME}/Red Alert/g' > packaging/linux/openra-ra
@sed 's/{MODID}/cnc/g' packaging/linux/openra.debug.in | sed 's/{TAG}/$(VERSION)/g' | sed 's/{MODNAME}/Tiberian Dawn/g' > packaging/linux/openra-cnc
@sed 's/{MODID}/d2k/g' packaging/linux/openra.debug.in | sed 's/{TAG}/$(VERSION)/g' | sed 's/{MODNAME}/Dune 2000/g' > packaging/linux/openra-d2k
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-ra "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-cnc "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-d2k "$(BIN_INSTALL_DIR)"
@-$(RM) packaging/linux/openra-ra packaging/linux/openra-cnc packaging/linux/openra-d2k packaging/linux/openra.debug.in
@sed 's/{MODID}/ra/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Red Alert/g' > packaging/linux/openra-ra-server
@sed 's/{MODID}/cnc/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Tiberian Dawn/g' > packaging/linux/openra-cnc-server
@sed 's/{MODID}/d2k/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Dune 2000/g' > packaging/linux/openra-d2k-server
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-ra-server "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-cnc-server "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-d2k-server "$(BIN_INSTALL_DIR)"
@-$(RM) packaging/linux/openra-ra-server packaging/linux/openra-cnc-server packaging/linux/openra-d2k-server packaging/linux/openra-server.debug.in
uninstall:
@-$(RM_R) "$(DATA_INSTALL_DIR)"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-ra"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-ra-server"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-cnc"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-cnc-server"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-d2k"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-d2k-server"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-ra.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-cnc.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-d2k.desktop"
@-for SIZE in 16x16 32x32 48x48 64x64 128x128; do \
$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-ra.png"; \
$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-cnc.png"; \
$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/$$SIZE/apps/openra-d2k.png"; \
done
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/openra-ra.svg"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/scalable/apps/openra-cnc.svg"
@-$(RM_F) "$(DESTDIR)$(datadir)/mime/packages/openra-ra.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/mime/packages/openra-cnc.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/mime/packages/openra-d2k.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/appdata/openra-ra.appdata.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/appdata/openra-cnc.appdata.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/appdata/openra-d2k.appdata.xml"
@-$(RM_F) "$(DESTDIR)$(mandir)/man6/openra.6"
@sh -c '. ./packaging/functions.sh; install_linux_appdata $(CWD) $(DATA_INSTALL_DIR) cnc d2k ra'
help:
@echo 'to compile, run:'
@@ -345,22 +159,14 @@ help:
@echo 'to check the engine and official mod dlls for code style violations, run:'
@echo ' make test'
@echo
@echo 'to install, run:'
@echo ' make [prefix=/foo] [bindir=/bar/bin] install'
@echo 'to compile and install Red Alert, Tiberian Dawn, and Dune 2000 run:'
@echo ' make [prefix=/foo] install'
@echo
@echo 'to install Linux startup scripts, desktop files and icons'
@echo ' make install-linux-shortcuts [DEBUG=false]'
@echo 'to install Linux startup scripts, desktop files, icons, and MIME metadata'
@echo ' make install-linux-shortcuts'
@echo
@echo ' to install the engine and common mod files (omitting the default mods):'
@echo ' make install-engine'
@echo ' make install-dependencies'
@echo ' make install-common-mod-files'
@echo
@echo 'to uninstall, run:'
@echo ' make uninstall'
@echo
@echo 'to start the game, run:'
@echo ' openra'
@echo 'to install Linux AppStream metadata'
@echo ' make install-linux-appdata'
########################### MAKEFILE SETTINGS ##########################
#
@@ -368,4 +174,4 @@ help:
.SUFFIXES:
.PHONY: check-scripts check test all core clean version install install-linux-shortcuts install-dependencies install-engine install-common-mod-files install-default-mods install-linux-icons install-linux-desktop install-linux-mime install-linux-appdata install-man-page install-linux-scripts uninstall help
.PHONY: all clean check check-scripts test version install install-linux-shortcuts install-linux-appdata help

View File

@@ -21,8 +21,7 @@ after_test:
- move /Y %APPVEYOR_BUILD_FOLDER%\bin\* %APPVEYOR_BUILD_FOLDER%
- if defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_TAG_NAME%
- if not defined APPVEYOR_REPO_TAG_NAME set VERSION=%APPVEYOR_REPO_COMMIT:~0,7%
- '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DTAG="git-%VERSION%" /DSUFFIX=" (dev)" /V3 packaging/windows/OpenRA.nsi'
- move /Y %APPVEYOR_BUILD_FOLDER%\packaging\windows\OpenRA.Setup.exe %APPVEYOR_BUILD_FOLDER%\OpenRA-%VERSION%.exe
- '"C:\Program Files (x86)\NSIS\makensis.exe" /DSRCDIR="%APPVEYOR_BUILD_FOLDER%" /DTAG="git-%VERSION%" /DSUFFIX=" (dev)" /V3 /DOUTFILE="OpenRA-$(VERSION).exe" packaging/windows/OpenRA.nsi'
artifacts:
- path: OpenRA-$(VERSION).exe

332
packaging/functions.sh Executable file
View File

@@ -0,0 +1,332 @@
#!/bin/sh
# Helper functions for packaging and installing OpenRA
####
# This file must stay /bin/sh and POSIX compliant for macOS and BSD portability.
# Copy-paste the entire script into http://shellcheck.net to check.
####
# Compile and publish (using Mono) the core engine and specified mod assemblies to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, linux-x64, unix-generic)
# COPY_GENERIC_LAUNCHER: If set to True the OpenRA.exe will also be copied (True, False)
# COPY_CNC_DLL: If set to True the OpenRA.Mods.Cnc.dll will also be copied (True, False)
# COPY_D2K_DLL: If set to True the OpenRA.Mods.D2k.dll and OpenRA.Mods.Cnc.dll will also be copied (True, False)
# Used by:
# Makefile (install target for local installs and downstream packaging)
# Linux AppImage packaging
# macOS packaging
# Windows packaging
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
install_assemblies_mono() {
SRC_PATH="${1}"
DEST_PATH="${2}"
TARGETPLATFORM="${3}"
COPY_GENERIC_LAUNCHER="${4}"
COPY_CNC_DLL="${5}"
COPY_D2K_DLL="${6}"
echo "Building assemblies"
ORIG_PWD=$(pwd)
cd "${SRC_PATH}" || exit 1
msbuild -verbosity:m -nologo -t:Clean
rm -rf "${SRC_PATH:?}/bin"
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}"
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
./configure-system-libraries.sh
fi
./fetch-geoip.sh
cd "${ORIG_PWD}" || exit 1
echo "Installing engine to ${DEST_PATH}"
install -d "${DEST_PATH}"
# Core engine
install -m755 "${SRC_PATH}/bin/OpenRA.Server.exe" "${DEST_PATH}"
install -m755 "${SRC_PATH}/bin/OpenRA.Utility.exe" "${DEST_PATH}"
install -m644 "${SRC_PATH}/bin/OpenRA.Game.dll" "${DEST_PATH}"
install -m644 "${SRC_PATH}/bin/OpenRA.Platforms.Default.dll" "${DEST_PATH}"
if [ "${COPY_GENERIC_LAUNCHER}" = "True" ]; then
install -m755 "${SRC_PATH}/bin/OpenRA.exe" "${DEST_PATH}"
fi
# Mod dlls
install -m644 "${SRC_PATH}/bin/OpenRA.Mods.Common.dll" "${DEST_PATH}"
if [ "${COPY_CNC_DLL}" = "True" ]; then
install -m644 "${SRC_PATH}/bin/OpenRA.Mods.Cnc.dll" "${DEST_PATH}"
fi
if [ "${COPY_D2K_DLL}" = "True" ]; then
install -m644 "${SRC_PATH}/bin/OpenRA.Mods.D2k.dll" "${DEST_PATH}"
fi
# Managed Dependencies
for LIB in ICSharpCode.SharpZipLib.dll FuzzyLogicLibrary.dll Open.Nat.dll BeaconLib.dll DiscordRPC.dll Newtonsoft.Json.dll SDL2-CS.dll OpenAL-CS.Core.dll Eluant.dll; do
install -m644 "${SRC_PATH}/bin/${LIB}" "${DEST_PATH}"
done
# Native dependencies
if [ "${TARGETPLATFORM}" = "win-x86" ] || [ "${TARGETPLATFORM}" = "win-x64" ]; then
echo "Installing dependencies for ${TARGETPLATFORM} to ${DEST_PATH}"
for LIB in soft_oal.dll SDL2.dll freetype6.dll lua51.dll libEGL.dll libGLESv2.dll; do
install -m644 "${SRC_PATH}/bin/${LIB}" "${DEST_PATH}"
done
else
for LIB in OpenRA.Platforms.Default.dll.config SDL2-CS.dll.config OpenAL-CS.Core.dll.config Eluant.dll.config; do
install -m644 "${SRC_PATH}/bin/${LIB}" "${DEST_PATH}"
done
fi
if [ "${TARGETPLATFORM}" = "linux-x64" ]; then
echo "Installing dependencies for ${TARGETPLATFORM} to ${DEST_PATH}"
for LIB in soft_oal.so SDL2.so freetype6.so lua51.so; do
install -m755 "${SRC_PATH}/bin/${LIB}" "${DEST_PATH}"
done
fi
if [ "${TARGETPLATFORM}" = "osx-x64" ]; then
echo "Installing dependencies for ${TARGETPLATFORM} to ${DEST_PATH}"
for LIB in soft_oal.dylib SDL2.dylib freetype6.dylib lua51.dylib; do
install -m755 "${SRC_PATH}/bin/${LIB}" "${DEST_PATH}"
done
fi
}
# Copy the core engine and specified mod data to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
# Used by:
# Makefile (install target for local installs and downstream packaging)
# Linux AppImage packaging
# macOS packaging
# Windows packaging
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
install_data() {
SRC_PATH="${1}"
DEST_PATH="${2}"
shift 2
echo "Installing engine files to ${DEST_PATH}"
for FILE in VERSION AUTHORS COPYING IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP "global mix database.dat"; do
install -m644 "${SRC_PATH}/${FILE}" "${DEST_PATH}"
done
cp -r "${SRC_PATH}/glsl" "${DEST_PATH}"
cp -r "${SRC_PATH}/lua" "${DEST_PATH}"
echo "Installing common mod files to ${DEST_PATH}"
install -d "${DEST_PATH}/mods"
cp -r "${SRC_PATH}/mods/common" "${DEST_PATH}/mods/"
while [ -n "${1}" ]; do
MOD_ID="${1}"
if [ "${MOD_ID}" = "ra" ] || [ "${MOD_ID}" = "cnc" ] || [ "${MOD_ID}" = "d2k" ]; then
echo "Installing mod ${MOD_ID} to ${DEST_PATH}"
cp -r "${SRC_PATH}/mods/${MOD_ID}" "${DEST_PATH}/mods/"
cp -r "${SRC_PATH}/mods/modcontent" "${DEST_PATH}/mods/"
fi
shift
done
}
# Compile and publish (using Mono) a windows launcher with the specified mod details to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
# TARGETPLATFORM: Platform type (win-x86, win-x64)
# MOD_ID: Mod id to launch (e.g. "ra")
# LAUNCHER_NAME: Filename (without the .exe extension) for the launcher
# MOD_NAME: Human-readable mod name to show in the crash dialog (e.g. "Red Alert")
# ICON_PATH: Path to a windows .ico file
# FAQ_URL: URL to load when the "View FAQ" button is pressed in the crash dialog (e.g. https://wiki.openra.net/FAQ)
# Used by:
# Windows packaging
# Mod SDK Windows packaging
install_windows_launcher()
{
SRC_PATH="${1}"
DEST_PATH="${2}"
TARGETPLATFORM="${3}"
MOD_ID="${4}"
LAUNCHER_NAME="${5}"
MOD_NAME="${6}"
ICON_PATH="${7}"
FAQ_URL="${8}"
msbuild -verbosity:m -nologo -t:Clean "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj"
rm -rf "${SRC_PATH:?}/bin"
msbuild -t:Build "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:LauncherIcon="${ICON_PATH}" -p:ModID="${MOD_ID}" -p:DisplayName="${MOD_NAME}" -p:FaqUrl="${FAQ_URL}"
install -m755 "${SRC_PATH}/bin/${LAUNCHER_NAME}.exe" "${DEST_PATH}"
install -m644 "${SRC_PATH}/bin/${LAUNCHER_NAME}.exe.config" "${DEST_PATH}"
# Enable the full 4GB address space for the 32 bit game executable
# The server and utility do not use enough memory to need this
if [ "${TARGETPLATFORM}" = "win-x86" ]; then
python3 "${SRC_PATH}/packaging/windows/MakeLAA.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"
fi
}
# Write a version string to the engine VERSION file
# Arguments:
# VERSION: OpenRA version string
# DEST_PATH: Path to the root of the install destination
# Used by:
# Makefile (install target for local installs and downstream packaging)
# Linux AppImage packaging
# macOS packaging
# Windows packaging
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
set_engine_version() {
VERSION="${1}"
DEST_PATH="${2}"
echo "${VERSION}" > "${DEST_PATH}/VERSION"
}
# Write a version string to a list of specified mod.yamls
# Arguments:
# VERSION: OpenRA version string
# MOD_YAML_PATH [MOD_YAML_PATH...]: One or more mod.yaml files to update
# Used by:
# Makefile (install target for local installs and downstream packaging)
# Linux AppImage packaging
# macOS packaging
# Windows packaging
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
set_mod_version() {
VERSION="${1}"
shift
while [ -n "${1}" ]; do
MOD_YAML_PATH="${1}"
awk -v v="${VERSION}" '{sub("Version:.*$", "Version: " v); print $0}' "${MOD_YAML_PATH}" > "${MOD_YAML_PATH}.tmp"
awk -v v="${VERSION}" '{sub("/[^/]*: User$", "/"v ": User"); print $0}' "${MOD_YAML_PATH}.tmp" > "${MOD_YAML_PATH}"
rm "${MOD_YAML_PATH}.tmp"
shift
done
}
# Copy launch wrappers, application icons, desktop, and MIME files to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# OPENRA_PATH: Path to the OpenRA installation (e.g. /usr/local/lib/openra)
# BIN_PATH: Path to install wrapper scripts (e.g. /usr/local/bin)
# SHARE_PATH: Parent path to the icons and applications directory (e.g. /usr/local/share)
# VERSION: OpenRA version string
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
# Used by:
# Makefile (install-linux-shortcuts target for local installs and downstream packaging)
install_linux_shortcuts() {
SRC_PATH="${1}"
OPENRA_PATH="${2}"
BIN_PATH="${3}"
SHARE_PATH="${4}"
VERSION="${5}"
shift 5
while [ -n "${1}" ]; do
MOD_ID="${1}"
if [ "${MOD_ID}" = "ra" ] || [ "${MOD_ID}" = "cnc" ] || [ "${MOD_ID}" = "d2k" ]; then
if [ "${MOD_ID}" = "cnc" ]; then
MOD_NAME="Tiberian Dawn"
fi
if [ "${MOD_ID}" = "d2k" ]; then
MOD_NAME="Dune 2000"
fi
if [ "${MOD_ID}" = "ra" ]; then
MOD_NAME="Red Alert"
fi
# bin wrappers
install -d "${DEST_PATH}/bin"
sed 's/{DEBUG}/--debug/' "${SRC_PATH}/packaging/linux/openra.in" | sed "s|{GAME_INSTALL_DIR}|${OPENRA_PATH}|" | sed "s|{BIN_DIR}|${DEST_PATH}/bin)|" | sed "s/{MODID}/${MOD_ID}/g" | sed "s/{TAG}/${VERSION}/g" | sed "s/{MODNAME}/${MOD_NAME}/g" > "${SRC_PATH}/packaging/linux/openra-${MOD_ID}"
sed 's/{DEBUG}/--debug/' "${SRC_PATH}/packaging/linux/openra-server.in" | sed "s|{GAME_INSTALL_DIR}|${OPENRA_PATH}|" | sed "s/{MODID}/${MOD_ID}/g" > "${SRC_PATH}/packaging/linux/openra-${MOD_ID}-server"
install -m755 "${SRC_PATH}/packaging/linux/openra-${MOD_ID}" "${BIN_PATH}"
install -m755 "${SRC_PATH}/packaging/linux/openra-${MOD_ID}-server" "${BIN_PATH}"
rm "${SRC_PATH}/packaging/linux/openra-${MOD_ID}" "${SRC_PATH}/packaging/linux/openra-${MOD_ID}-server"
# desktop files
install -d "${SHARE_PATH}/applications"
sed "s/{MODID}/${MOD_ID}/g" "${SRC_PATH}/packaging/linux/openra.desktop.in" | sed "s/{MODNAME}/${MOD_NAME}/g" | sed "s/{TAG}/${VERSION}/g" > "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.desktop"
install -m644 "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.desktop" "${SHARE_PATH}/applications"
rm "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.desktop"
# icons
for SIZE in 16x16 32x32 48x48 64x64 128x128; do
install -d "${SHARE_PATH}/icons/hicolor/${SIZE}/apps"
install -m644 "${SRC_PATH}/packaging/artwork/${MOD_ID}_${SIZE}.png" "${SHARE_PATH}/icons/hicolor/${SIZE}/apps/openra-${MOD_ID}.png"
done
if [ "${MOD_ID}" = "ra" ] || [ "${MOD_ID}" = "cnc" ]; then
install -d "${SHARE_PATH}/icons/hicolor/scalable/apps"
install -m644 "${SRC_PATH}/packaging/artwork/${MOD_ID}_scalable.svg" "${SHARE_PATH}/icons/hicolor/scalable/apps/openra-${MOD_ID}.svg"
fi
# MIME info
install -d "${SHARE_PATH}/mime/packages"
sed "s/{MODID}/${MOD_ID}/g" "${SRC_PATH}/packaging/linux/openra-mimeinfo.xml.in" | sed "s/{TAG}/${VERSION}/g" > "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.xml"
install -m644 "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.xml" "${SHARE_PATH}/mime/packages/openra-${MOD_ID}.xml"
rm "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.xml"
fi
shift
done
}
# Copy AppStream metadata to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# SHARE_PATH: Parent path to the appdata directory (e.g. /usr/local/share)
# MOD [MOD...]: One or more mod ids to copy (cnc, d2k, ra)
# Used by:
# Makefile (install-linux-appdata target for local installs and downstream packaging)
install_linux_appdata() {
SRC_PATH="${1}"
SHARE_PATH="${2}"
shift 2
while [ -n "${1}" ]; do
MOD_ID="${1}"
SCREENSHOT_CNC=
SCREENSHOT_D2K=
SCREENSHOT_RA=
if [ "${MOD_ID}" = "ra" ] || [ "${MOD_ID}" = "cnc" ] || [ "${MOD_ID}" = "d2k" ]; then
if [ "${MOD_ID}" = "cnc" ]; then
MOD_NAME="Tiberian Dawn"
SCREENSHOT_CNC=" type=\"default\""
fi
if [ "${MOD_ID}" = "d2k" ]; then
MOD_NAME="Dune 2000"
SCREENSHOT_D2K=" type=\"default\""
fi
if [ "${MOD_ID}" = "ra" ]; then
MOD_NAME="Red Alert"
SCREENSHOT_RA=" type=\"default\""
fi
fi
install -d "${SHARE_PATH}/appdata"
sed "s/{MODID}/${MOD_ID}/g" "${SRC_PATH}/packaging/linux/openra.appdata.xml.in" | sed "s/{MOD_NAME}/${MOD_NAME}/g" | sed "s/{SCREENSHOT_RA}/${SCREENSHOT_RA}/g" | sed "s/{SCREENSHOT_CNC}/${SCREENSHOT_CNC}/g" | sed "s/{SCREENSHOT_D2K}/${SCREENSHOT_D2K}/g"> "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.appdata.xml"
install -m644 "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.appdata.xml" "${SHARE_PATH}/appdata"
rm "${SRC_PATH}/packaging/linux/openra-${MOD_ID}.appdata.xml"
shift
done
}

View File

@@ -15,6 +15,7 @@ fi
# Set the working dir to the location of this script
cd "$(dirname "$0")" || exit 1
. ../functions.sh
TAG="$1"
OUTPUTDIR="$2"
@@ -42,20 +43,6 @@ if [ ! -d "${OUTPUTDIR}" ]; then
exit 1
fi
echo "Building core files"
pushd "${SRCDIR}" > /dev/null || exit 1
make clean
make core TARGETPLATFORM=linux-x64
make version VERSION="${TAG}"
make install-engine prefix="usr" DESTDIR="${BUILTDIR}/"
make install-common-mod-files prefix="usr" DESTDIR="${BUILTDIR}/"
make install-dependencies TARGETPLATFORM=linux-x64 prefix="usr" DESTDIR="${BUILTDIR}/"
popd > /dev/null || exit 1
# Add native libraries
echo "Downloading dependencies"
if command -v curl >/dev/null 2>&1; then
@@ -66,29 +53,21 @@ else
wget -cq https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3
fi
# 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
echo "Building AppImage"
mkdir libs
pushd libs
tar xf ../mono.tar.bz2
mkdir "${BUILTDIR}"
tar xf mono.tar.bz2 -C "${BUILTDIR}"
chmod 0755 "${BUILTDIR}/usr/bin/mono"
chmod 0644 "${BUILTDIR}/etc/mono/config"
chmod 0644 "${BUILTDIR}/etc/mono/4.5/machine.config"
chmod 0644 "${BUILTDIR}/usr/lib/mono/4.5/Facades/"*.dll
chmod 0644 "${BUILTDIR}/usr/lib/mono/4.5/"*.dll "${BUILTDIR}/usr/lib/mono/4.5/"*.exe
chmod 0755 "${BUILTDIR}/usr/lib/"*.so
install -d "${BUILTDIR}/usr/bin"
install -d "${BUILTDIR}/etc/mono/4.5"
install -d "${BUILTDIR}/usr/lib/mono/4.5/Facades"
install -Dm 0755 usr/bin/mono "${BUILTDIR}/usr/bin/"
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/Facades/*.dll); do install -Dm 0644 "$f" "${BUILTDIR}/usr/lib/mono/4.5/Facades/"; done
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); do install -Dm 0755 "$f" "${BUILTDIR}/usr/lib/"; done
popd
rm -rf libs mono.tar.bz2
rm -rf mono.tar.bz2
build_appimage() {
MOD_ID=${1}
@@ -99,28 +78,30 @@ build_appimage() {
cp -r "${BUILTDIR}" "${APPDIR}"
# Add mod files
pushd "${SRCDIR}" > /dev/null || exit 1
cp -r "mods/${MOD_ID}" mods/modcontent "${APPDIR}/usr/lib/openra/mods"
# HACK: The D2k dll is not copied by install-common-mod-files so we must do this ourselves
IS_D2K="False"
if [ "${MOD_ID}" = "d2k" ]; then
cp "bin/OpenRA.Mods.D2k.dll" "${APPDIR}/usr/lib/openra"
IS_D2K="True"
fi
popd > /dev/null || exit 1
install_assemblies_mono "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "True" "True" "${IS_D2K}"
install_data "${SRCDIR}" "${APPDIR}/usr/lib/openra" "${MOD_ID}"
set_engine_version "${TAG}" "${APPDIR}/usr/lib/openra"
set_mod_version "${TAG}" "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml" "${APPDIR}/usr/lib/openra/mods/modcontent/mod.yaml"
# Add launcher and icons
sed "s/{MODID}/${MOD_ID}/g" AppRun.in | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > AppRun.temp
install -m 0755 AppRun.temp "${APPDIR}/AppRun"
sed "s/{MODID}/${MOD_ID}/g" AppRun.in | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > "${APPDIR}/AppRun"
chmod 0755 "${APPDIR}/AppRun"
sed "s/{MODID}/${MOD_ID}/g" openra.desktop.in | sed "s/{MODNAME}/${DISPLAY_NAME}/g" | sed "s/{TAG}/${TAG}/g" | sed "s/{DISCORDAPPID}/${DISCORD_ID}/g" > temp.desktop
echo "StartupWMClass=openra-${MOD_ID}-${TAG}" >> temp.desktop
mkdir -p "${APPDIR}/usr/share/applications"
# Note that the non-discord version of the desktop file is used by the Mod SDK and must be maintained in parallel with the discord version!
sed "s/{MODID}/${MOD_ID}/g" openra.desktop.discord.in | sed "s/{MODNAME}/${DISPLAY_NAME}/g" | sed "s/{TAG}/${TAG}/g" | sed "s/{DISCORDAPPID}/${DISCORD_ID}/g" > "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop"
chmod 0755 "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop"
cp "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop" "${APPDIR}/openra-${MOD_ID}.desktop"
install -Dm 0755 temp.desktop "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop"
install -m 0755 temp.desktop "${APPDIR}/openra-${MOD_ID}.desktop"
sed "s/{MODID}/${MOD_ID}/g" openra-mimeinfo.xml.in | sed "s/{TAG}/${TAG}/g" > temp.xml
install -Dm 0755 temp.xml "${APPDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml"
mkdir -p "${APPDIR}/usr/share/mime/packages"
# Note that the non-discord version of the mimeinfo file is used by the Mod SDK and must be maintained in parallel with the discord version!
sed "s/{MODID}/${MOD_ID}/g" openra-mimeinfo.xml.discord.in | sed "s/{TAG}/${TAG}/g" | sed "s/{DISCORDAPPID}/${DISCORD_ID}/g" > "${APPDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml"
chmod 0755 "${APPDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml"
if [ -f "${ARTWORK_DIR}/${MOD_ID}_scalable.svg" ]; then
install -Dm644 "${ARTWORK_DIR}/${MOD_ID}_scalable.svg" "${APPDIR}/usr/share/icons/hicolor/scalable/apps/openra-${MOD_ID}.svg"
@@ -133,24 +114,20 @@ build_appimage() {
fi
done
sed "s/{MODID}/${MOD_ID}/g" openra.appimage.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > openra-mod.temp
install -m 0755 openra-mod.temp "${APPDIR}/usr/bin/openra-${MOD_ID}"
sed "s/{MODID}/${MOD_ID}/g" openra.appimage.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > "${APPDIR}/usr/bin/openra-${MOD_ID}"
chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}"
sed "s/{MODID}/${MOD_ID}/g" openra-server.appimage.in > openra-mod-server.temp
install -m 0755 openra-mod-server.temp "${APPDIR}/usr/bin/openra-${MOD_ID}-server"
sed "s/{MODID}/${MOD_ID}/g" openra-server.appimage.in > "${APPDIR}/usr/bin/openra-${MOD_ID}-server"
chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-server"
sed "s/{MODID}/${MOD_ID}/g" openra-utility.appimage.in > openra-mod-utility.temp
install -m 0755 openra-mod-utility.temp "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
sed "s/{MODID}/${MOD_ID}/g" openra-utility.appimage.in > "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
install -m 0755 gtk-dialog.py "${APPDIR}/usr/bin/gtk-dialog.py"
install -m 0755 restore-environment.sh "${APPDIR}/usr/bin/restore-environment.sh"
# travis-ci doesn't support mounting FUSE filesystems so extract and run the contents manually
./appimagetool-x86_64.AppImage --appimage-extract
# Embed update metadata if (and only if) compiled on travis
if [ ! -z "${TRAVIS_REPO_SLUG}" ]; then
if [ -n "${TRAVIS_REPO_SLUG}" ]; then
ARCH=x86_64 ./squashfs-root/AppRun --no-appstream -u "zsync|https://master.openra.net/appimagecheck?mod=${MOD_ID}&channel=${UPDATE_CHANNEL}" "${APPDIR}" "${OUTPUTDIR}/${APPIMAGE}"
zsyncmake -u "https://github.com/${TRAVIS_REPO_SLUG}/releases/download/${TAG}/${APPIMAGE}" -o "${OUTPUTDIR}/${APPIMAGE}.zsync" "${OUTPUTDIR}/${APPIMAGE}"
else
@@ -165,4 +142,4 @@ build_appimage "cnc" "Tiberian Dawn" "699223250181292033"
build_appimage "d2k" "Dune 2000" "712711732770111550"
# 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 "${BUILTDIR}"
rm -rf appimagetool-x86_64.AppImage squashfs-root "${BUILTDIR}"

View File

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

View File

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

View File

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

View File

@@ -4,9 +4,9 @@ Version=1.0
Name=OpenRA - {MODNAME}
GenericName=Real Time Strategy Game
GenericName[de]=Echtzeit-Strategiespiel
Comment=Reimagining of early Westwood Games
Icon=openra-{MODID}
Exec=openra-{MODID} %U
Terminal=false
Categories=Game;StrategyGame;
MimeType=x-scheme-handler/openra-{MODID}-{TAG};x-scheme-handler/discord-{DISCORDAPPID};
StartupWMClass=openra-{MODID}-{TAG}
MimeType=x-scheme-handler/openra-{MODID}-{TAG};

View File

@@ -1,3 +0,0 @@
<configuration>
<dllmap os="osx" dll="lua51.dll" target="liblua.5.1.dylib" />
</configuration>

View File

@@ -1,8 +1,9 @@
#!/bin/bash
# OpenRA packaging script for macOS
#
# The application bundles will be signed if the following environment variable is defined:
# MACOS_DEVELOPER_IDENTITY: Certificate name, of the form `Developer\ ID\ Application:\ <name with escaped spaces>`
# The application bundles will be signed if the following environment variables are defined:
# 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:
# MACOS_DEVELOPER_CERTIFICATE_BASE64: base64 content of the exported .p12 developer ID certificate.
# Generate using `base64 certificate.p12 | pbcopy`
@@ -12,6 +13,7 @@
# MACOS_DEVELOPER_USERNAME: Email address for the developer account
# MACOS_DEVELOPER_PASSWORD: App-specific password for the developer account
#
set -e
MONO_TAG="osx-launcher-20200830"
@@ -20,13 +22,14 @@ if [ $# -ne "2" ]; then
exit 1
fi
if [[ "$OSTYPE" != "darwin"* ]]; then
if [[ "${OSTYPE}" != "darwin"* ]]; then
echo >&2 "macOS packaging requires a macOS host"
exit 1
fi
# Set the working dir to the location of this script
cd "$(dirname "$0")" || exit 1
cd "$(dirname "${0}")" || exit 1
. ../functions.sh
# Import code signing certificate
if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
@@ -40,34 +43,39 @@ if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CER
rm -fr build.p12
fi
TAG="$1"
OUTPUTDIR="$2"
TAG="${1}"
OUTPUTDIR="${2}"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
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}"
}
# Copies the game files and sets metadata
populate_bundle() {
TEMPLATE_DIR="${BUILTDIR}/${1}"
MOD_ID=${2}
MOD_NAME=${3}
DISCORD_APPID=${4}
build_app() {
TEMPLATE_DIR="${1}"
LAUNCHER_DIR="${2}"
MOD_ID="${3}"
MOD_NAME="${4}"
DISCORD_APPID="${5}"
cp -r "${BUILTDIR}/OpenRA.app" "${TEMPLATE_DIR}"
LAUNCHER_CONTENTS_DIR="${LAUNCHER_DIR}/Contents"
LAUNCHER_RESOURCES_DIR="${LAUNCHER_CONTENTS_DIR}/Resources"
# Add mod files
pushd "${SRCDIR}" > /dev/null || exit 1
cp -r "mods/${MOD_ID}" mods/modcontent "${TEMPLATE_DIR}/Contents/Resources/mods"
cp -r "${TEMPLATE_DIR}" "${LAUNCHER_DIR}"
# HACK: The D2k dll is not copied by install-common-mod-files so we must do this ourselves
IS_D2K="False"
if [ "${MOD_ID}" = "d2k" ]; then
cp "bin/OpenRA.Mods.D2k.dll" "${TEMPLATE_DIR}/Contents/Resources"
IS_D2K="True"
fi
popd > /dev/null || exit 1
# Install engine and mod files
install_assemblies_mono "${SRCDIR}" "${LAUNCHER_RESOURCES_DIR}" "osx-x64" "True" "True" "${IS_D2K}"
install_data "${SRCDIR}" "${LAUNCHER_RESOURCES_DIR}" "${MOD_ID}"
set_engine_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}"
set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" "${LAUNCHER_RESOURCES_DIR}/mods/modcontent/mod.yaml"
# Assemble multi-resolution icon
mkdir "${MOD_ID}.iconset"
@@ -80,19 +88,19 @@ populate_bundle() {
cp "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${MOD_ID}.iconset/icon_256x256.png"
cp "${ARTWORK_DIR}/${MOD_ID}_512x512.png" "${MOD_ID}.iconset/icon_256x256@2x.png"
cp "${ARTWORK_DIR}/${MOD_ID}_1024x1024.png" "${MOD_ID}.iconset/icon_512x512@2x.png"
iconutil --convert icns "${MOD_ID}.iconset" -o "${TEMPLATE_DIR}/Contents/Resources/${MOD_ID}.icns"
iconutil --convert icns "${MOD_ID}.iconset" -o "${LAUNCHER_RESOURCES_DIR}/${MOD_ID}.icns"
rm -rf "${MOD_ID}.iconset"
# Copy macOS specific files
modify_plist "{MOD_ID}" "${MOD_ID}" "${TEMPLATE_DIR}/Contents/Info.plist"
modify_plist "{MOD_NAME}" "${MOD_NAME}" "${TEMPLATE_DIR}/Contents/Info.plist"
modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${TEMPLATE_DIR}/Contents/Info.plist"
modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${TEMPLATE_DIR}/Contents/Info.plist"
# Set launcher metadata
modify_plist "{MOD_ID}" "${MOD_ID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
modify_plist "{MOD_NAME}" "${MOD_NAME}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist"
# Sign binaries with developer certificate
if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements entitlements.plist "${BUILTDIR}/${1}/Contents/Resources/"*.dylib
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements entitlements.plist --deep "${BUILTDIR}/${1}"
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements entitlements.plist "${LAUNCHER_RESOURCES_DIR}/"*.dylib
codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements entitlements.plist --deep "${LAUNCHER_DIR}"
fi
}
@@ -101,47 +109,36 @@ build_platform() {
DMG_PATH="${2}"
echo "Building launchers (${PLATFORM})"
mkdir -p "${BUILTDIR}/OpenRA.app/Contents/Resources"
mkdir -p "${BUILTDIR}/OpenRA.app/Contents/MacOS"
echo "APPL????" > "${BUILTDIR}/OpenRA.app/Contents/PkgInfo"
cp Eluant.dll.config "${BUILTDIR}/OpenRA.app/Contents/Resources"
cp Info.plist.in "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
modify_plist "{DEV_VERSION}" "${TAG}" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
modify_plist "{FAQ_URL}" "http://wiki.openra.net/FAQ" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
# Prepare generic template for the mods to duplicate and customize
TEMPLATE_DIR="${BUILTDIR}/template.app"
mkdir -p "${TEMPLATE_DIR}/Contents/Resources"
mkdir -p "${TEMPLATE_DIR}/Contents/MacOS"
echo "APPL????" > "${TEMPLATE_DIR}/Contents/PkgInfo"
cp Info.plist.in "${TEMPLATE_DIR}/Contents/Info.plist"
modify_plist "{DEV_VERSION}" "${TAG}" "${TEMPLATE_DIR}/Contents/Info.plist"
modify_plist "{FAQ_URL}" "http://wiki.openra.net/FAQ" "${TEMPLATE_DIR}/Contents/Info.plist"
if [ "${PLATFORM}" = "compat" ]; then
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.9" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
clang -m64 launcher-mono.m -o "${BUILTDIR}/OpenRA.app/Contents/MacOS/OpenRA" -framework AppKit -mmacosx-version-min=10.9
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.9" "${TEMPLATE_DIR}/Contents/Info.plist"
clang -m64 launcher-mono.m -o "${TEMPLATE_DIR}/Contents/MacOS/OpenRA" -framework AppKit -mmacosx-version-min=10.9
else
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.13" "${BUILTDIR}/OpenRA.app/Contents/Info.plist"
clang -m64 launcher.m -o "${BUILTDIR}/OpenRA.app/Contents/MacOS/OpenRA" -framework AppKit -mmacosx-version-min=10.13
modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.13" "${TEMPLATE_DIR}/Contents/Info.plist"
clang -m64 launcher.m -o "${TEMPLATE_DIR}/Contents/MacOS/OpenRA" -framework AppKit -mmacosx-version-min=10.13
curl -s -L -O https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${MONO_TAG}/mono.zip || exit 3
unzip -qq -d "${BUILTDIR}/mono" mono.zip
mv "${BUILTDIR}/mono/mono" "${BUILTDIR}/OpenRA.app/Contents/MacOS/"
mv "${BUILTDIR}/mono/etc" "${BUILTDIR}/OpenRA.app/Contents/Resources"
mv "${BUILTDIR}/mono/lib" "${BUILTDIR}/OpenRA.app/Contents/Resources"
mv "${BUILTDIR}/mono/mono" "${TEMPLATE_DIR}/Contents/MacOS/"
mv "${BUILTDIR}/mono/etc" "${TEMPLATE_DIR}/Contents/Resources"
mv "${BUILTDIR}/mono/lib" "${TEMPLATE_DIR}/Contents/Resources"
rm mono.zip
rmdir "${BUILTDIR}/mono"
fi
echo "Building core files"
build_app "${TEMPLATE_DIR}" "${BUILTDIR}/OpenRA - Red Alert.app" "ra" "Red Alert" "699222659766026240"
build_app "${TEMPLATE_DIR}" "${BUILTDIR}/OpenRA - Tiberian Dawn.app" "cnc" "Tiberian Dawn" "699223250181292033"
build_app "${TEMPLATE_DIR}" "${BUILTDIR}/OpenRA - Dune 2000.app" "d2k" "Dune 2000" "712711732770111550"
pushd "${SRCDIR}" > /dev/null || exit 1
make clean
make core TARGETPLATFORM=osx-x64
make version VERSION="${TAG}"
make install-engine gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
make install-common-mod-files gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
make install-dependencies TARGETPLATFORM=osx-x64 gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
popd > /dev/null || exit 1
populate_bundle "OpenRA - Red Alert.app" "ra" "Red Alert" "699222659766026240"
populate_bundle "OpenRA - Tiberian Dawn.app" "cnc" "Tiberian Dawn" "699223250181292033"
populate_bundle "OpenRA - Dune 2000.app" "d2k" "Dune 2000" "712711732770111550"
rm -rf "${BUILTDIR}/OpenRA.app"
rm -rf "${TEMPLATE_DIR}"
echo "Packaging disk image"
hdiutil create "${DMG_PATH}" -format UDRW -volname "OpenRA" -fs HFS+ -srcfolder build
@@ -197,7 +194,7 @@ build_platform() {
notarize_package() {
DMG_PATH="${1}"
NOTARIZE_DMG_PATH="${DMG_PATH%.*}"-notarization.dmg
echo "Submitting ${PACKAGE_NAME} for notarization"
echo "Submitting ${DMG_PATH} for notarization"
# Reset xcode search path to fix xcrun not finding altool
sudo xcode-select -r

View File

@@ -19,7 +19,7 @@
!include "WordFunc.nsh"
Name "OpenRA"
OutFile "OpenRA.Setup.exe"
OutFile "${OUTFILE}"
ManifestDPIAware true

View File

@@ -1,4 +1,7 @@
#!/bin/bash
# OpenRA packaging script for Windows
set -e
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; }
@@ -12,6 +15,7 @@ fi
# Set the working dir to the location of this script
cd "$(dirname "$0")" || exit 1
. ../functions.sh
TAG="$1"
OUTPUTDIR="$2"
@@ -19,7 +23,7 @@ SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
FAQ_URL="http://wiki.openra.net/FAQ"
FAQ_URL="https://wiki.openra.net/FAQ"
SUFFIX=" (dev)"
if [[ ${TAG} == release* ]]; then
@@ -35,19 +39,8 @@ function makelauncher()
MOD_ID="${3}"
PLATFORM="${4}"
# Create multi-resolution icon
convert "${ARTWORK_DIR}/${MOD_ID}_16x16.png" "${ARTWORK_DIR}/${MOD_ID}_24x24.png" "${ARTWORK_DIR}/${MOD_ID}_32x32.png" "${ARTWORK_DIR}/${MOD_ID}_48x48.png" "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${BUILTDIR}/${MOD_ID}.ico"
# Create mod-specific launcher
msbuild -t:Build "${SRCDIR}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -restore -p:Configuration=Release -p:TargetPlatform="win-${PLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:LauncherIcon="${BUILTDIR}/${MOD_ID}.ico" -p:ModID="${MOD_ID}" -p:DisplayName="${DISPLAY_NAME}" -p:FaqUrl="${FAQ_URL}"
cp "${SRCDIR}/bin/${LAUNCHER_NAME}.exe" "${BUILTDIR}"
cp "${SRCDIR}/bin/${LAUNCHER_NAME}.exe.config" "${BUILTDIR}"
# Enable the full 4GB address space for the 32 bit game executable
# The server and utility do not use enough memory to need this
if [ "${PLATFORM}" = "x86" ]; then
python3 MakeLAA.py "${BUILTDIR}/${LAUNCHER_NAME}.exe"
fi
install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${BUILTDIR}/${MOD_ID}.ico" "${FAQ_URL}"
}
function build_platform()
@@ -55,37 +48,24 @@ function build_platform()
PLATFORM="${1}"
echo "Building core files (${PLATFORM})"
if [ "${PLATFORM}" = "win-x86" ]; then
if [ "${PLATFORM}" = "x86" ]; then
USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true"
else
USE_PROGRAMFILES32=""
fi
pushd "${SRCDIR}" > /dev/null || exit 1
make clean
make core TARGETPLATFORM="win-${PLATFORM}"
make version VERSION="${TAG}"
make install-engine TARGETPLATFORM="win-${PLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-common-mod-files gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-default-mods gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-dependencies TARGETPLATFORM="win-${PLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}"
popd > /dev/null || exit 1
install_assemblies_mono "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "False" "True" "True"
install_data "${SRCDIR}" "${BUILTDIR}" "cnc" "d2k" "ra"
set_engine_version "${TAG}" "${BUILTDIR}"
set_mod_version "${TAG}" "${BUILTDIR}/mods/cnc/mod.yaml" "${BUILTDIR}/mods/d2k/mod.yaml" "${BUILTDIR}/mods/ra/mod.yaml" "${BUILTDIR}/mods/modcontent/mod.yaml"
echo "Compiling Windows launchers (${PLATFORM})"
makelauncher "RedAlert" "Red Alert" "ra" ${PLATFORM}
makelauncher "TiberianDawn" "Tiberian Dawn" "cnc" ${PLATFORM}
makelauncher "Dune2000" "Dune 2000" "d2k" ${PLATFORM}
# Remove redundant generic launcher
rm "${BUILTDIR}/OpenRA.exe"
makelauncher "RedAlert" "Red Alert" "ra" "${PLATFORM}"
makelauncher "TiberianDawn" "Tiberian Dawn" "cnc" "${PLATFORM}"
makelauncher "Dune2000" "Dune 2000" "d2k" "${PLATFORM}"
echo "Building Windows setup.exe ($1)"
makensis -V2 -DSRCDIR="${BUILTDIR}" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" ${USE_PROGRAMFILES32} OpenRA.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "${OUTPUTDIR}/OpenRA-${TAG}-${PLATFORM}.exe"
else
exit 1
fi
makensis -V2 -DSRCDIR="${BUILTDIR}" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" -DOUTFILE="${OUTPUTDIR}/OpenRA-${TAG}-${PLATFORM}.exe" ${USE_PROGRAMFILES32} OpenRA.nsi || exit 1
echo "Packaging zip archive ($1)"
pushd "${BUILTDIR}" > /dev/null