Thomas Frohwein <[email protected]> writes:
> 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...
I don't know how widespread are PNGs like that, but in the future we may
use espie' new port pngcheck: it includes an utility to check for
malformed jpegs and pngs, as well as a png-fix-IDAT-windowsize that
fixes this kinds of errors and is slightly faster than optipng. I've
sent a diff to the pngcheck authors that adds an `-inline' flag that
would be so handy in these cases.
> [...]
>> +
>> +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}
Yep, I haven't thought about that. sthen@ already committed this diff,
so I'll address this in a future diff.
Thanks!