On Sun, Oct 17, 2021 at 01:40:11AM +0200, Omar Polo wrote:
> Hello,
>
> In my quest to update scons I noticed that boswars currently fails at
> runtime due to invalid png files:
>
> libpng warning: iCCP: known incorrect sRGB profile
> libpng error: IDAT: invalid distance too far back
> Error reading the PNG file.
> Can't load the graphic `graphics/ui/ui_minimap.png'
>
> This is an attempt at fixing the images using optipng (I think pngcrush
> could also be used, but optipng is what I had available.) It makes the
> build a bit longer but the game seems playable again. The exact list of
> broken PNGs is a courtesy of haikuports :)
>
> https://github.com/haikuports/haikuports/blob/master/games-strategy/boswars/boswars-2.7.recipe#L66
This fixes boswars for me, too. I think that's an acceptable solution
for now for a port with no new versions since 2013 per HOMEPAGE. I
wonder if other aging, unmaintained games will run into similar
issues...
>
> OK?
See comment about the command inline below; with or without that
suggestion ok thfr@..
>
> P.S.: portcheck complaints are not due this patch
>
> P.P.S: if you're bothered by the c++ warning 'optimization flag ... is
> not supported' I'm addressing that in a following patch to build
> it with scons 4
No significant issues in P.S. and P.P.S. for the moment, so that's fine
with me.
>
>
> Index: Makefile
> ===================================================================
> RCS file: /home/cvs/ports/games/boswars/Makefile,v
> retrieving revision 1.26
> diff -u -p -r1.26 Makefile
> --- Makefile 12 Jul 2019 20:46:15 -0000 1.26
> +++ Makefile 16 Oct 2021 23:33:22 -0000
> @@ -7,7 +7,7 @@ DISTNAME= boswars-${V}-src
> PKGNAME= boswars-${V}
> CATEGORIES= games x11
> MASTER_SITES= http://www.boswars.org/dist/releases/
> -REVISION= 1
> +REVISION= 2
>
> HOMEPAGE= http://www.boswars.org/
>
> @@ -24,7 +24,8 @@ MODULES= devel/scons \
> MODSCONS_FLAGS= CPPPATH="${LOCALBASE}/include ${X11BASE}/include" \
> opengl=1
>
> -BUILD_DEPENDS= devel/sdl-image
> +BUILD_DEPENDS= devel/sdl-image \
> + graphics/optipng
> LIB_DEPENDS= devel/sdl \
> multimedia/libtheora \
> audio/libvorbis \
> @@ -34,6 +35,12 @@ LIB_DEPENDS= devel/sdl \
> NO_TEST= Yes
>
> DATA_DIR= campaigns graphics intro languages maps patches scripts sounds
> units
> +
> +post-extract:
> +.for f in maps/antarticum.map/terrain.png graphics/ui/ui_*.png \
> + units/radar/radar*.png units/tree*/tree*.png
> + optipng -force -fix ${WRKSRC}/${f}
With something less commonly used in LOCALBASE, maybe absolute path
will grant a small protection to builders from stray commands in PATH?
${LOCALBASE}/bin/optipng -force -fix ${WRKSRC}/${f}
> +.endfor
>
> pre-configure:
> @${SUBST_CMD} ${WRKSRC}/SConstruct \
>