Commit 8537501f authored by Manuel Moos's avatar Manuel Moos
Browse files

Merge from legacy_0.2.8.3 with adaptions

See merge request !120
parents 822778b7 cd7ae6d9
Pipeline #266524941 passed with stages
in 27 minutes and 26 seconds
......@@ -103,3 +103,4 @@ src/.cproject
src/.project
src/.settings
autogen.sh
.vscode
......@@ -28,11 +28,10 @@ default:
# common before script: bootstrap, configure, make dist, prepare docker builds
before_script:
- if ! test -d gitlab_build; then
- docker help > /dev/null
- which docker && docker help > /dev/null
- touch timestamp.tag
- test "x${ARMAGETRONAD_FAKERELEASE}" == "x" && export ARMAGETRONAD_FAKERELEASE=false
- test -r configure || ./bootstrap.sh
- ls docker/build -al
- cat version.m4
- mkdir -p gitlab_build
- cd gitlab_build
......@@ -40,7 +39,7 @@ default:
- ../configure --prefix=/usr/local --disable-glout --disable-sysinstall --disable-desktop progname="${PROGRAM_NAME}" progtitle="${PROGRAM_TITLE}"
- test "x${ARMAGETRONAD_FAKERELEASE}" == "xtrue" && cp ../docker/build/fakerelease_proto.sh docker/build/fakerelease.sh
- cd docker/build
- make CI_prepare -j`nproc`
- make CI_prepare -j`nproc || echo 3`
- cd ../../../
- else
- find . -newer timestamp.tag ! -path "./gitlab_build" -exec touch -r timestamp.tag \{\} \;
......@@ -227,6 +226,27 @@ build_server_32:
- gitlab_build/docker/build/
expire_in: 1 day
# macOS builds need a special runner, but can start early.
# iIt should build directly from git content, the prepared linux source directories have soft links that won't work.
build_macos:
needs: []
dependencies: []
tags:
- macos
stage: build_main
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- when: on_success
script:
- docker/scripts/obsolete.sh || exit 0
- gitlab_build/docker/build/make_ci.sh macOS -j`nproc || echo 3`
artifacts:
paths:
- gitlab_build/docker/build/upload
- gitlab_build/docker/build/macOS/*.tag
expire_in: 1 day
build_collect:
stage: build_collect
rules:
......
......@@ -509,6 +509,8 @@ GENERICUNIX
)
SDL_CONFIG_DEFAULT=sdl-config
macosx=false
OBJC="not_needed_on_this_platform"
dnl *************************************************
dnl GL AND MATHLIB SELECTION ( SYSTEM DEPENDANT)
......@@ -532,6 +534,8 @@ case "$target" in
SYS_GL_LIB=""
SYS_GLU_LIB=""
test x$build_regular = xfalse || LIBS="$LIBS -framework OpenGL"
unset OBJC
macosx=true
dnl -framework GLU -framework Quicktime -lsmpeg"
;;
*-*-aix*)
......@@ -569,8 +573,13 @@ SAFEUNIX
;;
esac
dnl Objective C:
AC_PROG_OBJC
test -z "$SDL_CONFIG" && SDL_CONFIG=$SDL_CONFIG_DEFAULT
AM_CONDITIONAL(MACOSX, test x$macosx = xtrue)
AC_SUBST(docstyle)
#processor specific setup
......@@ -997,7 +1006,6 @@ src/doc/Makefile src/doc/net/Makefile src/doc/Doxyfile
src/doc/html.m4
src/thirdparty/Makefile
src/thirdparty/particles/Makefile
src/macosx/entrypoint.sh
src/macosx/build_bundle.sh
resource/Makefile
config/Makefile
......
......@@ -100,4 +100,21 @@ Then, run the runner with
gitlab-runner run
Security and consistency implication: You then only have one docker instance. Jobs running on your runner can therefore modify the same docker images, for example apply tags. Therefore, all our CI scripts reference used images by their digest and use randomized names for containers so they don't get into one another's way.
\ No newline at end of file
Security and consistency implication: You then only have one docker instance. Jobs running on your runner can therefore modify the same docker images, for example apply tags. Therefore, all our CI scripts reference used images by their digest and use randomized names for containers so they don't get into one another's way.
## macOS
macOS builds happen from this directory, too, without the need for docker. Of course, WITH docker, you can do all the other builds on a Mac.
Prerequisites:
brew install pkg-config autoconf automake sdl sdl_image sdl2 sdl2_image sdl2_mixer protobuf-c glew boost ftgl dylibbundler create-dmg wget python3
For a GitLab runner, choose a VirtualBox based runner. Use [this](https://github.com/myspaghetti/macos-virtualbox) script to create a Mojave VM,
then follow the [runner installation instructions](https://docs.gitlab.com/runner/install/osx.html). An important preparation step for building the
.dmg files correctly is that the builder user needs the rights to remote control Finder; for that, just ssh into the machine as the build user (can be from
within the VM itself) and do a test compilation run.
The macOS builds are done with
cd docker/build
make macOS
......@@ -78,7 +78,7 @@ all: default
dockertest.tag:
cp ${srcdir}/fakerelease_proto.sh .
@echo "Testing whether 'docker' works..."
docker help > /dev/null
if which docker; then docker help > /dev/null; fi
echo > $@
tarwrapper.sh: ${top_srcdir}/docker/scripts/tarwrapper.sh
......@@ -216,12 +216,17 @@ context.steam: context.64 gits_artifacts.tag
rm $@.dir/image
echo "armasteam_64" > $@.dir/image
# rebrand
sed -i $@.dir/version.sh -e s/PACKAGE_NAME=armagetronad/PACKAGE_NAME=$(STEAM_PACKAGE_TITLE)/ -e s/PACKAGE_TITLE=\"Armagetron\ Advanced/PACKAGE_TITLE=\"$(STEAM_PACKAGE_TITLE)/ -e s/PACKAGE_TITLE=\"Armagetron/PACKAGE_TITLE=\"$(STEAM_PACKAGE_TITLE)/
rm -f $@.dir/version.sh # required because the source and dest are hard links to the same file originally
sed < $<.dir/version.sh > $@.dir/version.sh -e s/PACKAGE_NAME=armagetronad/PACKAGE_NAME=$(STEAM_PACKAGE_TITLE)/ -e s/PACKAGE_TITLE=\"Armagetron\ Advanced/PACKAGE_TITLE=\"$(STEAM_PACKAGE_TITLE)/ -e s/PACKAGE_TITLE=\"Armagetron/PACKAGE_TITLE=\"$(STEAM_PACKAGE_TITLE)/
# no remotely adult stuff
sed -i $@.dir/source/src/engine/ePlayer.cpp -e "s/pr0n/cat videos/"
rm -f $@.dir/source/src/engine/ePlayer.cpp
sed < $<.dir/source/src/engine/ePlayer.cpp > $@.dir/source/src/engine/ePlayer.cpp -e "s/pr0n/cat videos/"
# install alternative title, adapt sources
cp gits/steam/title.png $@.dir/source/textures/
sed -i $@.dir/source/src/tron/gLogo.cpp $@.dir/source/Makefile.* -e "s,textures/title.jpg,textures/title.png,"
for f in source/src/tron/gLogo.cpp source/src/Makefile.am; do \
rm -f $@.dir/$$f; \
sed < $<.dir/$$f > $@.dir/$$f -e "s,textures/title.jpg,textures/title.png,"; \
done
cd $@.dir/source; automake
# done
echo > $@
......@@ -267,6 +272,48 @@ context.test: rootcontext.64
#***************************************************************
# macOS builds are done without docker
MACOS_CONFIG_ARGS="--disable-sysinstall --disable-etc --prefix=/usr"
MACOS_BUILD_BUNDLE="./src/macosx/build_bundle.sh"
macOS/client_build.tag: context.64 #Makefile
mkdir -p macOS/client
cd macOS/client && ../../$<.dir/source/configure "${MACOS_CONFIG_ARGS}" && ${MAKE}
echo > $@
macOS/client.tag: macOS/client_build.tag upload/.tag #Makefile
rm -rf macOS/client/*.app
cd macOS/client && bash ${MACOS_BUILD_BUNDLE}
cp macOS/client/*.dmg macOS/client/*.macOS.zip upload/
echo > $@
macOS/server_build.tag: context.64 #Makefile
mkdir -p macOS/server
cd macOS/server && ../../$<.dir/source/configure --disable-glout "${MACOS_CONFIG_ARGS}" && ${MAKE}
echo > $@
macOS/server.tag: macOS/server_build.tag upload/.tag #Makefile
rm -rf macOS/server/*.app
cd macOS/server && bash ${MACOS_BUILD_BUNDLE}
cp macOS/server/*.dmg macOS/server/*.macOS.zip upload/
echo > $@
macOS/steam_build.tag: context.steam #Makefile
mkdir -p macOS/steam
cd macOS/steam && ../../$<.dir/source/configure "${MACOS_CONFIG_ARGS}" progname="${STEAM_PACKAGE_NAME}" progtitle="${STEAM_PACKAGE_TITLE}" && ${MAKE}
echo > $@
macOS/steam.tag: macOS/steam_build.tag upload/.tag #Makefile
rm -rf macOS/steam/*.app
cd macOS/steam && bash ${MACOS_BUILD_BUNDLE}
cp macOS/steam/*.dmg macOS/steam/*.macOS.zip upload/
echo > $@
macOS_build: macOS/client_build.tag macOS/server_build.tag #macOS/steam_build.tag
macOS: macOS/client.tag macOS/server.tag #macOS/steam.tag
#***************************************************************
context.build_server_%: context.%
${srcdir}/prepare_context.sh $@.dir $<.dir/'*'
echo "server" > $@.dir/serverclient
......@@ -585,33 +632,6 @@ zeroinstall: zeroinstall.tag
#***************************************************************
# build on the mac via GitHub Actions. Requires staging.
context.macbuild: rootcontext.64 ${srcdir}/../deploy/*_macbuild.sh ${srcdir}/../deploy/wait_for_upload.sh ../deploy/* CI_INFO
${srcdir}/prepare_context.sh $@.dir $<.dir/'*' ../deploy/'*' ${srcdir}/../deploy/*_macbuild.sh ${srcdir}/../deploy/wait_for_upload.sh CI_INFO ${srcdir}/../scripts/.cache/gits/macOS
rm -f $@.dir/image
echo "armadeploy_64" > $@.dir/image
echo > $@
result.macbuild: context.macbuild
+$(srcdir)/context_to_result.sh $@.dir ./deploy_macbuild.sh
echo > $@
# only build macOS if we're not staging
macbuild: macbuild.tag
macbuild.tag: maybe_macbuild_${STAGING}.tag
touch $@
maybe_macbuild_.tag:
touch $@
maybe_macbuild_true.tag:
touch $@
maybe_macbuild_false.tag: result.macbuild upload/.tag
cp $<.dir/upload/${PROGRAM_TITLE}* upload/
# rm -rf steamdirs/steam_macOS.dir
# mkdir -p steamdirs/steam_macOS.dir
# cd steamdirs/steam_macOS.dir; unzip ../../$<.dir/upload/${STEAM_PACKAGE_NAME}-${PACKAGE_VERSION}.macOS.zip
touch $@
#***************************************************************
steamdirs/.tag:
mkdir -p steamdirs
echo > $@
......@@ -680,7 +700,7 @@ deploy_external: deploy_essential deploy_steam
# targets in our control
deploy_ours: result.deploy_zi result.deploy_download deploy_external
context.deploy_base_%: rootcontext.64 deploy_base.tag ${srcdir}/../deploy/deploy_%.sh ${srcdir}/../deploy/wait_for_upload.sh ../deploy/* CI_INFO macbuild
context.deploy_base_%: rootcontext.64 deploy_base.tag ${srcdir}/../deploy/deploy_%.sh ${srcdir}/../deploy/wait_for_upload.sh ../deploy/* CI_INFO
${srcdir}/prepare_context.sh $@.dir $<.dir/'*' upload ../deploy/'*' ${srcdir}/../deploy/deploy_$*.sh ${srcdir}/../deploy/wait_for_upload.sh CI_INFO
echo > $@
context.deploy_%: context.deploy_base_%
......@@ -843,7 +863,7 @@ artifactclean:
-rf
clean: intermediateclean
rm \
rm -rf \
*.tag \
gits \
proto \
......@@ -852,8 +872,9 @@ clean: intermediateclean
source \
steamdirs \
test.* \
upload \
-rf
macOS \
upload
if git -C ${srcdir} rev-parse --abbrev-ref HEAD > /dev/null; then rm -f CI_INFO; fi
distclean: clean
rm -rf $(TARBALL) CI_INFO
......
......@@ -11,7 +11,8 @@
set -x
wd="`dirname $0`"
bic="`readlink -f ${wd}/build_in_container.sh`"
bic="`readlink -f ${wd}/build_in_container.sh 2> /dev/null`" || \
bic="`greadlink -f ${wd}/build_in_container.sh`" || exit $?
name="$1"
shift
......
......@@ -14,20 +14,26 @@ echo -e "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\
set -x
rm -rf ${target}
mkdir -p ${target}
rm -rf "${target}"
mkdir -p "${target}"
if ! cp -lrf context/version.sh $@ ${target}/; then
rm -rf ${target}/version.sh
cp -lrf context/version.sh ${target}/ || { rm -rf ${target}; exit 1; }
if ! cp -lrf context/version.sh $@ "${target}"/ > /dev/null 2>&1; then
ln -f context/version.sh "${target}"/ || { rm -rf "${target}"; exit 1; }
for f in $@; do
rm -rf ${target}/`basename $f`
cp -lrf $f ${target}/ || { rm -rf ${target}; exit 1; }
rm -rf "${target}/`basename $f`"
if test -f "$f"; then
ln -f "$f" "${target}"/|| { rm -rf "${target}"; exit 1; }
else
if which rsync > /dev/null 2>&1; then
rsync -qav --link-dest="$f" "$f" "${target}/" || { rm -rf "${target}"; exit 1; }
else
cp -lrf "$f" "${target}/" || { rm -rf "${target}"; exit 1; }
fi
fi
done
fi
if test -f fakerelease.sh; then
rm -rf ${target}/fakerelease.sh
cp -lrf fakerelease.sh ${target}/
ln -f fakerelease.sh "${target}/"
fi
#!/bin/bash
# update and push macOS build on GitHib
set +x
mv secrets/ssh ~/.ssh
rm -rf secrets/*
set -x
. ./version.sh || exit $?
. ./targets.sh || exit $?
dd=`dirname $0`
# get tarball URI, make sure it exists
TAR_FILENAME=${PACKAGE_NAME}-${PACKAGE_VERSION}.tbz
TAR_URI=${DOWNLOAD_URI_BASE_STAGING}${TAR_FILENAME}
./wait_for_upload.sh ${TAR_URI} || exit $?
trust_github || exit $?
BRANCH_BASE=${ZI_SERIES}
pushd macOS || exit $?
DEPLOY_BRANCH=deploy_${BRANCH_BASE}_${VERSION_SERIES}
# take current cached revision, put it into the deploy branch
git branch -d ${DEPLOY_BRANCH} > /dev/null 2>&1 || true
git checkout -b ${DEPLOY_BRANCH} || exit $?
git remote add upstream ${MACOS_GIT} || exit $?
STEAM_PACKAGE_NAME=retrocycles
STEAM_PACKAGE_TITLE=Retrocycles
#PACKAGE_NAME_SUFFIX="`echo ${PACKAGE_NAME} | sed -e "s,.*-,-,"`"
#PACKAGE_TITLE_SUFFIX="`echo ${PACKAGE_TITLE} | sed -e "s,.* , ,"`"
#PROGTITLE_RC="${STEAM_PACKAGE_TITLE}${PACKAGE_TITLE_SUFFIX}"
#PROGNAME_RC="${STEAM_PACKAGE_NAME}${PACKAGE_NAME_SUFFIX}"
# write new definiton file
cat > INFO <<EOF
TARBALL=${TAR_URI}
VERSION=${PACKAGE_VERSION}
BRANCH=${ZI_SERIES}
PROGTITLE_RC="${STEAM_PACKAGE_TITLE}"
PROGNAME_RC="${STEAM_PACKAGE_NAME}"
UPLOAD=${UPLOAD_SCP_BASE_STAGING}${SF_DIR}/${PACKAGE_VERSION}/macOS
EOF
cat INFO
CHANGED=`git status --short -uno | sed -e "s/^ . //"`
if test -z "${CHANGED}"; then
echo "Nothing updated."
exit 0
fi
# commit and push
git commit . -m "Update to version ${PACKAGE_VERSION}" || exit $?
if ! test ${STAGING} == true; then
git push --force --set-upstream upstream ${DEPLOY_BRANCH} || exit $?
fi
popd
# cleanup
rm -rf source upload secrets secrets.*
if test ${STAGING} == true; then
# just staging, no actual build is done
exit 0
fi
# wait for result
sleep 300
MACOS_DOWNLOAD=${DOWNLOAD_URI_BASE_STAGING}/macOS/
timeout=5
ERROR=1
while test ${timeout} -gt -1; do
if ./wait_for_upload.sh ${MACOS_DOWNLOAD}mac_is_done.txt; then
timeout=-2
ERROR=0
else
ERROR=$?
fi
timeout=$(( ${timeout} - 1 ))
done
test ${ERROR} == 0 || exit ${ERROR}
mkdir upload
for ext in dmg macOS.zip; do
for base in ${PACKAGE_NAME} ${PACKAGE_NAME}-dedicated; do #${STEAM_PACKAGE_NAME}; do
FILE=${base}-${PACKAGE_VERSION}.${ext}
curl ${MACOS_DOWNLOAD}${FILE} --fail --silent --show-error -L -o upload/${FILE} || exit $?
done
done
......@@ -32,7 +32,6 @@ function ensure_git(){
return 0
}
ensure_git macOS https://github.com/ArmagetronAd/macOS.git || exit $?
ensure_git winlibs https://gitlab.com/armagetronad/winlibs.git || exit $?
ensure_git codeblocks https://gitlab.com/armagetronad/build_codeblocks.git || exit $?
ensure_git steam-art https://gitlab.com/armagetronad/steam-art.git master || exit $?
......
......@@ -19,7 +19,6 @@ function fix_gits(){
set -x
# On merge conflicts here: run update_gits.sh, that sorts things out
fix_git macOS 279af5a4086248e428682c2f2bd0f08c4d049e45 || return $?
fix_git winlibs d03e20bf8973a6cbd1e0ecb47dd8333c5614b139 || return $?
fix_git codeblocks c633fa6599c888d92156648a882d76f3ca15b610 || return $?
fix_git steam-art 7b3930ab85a3dfbb1caffaa17442b670c823f314 || return $?
......
......@@ -48,7 +48,6 @@ function fix_gits(){
EOF
fix_git macOS
fix_git winlibs
fix_git codeblocks
fix_git steam-art
......
......@@ -88,14 +88,20 @@ libengine_a_SOURCES=engine/eAdvWall.cpp engine/eAdvWall.h engine/eAuthentication
engine/eLagCompensation.cpp engine/eLagCompensation.h\
engine/eChat.cpp engine/eChat.h
if MACOSX
# put extra Objective C files here, like so:
#render_extra=render/rScreenHelper.h render/rScreenHelper.m
render_extra=
else
render_extra=
endif
librender_a_SOURCES=render/rConsole.cpp render/rConsoleGraph.cpp render/rConsole.h render/rFont.cpp\
librender_a_SOURCES=${render_extra} render/rConsole.cpp render/rConsoleGraph.cpp render/rConsole.h render/rFont.cpp\
render/rFont.h render/rGL.h render/rGL.cpp render/rGLRender.cpp render/rModel.cpp render/rModel.h render/rRender.cpp\
render/rDisplayList.h render/rDisplayList.cpp \
render/rRender.h render/rScreen.cpp render/rScreen.h render/rSDL.h render/rSysdep.cpp render/rSysdep.h\
render/rTexture.cpp render/rTexture.h render/rViewport.cpp render/rViewport.h
libtron_a_SOURCES=tron/gAIBase.cpp tron/gAIBase.h tron/gAICharacter.cpp tron/gAICharacter.h tron/gArena.cpp tron/gArena.h\
tron/gArmagetron.cpp tron/gCamera.cpp tron/gCamera.h tron/gCycle.cpp tron/gCycle.h tron/gCycleMovement.cpp\
tron/gCycleMovement.h tron/gExplosion.cpp tron/gExplosion.h tron/gGame.cpp tron/gGame.h\
......
......@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Armagetron Advanced</string>
<string>usr/bin/armagetronad</string>
<key>CFBundleIconFile</key>
<string>Armagetron Advanced.icns</string>
<key>CFBundleIdentifier</key>
......@@ -22,5 +22,6 @@
<string>SDLMain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key><false/>
</dict>
</plist>
......@@ -10,13 +10,12 @@ BUNDLE="${DIR}/${TITLE}.app"
mkdir -p "${BUNDLE}" || exit $?
# add launcher
cp `dirname $0`/entrypoint.sh "${BUNDLE}/${TITLE}" || exit $?
chmod 755 "${BUNDLE}/${TITLE}" || exit $?
# add plist with @v@ -> value and progtitle replacements
REL_SRCDIR=`echo @srcdir@ | sed -e s,^@top_builddir@/,,` || exit $?
sed < "${REL_SRCDIR}/Info.plist" > "${BUNDLE}/Info.plist" -e "s,Armagetron Advanced,${TITLE},g" || exit $?
sed < "${REL_SRCDIR}/Info.plist" > "${BUNDLE}/Info.plist" \
-e "s,Armagetron Advanced,${TITLE},g" \
-e "s,usr/bin/armagetronad,./@prefix@/bin/@progname@,g" \
|| exit $?
mkdir -p "${BUNDLE}/English.lproj" || exit $?
sed < "${REL_SRCDIR}/English.lproj/InfoPlist.strings.in" > "${BUNDLE}/English.lproj/InfoPlist.strings" \
-e "s,Armagetron Advanced,${TITLE},g" \
......@@ -32,7 +31,10 @@ cp "${REL_TOP_SRCDIR}/MacOS/Armagetron Advanced.icns" "${BUNDLE}/${TITLE}.icns"
DESTDIR="${BUNDLE}" make install || exit $?
# bundle libraries
(cd "${BUNDLE}"; dylibbundler -od -b -x "./@prefix@/bin/@progname@" -d "./@prefix@/libs/") || exit $?
(cd "${BUNDLE}"; dylibbundler -od -b -x "./@prefix@/bin/@progname@" -d "./@prefix@/libs/" -i /usr/lib/) || exit $?
# for debugging pure app bundle builds
# exit 0
# zip
(cd "${BUNDLE}" && zip -r ../@progname@-@version@.macOS.zip .) || exit $?
......
#!/bin/zsh
cd "`dirname "$0"`"
.@prefix@/bin/@progname@ "$@"
\ No newline at end of file
......@@ -728,7 +728,7 @@ tMemManager::tMemManager(int s):size(s){//,blocks(1000),full_blocks(1000){
std::ifstream l(leakname);
while (l.good() && !l.eof()){
int cs{-1},ln{0};
int cs = -1,ln = 0;
l >> cs >> ln;
if (cs>=0 && cs < MAXCHECKSUM && (ln < leaks[cs] || leaks[cs] == 0))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment