Bug 153437 - [patch] emulators/dgen-sdl: mark BROKEN on non-i386 archs
Summary: [patch] emulators/dgen-sdl: mark BROKEN on non-i386 archs
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Rene Ladan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-25 07:10 UTC by swell.k
Modified: 2011-11-14 19:13 UTC (History)
0 users

See Also:


Attachments
a.diff (1.49 KB, patch)
2010-12-25 07:10 UTC, swell.k
no flags Details | Diff
patch.txt (4.38 KB, text/plain; charset=us-ascii)
2011-01-10 13:32 UTC, Alex Kozlov
no flags Details
patch.txt (4.68 KB, text/plain; charset=us-ascii)
2011-01-10 14:52 UTC, Alex Kozlov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description swell.k 2010-12-25 07:10:08 UTC
MZ80 (not asm version) doesn't seem to work on at least amd64.

While here...
- move nasm dependency to i386 as it isn't used otherwise
- add more mirrors and homepage (source: freshmeat/wikipedia)
- remove ^M (carriage return) from sources to ease local patching

How-To-Repeat: $ fgrep -lr $(printf \\r) $(make -V WRKSRC)
WRKSRC/dgen-sdl-1.23/save.cpp
WRKSRC/dgen-sdl-1.23/myfm.cpp
WRKSRC/dgen-sdl-1.23/mz80.h
WRKSRC/dgen-sdl-1.23/mem.cpp
WRKSRC/dgen-sdl-1.23/mz80/makez80.c
WRKSRC/dgen-sdl-1.23/mz80/mz80.txt

$ gdb --args dgen atp.tennis.bin
[New LWP 103295]
[New Thread 808007400 (LWP 103295/initial thread)]
[New Thread 808008800 (LWP 106140/dgen)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 808007400 (LWP 103295/initial thread)]
0x0000000000000001 in ?? ()
Current language:  auto; currently c

(gdb) bt
#0  0x0000000000000001 in ?? ()
#1  0x000000000048fe9f in mz80exec (dwCycles=1016) at zz80.c:14960
#2  0x0000000000404efd in md::run_to_odo_z80 (this=0x7ffffffed540, odo_to=1016) at mdfr.cpp:41
#3  0x0000000000405166 in md::one_frame_musa (this=0x7ffffffed540, bm=0x6e6960, retpal=0x0, sndi=0x6e6980) at mdfr.cpp:168
#4  0x0000000000405335 in md::one_frame (this=0x7ffffffed540, bm=0x6e6960, retpal=0x0, sndi=0x6e6980) at mdfr.cpp:215
#5  0x000000000040f974 in main (argc=2, argv=0x7ffffffee458) at main.cpp:463

(gdb) info thr
  3 Thread 808008800 (LWP 106140/dgen)  0x000000080b49a8cc in write () at write.S:3
* 2 Thread 808007400 (LWP 103295/initial thread)  0x0000000000000001 in ?? ()
Current language:  auto; currently asm

(gdb) thr 3
[Switching to thread 3 (Thread 808008800 (LWP 106140/dgen))]#0  0x000000080b49a8cc in write () at write.S:3
3       write.S: No such file or directory.
        in write.S

(gdb) bt
#0  0x000000080b49a8cc in write () at write.S:3
#1  0x0000000804c49750 in __write (fd=9, buf=0x808240800, nbytes=2048) at /usr/src/lib/libthr/thread/thr_syscalls.c:741
#2  0x0000000806ef7c7a in DSP_PlayAudio (this=0x80829d280) at ./src/audio/dsp/SDL_dspaudio.c:135
#3  0x0000000806ec41a8 in SDL_RunAudio (audiop=0x80829d280) at ./src/audio/SDL_audio.c:249
#4  0x0000000806ed1145 in SDL_RunThread (data=0x80828aa20) at ./src/thread/SDL_thread.c:204
#5  0x0000000806f1af89 in RunThread (data=<value optimized out>) at ./src/thread/pthread/SDL_systhread.c:47
#6  0x0000000804c47854 in thread_start (curthread=0x808008800) at /usr/src/lib/libthr/thread/thr_create.c:273
#7  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffffbff000: Bad address.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-12-25 07:10:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

pgollucci@ wants his PRs (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2010-12-25 07:10:52 UTC
Maintainer of emulators/dgen-sdl,

Please note that PR ports/153437 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/153437

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2010-12-25 07:10:54 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 swell.k 2010-12-25 08:46:25 UTC
Nevermind, dgen-sdl seems to work fine with `Quilt patchset' from

  https://bugs.launchpad.net/ubuntu/+source/dgen/+bug/131281

that I've found after a bit of googling. It's easy to incorporate, e.g.

--- b.diff begins here ---
diff --git emulators/dgen-sdl/Makefile emulators/dgen-sdl/Makefile
index 77c8e17..95abd39 100644
--- emulators/dgen-sdl/Makefile
+++ emulators/dgen-sdl/Makefile
@@ -12,6 +12,7 @@ CATEGORIES=	emulators
 MASTER_SITES=	SF/dgen/dgen/sdl-${PORTVERSION} \
 		http://tamentis.com/projects/dgen/files/ \
 		http://src4.narod.ru/
+DISTFILES=	${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
 
 MAINTAINER=	spam@rm-rf.kiev.ua
 COMMENT=	A wonderful Sega Genesis/MegaDrive emulator
@@ -29,7 +30,15 @@ MAN5=		dgenrc.5
 .if ${ARCH} == i386
 BUILD_DEPENDS+=	nasm:${PORTSDIR}/devel/nasm
 .else
-BROKEN=		mz80 (zz80) segfaults on non-i386
+MASTER_SITES+=	http://launchpadlibrarian.net/10817989/:quilt
+DISTFILES+=	patches.tar.gz:quilt
+RESTRICTED=	modified versions of MZ80 are not allowed to be distributed
+RESTRICTED_FILES=patches.tar.gz
 .endif
 
+post-extract:	patch-quilt
+patch-quilt:
+	-for f in ${WRKDIR}/patches/*.patch; do \
+		${PATCH} -Efsp1 -d ${WRKSRC} -i $$f; done
+
 .include <bsd.port.post.mk>
diff --git emulators/dgen-sdl/distinfo emulators/dgen-sdl/distinfo
index 28f38e3..d1ec032 100644
--- emulators/dgen-sdl/distinfo
+++ emulators/dgen-sdl/distinfo
@@ -1,3 +1,4 @@
-MD5 (dgen-sdl-1.23.tar.gz) = b1896c1b21ddb152626aec2e8a157a3a
 SHA256 (dgen-sdl-1.23.tar.gz) = 44396b3b324433187cf7082d1059cd9f519f02accddd667e627a57ff8514d436
 SIZE (dgen-sdl-1.23.tar.gz) = 340556
+SHA256 (patches.tar.gz) = 457c9b3580c199a7873f87c3e7579325f3d5b0fd88d032e6e30419d983ea4cf3
+SIZE (patches.tar.gz) = 7778
--- b.diff ends here ---
Comment 5 Alex Kozlov 2011-01-10 13:32:00 UTC
Hi, Anonymous

Sorry for the delay, I was trying to contact author of MZ80.
I had made a little modifications to Your patch, can You please test it?
If all work fine, it can be committed. 
Comment 6 swell.k 2011-01-10 14:04:18 UTC
Alex Kozlov <spam@rm-rf.kiev.ua> writes:

> Sorry for the delay, I was trying to contact author of MZ80.
> I had made a little modifications to Your patch, can You please test it?
> If all work fine, it can be committed. 

It still works on amd64 after the changes. Before committing you need to

- pacify portlint
- make sure patches.tar.gz doesn't conflict with distfiles from other
  ports or use DIST_SUBDIR

I'm resending your patch with above changes. This time it should be
logged in GNATS.

--- a.diff begins here ---
Index: emulators/dgen-sdl/Makefile
===================================================================
RCS file: /a/.cvsup/ports/emulators/dgen-sdl/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- emulators/dgen-sdl/Makefile	18 Jun 2008 07:24:39 -0000	1.21
+++ emulators/dgen-sdl/Makefile	10 Jan 2011 13:56:00 -0000
@@ -7,20 +7,46 @@
 
 PORTNAME=	dgen-sdl
 PORTVERSION=	1.23
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	emulators
-MASTER_SITES=	http://src4.narod.ru/
+MASTER_SITES=	SF/dgen/dgen/sdl-${PORTVERSION} \
+		http://tamentis.com/projects/dgen/files/ \
+		http://launchpadlibrarian.net/10817989/:quilt
+DISTFILES=	${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX} \
+		patches.tar.gz:quilt
+DIST_SUBDIR=	dgen
 
 MAINTAINER=	spam@rm-rf.kiev.ua
 COMMENT=	A wonderful Sega Genesis/MegaDrive emulator
 
-BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm
+NO_CDROM=	License only permits non-commerical use, modified versions of MZ80 are not allowed to be distributed
+NO_PACKAGE=	${NO_CDROM}
+RESTRICTED=	${NO_CDROM}
+RESTRICTED_FILES=	patches.tar.gz
 
 USE_SDL=	sdl
 USE_GL=		yes
 GNU_CONFIGURE=	yes
 
+CONFIGURE_ARGS+=	--with-extra-opt
+
+EXTRA_PATCHES=	${WRKDIR}/patches/fm-do-not-use-long.patch \
+		${WRKDIR}/patches/mz80-pbPC-pointer-subtract.patch \
+		${WRKDIR}/patches/mz80-stdint.patch \
+		${WRKDIR}/patches/mz80init.patch \
+		${WRKDIR}/patches/ras-emulate-pointer-wraparound.patch \
+		${WRKDIR}/patches/sdl-use-stdint.patch
+
 MAN1=		dgen.1 tobin.1
 MAN5=		dgenrc.5
 
-.include <bsd.port.mk>
+post-extract:
+		@${REINPLACE_CMD} -e 's|^Index: dgen-|Index: ../dgen-sdl-|' ${WRKDIR}/patches/*
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == i386
+BUILD_DEPENDS+=	nasm:${PORTSDIR}/devel/nasm
+.endif
+
+.include <bsd.port.post.mk>
Index: emulators/dgen-sdl/distinfo
===================================================================
RCS file: /a/.cvsup/ports/emulators/dgen-sdl/distinfo,v
retrieving revision 1.7
diff -u -p -r1.7 distinfo
--- emulators/dgen-sdl/distinfo	24 Nov 2005 16:07:47 -0000	1.7
+++ emulators/dgen-sdl/distinfo	10 Jan 2011 13:52:29 -0000
@@ -1,3 +1,4 @@
-MD5 (dgen-sdl-1.23.tar.gz) = b1896c1b21ddb152626aec2e8a157a3a
-SHA256 (dgen-sdl-1.23.tar.gz) = 44396b3b324433187cf7082d1059cd9f519f02accddd667e627a57ff8514d436
-SIZE (dgen-sdl-1.23.tar.gz) = 340556
+SHA256 (dgen/dgen-sdl-1.23.tar.gz) = 44396b3b324433187cf7082d1059cd9f519f02accddd667e627a57ff8514d436
+SIZE (dgen/dgen-sdl-1.23.tar.gz) = 340556
+SHA256 (dgen/patches.tar.gz) = 457c9b3580c199a7873f87c3e7579325f3d5b0fd88d032e6e30419d983ea4cf3
+SIZE (dgen/patches.tar.gz) = 7778
Index: emulators/dgen-sdl/pkg-descr
===================================================================
RCS file: /a/.cvsup/ports/emulators/dgen-sdl/pkg-descr,v
retrieving revision 1.3
diff -u -p -r1.3 pkg-descr
--- emulators/dgen-sdl/pkg-descr	18 Jun 2008 07:24:39 -0000	1.3
+++ emulators/dgen-sdl/pkg-descr	10 Jan 2011 13:20:41 -0000
@@ -1 +1,3 @@
 DGen is a wonderful Sega Genesis/MegaDrive emulator.
+
+WWW: http://tamentis.com/projects/dgen
Index: emulators/dgen-sdl/files/patch-configure
===================================================================
RCS file: /a/.cvsup/ports/emulators/dgen-sdl/files/patch-configure,v
retrieving revision 1.1
diff -u -p -r1.1 patch-configure
--- emulators/dgen-sdl/files/patch-configure	23 Feb 2001 17:54:29 -0000	1.1
+++ emulators/dgen-sdl/files/patch-configure	10 Jan 2011 13:21:14 -0000
@@ -1,8 +1,19 @@
-
-$FreeBSD: ports/emulators/dgen-sdl/files/patch-configure,v 1.1 2001/02/23 17:54:29 sobomax Exp $
-
---- configure	2001/02/23 11:37:15	1.1
-+++ configure	2001/02/23 11:37:28
+Index: configure
+@@ -897,12 +897,12 @@
+ 
+ if test x$ADD_OPT \!= xno; then
+ 	case $machtype in
+-	i?86)
++	disabled)
+ 		CFLAGS="$CFLAGS -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer -frerun-cse-after-loop -funroll-loops -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 -malign-double -fno-exceptions -fno-rtti"
+ 		CXXFLAGS="$CXXFLAGS -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer -frerun-cse-after-loop -funroll-loops -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 -malign-double -fno-exceptions -fno-rtti"
+ 		;;
+ 	*)
+-		CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -funroll-loops -frerun-cse-after-loop"
++		CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -funroll-loops -frerun-cse-after-loop"
+ 		CXXFLAGS="$CXXFLAGS -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -funroll-loops -frerun-cse-after-loop"
+ 		;;
+ 	esac
 @@ -1779,7 +1779,7 @@
  #include <stdio.h>
  #include <stdlib.h>
Index: emulators/dgen-sdl/files/patch-rc.cpp
===================================================================
RCS file: emulators/dgen-sdl/files/patch-rc.cpp
diff -N emulators/dgen-sdl/files/patch-rc.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ emulators/dgen-sdl/files/patch-rc.cpp	10 Jan 2011 13:20:41 -0000
@@ -0,0 +1,26 @@
+Index: rc.cpp
+@@ -14,13 +14,13 @@
+ 
+ 
+ // CTV names
+-char *ctv_names[NUM_CTV] = { "off", "blur", "scanline", "interlace" };
++char const *ctv_names[NUM_CTV] = { "off", "blur", "scanline", "interlace" };
+ 
+ // The table of strings and the keysyms they map to.
+ // The order is a bit weird, since this was originally a mapping for the SVGALib
+ // scancodes, and I just added the SDL stuff on top of it.
+ struct rc_keysym {
+-  char *name;
++  char const *name;
+   long keysym;
+ } keysyms[] = {
+   { "ESCAPE", PDK_ESCAPE },
+@@ -300,7 +300,7 @@
+ /* This is a table of all the RC options, the variables they affect, and the
+  * functions to parse their values. */
+ struct rc_field {
+-  char *fieldname;
++  char const *fieldname;
+   long (*parser)(const char*);
+   long *variable;
+ } rc_fields[] = {
Index: emulators/dgen-sdl/files/patch-rc.h
===================================================================
RCS file: emulators/dgen-sdl/files/patch-rc.h
diff -N emulators/dgen-sdl/files/patch-rc.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ emulators/dgen-sdl/files/patch-rc.h	10 Jan 2011 13:20:41 -0000
@@ -0,0 +1,10 @@
+Index: rc.h
+@@ -16,7 +16,7 @@
+ #define KEYSYM_MOD_META		0x08000000
+ 
+ // All the CTV engine names, in string form for the RC and message bar
+-extern char *ctv_names[];
++extern char const *ctv_names[];
+ 
+ // Provide a prototype to the parse_rc function in rc.cpp
+ void parse_rc(const char *file);
--- a.diff ends here ---
Comment 7 Alex Kozlov 2011-01-10 14:52:31 UTC
On Mon, Jan 10, 2011 at 05:04:18PM +0300, Anonymous wrote:
> Alex Kozlov <spam@rm-rf.kiev.ua> writes:
>> Sorry for the delay, I was trying to contact author of MZ80.
>> I had made a little modifications to Your patch, can You please test it?
>> If all work fine, it can be committed. 
> It still works on amd64 after the changes. Before committing you need to
> 
> - pacify portlint
> - make sure patches.tar.gz doesn't conflict with distfiles from other
>   ports or use DIST_SUBDIR
> 
> I'm resending your patch with above changes. This time it should be
> logged in GNATS.
Oops, sorry for the mangled patch.
Patch below contains mostly cosmetic changes agains yours, but please
test it one last time and it can be committed.
Comment 8 swell.k 2011-01-10 16:15:10 UTC
Alex Kozlov <spam@rm-rf.kiev.ua> writes:

> Oops, sorry for the mangled patch.
> Patch below contains mostly cosmetic changes agains yours, but please
> test it one last time and it can be committed.

Works fine, thanks.
Comment 9 Alex Kozlov 2011-04-19 21:03:10 UTC
Hi, Philip

Is there anything wrong with this pr?
Could You please take a look?


--
Adios
Comment 10 Philip M. Gollucci freebsd_committer freebsd_triage 2011-06-23 19:44:37 UTC
Responsible Changed
From-To: pgollucci->freebsd-ports-bugs

E-NO-TIME right now, back to pool
Comment 11 Tilman Keskinoz freebsd_committer freebsd_triage 2011-08-01 20:28:36 UTC
State Changed
From-To: feedback->open

feedback received
Comment 12 Rene Ladan freebsd_committer freebsd_triage 2011-08-15 18:58:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rene

Grab
Comment 13 Rene Ladan freebsd_committer freebsd_triage 2011-08-18 20:36:34 UTC
I applied the patch and while it builds fine (see
http://rene-ladan.nl:8080/tb/index.php?action=describe_port&id=486 for
i386, amd64 is ok too), when I run it with a .bin file on my 9.0-amd64
laptop all I get is a black screen which I have to kill with SIGKILL.
The program seems to be looping somewhere in the initialization. On
another 8.2-i386 laptop the .bin file plays fine.

Can you investigate what's wrong?
Comment 14 Rene Ladan freebsd_committer freebsd_triage 2011-08-18 20:36:58 UTC
State Changed
From-To: open->feedback

Builds fine, but amd64 is broken at runtime.
Comment 15 dfilter service freebsd_committer freebsd_triage 2011-09-30 21:11:59 UTC
rene        2011-09-30 20:11:46 UTC

  FreeBSD ports repository

  Modified files:
    emulators/dgen-sdl   Makefile distinfo pkg-descr 
    emulators/dgen-sdl/files patch-configure 
  Added files:
    emulators/dgen-sdl/files patch-rc.cpp patch-rc.h 
  Removed files:
    emulators/dgen-sdl   pkg-plist 
  Log:
  - Incorporate Quilt MZ80 patches for non-i386 and add legal notifications
  - Update MASTER_SITES
  - Replace pkg-plist by PLIST_FILES
  - Only depend on devel/nasm when on i386
  - Add WWW to pkg-descr
  - Bump PORTREVISION
  
  PR:             ports/153437
  Submitted by:   Anonymous (swell.k)
  Approved by:    maintainer
  
  Revision  Changes    Path
  1.22      +33 -4     ports/emulators/dgen-sdl/Makefile
  1.9       +4 -2      ports/emulators/dgen-sdl/distinfo
  1.2       +16 -5     ports/emulators/dgen-sdl/files/patch-configure
  1.1       +26 -0     ports/emulators/dgen-sdl/files/patch-rc.cpp (new)
  1.1       +10 -0     ports/emulators/dgen-sdl/files/patch-rc.h (new)
  1.4       +2 -0      ports/emulators/dgen-sdl/pkg-descr
  1.2       +0 -2      ports/emulators/dgen-sdl/pkg-plist (dead)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 16 Rene Ladan freebsd_committer freebsd_triage 2011-11-14 19:12:59 UTC
State Changed
From-To: feedback->closed

Fixed with 1.27 update