summaryrefslogtreecommitdiff
path: root/emulators/x48
diff options
context:
space:
mode:
authorhe <he>2013-07-08 08:37:10 +0000
committerhe <he>2013-07-08 08:37:10 +0000
commitdf3c7c2f7b5aa1caee8a0bfe832fcc8d2855f3ba (patch)
tree71de23397bfbf7db37ab283df191975d81f1e2e0 /emulators/x48
parent2d36adf5e4fbd575ed1c88f17c011983592a08db (diff)
downloadpkgsrc-df3c7c2f7b5aa1caee8a0bfe832fcc8d2855f3ba.tar.gz
Update x48 from version 0.4.1 to 0.6.4.
Pkgsrc changes; * HOMEPAGE & distribution site moved. * HP has released the ROMs, and copies of these are now automatically installed. * I could not get the X11 shm option to work (native X11, NetBSD 6.1/i386), so it is disabled in the Makefile. * Patch with updated pty handling code, borrowing some from FreeBSD's package here. Upstream changes: 2011-08-08 "G. Allen Morris III" <gam3@gam3.net> release 0.6.4 * Default to throttling speed only when key-pressed * Add throttle switch for speed emulation * Fix buffer overflow bug * release keys on loss of focus * typo in access_time adjust 2010-02-01 "G. Allen Morris III" <gam3@gam3.net> release 0.6.3 * made updates to x48.spec * put debian directory in dist file * install X48 app data in correct place using pkg-config appdefaultdir xt * removed more debugging messages * added 'netbook' look for small/short screens use +netbook on the command line 2010-01-30 "G. Allen Morris III" <gam3@gam3.net> release 0.6.2 * remove setlocal code that was causing a bug. * removed some debugging code. 2009-06-31 "G. Allen Morris III" <gam3@gam3.net> release 0.6.1 * Fix to XShm to solve the 'LCD' Scramble problem. 2006-04-20 "G. Allen Morris III" <gam3@gam3.net> * Added simple paste feature * Repaired debugger non-readline input * Changed from building with Imakefile to using GNU autoconfig 2005-03-20 "G. Allen Morris III" <gam3@gam3.net> * added equal key for + and Meta Keys for Alpha * applied a different fix for the arrow repeat key bug * fixed a bug in the timer one logic. The cursor now flashes on input. 2005-03-20 "G. Allen Morris III" <gam3@gam3.net> * added patch [000390] time.h compile bug * added patch [000391] Arrow key repeat patch * added ChangeLog file 2005-03-18 "G. Allen Morris III" <gam3@gam3.net> * starting from x48 0.4.0.
Diffstat (limited to 'emulators/x48')
-rw-r--r--emulators/x48/DESCR8
-rw-r--r--emulators/x48/Makefile44
-rw-r--r--emulators/x48/PLIST9
-rw-r--r--emulators/x48/distinfo27
-rw-r--r--emulators/x48/patches/patch-Makefile.am15
-rw-r--r--emulators/x48/patches/patch-aa31
-rw-r--r--emulators/x48/patches/patch-ab51
-rw-r--r--emulators/x48/patches/patch-ac56
-rw-r--r--emulators/x48/patches/patch-ad43
-rw-r--r--emulators/x48/patches/patch-ae194
-rw-r--r--emulators/x48/patches/patch-af13
-rw-r--r--emulators/x48/patches/patch-configure.ac26
-rw-r--r--emulators/x48/patches/patch-src_emulate.c4
-rw-r--r--emulators/x48/patches/patch-src_global.h21
-rw-r--r--emulators/x48/patches/patch-src_serial.c522
15 files changed, 645 insertions, 419 deletions
diff --git a/emulators/x48/DESCR b/emulators/x48/DESCR
index eac31089d24..333093144cd 100644
--- a/emulators/x48/DESCR
+++ b/emulators/x48/DESCR
@@ -1,8 +1,2 @@
This emulator is capable of providing a faithful replication of the
-HP48. In order to do so, it requires a copy of the ROM software
-from YOUR calculator. In order to avoid breaking copyright laws,
-and upsetting HP, you MUST BE THE PROUD OWNER OF AN HP48 before
-running this program. Of course you can run this program without a
-copy of the ROM software in order to write trivial machine code
-programs but you will not be able to access any of the calculator
-functionality.
+HP48.
diff --git a/emulators/x48/Makefile b/emulators/x48/Makefile
index 0bb2968b954..271044e1a3f 100644
--- a/emulators/x48/Makefile
+++ b/emulators/x48/Makefile
@@ -1,24 +1,51 @@
-# $NetBSD: Makefile,v 1.15 2013/01/17 15:51:26 joerg Exp $
+# $NetBSD: Makefile,v 1.16 2013/07/08 08:37:10 he Exp $
#
-DISTNAME= x48_041
-PKGNAME= x48-0.4.1
-PKGREVISION= 1
+DISTNAME= x48-0.6.4
CATEGORIES= emulators
-MASTER_SITES= http://home.earthlink.net/~rmmlgetz/
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=x48.berlios/}
+DISTFILES= ${PKGNAME}${EXTRACT_SUFX}
+DISTFILES+= sxrom-e.bz2 gxrom-r.bz2
+EXTRACT_SUFX= .tar.bz2
MAINTAINER= pkgsrc-users@NetBSD.org
-HOMEPAGE= http://home.earthlink.net/~rmmlgetz/
+HOMEPAGE= http://x48.berlios.de/
COMMENT= HP48 emulator
+LICENSE= gnu-gpl-v3
-WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
-USE_IMAKE= YES
+WRKSRC= ${WRKDIR}
+#USE_IMAKE= YES
+GNU_CONFIGURE= YES
+USE_TOOLS+= pkg-config aclocal autoconf automake autoreconf
+USE_LIBTOOL= yes
+USE_TOOLS+= gmake
+
+DATADIR= lib/x48
INSTALLATION_DIRS+= share/doc/x48/romdump
+INSTALLATION_DIRS+= ${DATADIR}
+INSTALLATION_DIRS+= lib/X11/app-defaults
+
+CONFIGURE_ARGS= --disable-shm
CPPFLAGS+= -DHAVE_STDLIB
+SUBST_CLASSES= fix-ad
+SUBST_STAGE.fix-ad= post-configure
+SUBST_MESSAGE.fix-ad= Fix default rom path
+SUBST_FILES.fix-ad= X48.ad
+SUBST_SED.fix-ad= -e 's,"rom.dump,"${DATADIR}/gxrom-r,'
+
+
+pre-configure:
+ cd ${WRKSRC} && autoreconf -fi
+
post-install:
+ cd ${WRKSRC} && \
+ ${INSTALL_DATA} X48 \
+ ${DESTDIR}${PREFIX}/lib/X11/app-defaults
+ cd ${WRKSRC} && \
+ ${INSTALL_DATA} ??rom-? ${DESTDIR}${PREFIX}/${DATADIR}
cd ${WRKSRC}/doc && \
${INSTALL_MAN} CARDS.doc INSTALLING ROMDump.doc \
${DESTDIR}${PREFIX}/share/doc/x48
@@ -28,4 +55,5 @@ post-install:
${DESTDIR}${PREFIX}/share/doc/x48/romdump
.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libXt/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/emulators/x48/PLIST b/emulators/x48/PLIST
index e90d693598b..9ba2790d502 100644
--- a/emulators/x48/PLIST
+++ b/emulators/x48/PLIST
@@ -1,9 +1,12 @@
-@comment $NetBSD: PLIST,v 1.2 2009/06/14 17:51:10 joerg Exp $
-bin/x48
-bin/dump2rom
+@comment $NetBSD: PLIST,v 1.3 2013/07/08 08:37:10 he Exp $
bin/checkrom
+bin/dump2rom
bin/mkcard
+bin/x48
lib/X11/app-defaults/X48
+lib/x48/gxrom-r
+lib/x48/sxrom-e
+man/man1/x48.1
share/doc/x48/CARDS.doc
share/doc/x48/INSTALLING
share/doc/x48/ROMDump.doc
diff --git a/emulators/x48/distinfo b/emulators/x48/distinfo
index 683b0bdbe1a..573fd756b38 100644
--- a/emulators/x48/distinfo
+++ b/emulators/x48/distinfo
@@ -1,13 +1,16 @@
-$NetBSD: distinfo,v 1.7 2013/01/17 15:51:26 joerg Exp $
+$NetBSD: distinfo,v 1.8 2013/07/08 08:37:10 he Exp $
-SHA1 (x48_041.tar.gz) = 7b166ab4a7570b0617a0d8d01d0938b6ae372ab6
-RMD160 (x48_041.tar.gz) = e41b32bd2b38c4163e4a1aae0776048b0c372637
-Size (x48_041.tar.gz) = 193864 bytes
-SHA1 (patch-aa) = f69a736b1057081f12076a2e33d725c0f3659c79
-SHA1 (patch-ab) = 5bc7609bcaaa555ad29cb5cc3a8b53d83e7e6da5
-SHA1 (patch-ac) = ee5784614db4bf00c047e819aaa0f272d3bf9bce
-SHA1 (patch-ad) = c1f98b7672fe96ab8e203081dfedd6cf96075cfa
-SHA1 (patch-ae) = 29ec4f1495ab23d520883eebd51356b394c7143f
-SHA1 (patch-af) = 60adc15ae8c20528892cbcaa029a3dd206a7edca
-SHA1 (patch-src_emulate.c) = 9c670fb5382603a6de3b6ee15aff1f294d5d2810
-SHA1 (patch-src_timer_c) = 976debb83985bad55ca8b25dfe256370e59e3ac8
+SHA1 (gxrom-r.bz2) = c60a83cd57681c3cb359f0cd2505ede686fdb4c8
+RMD160 (gxrom-r.bz2) = 1dafce5902310161cb60f3dde401941565fd031c
+Size (gxrom-r.bz2) = 332316 bytes
+SHA1 (sxrom-e.bz2) = 62d07d48d2acc4ccb8da9b5ae264a19e2d09b361
+RMD160 (sxrom-e.bz2) = 023f2c2ca0ba12c5b0abb6e3b70e4888257e04a9
+Size (sxrom-e.bz2) = 190826 bytes
+SHA1 (x48-0.6.4.tar.bz2) = dfc82fe84f0c793a5f7b8024127e16d341ad2899
+RMD160 (x48-0.6.4.tar.bz2) = a5d7ddb4eb47426c639941d8cf53926bd3451ef5
+Size (x48-0.6.4.tar.bz2) = 227991 bytes
+SHA1 (patch-Makefile.am) = c17957624ea2a65e7bce3e65ced645993b30ee0c
+SHA1 (patch-configure.ac) = 55f1033b0f49e0a296290a1af83f6772e5783f0d
+SHA1 (patch-src_emulate.c) = 75a62b9038a07baff779ed7fad46252e276e69b0
+SHA1 (patch-src_global.h) = 48f076bdf72fb7a6df92e1bb961997fb3844ab30
+SHA1 (patch-src_serial.c) = 9b681d0d94ad53c9d770e54d56eddbda900627b1
diff --git a/emulators/x48/patches/patch-Makefile.am b/emulators/x48/patches/patch-Makefile.am
new file mode 100644
index 00000000000..0a1f58831e7
--- /dev/null
+++ b/emulators/x48/patches/patch-Makefile.am
@@ -0,0 +1,15 @@
+$NetBSD: patch-Makefile.am,v 1.1 2013/07/08 08:37:10 he Exp $
+
+Can't use $< in non-implicit rule.
+
+--- Makefile.am.orig 2011-11-15 03:03:40.000000000 +0000
++++ Makefile.am
+@@ -9,7 +9,7 @@ EXTRA_DIST=rpm/x48.spec \
+ debian/dirs debian/docs debian/menu debian/README.Debian debian/rules
+
+ X48 : src/X48.ad
+- cp $< $@
++ cp src/X48.ad $@
+
+ appdefault_DATA = X48
+
diff --git a/emulators/x48/patches/patch-aa b/emulators/x48/patches/patch-aa
deleted file mode 100644
index 3039a9ffcab..00000000000
--- a/emulators/x48/patches/patch-aa
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-aa,v 1.2 2012/04/22 22:04:24 dholland Exp $
-
-- configure for pkgsrc
-- use valid compiler options
-
---- config.h.orig 1999-06-28 22:36:58.000000000 +0000
-+++ config.h
-@@ -29,7 +29,7 @@
- /*
- * Which OS are you on?
- */
--#define UNIX_DEF -DLINUX
-+/* #define UNIX_DEF -DLINUX */
- /* #define UNIX_DEF -DSOLARIS */
- /* #define UNIX_DEF -DSUNOS */
- /* #define UNIX_DEF -DIRIX */
-@@ -56,12 +56,12 @@
- /*
- * Which Compiler to use:
- */
--#define CC_DEF gcc
-+/* #define CC_DEF gcc */
-
- /*
- * Which Optimization Flags:
- */
--#define CDEBUGFLAGS_DEF -O6 -Wall
-+#define CDEBUGFLAGS_DEF -O3 -Wall
-
- /*
- * Which Flags to pass to the Linker:
diff --git a/emulators/x48/patches/patch-ab b/emulators/x48/patches/patch-ab
deleted file mode 100644
index 92b7020cdbe..00000000000
--- a/emulators/x48/patches/patch-ab
+++ /dev/null
@@ -1,51 +0,0 @@
-$NetBSD: patch-ab,v 1.2 2010/01/30 00:02:54 joerg Exp $
-
---- src/Imakefile.orig Sun Feb 4 18:31:52 2001
-+++ src/Imakefile
-@@ -60,7 +60,7 @@
- LDOPTIONS = LDOPTIONS_DEF
- #endif
-
-- DEFINES = -I/usr/openwin/include UNIX_DEF XSHM_DEF READLINE_DEF
-+ DEFINES = UNIX_DEF XSHM_DEF READLINE_DEF
- HDRS = annunc.h append.h buttons.h constants.h debugger.h \
- device.h disasm.h errors.h global.h hp.h hp48.h \
- hp48_emu.h hp48char.h icon.h mmu.h options.h resources.h \
-@@ -87,9 +87,9 @@
- CO = co -l
- TARFILES = Imakefile X48.ad $(TARS1) $(SRCS2) $(SRCS3) $(SRCS4) $(HDRS)
-
--all:: $(BIN)/x48 $(BIN)/dump2rom $(BIN)/checkrom $(BIN)/mkcard
-+all:: x48 dump2rom checkrom mkcard
-
-- PROGRAMS = $(BIN)/x48 $(BIN)/dump2rom $(BIN)/checkrom $(BIN)/mkcard
-+ PROGRAMS = x48 dump2rom checkrom mkcard
-
- depend:: version.c X48.ad.h
-
-@@ -102,16 +102,20 @@
- RemoveTargetProgram($@) @@\
- $(CC) -o $@ $(LDOPTIONS) $(OBJS4) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
- @@\
--SaberProgramTarget(program,$(SRCS4),$(OBJS4),locallib,syslib) @@\
- @@\
- InstallProgram(program,$(BINDIR)) @@\
- InstallManPage(program,$(MANDIR))
- #endif /* ComplexProgramTarget_4 */
-
--ComplexProgramTarget_1($(BIN)/x48, $(X48LIBS),)
--ComplexProgramTarget_2($(BIN)/dump2rom,,)
--ComplexProgramTarget_3($(BIN)/checkrom,,)
--ComplexProgramTarget_4($(BIN)/mkcard,,)
-+NormalProgramTarget(x48, $(OBJS1),, $(X48LIBS),)
-+NormalProgramTarget(dump2rom, $(OBJS2),,,)
-+NormalProgramTarget(checkrom, $(OBJS3),,,)
-+NormalProgramTarget(mkcard, $(OBJS4),,,)
-+
-+InstallProgram(x48,$(BINDIR))
-+InstallProgram(dump2rom,$(BINDIR))
-+InstallProgram(checkrom,$(BINDIR))
-+InstallProgram(mkcard,$(BINDIR))
-
- InstallAppDefaults(X48)
-
diff --git a/emulators/x48/patches/patch-ac b/emulators/x48/patches/patch-ac
deleted file mode 100644
index af6129bfa72..00000000000
--- a/emulators/x48/patches/patch-ac
+++ /dev/null
@@ -1,56 +0,0 @@
-$NetBSD: patch-ac,v 1.1.1.1 2001/04/27 14:56:27 agc Exp $
-
---- src/init.c.orig Sun Feb 4 18:32:22 2001
-+++ src/init.c
-@@ -1204,13 +1204,15 @@
- struct stat st;
- FILE *fp;
-
-- fprintf(stderr, "testing: Getting home dir\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: Getting home dir\n");
- get_home_directory(path);
- strcat(path, "/");
-
- saturn.rom = (word_4 *)NULL;
-
-- fprintf(stderr, "testing: Reading ROM files\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: Reading ROM files\n");
- strcpy(fnam, path);
- strcat(fnam, "rom");
- if (!read_rom_file(fnam, &saturn.rom, &rom_size))
-@@ -1367,7 +1369,8 @@
- exit (1);
- }
-
-- fprintf(stderr, "testing: Reading RAM file\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: Reading RAM file\n");
-
- strcpy(fnam, path);
- strcat(fnam, "ram");
-@@ -1466,11 +1469,13 @@
- saturn.card_status |= port2_is_ram ? 8 : 0;
- }
-
-+#ifdef notyet
- fprintf(stderr, "testing: Reading Enteries file\n");
- strcpy(fnam, path);
- strcat(fnam, "entries.o");
- if (!read_entries_file(fnam, &saturn.entries))
- return 0;
-+#endif
-
-
- return 1;
-@@ -1841,7 +1846,8 @@
- {
- if (!initialize)
- {
-- fprintf(stderr, "testing: Read Files\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: Read Files\n");
- if (read_files())
- {
- if (resetOnStartup)
diff --git a/emulators/x48/patches/patch-ad b/emulators/x48/patches/patch-ad
deleted file mode 100644
index 5e2431dd25f..00000000000
--- a/emulators/x48/patches/patch-ad
+++ /dev/null
@@ -1,43 +0,0 @@
-$NetBSD: patch-ad,v 1.1.1.1 2001/04/27 14:56:27 agc Exp $
-
---- src/main.c.orig Sun Feb 4 18:32:37 2001
-+++ src/main.c
-@@ -70,6 +70,7 @@
- #include "x48_x11.h"
- #include "hp48.h"
- #include "debugger.h"
-+#include "resources.h"
-
- char *progname;
- char *res_name;
-@@ -169,7 +170,15 @@
- /*
- * Open up the display
- */
-- fprintf(stderr, "testing1\n");
-+#ifdef noyet
-+ /*
-+ * XXX options are not parsed yet so quiet is still 0. The
-+ * parsing of options is done by the X11 specific code in
-+ * InitDisplay.
-+ */
-+ if (!quiet)
-+ fprintf(stderr, "testing: InitDisplay\n");
-+#endif
- if (InitDisplay(argc, argv) < 0) {
- exit (1);
- }
-@@ -177,9 +186,11 @@
- /*
- * initialize emulator stuff
- */
-- fprintf(stderr, "testing1\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: init_emulator\n");
- init_emulator();
-- fprintf(stderr, "testing2\n");
-+ if (!quiet)
-+ fprintf(stderr, "testing: init_emulator done\n");
-
-
- /*
diff --git a/emulators/x48/patches/patch-ae b/emulators/x48/patches/patch-ae
deleted file mode 100644
index f82ee24b98b..00000000000
--- a/emulators/x48/patches/patch-ae
+++ /dev/null
@@ -1,194 +0,0 @@
-$NetBSD: patch-ae,v 1.2 2005/12/03 17:16:52 joerg Exp $
-
---- src/serial.c.orig 1999-06-28 22:12:29.000000000 +0000
-+++ src/serial.c
-@@ -69,7 +69,7 @@
- #include <fcntl.h>
- #include <errno.h>
- #include <sys/time.h>
--#if defined(LINUX) || defined(HPUX)
-+#if defined(LINUX) || defined(HPUX) || defined(CSRG_BASED)
- #include <sys/ioctl.h>
- #endif
- #include <unistd.h>
-@@ -77,6 +77,8 @@
- #ifdef SOLARIS
- #include <sys/stream.h>
- #include <sys/stropts.h>
-+#endif
-+#if defined(SOLARIS) || defined(CSRG_BASED)
- #include <sys/termios.h>
- #endif
-
-@@ -129,6 +131,9 @@ serial_init()
- #else
- int c;
- #endif
-+#if defined(CSRG_BASED)
-+ char *ptr1, *ptr2;
-+#endif
- int n;
- char tty_dev_name[128];
- struct termios ttybuf;
-@@ -200,6 +205,51 @@ serial_init()
- }
- while ((wire_fd < 0) && (errno != ENOENT));
- #else /* LINUX */
-+#if defined(CSRG_BASED)
-+ c = c; /* XXX gcc */
-+/* This is how Stevens does it in:
-+ * Advanced programming in the UNIX environment
-+ */
-+ strcpy(tty_dev_name, "/dev/ptyXY");
-+ /* array index: 0123456789 (for references in following code) */
-+ for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++)
-+ {
-+ tty_dev_name[8] = *ptr1;
-+ for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++)
-+ {
-+ tty_dev_name[9] = *ptr2;
-+
-+ /* try open the master */
-+ if ((wire_fd = open(tty_dev_name, O_RDWR, 0666)) < 0)
-+ {
-+ if (errno == ENOENT)
-+ {
-+ wire_fd = -1; /* out of pty devices */
-+ ttyp = -1;
-+ goto break_for_pty;
-+ }
-+ else
-+ continue; /* try next pty device */
-+ }
-+
-+ tty_dev_name[5] = 't'; /* change pty to tty */
-+ if ((ttyp = open(tty_dev_name, O_RDWR, 0666)) < 0)
-+ {
-+ printf("open tty: %s failed: %s, trying with another\n",
-+ tty_dev_name, strerror(errno));
-+ close(wire_fd);
-+ wire_fd = -1;
-+ ttyp = -1;
-+ continue;
-+ }
-+ if (verbose)
-+ printf("%s: wire connection on %s\n", progname, tty_dev_name);
-+ wire_name = strdup(tty_dev_name);
-+ goto break_for_pty;
-+ }
-+ }
-+break_for_pty:
-+#else
- /*
- * Here we go for SUNOS, HPUX
- */
-@@ -231,14 +281,16 @@ serial_init()
- c++;
- }
- while ((wire_fd < 0) && (errno != ENOENT));
-+#endif /* CSRG_BASED */
- #endif /* LINUX */
- #endif /* SOLARIS */
- #endif /* IRIX */
-+ ;
- }
-
- if (ttyp >= 0)
- {
--#if defined(SUNOS) || defined(HPUX)
-+#if defined(SUNOS) || defined(HPUX) || defined(CSRG_BASED)
- if (tcgetattr(ttyp, &ttybuf) < 0)
- #else
- if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
-@@ -263,7 +315,7 @@ serial_init()
-
- if (ttyp >= 0)
- {
--#if defined(SUNOS) || defined (HPUX)
-+#if defined(SUNOS) || defined (HPUX) || defined(CSRG_BASED)
- if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
- #else
- if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
-@@ -291,7 +343,7 @@ serial_init()
-
- if (ir_fd >= 0)
- {
--#if defined(SUNOS) || defined (HPUX)
-+#if defined(SUNOS) || defined (HPUX) || defined(CSRG_BASED)
- if (tcgetattr(ir_fd, &ttybuf) < 0)
- #else
- if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
-@@ -315,7 +367,7 @@ serial_init()
-
- if (ir_fd >= 0)
- {
--#if defined(SUNOS) || defined(HPUX)
-+#if defined(SUNOS) || defined(HPUX) || defined(CSRG_BASED)
- if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
- #else
- if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
-@@ -344,7 +396,7 @@ int baud;
-
- if (ir_fd >= 0)
- {
--#if defined(SUNOS) || defined (HPUX)
-+#if defined(SUNOS) || defined (HPUX) || defined(CSRG_BASED)
- if (tcgetattr(ir_fd, &ttybuf) < 0)
- #else
- if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
-@@ -358,6 +410,10 @@ int baud;
- }
- }
-
-+#if defined(CSRG_BASED)
-+ cfsetspeed(&ttybuf, baud);
-+#else
-+
- ttybuf.c_cflag &= ~CBAUD;
-
- baud &= 0x7;
-@@ -404,9 +460,11 @@ int baud;
- ttybuf.c_cflag |= B9600;
- }
-
-+#endif /* CSRG_BASED */
-+
- if (ir_fd >= 0)
- {
--#if defined(SUNOS) || defined(HPUX)
-+#if defined(SUNOS) || defined(HPUX) || defined(CSRG_BASED)
- if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
- #else
- if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
-@@ -422,7 +480,7 @@ int baud;
-
- if (ttyp >= 0)
- {
--#if defined(SUNOS) || defined(HPUX)
-+#if defined(SUNOS) || defined(HPUX) || defined(CSRG_BASED)
- if (tcgetattr(ttyp, &ttybuf) < 0)
- #else
- if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
-@@ -437,6 +495,9 @@ int baud;
- }
- }
-
-+#if defined(CSRG_BASED)
-+ cfsetspeed(&ttybuf, baud);
-+#else
- ttybuf.c_cflag &= ~CBAUD;
-
- baud &= 0x7;
-@@ -482,10 +543,11 @@ int baud;
- fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
- ttybuf.c_cflag |= B9600;
- }
-+#endif
-
- if (ttyp >= 0)
- {
--#if defined(SUNOS) || defined(HPUX)
-+#if defined(SUNOS) || defined(HPUX) || defined(CSRG_BASED)
- if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
- #else
- if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
diff --git a/emulators/x48/patches/patch-af b/emulators/x48/patches/patch-af
deleted file mode 100644
index b28d105db26..00000000000
--- a/emulators/x48/patches/patch-af
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-af,v 1.1.1.1 2001/04/27 14:56:27 agc Exp $
-
---- src/x48_x11.c.orig Sun Feb 4 18:33:36 2001
-+++ src/x48_x11.c
-@@ -3605,6 +3605,8 @@
- break;
- case XK_Alt_L:
- case XK_Alt_R:
-+ case XK_Meta_L:
-+ case XK_Meta_R:
- key_event(BUTTON_ALPHA, xev);
- wake = 1;
- break;
diff --git a/emulators/x48/patches/patch-configure.ac b/emulators/x48/patches/patch-configure.ac
new file mode 100644
index 00000000000..5db2d0e0d9f
--- /dev/null
+++ b/emulators/x48/patches/patch-configure.ac
@@ -0,0 +1,26 @@
+$NetBSD: patch-configure.ac,v 1.1 2013/07/08 08:37:10 he Exp $
+
+Add some tests for various PTY- and TTY-related functions.
+
+--- configure.ac.orig 2011-11-15 03:03:40.000000000 +0000
++++ configure.ac
+@@ -79,6 +79,19 @@ fi
+
+ # Checks for libraries.
+ AC_CHECK_LIB([GL], [XCloseDisplay])
++AC_SEARCH_LIBS([grantpt], [c], [
++ AC_DEFINE([HAVE_GRANTPT], 1, [Has grantpt() function])
++])
++AC_SEARCH_LIBS([ptsname_r], [c], [
++ AC_DEFINE([HAVE_PTSNAME_R], 1, [Has ptsname_r() function])
++])
++AC_SEARCH_LIBS([cfsetspeed], [c], [
++ AC_DEFINE([HAVE_CFSETSPEED], 1, [Has cfsetspeed() function])
++])
++AC_SEARCH_LIBS([openpty], [util], [
++ AC_DEFINE([HAVE_OPENPTY], 1, [Has openpty() function])
++ LIBS=-lutil ${LIBS}
++])
+
+ # Checks for header files.
+ AC_HEADER_STDC
diff --git a/emulators/x48/patches/patch-src_emulate.c b/emulators/x48/patches/patch-src_emulate.c
index 5607d831662..8387649225a 100644
--- a/emulators/x48/patches/patch-src_emulate.c
+++ b/emulators/x48/patches/patch-src_emulate.c
@@ -1,4 +1,6 @@
-$NetBSD: patch-src_emulate.c,v 1.1 2013/01/17 15:51:26 joerg Exp $
+$NetBSD: patch-src_emulate.c,v 1.2 2013/07/08 08:37:10 he Exp $
+
+Add static to an inline function.
--- src/emulate.c.orig 2013-01-16 14:12:03.000000000 +0000
+++ src/emulate.c
diff --git a/emulators/x48/patches/patch-src_global.h b/emulators/x48/patches/patch-src_global.h
new file mode 100644
index 00000000000..4f32368a87e
--- /dev/null
+++ b/emulators/x48/patches/patch-src_global.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_global.h,v 1.1 2013/07/08 08:37:10 he Exp $
+
+Define CSRG_BASED if BSD is defined in the "non-linux" && non-Sun
+branch.
+
+--- src/global.h.orig 2011-11-15 03:03:40.000000000 +0000
++++ src/global.h
+@@ -101,9 +101,13 @@
+
+ #else /* Not HP-UX */
+
++#if defined(BSD)
++#define CSRG_BASED 1
++#else
+ #ifndef SUNOS
+ #define SUNOS 1
+ #endif
++#endif /* not BSD */
+
+ #endif /* Not HP-UX */
+ #endif /* Not Solaris */
diff --git a/emulators/x48/patches/patch-src_serial.c b/emulators/x48/patches/patch-src_serial.c
new file mode 100644
index 00000000000..0ead5840cba
--- /dev/null
+++ b/emulators/x48/patches/patch-src_serial.c
@@ -0,0 +1,522 @@
+$NetBSD: patch-src_serial.c,v 1.1 2013/07/08 08:37:10 he Exp $
+
+Improve portability and precision of error messages.
+Conditionalize to get rid of bare non-portable use of CBAUD.
+
+--- src/serial.c.orig 2011-11-15 03:03:40.000000000 +0000
++++ src/serial.c
+@@ -129,6 +129,9 @@ serial_init()
+ int n;
+ char tty_dev_name[128];
+ struct termios ttybuf;
++#if defined(CSRG_BASED)
++ char *ptr1, *ptr2;
++#endif
+
+ wire_fd = -1;
+ ttyp = -1;
+@@ -215,6 +218,88 @@ serial_init()
+ }
+ while ((wire_fd < 0) && (errno != ENOENT));
+ }
++#elif defined(CSRG_BASED)
++#if defined(HAVE_GRANTPT)
++ /* Unix98 PTY (Preferred) */
++ if ((wire_fd = open("/dev/ptmx", O_RDWR | O_NONBLOCK, 0666)) >= 0)
++ {
++ grantpt(wire_fd);
++ unlockpt(wire_fd);
++ wire_name = strdup(ptsname(wire_fd));
++ if ((ttyp = open(wire_name, O_RDWR | O_NDELAY, 0666)) >= 0)
++ {
++ if (verbose)
++ printf("%s: wire connection on %s\n", progname,
++ wire_name);
++ }
++ else
++ wire_name = NULL;
++ }
++ else
++#endif
++#if defined(HAVE_OPENPTY)
++ {
++ int tty_m, tty_s;
++ if (openpty(&tty_m, &tty_s, tty_dev_name, NULL, NULL) == 0)
++ {
++ if (verbose)
++ printf("%s: wire connection on %s\n", progname, tty_dev_name);
++ wire_fd = tty_m;
++ ttyp = tty_s;
++ wire_name = strdup(tty_dev_name);
++ }
++ else
++ perror("openpty");
++ }
++#else
++ {
++ c = c; /* XXX gcc */
++ /* This is how Stevens does it in:
++ * Advanced programming in the UNIX environment
++ */
++ strcpy(tty_dev_name, "/dev/ptyXY");
++ /* array index: 0123456789 (for references in following code) */
++ for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++)
++ {
++ tty_dev_name[8] = *ptr1;
++ for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++)
++ {
++ tty_dev_name[9] = *ptr2;
++
++ /* try open the master */
++ if ((wire_fd = open(tty_dev_name, O_RDWR, 0666)) < 0)
++ {
++ if (errno == ENOENT)
++ {
++ wire_fd = -1; /* out of pty devices */
++ ttyp = -1;
++ goto break_for_pty;
++ }
++ else
++ continue; /* try next pty device */
++ }
++
++ tty_dev_name[5] = 't'; /* change pty to tty */
++ if ((ttyp = open(tty_dev_name, O_RDWR, 0666)) < 0)
++ {
++ printf("open tty: %s failed: %s, trying with another\n",
++ tty_dev_name, strerror(errno));
++ close(wire_fd);
++ wire_fd = -1;
++ ttyp = -1;
++ continue;
++ }
++ if (verbose)
++ printf("%s: wire connection on %s\n",
++ progname, tty_dev_name);
++ wire_name = strdup(tty_dev_name);
++ goto break_for_pty;
++ }
++ }
++ }
++ break_for_pty:
++ c = c; /* must have statement here... */
++#endif /* no openpty */
+ #else
+ /*
+ * Here we go for SUNOS, HPUX
+@@ -254,9 +339,15 @@ serial_init()
+ {
+ #if defined(TCSANOW)
+ if (tcgetattr(ttyp, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcgetattr(wire) failed, errno = %d\n",
++ progname, errno);
++ wire_fd = -1;
++ ttyp = -1;
++ }
+ #else
+ if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(wire, TCGETS) failed, errno = %d\n",
+@@ -264,12 +355,23 @@ serial_init()
+ wire_fd = -1;
+ ttyp = -1;
+ }
++#endif
+ }
+
+ ttybuf.c_lflag = 0;
+ ttybuf.c_iflag = 0;
+ ttybuf.c_oflag = 0;
+- ttybuf.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
++ ttybuf.c_cflag = CS8 | CLOCAL | CREAD;
++#if defined(TCSANOW)
++#if defined(HAVE_CFSETSPEED)
++ cfsetspeed(&ttybuf, B9600);
++#else
++ ttybuf.c_ispeed = B9600;
++ ttybuf.c_ospeed = B9600;
++#endif
++#elif defined CBAUD
++ ttybuf.c_cflag |= B9600;
++#endif
+ for (n = 0; n < NCCS; n++)
+ ttybuf.c_cc[n] = 0;
+ ttybuf.c_cc[VTIME] = 0;
+@@ -279,9 +381,15 @@ serial_init()
+ {
+ #if defined(TCSANOW)
+ if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcsetattr(wire) failed, errno = %d\n",
++ progname, errno);
++ wire_fd = -1;
++ ttyp = -1;
++ }
+ #else
+ if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(wire, TCSETS) failed, errno = %d\n",
+@@ -289,6 +397,7 @@ serial_init()
+ wire_fd = -1;
+ ttyp = -1;
+ }
++#endif
+ }
+
+ ir_fd = -1;
+@@ -307,21 +416,37 @@ serial_init()
+ {
+ #if defined(TCSANOW)
+ if (tcgetattr(ir_fd, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcgetattr(IR) failed, errno = %d\n",
++ progname, errno);
++ ir_fd = -1;
++ }
+ #else
+ if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n",
+ progname, errno);
+ ir_fd = -1;
+ }
++#endif
+ }
+
+ ttybuf.c_lflag = 0;
+ ttybuf.c_iflag = 0;
+ ttybuf.c_oflag = 0;
+- ttybuf.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
++ ttybuf.c_cflag = CS8 | CLOCAL | CREAD;
++#ifdef CBAUD
++ ttybuf.c_cflag |= B9600;
++#elif defined(TCSANOW)
++#if defined(HAVE_CFSETSPEED)
++ cfsetspeed(&ttybuf, B9600);
++#else
++ ttybuf.c_ispeed = B9600;
++ ttybuf.c_ospeed = B9600;
++#endif
++#endif
+ for (n = 0; n < NCCS; n++)
+ ttybuf.c_cc[n] = 0;
+ ttybuf.c_cc[VTIME] = 0;
+@@ -331,15 +456,21 @@ serial_init()
+ {
+ #if defined(TCSANOW)
+ if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcsetattr(IR, TCSANOW) failed, errno = %d\n",
++ progname, errno);
++ ir_fd = -1;
++ }
+ #else
+ if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n",
+ progname, errno);
+ ir_fd = -1;
+ }
++#endif
+ }
+ update_connection_display();
+ return 1;
+@@ -355,14 +486,21 @@ int baud;
+ {
+ int error = 0;
+ struct termios ttybuf;
++ int speed;
+
+ if (ir_fd >= 0)
+ {
+ #if defined(TCSANOW)
+ if (tcgetattr(ir_fd, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcgetattr(IR) failed, errno = %d\n",
++ progname, errno);
++ ir_fd = -1;
++ error = 1;
++ }
+ #else
+ if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n",
+@@ -370,106 +508,76 @@ int baud;
+ ir_fd = -1;
+ error = 1;
+ }
++#endif
+ }
+
+-#if defined(__APPLE__)
++ speed = 0;
+ baud &= 0x7;
+- switch (baud)
+- {
+- case 0: /* 1200 */
+- ttybuf.c_cflag |= B1200;
+- break;
+- case 1: /* 1920 */
+-# ifdef B1920
+- ttybuf.c_cflag |= B1920;
+-# endif
+- break;
+- case 2: /* 2400 */
+- ttybuf.c_cflag |= B2400;
+- break;
+- case 3: /* 3840 */
+-# ifdef B3840
+- ttybuf.c_cflag |= B3840;
+-# endif
+- break;
+- case 4: /* 4800 */
+- ttybuf.c_cflag |= B4800;
+- break;
+- case 5: /* 7680 */
+-# ifdef B7680
+- ttybuf.c_cflag |= B7680;
+-# endif
+- break;
+- case 6: /* 9600 */
+- ttybuf.c_cflag |= B9600;
+- break;
+- case 7: /* 15360 */
+-# ifdef B15360
+- ttybuf.c_cflag |= B15360;
+-# endif
+- break;
+- }
+-
+- if ((ir_fd >= 0) && ((ttybuf.c_ospeed) == 0))
+- {
+- if (!quiet)
+- fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
+- ttybuf.c_cflag |= B9600;
+- }
+-#else
+- ttybuf.c_cflag &= ~CBAUD;
+
+- baud &= 0x7;
+ switch (baud)
+ {
+ case 0: /* 1200 */
+- ttybuf.c_cflag |= B1200;
++ speed = B1200;
+ break;
+ case 1: /* 1920 */
+ # ifdef B1920
+- ttybuf.c_cflag |= B1920;
++ speed = B1920;
+ # endif
+ break;
+ case 2: /* 2400 */
+- ttybuf.c_cflag |= B2400;
++ speed = B2400;
+ break;
+ case 3: /* 3840 */
+ # ifdef B3840
+- ttybuf.c_cflag |= B3840;
++ speed = B3840;
+ # endif
+ break;
+ case 4: /* 4800 */
+- ttybuf.c_cflag |= B4800;
++ speed = B4800;
+ break;
+ case 5: /* 7680 */
+ # ifdef B7680
+- ttybuf.c_cflag |= B7680;
++ speed = B7680;
+ # endif
+ break;
+ case 6: /* 9600 */
+- ttybuf.c_cflag |= B9600;
++ speed = B9600;
+ break;
+ case 7: /* 15360 */
+ # ifdef B15360
+- ttybuf.c_cflag |= B15360;
++ speed = B15360;
+ # endif
+ break;
+ }
+
+- if ((ir_fd >= 0) && ((ttybuf.c_cflag & CBAUD) == 0))
+- {
++ if ((ir_fd >= 0) && (speed == 0)) {
+ if (!quiet)
+ fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
+- ttybuf.c_cflag |= B9600;
+- }
+-#endif
++ speed = B9600;
++ }
++
+ if (ir_fd >= 0)
+ {
+ #if defined(TCSANOW)
++#if defined(HAVE_CFSETSPEED)
++ cfsetspeed(&ttybuf, speed);
++#else
++ ttybuf.c_ispeed = speed;
++ ttybuf.c_ospeed = speed;
++#endif
+ if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcsetattr(IR, TCSANOW) failed, errno = %d\n",
++ progname, errno);
++ ir_fd = -1;
++ error = 1;
++ }
+ #else
++ ttybuf.c_cflag &= ~CBAUD;
++ ttybuf.c_cflag |= speed;
++
+ if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n",
+@@ -477,15 +585,23 @@ int baud;
+ ir_fd = -1;
+ error = 1;
+ }
++#endif
+ }
+
+ if (ttyp >= 0)
+ {
+ #if defined(TCSANOW)
+ if (tcgetattr(ttyp, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcgetattr(wire, TCSANOW) failed, errno = %d\n",
++ progname, errno);
++ wire_fd = -1;
++ ttyp = -1;
++ error = 1;
++ }
+ #else
+ if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(wire, TCGETS) failed, errno = %d\n",
+@@ -494,63 +610,80 @@ int baud;
+ ttyp = -1;
+ error = 1;
+ }
++#endif
+ }
+
+ #if defined(__APPLE__)
+ #else
+- ttybuf.c_cflag &= ~CBAUD;
++ speed = 0;
+
+ baud &= 0x7;
+ switch (baud)
+ {
+ case 0: /* 1200 */
+- ttybuf.c_cflag |= B1200;
++ speed = B1200;
+ break;
+ case 1: /* 1920 */
+ # ifdef B1920
+- ttybuf.c_cflag |= B1920;
++ speed = B1920;
+ # endif
+ break;
+ case 2: /* 2400 */
+- ttybuf.c_cflag |= B2400;
++ speed = B2400;
+ break;
+ case 3: /* 3840 */
+ # ifdef B3840
+- ttybuf.c_cflag |= B3840;
++ speed = B3840;
+ # endif
+ break;
+ case 4: /* 4800 */
+- ttybuf.c_cflag |= B4800;
++ speed = B4800;
+ break;
+ case 5: /* 7680 */
+ # ifdef B7680
+- ttybuf.c_cflag |= B7680;
++ speed = B7680;
+ # endif
+ break;
+ case 6: /* 9600 */
+- ttybuf.c_cflag |= B9600;
++ speed = B9600;
+ break;
+ case 7: /* 15360 */
+ # ifdef B15360
+- ttybuf.c_cflag |= B15360;
++ speed = B15360;
+ # endif
+ break;
+ }
+
+- if ((ttyp >= 0) && ((ttybuf.c_cflag & CBAUD) == 0))
++ if ((ttyp >= 0) && (speed == 0))
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
+- ttybuf.c_cflag |= B9600;
++ speed = B9600;
+ }
+ #endif
+ if (ttyp >= 0)
+ {
+ #if defined(TCSANOW)
++#if defined(HAVE_CFSETSPEED)
++ cfsetspeed(&ttybuf, speed);
++#else
++ ttybuf.c_ispeed = speed;
++ ttybuf.c_ospeed = speed;
++#endif
+ if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
++ {
++ if (!quiet)
++ fprintf(stderr, "%s: tcsetattr(wire, TCSANOW) failed, errno = %d\n",
++ progname, errno);
++ wire_fd = -1;
++ ttyp = -1;
++ error = 1;
++ }
+ #else
++ ttybuf.c_cflag &= ~CBAUD;
++ ttybuf.c_cflag |= speed;
++
+ if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
+-#endif
+ {
+ if (!quiet)
+ fprintf(stderr, "%s: ioctl(wire, TCSETS) failed, errno = %d\n",
+@@ -559,6 +692,7 @@ int baud;
+ ttyp = -1;
+ error = 1;
+ }
++#endif
+ }
+ if (error)
+ update_connection_display();