Sunday, August 08, 2021

Re: Teeworlds update - Teeworlds 0.7.5

Stuart Henderson wrote:
> On 2019/07/17 17:05, Neon King wrote:
>> Hello dear ports@readers,
>>
>> The following diff upgrades Teeworlds game to the latest version. Changelog
>> is available on their homepage https://teeworlds.com/

I've fixed up this port and updated teeworlds to version 0.7.5.
Note that version 0.7.x is incompatible with servers from 0.6.x.

- switched to GH_*
- moved to cmake and dropped BAM
- dropped unnecessary patches (all of them)
- avoid git from running (new patch)
- the strict-alignment crash *should* be resolved. The TODO in the code
is gone and the function looks different now
- replaced SDL with SDL2
- update to python3

All the fixes for build.lua, configure.lua and scripts/* are not
necessary anymore because the cmake build is not using these files.

The only file used in the script/ folder is cmd5.py.

The maps (teeworlds-data) are optional. They are downloaded on demand
when playing. I'm not sure if they are necessary when hosting a game.
The previous port did not contain them. But as Neon King got them
hosted, I included them as well.

I tried to go around the local copy of DejavuSans.ttf. Unfortunately the
current version does not pick up the system font. It shows buttons
without text. System wavpack and zlib are still used. The bundled
pnglite is used.

Portcheck and make port-lib-depends-check are happy. Tested on amd64.
I also played this for a few hours on various servers.

I won't mind taking MAINTAINER for this port, but as Neon King and
Donovan (CC) offered port updates earlier, I won't mind if they pick
this up.

OK?

Best Regards,
Stefan

Index: games/teeworlds/Makefile
===================================================================
RCS file: /cvs/ports/games/teeworlds/Makefile,v
retrieving revision 1.28
diff -u -p -u -p -r1.28 Makefile
--- games/teeworlds/Makefile 23 Feb 2021 19:39:23 -0000 1.28
+++ games/teeworlds/Makefile 8 Aug 2021 19:58:01 -0000
@@ -1,76 +1,56 @@
# $OpenBSD: Makefile,v 1.28 2021/02/23 19:39:23 sthen Exp $

-# Crashes on strict-alignment archs, see: src/base/system.c:164
ONLY_FOR_ARCHS= amd64 i386 powerpc

COMMENT= platform game featuring buggers equipped with weapons

-V= 0.6.4
-DISTNAME= teeworlds-${V}-src
-PKGNAME= teeworlds-${V}
+V= 0.7.5
+GH_ACCOUNT= teeworlds
+GH_PROJECT= teeworlds
+GH_TAGNAME= ${V}
+
CATEGORIES= games
-REVISION= 3

-HOMEPAGE= https://www.teeworlds.com/
+HOMEPAGE= https://www.teeworlds.com

-BAM_VERSION= 0.4.0
-BAM_WRKSRC= ${WRKSRC}/bam-${BAM_VERSION}
+PKGNAME= ${GH_PROJECT}-${V}
+DISTNAME= ${PKGNAME}-src

-MASTER_SITES= https://downloads.teeworlds.com/
-DISTFILES=
${DISTNAME}${EXTRACT_SUFX} bam-${BAM_VERSION}${EXTRACT_SUFX}
+MASTER_SITES= https://github.com/teeworlds/teeworlds/releases/download/${V}/
+# maps repo without tags/releases on https://github.com/teeworlds/teeworlds-maps
+# therefore hosted as archive on perso.pw
+MASTER_SITES0= http://distfiles-openbsd.perso.pw/
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} teeworlds-data.tar.gz:0

# BSD-like
PERMIT_PACKAGE= Yes

-WANTLIB= GL GLU SDL X11 c freetype m pthread ${COMPILER_LIBCXX} wavpack z
+WANTLIB= GL SDL2 X11 c crypto freetype m pthread ${COMPILER_LIBCXX}
+WANTLIB+= wavpack z

COMPILER = base-clang ports-gcc

LIB_DEPENDS= audio/wavpack \
- devel/sdl
+ devel/sdl2

-MODULES= lang/python
-MODPY_VERSION = ${MODPY_DEFAULT_VERSION_2}
+MODULES= devel/cmake lang/python
+MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
MODPY_RUNDEP= No

-SUBST_VARS= CC CXX CFLAGS CXXFLAGS X11BASE
+CONFIGURE_STYLE= cmake
+CONFIGURE_ARGS= -DPYTHON_EXECUTABLE="${MODPY_BIN}"

NO_TEST= Yes

+WRKSRC= ${WRKDIR}/${DISTNAME}
+WRKDIST= ${WRKSRC}
+
# Give it a chance on ppc
CXXFLAGS+= -fsigned-char

-post-extract:
- @mv ${WRKDIR}/bam-${BAM_VERSION} ${BAM_WRKSRC}
-
-pre-configure:
- @${SUBST_CMD} ${WRKSRC}/src/engine/shared/storage.cpp \
- ${WRKSRC}/src/game/client/gameclient.cpp \
- ${WRKSRC}/scripts/build.py \
- ${WRKSRC}/scripts/compiler.py \
- ${WRKSRC}/scripts/font_installer.sh \
- ${WRKSRC}/scripts/make_src.py \
- ${WRKSRC}/bam.lua \
- ${WRKSRC}/configure.lua \
- ${BAM_WRKSRC}/make_unix.sh \
- ${BAM_WRKSRC}/src/driver_gcc.lua \
- ${BAM_WRKSRC}/src/base.lua
- # Make sure internal wavpack and zlib can't be picked up
- rm -rf ${WRKSRC}/src/engine/external/{wavpack,zlib}
- # Don't provide an extra copy of DejaVu
- rm -rf ${WRKSRC}/data/fonts
-
-# build bam executable - teeworlds own build system
-pre-build:
- cd ${BAM_WRKSRC} && /bin/sh -v make_unix.sh
-
-do-build:
- cd ${WRKSRC} && CC=${CC} ${BAM_WRKSRC}/bam -a -v release wavpack=${LOCALBASE}
-
-do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/teeworlds ${PREFIX}/bin
- ${INSTALL_PROGRAM} ${WRKSRC}/teeworlds_srv ${PREFIX}/bin
- ${INSTALL_DATA_DIR} ${PREFIX}/share/teeworlds
- cd ${WRKSRC}; tar cf - data | tar xf - -C ${PREFIX}/share/teeworlds
+post-install:
+ mv ${WRKDIR}/maps/* ${WRKDIST}/datasrc/maps ; \
+ mv ${WRKDIR}/languages/* ${WRKDIST}/datasrc/languages ; \
+ rm -rf ${WRKDIR}/maps ; rm -rf ${WRKDIR}/languages ;

.include <bsd.port.mk>
Index: games/teeworlds/distinfo
===================================================================
RCS file: /cvs/ports/games/teeworlds/distinfo,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 distinfo
--- games/teeworlds/distinfo 30 Nov 2016 18:17:03 -0000 1.6
+++ games/teeworlds/distinfo 8 Aug 2021 19:58:01 -0000
@@ -1,4 +1,4 @@
-SHA256 (bam-0.4.0.tar.gz) = Xk5JILTSZdpYL2Z3TpseyN37513cAo+6hsEvaG6hjbM=
-SHA256 (teeworlds-0.6.4-src.tar.gz) = wmHRnrsAtUUfqizrSnypRcrSrdSLBgRutDtAzMn9mOI=
-SIZE (bam-0.4.0.tar.gz) = 206780
-SIZE (teeworlds-0.6.4-src.tar.gz) = 8771622
+SHA256 (teeworlds-0.7.5-src.tar.gz) = /N4iIzmOAnQ07JYxUQPphh/EWBYbSbFZCNxWuOeo7Nk=
+SHA256 (teeworlds-data.tar.gz) = My+UViTDKr75PkYu8/IfHWJGpPqF0ynJN49vEG4h6iI=
+SIZE (teeworlds-0.7.5-src.tar.gz) = 8935505
+SIZE (teeworlds-data.tar.gz) = 304464
Index: games/teeworlds/patches/patch-CMakeLists_txt
===================================================================
RCS file: games/teeworlds/patches/patch-CMakeLists_txt
diff -N games/teeworlds/patches/patch-CMakeLists_txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ games/teeworlds/patches/patch-CMakeLists_txt 8 Aug 2021 19:58:01 -0000
@@ -0,0 +1,86 @@
+$OpenBSD$
+
+- fstack-clash-protection is unused
+- don't execute git
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -155,7 +155,7 @@ if(NOT MSVC)
+ add_c_compiler_flag_if_supported(OUR_FLAGS -fstack-protector-strong)
+
+ # Protect the stack from clashing.
+- add_c_compiler_flag_if_supported(OUR_FLAGS -fstack-clash-protection)
++ # add_c_compiler_flag_if_supported(OUR_FLAGS -fstack-clash-protection)
+
+ # Control-flow protection. Should protect against ROP.
+ add_c_compiler_flag_if_supported(OUR_FLAGS -fcf-protection)
+@@ -1222,29 +1222,29 @@ function(generate_source output_file script_parameter)
+ endfunction()
+
+ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src/generated/")
+-if(GIT_FOUND)
+- execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
+- ERROR_QUIET
+- OUTPUT_VARIABLE PROJECT_GIT_DIR
+- OUTPUT_STRIP_TRAILING_WHITESPACE
+- RESULT_VARIABLE PROJECT_GIT_DIR_ERROR
+- )
+- if(NOT PROJECT_GIT_DIR_ERROR)
+- set(GIT_REVISION_EXTRA_DEPS
+- ${PROJECT_GIT_DIR}/index
+- ${PROJECT_GIT_DIR}/logs/HEAD
+- )
+- endif()
+-endif()
+-add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src/generated/git_revision.cpp
+- COMMAND ${PYTHON_EXECUTABLE}
+- scripts/git_revision.py
+- >${PROJECT_BINARY_DIR}/src/generated/git_revision.cpp
+- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+- DEPENDS
+- ${GIT_REVISION_EXTRA_DEPS}
+- scripts/git_revision.py
+-)
++#if(GIT_FOUND)
++# execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
++# ERROR_QUIET
++# OUTPUT_VARIABLE PROJECT_GIT_DIR
++# OUTPUT_STRIP_TRAILING_WHITESPACE
++# RESULT_VARIABLE PROJECT_GIT_DIR_ERROR
++# )
++# if(NOT PROJECT_GIT_DIR_ERROR)
++# set(GIT_REVISION_EXTRA_DEPS
++# ${PROJECT_GIT_DIR}/index
++# ${PROJECT_GIT_DIR}/logs/HEAD
++# )
++# endif()
++

No comments:

Post a Comment