On Sun, 2 Feb 2020 15:12:29 +0100
Charlene Wendling <juliana...@posteo.jp> wrote:

> It works fine on amd64, has no further regressions on powerpc, and
> i'm fine with your clang fix. Obviously, powerpc issues should not
> hinder the x86 fix, and i've no objection to see that diff committed
> after devel/p5-SDL is committed.
> 
> For everyone's convenience, here is a diff with the Perl 5.30 fixes
> and the clang one combined.

The combined diff is ok gkoehler@

I have no opinion about whether your games/frozen-bubble commit will
happen before or after my devel/p5-SDL commit.  --George

> 
> Charlène.
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/frozen-bubble/Makefile,v
> retrieving revision 1.28
> diff -u -p -u -p -r1.28 Makefile
> --- Makefile  17 Jul 2019 14:49:22 -0000      1.28
> +++ Makefile  2 Feb 2020 14:05:17 -0000
> @@ -6,7 +6,7 @@ COMMENT-server =      server for the frozen-b
>  VER =                        2.2.0
>  DISTNAME =           frozen-bubble-${VER}
>  PKGNAME-main =               ${DISTNAME}
> -REVISION-main =              14
> +REVISION-main =              15
>  PKGNAME-server =     frozen-bubble-server-${VER}
>  REVISION-server =    10
>  CATEGORIES =         games
> @@ -29,6 +29,9 @@ BUILD_DEPENDS =             devel/p5-SDL \
>                       devel/p5-Locale-gettext \
>                       devel/gettext,-tools
>  
> +# Needed for post-patch deinterlacing
> +BUILD_DEPENDS +=     graphics/ImageMagick
> +
>  RUN_DEPENDS-main =   devel/p5-SDL \
>                       devel/p5-Locale-gettext \
>                       ${BASE_PKGPATH},-server
> @@ -46,5 +49,14 @@ WANTLIB-main =             SDL SDL_Pango SDL_mixer 
>  WANTLIB-server =     c glib-2.0 intl pthread
>  
>  MULTI_PACKAGES =     -main -server
> +
> +# fix "Interlace handling should be turned on when using png_read_image"
> +post-patch:
> +     @cd ${WRKSRC} && for interlaced in      gfx/flags/flag-de.png \
> +                                             gfx/flags/flag-fi.png \
> +                                             gfx/flags/flag-no.png; \
> +     do \
> +             ${LOCALBASE}/bin/mogrify -interlace none $${interlaced} ;\
> +     done
>  
>  .include <bsd.port.mk>
> Index: patches/patch-c_stuff_fb_c_stuff_xs
> ===================================================================
> RCS file: patches/patch-c_stuff_fb_c_stuff_xs
> diff -N patches/patch-c_stuff_fb_c_stuff_xs
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-c_stuff_fb_c_stuff_xs       2 Feb 2020 14:05:17 -0000
> @@ -0,0 +1,125 @@
> +$OpenBSD$
> +
> +Fix build with clang: it errors when functions are inside other
> +functions.  Rename sqr(int) to prevent conflict with sqr(float).
> +
> +Index: c_stuff/fb_c_stuff.xs
> +--- c_stuff/fb_c_stuff.xs.orig
> ++++ c_stuff/fb_c_stuff.xs
> +@@ -94,17 +94,17 @@ int rand_(double val) { return 1+(int) (val*rand()/(RA
> + 
> + /* -------------- Double Store ------------------ */
> + 
> ++static void copy_line(int l, SDL_Surface * s, SDL_Surface * img) {
> ++    memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, 
> img->pitch);
> ++}
> ++static void copy_column(int c, SDL_Surface * s, SDL_Surface * img) {
> ++    int bpp = img->format->BytesPerPixel;
> ++    for (y=0; y<YRES; y++)
> ++            memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + 
> y*img->pitch + c*bpp, bpp);
> ++}
> ++
> + void store_effect(SDL_Surface * s, SDL_Surface * img)
> + {
> +-    void copy_line(int l) {
> +-            memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, 
> img->pitch);
> +-    }
> +-    void copy_column(int c) {
> +-            int bpp = img->format->BytesPerPixel;
> +-            for (y=0; y<YRES; y++)
> +-                    memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + 
> y*img->pitch + c*bpp, bpp);
> +-    }
> +-
> +     int step = 0;
> +     int store_thickness = 15;
> + 
> +@@ -116,8 +116,8 @@ void store_effect(SDL_Surface * s, SDL_Surface * img)
> +                     for (i=0; i<=YRES/2/store_thickness; i++) {
> +                             int v = step - i;
> +                             if (v >= 0 && v < store_thickness) {
> +-                                    copy_line(i*store_thickness + v);
> +-                                    copy_line(YRES - 1 - (i*store_thickness 
> + v));
> ++                                    copy_line(i*store_thickness + v, s, 
> img);
> ++                                    copy_line(YRES - 1 - (i*store_thickness 
> + v), s, img);
> +                             }
> +                     }
> +                     step++;
> +@@ -133,8 +133,8 @@ void store_effect(SDL_Surface * s, SDL_Surface * img)
> +                     for (i=0; i<=XRES/2/store_thickness; i++) {
> +                             int v = step - i;
> +                             if (v >= 0 && v < store_thickness) {
> +-                                    copy_column(i*store_thickness + v);
> +-                                    copy_column(XRES - 1 - 
> (i*store_thickness + v));
> ++                                    copy_column(i*store_thickness + v, s, 
> img);
> ++                                    copy_column(XRES - 1 - 
> (i*store_thickness + v), s, img);
> +                             }
> +                     }
> +                     step++;
> +@@ -176,21 +176,22 @@ void bars_effect(SDL_Surface * s, SDL_Surface * img)
> + 
> + /* -------------- Squares ------------------ */
> + 
> ++static const int squares_size = 32;
> ++
> ++static int fillrect(int i, int j, SDL_Surface * s, SDL_Surface * img, int 
> bpp) {
> ++    int c, v;
> ++    if (i >= XRES/squares_size || j >= YRES/squares_size)
> ++            return 0;
> ++    v = i*squares_size*bpp + j*squares_size*img->pitch;
> ++    for (c=0; c<squares_size; c++)
> ++            memcpy(s->pixels + v + c*img->pitch, img->pixels + v + 
> c*img->pitch, squares_size*bpp);
> ++    return 1;
> ++}
> ++
> + void squares_effect(SDL_Surface * s, SDL_Surface * img)
> + {
> +     int bpp = img->format->BytesPerPixel;
> +-    const int squares_size = 32;
> + 
> +-    int fillrect(int i, int j) {
> +-            int c, v;
> +-            if (i >= XRES/squares_size || j >= YRES/squares_size)
> +-                    return 0;
> +-            v = i*squares_size*bpp + j*squares_size*img->pitch;
> +-            for (c=0; c<squares_size; c++)
> +-                    memcpy(s->pixels + v + c*img->pitch, img->pixels + v + 
> c*img->pitch, squares_size*bpp);
> +-            return 1;
> +-    }
> +-
> +     int still_moving = 1;
> + 
> +     for (i=0; still_moving; i++) {
> +@@ -200,7 +201,7 @@ void squares_effect(SDL_Surface * s, SDL_Surface * img
> + 
> +             still_moving = 0;
> +             for (j=i; j>=0; j--) {
> +-                    if (fillrect(j, k))
> ++                    if (fillrect(j, k, s, img, bpp))
> +                             still_moving = 1;
> +                     k++;
> +             }
> +@@ -212,20 +213,20 @@ void squares_effect(SDL_Surface * s, SDL_Surface * img
> + 
> + /* -------------- Circle ------------------ */
> + 
> ++static int sqi(int v) { return v*v; }
> ++
> + int * circle_steps;
> + const int circle_max_steps = 40;
> + void circle_init(void)
> + {
> +-    int sqr(int v) { return v*v; }
> +-
> +     circle_steps = malloc(XRES * YRES * sizeof(int));
> +     if (!circle_steps)
> +             fb__out_of_memory();
> + 
> +     for (y=0; y<YRES; y++)
> +             for (x=0; x<XRES; x++) {
> +-                    int max = sqrt(sqr(XRES/2) + sqr(YRES/2));
> +-                    int value = sqrt(sqr(x-XRES/2) + sqr(y-YRES/2));
> ++                    int max = sqrt(sqi(XRES/2) + sqi(YRES/2));
> ++                    int value = sqrt(sqi(x-XRES/2) + sqi(y-YRES/2));
> +                     circle_steps[x+y*XRES] = 
> (max-value)*circle_max_steps/max;
> +             }
> + }
> Index: patches/patch-c_stuff_lib_FBLE_pm
> ===================================================================
> RCS file: patches/patch-c_stuff_lib_FBLE_pm
> diff -N patches/patch-c_stuff_lib_FBLE_pm
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-c_stuff_lib_FBLE_pm 2 Feb 2020 14:05:17 -0000
> @@ -0,0 +1,34 @@
> +$OpenBSD$
> +
> +Perl 5.30+ prohibits using my() in false conditionals
> +
> +Index: c_stuff/lib/FBLE.pm
> +--- c_stuff/lib/FBLE.pm.orig
> ++++ c_stuff/lib/FBLE.pm
> +@@ -31,6 +31,8 @@
> + 
> + package FBLE;
> + 
> ++use feature qw(state);
> ++
> + use POSIX(qw(floor ceil));
> + use SDL;
> + use SDL::App;
> +@@ -1405,7 +1407,7 @@ sub display_levelset_screenshot {
> +                    $rect{middle}->y + $rect{middle}->height/2 - 
> $rect{screenshot}->height/8 - 3 + $widgetMove);
> + 
> + 
> +-    my %shrinks if 0;
> ++    state %shrinks;
> +     my $current_nb = $start_level || 1;
> +     if (!exists $shrinks{$name}{$current_nb}) {
> +         my $surf = SDL::Surface->new(-name => 
> "$FPATH/gfx/menu/please_wait.png");
> +@@ -1417,7 +1419,7 @@ sub display_levelset_screenshot {
> +         $app->update($rect{middle});
> + 
> +         #- sorta "read ahead": will compute next 10 levels screenshots as 
> well
> +-        my $s_save if 0;
> ++        state $s_save;
> +         if (!$s_save) {
> +             $s_save = SDL::Surface->new(-name => 
> "$FPATH/gfx/level_editor.png");
> +         }
> Index: patches/patch-frozen-bubble
> ===================================================================
> RCS file: patches/patch-frozen-bubble
> diff -N patches/patch-frozen-bubble
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-frozen-bubble       2 Feb 2020 14:05:17 -0000
> @@ -0,0 +1,52 @@
> +$OpenBSD$
> +
> +Perl 5.30+ prohibits using my() in false conditionals
> +
> +Index: frozen-bubble
> +--- frozen-bubble.orig
> ++++ frozen-bubble
> +@@ -47,6 +47,8 @@ use vars qw($TARGET_ANIM_SPEED $BUBBLE_SIZE $ROW_SIZE 
> +             $lev_number $playermalus $mptrainingdiff $loaded_levelset 
> $direct_levelset $chainreaction %chains %img_mini $frame $sock $gameserver 
> $mynick
> +             $continuegamewhenplayersleave $singleplayertargetting 
> $mylatitude $mylongitude %autokick $replayparam $autorecord $comment 
> $saveframes $saveframesbase $saveframescounter);
> + 
> ++use feature qw(state);
> ++
> + use Getopt::Long;
> + use Data::Dumper;
> + use Locale::gettext;
> +@@ -269,7 +271,7 @@ sub play_music($) {
> +     $app->delay(400);
> +     $app->delay(10) while $mixer->playing_music;  #- mikmod will segfault 
> if we try to load a music while old one is still fading out
> +     my %musics = (intro => '/snd/introzik.ogg', main1p => 
> '/snd/frozen-mainzik-1p.ogg', main2p => '/snd/frozen-mainzik-2p.xm');
> +-    my $mus if 0;                                 #- I need to keep a 
> reference on the music or it will be collected at the end of this function, 
> thus I manually collect previous music
> ++    state $mus;                                 #- I need to keep a 
> reference on the music or it will be collected at the end of this function, 
> thus I manually collect previous music
> +     if (@playlist) {
> +     my $tryanother = sub {
> +         my $elem = chomp_(shift @playlist);
> +@@ -3488,7 +3490,7 @@ sub choose_1p_game_mode() {
> +         };
> + 
> +         my $img = $imgbin{'1p_panel'};
> +-        my $save if 0;
> ++        state $save;
> +         my $drect = SDL::Rect->new(-width => $img->width, -height => 
> $img->height,
> +                                    -x => $MENUPOS{xpos_panel}, '-y' => 
> $MENUPOS{ypos_panel});
> +         if ($save) {
> +@@ -5573,7 +5575,7 @@ sub menu {
> +                      'highscores' => { pos => 8, type => 'run',
> +                                        run => sub { 
> $menu_display_highscores->() } },
> +                    );
> +-    my $current_pos if 0; $current_pos ||= 1;
> ++    state $current_pos; $current_pos ||= 1;
> +     my @menu_invalids;
> +     $invalidate_all = sub { push @menu_invalids, $menu_entries{$_}->{pos} 
> foreach keys %menu_entries };
> + 
> +@@ -5724,7 +5726,7 @@ sub menu {
> +     }
> + 
> +     if ($graphics_level > 1) {
> +-        my $banner_pos if 0;
> ++        state $banner_pos;
> +         $banner_pos ||= 670;
> +         foreach my $b (keys %banners) {
> +             my $xpos = $banners{$b} - $banner_pos;
> 
> 
> 
> 
> 
> 
> 


-- 
George Koehler <kern...@gmail.com>

Reply via email to