aboutsummaryrefslogtreecommitdiff
path: root/emulators/x49gp
diff options
context:
space:
mode:
authorShaun Amott <shaun@FreeBSD.org>2014-01-16 19:31:03 +0000
committerShaun Amott <shaun@FreeBSD.org>2014-01-16 19:31:03 +0000
commite89a2108130e65533009cc4cd6e23b56ad597610 (patch)
tree0dfaf5c450c83a52aff62178225ee7a26423ba3b /emulators/x49gp
parentafcb0655a64f544b5c7509c93cc56c22b7c28301 (diff)
downloadports-e89a2108130e65533009cc4cd6e23b56ad597610.tar.gz
ports-e89a2108130e65533009cc4cd6e23b56ad597610.zip
Add x49gp - a HP49G+/50G graphics calculator emulator.
Notes
Notes: svn path=/head/; revision=339966
Diffstat (limited to 'emulators/x49gp')
-rw-r--r--emulators/x49gp/Makefile84
-rw-r--r--emulators/x49gp/distinfo6
-rw-r--r--emulators/x49gp/files/config-hp49g+18
-rw-r--r--emulators/x49gp/files/config-hp50g18
-rw-r--r--emulators/x49gp/files/hp50g.sh.in58
-rw-r--r--emulators/x49gp/files/patch-Makefile32
-rw-r--r--emulators/x49gp/files/patch-main.c17
-rw-r--r--emulators/x49gp/files/patch-module.c11
-rw-r--r--emulators/x49gp/files/patch-ui.c31
-rw-r--r--emulators/x49gp/pkg-descr11
-rw-r--r--emulators/x49gp/pkg-message40
-rw-r--r--emulators/x49gp/pkg-plist14
12 files changed, 340 insertions, 0 deletions
diff --git a/emulators/x49gp/Makefile b/emulators/x49gp/Makefile
new file mode 100644
index 000000000000..ef279af7a255
--- /dev/null
+++ b/emulators/x49gp/Makefile
@@ -0,0 +1,84 @@
+# Created by: Shaun Amott <shaun@FreeBSD.org>
+# $FreeBSD$
+
+# Note: sdcard64.tar.gz contains just an empty 64MB FAT-16 disk image
+
+PORTNAME= x49gp
+PORTVERSION= 20100425
+CATEGORIES= emulators math
+MASTER_SITES= LOCAL/shaun
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} sdcard64.tar.gz
+
+MAINTAINER= shaun@FreeBSD.org
+COMMENT= HP 49g+/50g graphics calculator emulator
+
+EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
+
+WRKSRC= ${WRKDIR}/x49gp/x49gp-code
+
+USE_GCC= any
+USE_XORG= x11
+USE_GNOME= gtk20
+
+USES= gmake pkgconfig
+
+OPTIONS_SINGLE= FIRMWARE
+OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215 FIRMWARE_209
+#OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215H3 FIRMWARE_215 FIRMWARE_209
+
+#FIRMWARE_215H3_DESC= Calculator ROM firmware version 2.15 plus HPGCC3
+FIRMWARE_215_DESC= Calculator ROM firmware version 2.15
+FIRMWARE_209_DESC= Calculator ROM firmware version 2.09
+
+OPTIONS_DEFAULT=FIRMWARE_215
+
+SUB_FILES= hp50g.sh
+
+.if defined(WITH_DEBUG)
+MAKE_ENV+= DEBUGB=1
+.endif
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215}
+MAKE_ARGS+=FIRMWARE=4950_215.bin
+DISTFILES+=hp4950v215.zip
+EXTRACT_ONLY+=hp4950v215.zip
+.else
+MAKE_ARGS+=FIRMWARE=4950_92.bin
+.endif
+
+#.if ${PORT_OPTIONS:MFIRMWARE_215H3}
+#DISTFILES+=rom215_hpgcc3_R004.tar.gz
+#EXTRACT_ONLY+=rom215_hpgcc3_R004.tar.gz
+#.endif
+
+post-patch:
+.if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215}
+ @${CP} ${WRKDIR}/hp4950v215/*.lib ${WRKSRC}/
+ @${CP} ${WRKDIR}/hp4950v215/*.bin ${WRKSRC}/
+ @${CP} ${WRKDIR}/hp4950v215/*.scp ${WRKSRC}/
+.endif
+#.if ${PORT_OPTIONS:MFIRMWARE_215H3}
+# @${CP} ${WRKDIR}/rom215_hpgcc3_R004/hpgccrom.bin ${WRKSRC}/4950_215.bin
+#.endif
+
+do-build:
+ cd ${WRKSRC} && ${GMAKE} ${MAKE_ARGS}
+
+do-install:
+ @${MKDIR} ${STAGEDIR}${DATADIR}
+.for f in flash-50g hp50g.png hp50g-hack.png hp49g+.png flash-49g+ sram s3c2410-sram
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DATADIR}/
+.endfor
+ ${INSTALL_DATA} ${FILESDIR}/config-hp50g ${STAGEDIR}${DATADIR}/
+ ${INSTALL_DATA} ${FILESDIR}/config-hp49g+ ${STAGEDIR}${DATADIR}/
+ ${INSTALL_PROGRAM} ${WRKSRC}/x49gp ${STAGEDIR}${PREFIX}/bin/x49gp-bin
+
+ ${INSTALL_SCRIPT} ${WRKDIR}/hp50g.sh ${STAGEDIR}${PREFIX}/bin/hp50g
+ ${RM} -f ${STAGEDIR}${PREFIX}/bin/hp49g+
+ ${LN} ${STAGEDIR}${PREFIX}/bin/hp50g ${STAGEDIR}${PREFIX}/bin/hp49g+
+
+ ${INSTALL_DATA} ${DISTDIR}/sdcard64.tar.gz ${STAGEDIR}${DATADIR}/
+
+.include <bsd.port.mk>
diff --git a/emulators/x49gp/distinfo b/emulators/x49gp/distinfo
new file mode 100644
index 000000000000..e0c993e6cf1c
--- /dev/null
+++ b/emulators/x49gp/distinfo
@@ -0,0 +1,6 @@
+SHA256 (x49gp-20100425.tar.gz) = ae2fd793105cfdd10b1c0c9f36c1bb27828791d4b2250015b700ddef36bf0968
+SIZE (x49gp-20100425.tar.gz) = 13530661
+SHA256 (sdcard64.tar.gz) = 908d0b57831ec2685dc8a8ca5d5d98f47efdf3bd66de310cae330079c096c736
+SIZE (sdcard64.tar.gz) = 65560
+SHA256 (hp4950v215.zip) = 79db72b67de00f648b54bab421279980c23b12c721b1aa33d49759409ddcf611
+SIZE (hp4950v215.zip) = 1742733
diff --git a/emulators/x49gp/files/config-hp49g+ b/emulators/x49gp/files/config-hp49g+
new file mode 100644
index 000000000000..6eae9af1b0ff
--- /dev/null
+++ b/emulators/x49gp/files/config-hp49g+
@@ -0,0 +1,18 @@
+[x49gp]
+basename=
+
+[gui]
+name=hp49g+
+image=hp49g+.png
+
+[flash]
+filename=flash-49g+
+
+[sram]
+filename=sram
+
+[s3c2410-sram]
+filename=s3c2410-sram
+
+[s3c2410-sdi]
+filename=../sdcard
diff --git a/emulators/x49gp/files/config-hp50g b/emulators/x49gp/files/config-hp50g
new file mode 100644
index 000000000000..aac4d92c99e7
--- /dev/null
+++ b/emulators/x49gp/files/config-hp50g
@@ -0,0 +1,18 @@
+[x49gp]
+basename=
+
+[gui]
+name=hp50g
+image=hp50g.png
+
+[flash]
+filename=flash-50g
+
+[sram]
+filename=sram
+
+[s3c2410-sram]
+filename=s3c2410-sram
+
+[s3c2410-sdi]
+filename=../sdcard
diff --git a/emulators/x49gp/files/hp50g.sh.in b/emulators/x49gp/files/hp50g.sh.in
new file mode 100644
index 000000000000..12ab40dfc2fd
--- /dev/null
+++ b/emulators/x49gp/files/hp50g.sh.in
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+calc=`basename $0`
+
+if [ "${calc}" != "hp50g" -a "${calc}" != "hp49g+" ]; then
+ echo "Invalid calculator name"
+ exit 1
+fi
+
+if [ "$1" ]; then
+ cname="$1"
+else
+ cname="${calc}"
+fi
+
+bdir="${HOME}/.x49gp"
+sdir="${bdir}/${cname}"
+
+datadir="%%DATADIR%%"
+
+# Copy datafiles if we don't have any
+
+if [ ! -d "${bdir}" ]; then
+ mkdir "${bdir}" || exit 1
+fi
+
+if [ ! -d "${sdir}" ]; then
+ echo "Creating new calculator..."
+
+ mkdir "${sdir}" || exit 1
+
+ cp "${datadir}/config-${calc}" "${sdir}/config"
+
+ if [ "${calc}" = "hp50g" ]; then
+ cp "${datadir}/flash-50g" "${sdir}/"
+
+ if [ "`uname -p`" = "amd64" ]; then
+ cp "${datadir}/hp50g-hack.png" "${sdir}/"
+ else
+ cp "${datadir}/hp50g.png" "${sdir}/"
+ fi
+ else
+ cp "${datadir}/flash-49g+" "${sdir}/"
+ cp "${datadir}/hp49g+.png" "${sdir}/"
+ fi
+
+ cp "${datadir}/sram" "${sdir}/"
+ cp "${datadir}/s3c2410-sram" "${sdir}/"
+
+ if [ -f "${datadir}/sdcard64.tar.gz" -a ! -f "${bdir}/sdcard" ]; then
+ tar -C "${bdir}" -xzf "${datadir}/sdcard64.tar.gz"
+ fi
+
+ chmod -R u+rw "${sdir}"
+fi
+
+cd "${sdir}" \
+ && x49gp-bin config
diff --git a/emulators/x49gp/files/patch-Makefile b/emulators/x49gp/files/patch-Makefile
new file mode 100644
index 000000000000..84097f689616
--- /dev/null
+++ b/emulators/x49gp/files/patch-Makefile
@@ -0,0 +1,32 @@
+--- Makefile.orig 2014-01-09 18:03:02.000000000 +0000
++++ Makefile 2014-01-09 18:04:14.000000000 +0000
+@@ -31,10 +31,14 @@
+ -DDEBUG_X49GP_ENABLE_IRQ \
+ -DDEBUG_X49GP_UI
+
++ifdef DEBUGB
+ DEBUG = -g # -pg
++else
++DEBUG =
++endif
+
+ #2.09
+-FIRMWARE = 4950_92.bin
++#FIRMWARE = 4950_92.bin
+ #2.10-7
+ #FIRMWARE = hp49g-u.bin
+ #HPGCC3 (copy HPGCC3 ROM first)
+@@ -53,9 +57,12 @@
+ -fno-strict-aliasing
+
+ # Use this to debug
+-# DEFINES = $(X49GP_DEBUG) $(QEMU_DEFINES)
++ifdef DEBUGB
++DEFINES = $(X49GP_DEBUG) $(QEMU_DEFINES)
++else
+ # Use this for speed
+ DEFINES = $(QEMU_DEFINES)
++endif
+
+ ifdef QEMU_OLD
+ QEMUSRC = qemu/prepare.sh \
diff --git a/emulators/x49gp/files/patch-main.c b/emulators/x49gp/files/patch-main.c
new file mode 100644
index 000000000000..f39256817c4a
--- /dev/null
+++ b/emulators/x49gp/files/patch-main.c
@@ -0,0 +1,17 @@
+--- main.c.orig 2014-01-09 17:47:52.000000000 +0000
++++ main.c 2014-01-09 17:47:38.000000000 +0000
+@@ -25,6 +25,14 @@
+
+ #include "gdbstub.h"
+
++static void *oom_check(void *ptr)
++{
++ if (ptr == NULL) {
++ abort();
++ }
++ return ptr;
++}
++
+ static x49gp_t *x49gp;
+
+ #ifdef QEMU_OLD // LD TEMPO HACK
diff --git a/emulators/x49gp/files/patch-module.c b/emulators/x49gp/files/patch-module.c
new file mode 100644
index 000000000000..771969e55e63
--- /dev/null
+++ b/emulators/x49gp/files/patch-module.c
@@ -0,0 +1,11 @@
+--- module.c.orig 2014-01-09 17:55:30.000000000 +0000
++++ module.c 2014-01-09 17:55:54.000000000 +0000
+@@ -257,7 +257,7 @@
+ return NULL;
+ }
+
+- path = g_build_filename(home, basename, filename, NULL);
++ path = g_build_filename(/*home,*/ basename, filename, NULL);
+ if (NULL == path) {
+ fprintf(stderr, "%s: %s:%u: Out of memory\n",
+ module->name, __FUNCTION__, __LINE__);
diff --git a/emulators/x49gp/files/patch-ui.c b/emulators/x49gp/files/patch-ui.c
new file mode 100644
index 000000000000..8af739555fba
--- /dev/null
+++ b/emulators/x49gp/files/patch-ui.c
@@ -0,0 +1,31 @@
+--- ui.c.orig 2014-01-09 17:49:18.000000000 +0000
++++ ui.c 2014-01-09 17:54:49.000000000 +0000
+@@ -1729,6 +1729,8 @@
+
+ button->pixmap = gdk_pixmap_new(widget->style->bg_pixmap[0], w, h, -1);
+
++ assert(button->pixmap);
++
+ gdk_draw_drawable(button->pixmap, widget->style->black_gc,
+ widget->style->bg_pixmap[0],
+ xoffset, yoffset,
+@@ -1740,6 +1742,7 @@
+ h -= 4;
+
+ cr = gdk_cairo_create(button->pixmap);
++ assert(cr);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
+
+@@ -2201,6 +2204,11 @@
+ imagefile = x49gp_module_get_filename(module, keyfile, "image");
+ x49gp_module_get_string(module, keyfile, "name", "hp49g+", &name);
+
++ if (access(imagefile, R_OK) == -1) {
++ fprintf(stderr, "Calculator skin file \"%s\" not accessible.\n", imagefile);
++ return 1;
++ }
++
+ if (!strcmp(name, "hp49g+")) {
+ ui->calculator = UI_CALCULATOR_HP49GP;
+ } else if (!strcmp(name, "hp50g")) {
diff --git a/emulators/x49gp/pkg-descr b/emulators/x49gp/pkg-descr
new file mode 100644
index 000000000000..a086dd64c0ef
--- /dev/null
+++ b/emulators/x49gp/pkg-descr
@@ -0,0 +1,11 @@
+An emulator for the HP 49g+/50g calculator series. This is an ARM-based
+emulator (unlike emu48 / debug4x), so it is possible to run hpgcc
+binaries within the emulator.
+
+Skins for both variants of the calculator are included.
+
+Known limitations:
+ - Cannot write to port 2. Libraries will eat up your RAM.
+ - HPGCC2/3 SD I/O is unstable.
+
+WWW: http://sourceforge.net/projects/x49gp/
diff --git a/emulators/x49gp/pkg-message b/emulators/x49gp/pkg-message
new file mode 100644
index 000000000000..704a7fd43320
--- /dev/null
+++ b/emulators/x49gp/pkg-message
@@ -0,0 +1,40 @@
+-------------------------------------------------------
+ Instructions
+-------------------------------------------------------
+ - Start a HP 50g with "hp50g"
+
+ - Start a HP 49G+ with "hp49g+"
+
+ - You can run each calculator type independently with
+ its own state and settings. Or create more than two
+ by supplying a name:
+
+ hp50g home
+ hp50g work
+
+ - To reset a calculator, remove its subdirectory
+ under ~/.x49gp (or the whole directory).
+
+ - A 64MB SD card is included, and shared between
+ calculators. If you want to run multiple calculators
+ simultaneously, you will probably need a different
+ arrangement. The config file for each calculator can
+ be edited to change the SD card file.
+
+ - Remember to install the ARM Toolbox if you want to
+ use HPGCC2 binaries.
+
+ - Mount the SD card with:
+ mdconfig -a -f ~/.x49gp/sdcard
+ mount_msdosfs /dev/md0 /mnt
+
+ When finished:
+ umount /mnt
+ mdconfig -d -u 0
+-------------------------------------------------------
+ Known limitations
+-------------------------------------------------------
+ - Cannot write to port 2. Libs will eat up your RAM.
+
+ - HPGCC2/3 SD I/O is unstable.
+-------------------------------------------------------
diff --git a/emulators/x49gp/pkg-plist b/emulators/x49gp/pkg-plist
new file mode 100644
index 000000000000..f9fc225c2862
--- /dev/null
+++ b/emulators/x49gp/pkg-plist
@@ -0,0 +1,14 @@
+bin/hp49g+
+bin/hp50g
+bin/x49gp-bin
+%%DATADIR%%/config-hp50g
+%%DATADIR%%/config-hp49g+
+%%DATADIR%%/flash-49g+
+%%DATADIR%%/flash-50g
+%%DATADIR%%/hp49g+.png
+%%DATADIR%%/hp50g.png
+%%DATADIR%%/hp50g-hack.png
+%%DATADIR%%/s3c2410-sram
+%%DATADIR%%/sdcard64.tar.gz
+%%DATADIR%%/sram
+@dirrm %%DATADIR%%