Merge pull request #5460 from Mailaender/system-libraries

Added support for SDL2 and Lua 5.1 system libraries
This commit is contained in:
Paul Chote
2014-06-01 18:14:05 +12:00
12 changed files with 102 additions and 52 deletions

1
.gitignore vendored
View File

@@ -52,6 +52,7 @@ OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3
# auto-generated documentation
DOCUMENTATION.md
Lua-API.md
*.html
# StyleCop

View File

@@ -11,8 +11,8 @@ cache: apt
# Run the build script
# call RALint to check for YAML errors
# Test run the packaging scripts for all platforms
script:
- make dependencies
- make all
- make test

View File

@@ -15,7 +15,7 @@ Windows
To compile OpenRA, open the `OpenRA.sln` solution in the main folder,
or build it from the command-line with MSBuild.
Copy both the native DLLs from `.\packaging\windows`
Copy both the native DLLs from `.\thirdparty\windows`
and the CLI images from `.\thirdparty` to the main folder.
Run the game with `OpenRA.Game.exe Game.Mod=ra` for Red Alert
@@ -24,7 +24,7 @@ or `OpenRA.Game.exe Game.Mod=cnc` for Tiberian Dawn.
Linux
=====
To grab the bundled CLI DLLs type `make dependencies`.
Run `./configure` to map the native libraries to your system.
To compile OpenRA, run `make all` from the command line.
Run with either `launch-game.sh' or `mono --debug OpenRA.Game.exe'.

View File

@@ -18,8 +18,8 @@
# to install with development tools, run:
# make [prefix=/foo] [bindir=/bar/bin] install-all
#
# to install Linux desktop files and icons:
# make install-shortcuts
# to install Linux startup scripts, desktop files and icons:
# make install-linux-shortcuts
#
# to uninstall, run:
# make uninstall
@@ -48,10 +48,11 @@ prefix ?= /usr/local
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
bindir ?= $(prefix)/bin
libexecdir ?= $(prefix)/lib
libdir ?= $(prefix)/lib
gameinstalldir ?= $(libdir)/openra
BIN_INSTALL_DIR = $(DESTDIR)$(bindir)
# TODO: separate data and binaries properly
DATA_INSTALL_DIR = $(DESTDIR)$(libexecdir)/openra
DATA_INSTALL_DIR = $(DESTDIR)$(gameinstalldir)
# install tools
RM = rm
@@ -66,8 +67,8 @@ INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
# program targets
CORE = rsdl2 rnull game utility irc
TOOLS = editor tsbuild ralint
CORE = rsdl2 rnull game utility irc ralint
TOOLS = editor tsbuild crashdialog
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
@@ -251,7 +252,7 @@ $(foreach prog,$(PROGRAMS),$(eval $(call BUILD_ASSEMBLY,$(prog))))
########################## MAKE/INSTALL RULES ##########################
#
default: dependencies core
default: cli-dependencies core
core: game renderers mods utility ralint
@@ -261,7 +262,7 @@ package: dependencies core editor crashdialog docs version
mods: mod_ra mod_cnc mod_d2k mod_ts
all: dependencies core tools
all: cli-dependencies core tools
clean:
@-$(RM_F) *.exe *.dll ./OpenRA*/*.dll ./OpenRA*/*.mdb *.mdb mods/**/*.dll mods/**/*.mdb *.resources
@@ -274,8 +275,13 @@ ifeq ($(shell uname),Darwin)
platformdeps = "osx"
endif
dependencies:
@ $(CP_R) thirdparty/*.dl* .
dependencies: cli-dependencies native-dependencies
cli-dependencies:
@ $(CP_R) thirdparty/*.dll .
@ $(CP_R) thirdparty/*.dll.config .
native-dependencies:
@ $(CP_R) thirdparty/${platformdeps}/* .
version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/modchooser/mod.yaml
@@ -287,11 +293,14 @@ version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/modchooser/mo
# Documentation (d2k depends on all mod libraries)
docs: utility
@mono --debug OpenRA.Utility.exe --docs d2k > DOCUMENTATION.md
@mono --debug OpenRA.Utility.exe --lua-docs ra > Lua-API.md
install: install-core
install-all: install-core install-tools
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
install-core: default
@-echo "Installing OpenRA to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
@@ -314,20 +323,19 @@ install-core: default
@$(CP_R) glsl "$(DATA_INSTALL_DIR)"
@$(CP_R) lua "$(DATA_INSTALL_DIR)"
@$(CP) *.ttf "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/SDL2-CS* "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/Eluant* "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/FuzzyLogicLibrary.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/SharpFont.dll "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/SharpFont.dll.config "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/Mono.Nat.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/KopiLua.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/NLua.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/MaxMind.Db.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/MaxMind.GeoIP2.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/Newtonsoft.Json.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) thirdparty/RestSharp.dll "$(DATA_INSTALL_DIR)"
@$(CP) thirdparty/${platformdeps}/* "$(DATA_INSTALL_DIR)"
@$(CP) SDL2-CS* "$(DATA_INSTALL_DIR)"
@$(CP) Eluant* "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) FuzzyLogicLibrary.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) SharpFont.dll "$(DATA_INSTALL_DIR)"
@$(CP) SharpFont.dll.config "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) Mono.Nat.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) KopiLua.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) NLua.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) MaxMind.Db.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) MaxMind.GeoIP2.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) Newtonsoft.Json.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) RestSharp.dll "$(DATA_INSTALL_DIR)"
ifeq ($(shell uname),Linux)
@$(CP) *.sh "$(DATA_INSTALL_DIR)"
@@ -338,36 +346,30 @@ install-tools: tools
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) $(foreach prog,$(TOOLS),$($(prog)_TARGET)) "$(DATA_INSTALL_DIR)"
install-shortcuts:
install-linux-icons:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/"
@$(CP_R) packaging/linux/hicolor/ "$(DESTDIR)$(datadir)/icons"
install-linux-desktop:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-editor.desktop "$(DESTDIR)$(datadir)/applications"
install-linux-scripts:
@echo "#!/bin/sh" > openra
@echo 'BINDIR=$$(dirname $$(readlink -f $$0))' >> openra
@echo 'ROOTDIR="$${BINDIR%'"$(bindir)"'}"' >> openra
@echo 'EXECDIR="$${ROOTDIR}'"$(libexecdir)"'"' >> openra
@echo 'cd "$${EXECDIR}/openra"' >> openra
@echo 'cd "$(gameinstalldir)"' >> openra
@echo 'exec mono OpenRA.Game.exe "$$@"' >> openra
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx openra "$(BIN_INSTALL_DIR)"
@-$(RM) openra
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra.desktop "$(DESTDIR)$(datadir)/applications"
@echo "#!/bin/sh" > openra-editor
@echo 'BINDIR=$$(dirname $$(readlink -f $$0))' >> openra-editor
@echo 'ROOTDIR="$${BINDIR%'"$(bindir)"'}"' >> openra-editor
@echo 'EXECDIR="$${ROOTDIR}'"$(libexecdir)"'"' >> openra-editor
@echo 'cd "$${EXECDIR}/openra"' >> openra-editor
@echo 'cd "$(gameinstalldir)"' >> openra-editor
@echo 'exec mono OpenRA.Editor.exe "$$@"' >> openra-editor
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx openra-editor "$(BIN_INSTALL_DIR)"
@-$(RM) openra-editor
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-editor.desktop "$(DESTDIR)$(datadir)/applications"
uninstall:
@-$(RM_R) "$(DATA_INSTALL_DIR)"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra"
@@ -401,8 +403,8 @@ help:
@echo to install with development tools, run:
@echo \ \ make \[prefix=/foo\] \[bindir=/bar/bin\] install-all
@echo
@echo to install Linux desktop files and icons
@echo \ \ make install-shortcuts
@echo to install Linux startup scripts, desktop files and icons
@echo \ \ make install-linux-shortcuts
@echo
@echo to uninstall, run:
@echo \ \ make uninstall

24
configure vendored Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Use Linux system dependencies where possible, but take into account different .so names.
os=`uname`
if [ "$os" == 'Linux' ]; then
locations=(/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu /usr/local/lib /opt/lib)
sonames=(liblua5.1.so.5.1 liblua5.1.so.0 liblua.so.5.1 liblua-5.1.so liblua5.1.so)
for location in "${locations[@]}" ; do
for soname in ${sonames[@]} ; do
if [ -f $location/$soname ]; then
liblua51=$soname
echo "Detected Lua 5.1 library at "$location/$soname
break 2
fi
done
done
if [ -z "$liblua51" ]; then
echo "Lua 5.1 library detection failed."
exit 1
else
sed "s/@LIBLUA51@/${liblua51}/" thirdparty/Eluant.dll.config.in > Eluant.dll.config
echo "Eluant.dll.config has been created successfully."
fi
fi

View File

@@ -21,12 +21,17 @@ cd ../..
# Copy files for OpenRA.Game.exe and OpenRA.Editor.exe as well as all dependencies.
make install-all prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
# Icons and .desktop files
make install-shortcuts prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
cp $DEPSDIR/* $PWD/packaging/linux/$ROOTDIR/usr/lib/openra/
# Install startup scripts, desktop files and icons
make install-linux-shortcuts prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
# Remove the WinForms dialog which is replaced with a native one provided by zenity
rm $PWD/packaging/linux/$ROOTDIR/usr/lib/openra/OpenRA.CrashDialog.exe
# Remove the WinForms tileset builder which does not work outside the source tree
rm $PWD/packaging/linux/$ROOTDIR/usr/lib/openra/OpenRA.TilesetBuilder.exe
# Documentation
mkdir -p $PWD/packaging/linux/$ROOTDIR/usr/share/doc/openra/
cp *.html $PWD/packaging/linux/$ROOTDIR/usr/share/doc/openra/

View File

@@ -27,6 +27,7 @@ markdown Changelog.md > CHANGELOG.html
markdown README.md > README.html
markdown CONTRIBUTING.md > CONTRIBUTING.html
markdown DOCUMENTATION.md > DOCUMENTATION.html
markdown Lua-API.md > Lua-API.html
# List of files that are packaged on all platforms
FILES=('OpenRA.Game.exe' 'OpenRA.Editor.exe' 'OpenRA.Utility.exe' 'OpenRA.CrashDialog.exe' \

3
thirdparty/Eluant.dll.config.in vendored Normal file
View File

@@ -0,0 +1,3 @@
<configuration>
<dllmap os="linux" dll="lua51.dll" target="@LIBLUA51@" />
</configuration>

View File

@@ -1,21 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<dllmap os="linux" dll="SDL2.dll" cpu="x86" target="libSDL232.2.0.2.so" />
<dllmap os="linux" dll="SDL2.dll" cpu="x86-64" target="libSDL264.2.0.2.so" />
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0" />
<dllmap dll="soft_oal.dll" os="osx" target="/System/Library/Frameworks/OpenAL.framework/OpenAL"/>
<dllmap dll="soft_oal.dll" os="linux" target="libopenal.so.1"/>
<dllmap dll="opengl32.dll">
<dllentry os="linux" dll="libGL.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/OpenGL" />
</dllmap>
<dllmap dll="glu32.dll">
<dllentry os="linux" dll="libGLU.so.1" />
<dllentry os="windows" dll="opengl32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib" />
</dllmap>
</configuration>

View File

@@ -1,5 +1,4 @@
<configuration>
<dllmap os="linux" dll="lua51.dll" cpu="x86" target="liblua32.5.1.5.so" />
<dllmap os="linux" dll="lua51.dll" cpu="x86-64" target="liblua64.5.1.5.so" />
<dllmap os="osx" dll="lua51.dll" target="liblua.5.1.dylib" />
</configuration>

15
thirdparty/linux/SDL2-CS.dll.config vendored Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap os="linux" dll="SDL2.dll" cpu="x86" target="libSDL232.2.0.2.so" />
<dllmap os="linux" dll="SDL2.dll" cpu="x86-64" target="libSDL264.2.0.2.so" />
<dllmap dll="soft_oal.dll" os="linux" target="libopenal.so.1"/>
<dllmap dll="opengl32.dll">
<dllentry os="linux" dll="libGL.so.1" />
</dllmap>
<dllmap dll="glu32.dll">
<dllentry os="linux" dll="libGLU.so.1" />
</dllmap>
</configuration>

3
thirdparty/osx/Eluant.dll.config vendored Normal file
View File

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