diff --git a/.gitignore b/.gitignore index 24244cd849..5cfee6b657 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3 # auto-generated documentation DOCUMENTATION.md +Lua-API.md *.html # StyleCop diff --git a/.travis.yml b/.travis.yml index 02949f0030..343cfb7dc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/INSTALL.md b/INSTALL.md index e32f2633d5..ba01f4329d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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'. diff --git a/Makefile b/Makefile index b1a07b2c03..55cdbfb537 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/configure b/configure new file mode 100755 index 0000000000..4490455b63 --- /dev/null +++ b/configure @@ -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 \ No newline at end of file diff --git a/packaging/linux/buildpackage.sh b/packaging/linux/buildpackage.sh index cc38f3f577..111bd660ea 100755 --- a/packaging/linux/buildpackage.sh +++ b/packaging/linux/buildpackage.sh @@ -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/ diff --git a/packaging/package-all.sh b/packaging/package-all.sh index 5feda0b25a..9a96eaa58d 100755 --- a/packaging/package-all.sh +++ b/packaging/package-all.sh @@ -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' \ diff --git a/thirdparty/Eluant.dll.config.in b/thirdparty/Eluant.dll.config.in new file mode 100644 index 0000000000..6c00f329f4 --- /dev/null +++ b/thirdparty/Eluant.dll.config.in @@ -0,0 +1,3 @@ + + + diff --git a/thirdparty/SDL2-CS.dll.config b/thirdparty/SDL2-CS.dll.config index 85592006e0..9637cfe6b5 100644 --- a/thirdparty/SDL2-CS.dll.config +++ b/thirdparty/SDL2-CS.dll.config @@ -1,21 +1,18 @@ - - + - - diff --git a/thirdparty/Eluant.dll.config b/thirdparty/linux/Eluant.dll.config similarity index 74% rename from thirdparty/Eluant.dll.config rename to thirdparty/linux/Eluant.dll.config index 2795a21468..5e2566f319 100644 --- a/thirdparty/Eluant.dll.config +++ b/thirdparty/linux/Eluant.dll.config @@ -1,5 +1,4 @@ - diff --git a/thirdparty/linux/SDL2-CS.dll.config b/thirdparty/linux/SDL2-CS.dll.config new file mode 100644 index 0000000000..85bfbbec94 --- /dev/null +++ b/thirdparty/linux/SDL2-CS.dll.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/thirdparty/osx/Eluant.dll.config b/thirdparty/osx/Eluant.dll.config new file mode 100644 index 0000000000..43be429756 --- /dev/null +++ b/thirdparty/osx/Eluant.dll.config @@ -0,0 +1,3 @@ + + +