Merge pull request #13215 from pchote/packaging-simplification

Overhaul packaging scripts
This commit is contained in:
abcdefg30
2017-05-10 16:34:01 +02:00
committed by GitHub
11 changed files with 218 additions and 296 deletions

View File

@@ -1,76 +0,0 @@
#!/bin/bash
ARGS=1
E_BADARGS=85
if [ $# -ne "$ARGS" ]; then
echo "Usage: `basename $0` tag"
exit $E_BADARGS
fi
msg () {
echo -ne $1
echo $2
echo -ne "\E[0m"
}
TAG=$1
VERSION=`echo $TAG | grep -o "[0-9]\\+-\\?[0-9]\\?"`
_gitroot="git://github.com/OpenRA/OpenRA.git"
_gitname="OpenRA"
if [ -z $VERSION ]; then
msg "\E[31m" "Malformed tag $TAG"
exit 1
fi
if [ ! -d ~/openra-package/ ]; then
mkdir ~/openra-package/
fi
pushd ~/openra-package/ &> /dev/null
msg "\E[32m" "Connecting to GIT server...."
if [ -d $_gitname ] ; then
pushd $_gitname &> /dev/null && git pull origin
msg "\E[32m" "The local files are updated."
popd &> /dev/null # $_gitname
else
git clone $_gitroot $_gitname
fi
msg "\E[32m" "GIT checkout done or server timeout"
rm -rf "$_gitname-build"
git clone "$_gitname" "$_gitname-build"
pushd "$_gitname-build" &> /dev/null
msg "\E[32m" "Checking out $TAG"
git checkout $TAG &> /dev/null
if [ $? -ne 0 ]; then
msg "\E[31m" "Checkout of $TAG failed."
exit 1
fi
pushd packaging &> /dev/null
if [ ! -d ~/openra-package/packages/ ] ; then
mkdir ~/openra-package/packages/
fi
./package-all.sh $TAG ~/openra-package/packages/
echo "Downloading source code packages from GitHub..."
curl -s -L -o "$HOME/openra-package/packages/$TAG.tar.gz" "https://github.com/OpenRA/OpenRA/archive/$TAG.tar.gz"
if [ $? -ne 0 ]; then
echo "Source code package download failed."
fi
./upload-all.sh $TAG ~/openra-package/packages
./update-wiki.sh
popd &> /dev/null # packaging
popd &> /dev/null # $_gitname-build
popd &> /dev/null # ~/openra-package/

View File

@@ -1,10 +0,0 @@
#!/bin/bash
rm -rf packaging/linux/root
rm -rf packaging/built
rm packaging/linux/package.log
rm packaging/linux/deb/package.log
rm packaging/linux/rpm/package.log
rm packaging/linux/pkgbuild/package.log
rm packaging/osx/package.log
rm packaging/windows/package.log

View File

@@ -1,41 +1,60 @@
#!/bin/bash
# OpenRA packaging master script for linux packages
if [ $# -ne "3" ]; then
echo "Usage: `basename $0` tag files-dir outputdir"
command -v curl >/dev/null 2>&1 || { echo >&2 "Linux packaging requires curl."; exit 1; }
command -v markdown >/dev/null 2>&1 || { echo >&2 "Linux packaging requires markdown."; exit 1; }
if [ $# -ne "2" ]; then
echo "Usage: `basename $0` tag outputdir"
exit 1
fi
TAG=$1
VERSION=`echo $TAG | grep -o "[0-9]\\+-\\?[0-9]\\?"`
BUILTDIR=$2
PACKAGEDIR=$3
ROOTDIR=root
# Set the working dir to the location of this script
cd $(dirname $0)
TAG="${1}"
VERSION=`echo ${TAG} | grep -o "[0-9]\\+-\\?[0-9]\\?"`
OUTPUTDIR="${2}"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
# Clean up
rm -rf $ROOTDIR
rm -rf ${BUILTDIR}
cd ../..
echo "Building core files"
# Copy files for OpenRA.Game.exe and OpenRA.Editor.exe as well as all dependencies.
make install prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
pushd ${SRCDIR} > /dev/null
make linux-dependencies
make core SDK="-sdk:4.5"
make version VERSION="${TAG}"
# Install startup scripts, desktop files and icons
make install-linux-shortcuts prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-linux-mime prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-linux-appdata prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-man-page prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install-core prefix="/usr" DESTDIR="${BUILTDIR}"
make install-linux-shortcuts prefix="/usr" DESTDIR="${BUILTDIR}"
make install-linux-mime prefix="/usr" DESTDIR="${BUILTDIR}"
make install-linux-appdata prefix="/usr" DESTDIR="${BUILTDIR}"
make install-man-page prefix="/usr" DESTDIR="${BUILTDIR}"
popd > /dev/null
# Documentation
mkdir -p $PWD/packaging/linux/$ROOTDIR/usr/share/doc/openra/
cp *.html $PWD/packaging/linux/$ROOTDIR/usr/share/doc/openra/
DOCSDIR="${BUILTDIR}/usr/share/doc/openra/"
pushd packaging/linux/deb >/dev/null
echo "Building Debian package."
./buildpackage.sh "$TAG" ../$ROOTDIR "$PACKAGEDIR"
mkdir -p "${DOCSDIR}"
curl -s -L -O https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md
markdown Changelog.md > "${DOCSDIR}/Changelog.html"
rm Changelog.md
markdown ${SRCDIR}/README.md > "${DOCSDIR}/README.html"
markdown ${SRCDIR}/CONTRIBUTING.md > "${DOCSDIR}/CONTRIBUTING.html"
pushd deb >/dev/null
echo "Building Debian package"
./buildpackage.sh "${TAG}" "${BUILTDIR}" "${OUTPUTDIR}"
if [ $? -ne 0 ]; then
echo "Debian package build failed."
fi
popd >/dev/null
rm -rf $PWD/packaging/linux/$ROOTDIR/
rm -rf "${BUILTDIR}"

View File

@@ -1,22 +1,32 @@
#!/bin/bash
# OpenRA packaging script for Debian based distributions
LINUX_BUILD_ROOT="$(readlink -f "$2")"
DEB_BUILD_ROOT=./root
command -v fakeroot >/dev/null 2>&1 || { echo >&2 "Debian packaging requires fakeroot."; exit 1; }
command -v dpkg-deb >/dev/null 2>&1 || { echo >&2 "Debian packaging requires dpkg-deb."; exit 1; }
LIBDIR=/usr/lib/openra
DOCDIR=/usr/share/doc/openra
LINTIANORDIR=/usr/share/lintian/overrides
E_BADARGS=85
if [ $# -ne "3" ]
then
echo "Usage: `basename $0` version root-dir outputdir"
exit $E_BADARGS
fi
DATE=`echo $1 | grep -o "[0-9]\\+-\\?[0-9]\\?"`
# Set the working dir to the location of this script
cd $(dirname $0)
TAG="${1}"
LINUX_BUILD_ROOT="${2}"
OUTPUTDIR="${3}"
DEB_BUILD_ROOT="$(pwd)/build"
LIBDIR=/usr/lib/openra
DOCDIR=/usr/share/doc/openra
LINTIANORDIR=/usr/share/lintian/overrides
E_BADARGS=85
DATE=`echo ${TAG} | grep -o "[0-9]\\+-\\?[0-9]\\?"`
TYPE=`echo $1 | grep -o "^[a-z]*"`
VERSION="$DATE.$TYPE"
VERSION="${DATE}.${TYPE}"
# Copy template files into a clean build directory (required)
mkdir "${DEB_BUILD_ROOT}"
@@ -62,21 +72,32 @@ rm "${DEB_BUILD_ROOT}/${LIBDIR}/COPYING"
chmod -R g-w "${DEB_BUILD_ROOT}"
# Create the control file
PACKAGE_SIZE=`du --apparent-size -c "${DEB_BUILD_ROOT}/usr" | grep "total" | awk '{print $1}'`
sed "s/{VERSION}/$VERSION/" DEBIAN/control | sed "s/{SIZE}/$PACKAGE_SIZE/" > "${DEB_BUILD_ROOT}/DEBIAN/control"
if [[ "$OSTYPE" == "darwin"* ]]; then
# BSD du doesn't have an --apparent-size flag, so we must accept a different result
PACKAGE_SIZE=`du -c "${DEB_BUILD_ROOT}/usr" | grep "total" | awk '{print $1}'`
else
PACKAGE_SIZE=`du --apparent-size -c "${DEB_BUILD_ROOT}/usr" | grep "total" | awk '{print $1}'`
fi
sed "s/{VERSION}/${VERSION}/" DEBIAN/control | sed "s/{SIZE}/${PACKAGE_SIZE}/" > "${DEB_BUILD_ROOT}/DEBIAN/control"
# Build it in the temp directory, but place the finished deb in our starting directory
pushd "${DEB_BUILD_ROOT}" >/dev/null
# Calculate md5sums and clean up the ./usr/ part of them
find . -type f -not -path "./DEBIAN/*" -print0 | xargs -0 -n1 md5sum | sed 's|\./usr/|usr/|' > DEBIAN/md5sums
if [[ "$OSTYPE" == "darwin"* ]]; then
find . -type f -not -path "./DEBIAN/*" -print0 | xargs -0 -n1 openssl md5 | awk '{ print $2, substr($1, 7, length($1)-8) }' > DEBIAN/md5sums
else
find . -type f -not -path "./DEBIAN/*" -print0 | xargs -0 -n1 md5sum | sed 's|\./usr/|usr/|' > DEBIAN/md5sums
fi
chmod 0644 DEBIAN/md5sums
# Replace any dashes in the version string with periods
PKGVERSION=`echo $1 | sed "s/-/\\./g"`
PKGVERSION=`echo ${TAG} | sed "s/-/\\./g"`
# Start building, the file should appear in the output directory
fakeroot dpkg-deb -b . "$3/openra_${PKGVERSION}_all.deb"
fakeroot dpkg-deb -b . "${OUTPUTDIR}/openra_${PKGVERSION}_all.deb"
# Clean up
popd >/dev/null

View File

@@ -1,22 +1,28 @@
#!/bin/bash
# OpenRA packaging script for Mac OSX
# OpenRA packaging script for macOS
command -v curl >/dev/null 2>&1 || { echo >&2 "macOS packaging requires curl."; exit 1; }
command -v markdown >/dev/null 2>&1 || { echo >&2 "macOS packaging requires markdown."; exit 1; }
if [[ "$OSTYPE" != "darwin"* ]]; then
command -v cmake >/dev/null 2>&1 || { echo >&2 "macOS packaging requires cmake."; exit 1; }
command -v genisoimage >/dev/null 2>&1 || { echo >&2 "macOS packaging requires genisoimage."; exit 1; }
fi
LAUNCHER_TAG="osx-launcher-20170414"
if [ $# -ne "3" ]; then
echo "Usage: `basename $0` tag files-dir outputdir"
if [ $# -ne "2" ]; then
echo "Usage: `basename $0` tag outputdir"
exit 1
fi
# Dirty build dir; last build failed?
if [ -e "OpenRA.app" ]; then
echo "Error: OpenRA.app already exists"
exit 2
fi
# Set the working dir to the location of this script
cd $(dirname $0)
TAG="$1"
BUILTDIR="$2"
OUTPUTDIR="$3"
OUTPUTDIR="$2"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
modify_plist() {
sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3"
@@ -24,50 +30,59 @@ modify_plist() {
# Copies the game files and sets metadata
populate_template() {
cp -r OpenRA.app "build/$1"
cp -r $BUILTDIR/* "build/$1/Contents/Resources/" || exit 3
cp "$2.icns" "build/$1/Contents/Resources/OpenRA.icns"
modify_plist "{MOD_ID}" "$2" "build/$1/Contents/Info.plist"
modify_plist "{MOD_NAME}" "$3" "build/$1/Contents/Info.plist"
modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-$2-$TAG" "build/$1/Contents/Info.plist"
TEMPLATE_DIR="${BUILTDIR}/${1}"
MOD_ID=${2}
MOD_NAME=${3}
cp -r "${BUILTDIR}/OpenRA.app" "${TEMPLATE_DIR}"
# Copy macOS specific files
cp "${MOD_ID}.icns" "${TEMPLATE_DIR}/Contents/Resources/OpenRA.icns"
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"
}
# Deletes from the first argument's mod dirs all the later arguments
delete_mods() {
pushd "build/$1/Contents/Resources/mods" > /dev/null
pushd "${BUILTDIR}/${1}/Contents/Resources/mods" > /dev/null
shift
rm -rf $@
pushd > /dev/null
}
echo "Building libdmg-hfsplus"
# Cloning is very slow, so fetch zip instead
curl -s -L -O https://github.com/OpenRA/libdmg-hfsplus/archive/master.zip || exit 3
unzip -qq master.zip
rm master.zip
pushd libdmg-hfsplus-master > /dev/null
cmake . > /dev/null
make > /dev/null
popd > /dev/null
echo "Building launchers"
curl -s -L -O https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${LAUNCHER_TAG}/launcher.zip || exit 3
unzip -qq launcher.zip
unzip -qq -d "${BUILTDIR}" launcher.zip
rm launcher.zip
mkdir -p build/.DropDMGBackground
mkdir -p "${BUILTDIR}/.DropDMGBackground"
# Background image is created from source svg in artsrc repository
# exported to tiff at 72 + 144 DPI, then combined using
# tiffutil -cathidpicheck bg.tiff bg2x.tiff -out background.tiff
cp background.tiff build/.DropDMGBackground
cp background.tiff "${BUILTDIR}/.DropDMGBackground"
# Finder metadata created using free trial of DropDMG
cp DS_Store build/.DS_Store
cp DS_Store "${BUILTDIR}/.DS_Store"
ln -s /Applications/ build/Applications
ln -s /Applications/ "${BUILTDIR}/Applications"
modify_plist "{DEV_VERSION}" "${1}" "OpenRA.app/Contents/Info.plist"
modify_plist "{FAQ_URL}" "http://wiki.openra.net/FAQ" "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"
echo "Building core files"
pushd ${SRCDIR} > /dev/null
make osx-dependencies
make core SDK="-sdk:4.5"
make version VERSION="${TAG}"
make install-core gameinstalldir="/Contents/Resources/" DESTDIR="${BUILTDIR}/OpenRA.app"
popd > /dev/null
curl -s -L -O https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md
markdown Changelog.md > "${BUILTDIR}/OpenRA.app/Contents/Resources/CHANGELOG.html"
rm Changelog.md
markdown "${SRCDIR}/README.md" > "${BUILTDIR}/OpenRA.app/Contents/Resources/README.html"
markdown "${SRCDIR}/CONTRIBUTING.md" > "${BUILTDIR}/OpenRA.app/Contents/Resources/CONTRIBUTING.html"
populate_template "OpenRA - Red Alert.app" "ra" "Red Alert"
delete_mods "OpenRA - Red Alert.app" "cnc" "d2k"
@@ -78,9 +93,33 @@ delete_mods "OpenRA - Tiberian Dawn.app" "ra" "d2k"
populate_template "OpenRA - Dune 2000.app" "d2k" "Dune 2000"
delete_mods "OpenRA - Dune 2000.app" "ra" "cnc"
rm -rf "${BUILTDIR}/OpenRA.app"
echo "Packaging disk image"
genisoimage -V OpenRA -D -R -apple -no-pad -o build.dmg build
libdmg-hfsplus-master/dmg/dmg dmg ./build.dmg "$3/OpenRA-$1.dmg"
if [[ "$OSTYPE" == "darwin"* ]]; then
hdiutil create -volname OpenRA -srcfolder build -ov -format UDZO "${OUTPUTDIR}/OpenRA-${TAG}.dmg"
else
echo "Building libdmg-hfsplus"
# Cloning is very slow, so fetch zip instead
curl -s -L -O https://github.com/OpenRA/libdmg-hfsplus/archive/master.zip || exit 3
unzip -qq master.zip
rm master.zip
pushd libdmg-hfsplus-master > /dev/null
cmake . > /dev/null
make > /dev/null
popd > /dev/null
if [[ ! -f libdmg-hfsplus-master/dmg/dmg ]] ; then
echo "libdmg-hfsplus compilation failed"
exit 3
fi
genisoimage -V OpenRA -D -R -apple -no-pad -o build.dmg build
libdmg-hfsplus-master/dmg/dmg dmg ./build.dmg "${OUTPUTDIR}/OpenRA-${TAG}.dmg"
rm build.dmg
fi
# Clean up
rm -rf OpenRA.app build.dmg libdmg-hfsplus-master build
rm -rf libdmg-hfsplus-master "${BUILTDIR}"

View File

@@ -6,95 +6,31 @@ if [ $# -ne "2" ]; then
exit 1
fi
# Resolve the absolute source path from the location of this script
SRCDIR=$(readlink -f $(dirname $0)/../)
BUILTDIR="${SRCDIR}/packaging/built"
TAG=$1
OUTPUTDIR=$(readlink -f $2)
# Build the code and push the files into a clean dir
cd "$SRCDIR"
mkdir packaging/built
mkdir packaging/built/mods
make package
# Remove the mdb files that are created during `make`
find . -path "*.mdb" -delete
test -e Changelog.md && rm Changelog.md
curl -s -L -O https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md
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.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe'
'OpenRA.Platforms.Default.dll' \
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modcontent' \
'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \
'global mix database.dat' 'GeoLite2-Country.mmdb.gz')
echo "Copying files..."
for i in "${FILES[@]}"; do
cp -R "${i}" "packaging/built/${i}" || exit 3
done
# SharpZipLib for zip file support
cp thirdparty/download/ICSharpCode.SharpZipLib.dll packaging/built
# FuzzyLogicLibrary for improved AI
cp thirdparty/download/FuzzyLogicLibrary.dll packaging/built
# SharpFont for FreeType support
cp thirdparty/download/SharpFont* packaging/built
# SDL2-CS
cp thirdparty/download/SDL2-CS* packaging/built
# OpenAL-CS
cp thirdparty/download/OpenAL-CS* packaging/built
# Open.NAT for UPnP support
cp thirdparty/download/Open.Nat.dll packaging/built
# Eluant (Lua integration)
cp thirdparty/download/Eluant* packaging/built
# GeoIP database access
cp thirdparty/download/MaxMind.Db.dll packaging/built
# global chat
cp thirdparty/download/SmarIrc4net.dll packaging/built
cd packaging
echo "Creating packages..."
# Set the working dir to the location of this script
cd $(dirname $0)
pushd windows >/dev/null
./buildpackage.sh "$TAG" "$BUILTDIR" "$SRCDIR" "$OUTPUTDIR"
echo "Building Windows package"
./buildpackage.sh "$1" "$2"
if [ $? -ne 0 ]; then
echo "Windows package build failed."
fi
popd >/dev/null
pushd osx >/dev/null
echo "Building OS X package"
./buildpackage.sh "$TAG" "$BUILTDIR" "$OUTPUTDIR"
echo "Building macOS package"
./buildpackage.sh "$1" "$2"
if [ $? -ne 0 ]; then
echo "OS X package build failed."
echo "macOS package build failed."
fi
popd >/dev/null
pushd linux >/dev/null
echo "Building Linux packages"
./buildpackage.sh "$TAG" "$BUILTDIR" "$OUTPUTDIR"
./buildpackage.sh "$1" "$2"
if [ $? -ne 0 ]; then
echo "Linux package build failed."
fi
popd >/dev/null
echo "Package build done."
rm -rf $BUILTDIR

View File

@@ -26,8 +26,9 @@ chmod 0600 "$SSH_KEY"
rm -rf $HOME/openra-wiki
git clone git@github.com:OpenRA/OpenRA.wiki.git $HOME/openra-wiki
cp -fr ../DOCUMENTATION.md "${HOME}/openra-wiki/Traits${TAG}.md"
cp -fr ../Lua-API.md "${HOME}/openra-wiki/Lua API${TAG}.md"
mono --debug ../OpenRA.Utility.exe all --docs > "${HOME}/openra-wiki/Traits${TAG}.md"
mono --debug ../OpenRA.Utility.exe all --lua-docs > "${HOME}/openra-wiki/Lua API${TAG}.md"
pushd $HOME/openra-wiki
git config --local user.email "orabot@users.noreply.github.com"

View File

@@ -1,23 +0,0 @@
#!/bin/bash
UPLOADUSER=openra
SERVER=openra.res0l.net
PATHBASE="openra.res0l.net/assets/downloads"
upload () {
PLATFORM=$1
FILENAME=$2
scp "${FILENAME}" ${UPLOADUSER}@${SERVER}:${PATHBASE}/${PLATFORM}/
}
TAG=$1
PKGDIR=$2
LINUXVERSION=`echo ${TAG} | sed "s/-/\\./g"`
cd ${PKGDIR}
upload windows OpenRA-${TAG}.exe
upload mac OpenRA-${TAG}.zip
upload linux/deb openra_${LINUXVERSION}_all.deb
upload linux/rpm openra-${LINUXVERSION}-1.noarch.rpm
upload linux/arch openra-${LINUXVERSION}-1-any.pkg.tar.xz
upload source ${TAG}.tar.gz

View File

@@ -110,7 +110,6 @@ Section "Game" GAME
File "${SRCDIR}\README.html"
File "${SRCDIR}\CHANGELOG.html"
File "${SRCDIR}\CONTRIBUTING.html"
File "${SRCDIR}\DOCUMENTATION.html"
File "${SRCDIR}\OpenRA.ico"
File "${SRCDIR}\RedAlert.ico"
File "${SRCDIR}\TiberianDawn.ico"
@@ -220,7 +219,6 @@ Function ${UN}Clean
Delete $INSTDIR\README.html
Delete $INSTDIR\CHANGELOG.html
Delete $INSTDIR\CONTRIBUTING.html
Delete $INSTDIR\DOCUMENTATION.html
Delete $INSTDIR\OpenRA.ico
Delete $INSTDIR\RedAlert.ico
Delete $INSTDIR\TiberianDawn.ico

View File

@@ -1,17 +1,29 @@
#!/bin/bash
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
command -v markdown >/dev/null 2>&1 || { echo >&2 "Windows packaging requires markdown."; exit 1; }
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
if [ $# -ne "2" ]; then
echo "Usage: `basename $0` tag outputdir"
exit 1
fi
# Set the working dir to the location of this script
cd $(dirname $0)
TAG="$1"
BUILTDIR="$2"
SRCDIR="$3"
OUTPUTDIR="$4"
OUTPUTDIR="$2"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe"
FAQ_URL="http://wiki.openra.net/FAQ"
SUFFIX=" (dev)"
if [[ $TAG == release* ]]; then
if [[ ${TAG} == release* ]]; then
SUFFIX=""
elif [[ $TAG == playtest* ]]; then
elif [[ ${TAG} == playtest* ]]; then
SUFFIX=" (playtest)"
fi
@@ -20,29 +32,41 @@ function makelauncher()
sed "s|DISPLAY_NAME|$2|" WindowsLauncher.cs.in | sed "s|MOD_ID|$3|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs
mcs -sdk:4.5 WindowsLauncher.cs -warn:4 -codepage:utf8 -warnaserror -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4"
rm WindowsLauncher.cs
mono ${SRCDIR}/fixheader.exe $1 > /dev/null
mono "${SRCDIR}/fixheader.exe" $1 > /dev/null
}
echo "Building core files"
pushd ${SRCDIR} > /dev/null
make windows-dependencies
make core SDK="-sdk:4.5"
make version VERSION="${TAG}"
make install-core gameinstalldir="" DESTDIR="${BUILTDIR}"
popd > /dev/null
echo "Compiling Windows launchers"
makelauncher ${BUILTDIR}/RedAlert.exe "Red Alert" "ra" RedAlert.ico
makelauncher ${BUILTDIR}/TiberianDawn.exe "Tiberian Dawn" "cnc" TiberianDawn.ico
makelauncher ${BUILTDIR}/Dune2000.exe "Dune 2000" "d2k" Dune2000.ico
makelauncher "${BUILTDIR}/RedAlert.exe" "Red Alert" "ra" RedAlert.ico
makelauncher "${BUILTDIR}/TiberianDawn.exe" "Tiberian Dawn" "cnc" TiberianDawn.ico
makelauncher "${BUILTDIR}/Dune2000.exe" "Dune 2000" "d2k" Dune2000.ico
# Windows specific icons
cp OpenRA.ico RedAlert.ico TiberianDawn.ico Dune2000.ico ${BUILTDIR}
# Windows specific files
cp OpenRA.ico RedAlert.ico TiberianDawn.ico Dune2000.ico "${BUILTDIR}"
cp "${SRCDIR}/OpenRA.Game.exe.config" "${BUILTDIR}"
if [ -x /usr/bin/makensis ]; then
echo "Building Windows setup.exe"
makensis -V2 -DSRCDIR="$BUILTDIR" -DDEPSDIR="${SRCDIR}/thirdparty/download/windows" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" OpenRA.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "$OUTPUTDIR"/OpenRA-$TAG.exe
else
exit 1
fi
curl -s -L -O https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md
markdown Changelog.md > "${BUILTDIR}/CHANGELOG.html"
rm Changelog.md
markdown "${SRCDIR}/README.md" > "${BUILTDIR}/README.html"
markdown "${SRCDIR}/CONTRIBUTING.md" > "${BUILTDIR}/CONTRIBUTING.html"
echo "Building Windows setup.exe"
makensis -V2 -DSRCDIR="${BUILTDIR}" -DDEPSDIR="${SRCDIR}/thirdparty/download/windows" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" OpenRA.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "${OUTPUTDIR}/OpenRA-$TAG.exe"
else
echo "Skipping Windows setup.exe build due to missing NSIS"
exit 1
fi
# Cleanup
rm ${BUILTDIR}/OpenRA.ico ${BUILTDIR}/RedAlert.ico ${BUILTDIR}/TiberianDawn.ico ${BUILTDIR}/Dune2000.ico
rm ${BUILTDIR}/RedAlert.exe ${BUILTDIR}/TiberianDawn.exe ${BUILTDIR}/Dune2000.exe
rm -rf "${BUILTDIR}"