Package-Name: uae
Requires: XFree86|Xorg|svgalib
# FIXME: suggests gtk+ but doesn't support v2
Homepage: http://www.freiburg.linux.de/~uae/
#Source: ftp://ftp.freiburg.linux.de/pub/uae/sources/develop/uae-(\d+.\d+(.\d+)?).tar.gz $1
Source: ftp://ftp.coresystems.de/pub/uae/sources/develop/uae-(\d+.\d+(.\d+)?).tar.gz $1
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
# Package options available:
# -ofilesound: compile to write sound data to a file instead of /dev/dsp
# -othreads: enable threads
Compile:
	mv -f COPYING docs/{COMPATIBILITY,CREDITS,FAQ,NEWS,README*} "$(PREFIX)/"
	mv -f docs/unix/README "$(PREFIX)"/README.unix
	umask 022 ; mkdir -p "$(PREFIX)"/{bin,man/man1}
	set -e ; if packager c XFree86 || packager c Xorg ; then \
		if [ "$(PKGOPT_filesound)" ] ; then FILESOUND="--enable-file-sound" ; else FILESOUND="" ; fi ; \
		if [ "$(PKGOPT_threads)" ] ; then THREADS="--enable-threads" ; else THREADS="--disable-threads" ; fi ; \
		$(MAKE) -f ../Makefile configure CONFIGURE_OPTS="--with-x --without-svgalib --without-asciiart --disable-ui --enable-dga --enable-vidmode $$FILESOUND $$THREADS" ; \
		$(MAKE) ; \
		mv -f uae "$(PREFIX)"/bin/uae ; \
	else \
		rm -f "$(PREFIX)"/bin/uae ; \
	fi
	set -e ; if packager c svgalibXXX ; then \
		if test -f Makefile ; then $(MAKE) streifenfrei ; fi ; \
		if [ "$(PKGOPT_filesound)" ] ; then FILESOUND="--enable-file-sound" ; else FILESOUND="" ; fi ; \
		if [ "$(PKGOPT_threads)" ] ; then THREADS="--enable-threads" ; else THREADS="" ; fi ; \
		$(MAKE) -f ../Makefile configure CONFIGURE_OPTS="--with-svgalib --without-x --without-asciiart $$FILESOUND $$THREADS" ; \
		$(MAKE) ; \
		mv -f uae "$(PREFIX)"/bin/suae ; \
	else \
		rm -f "$(PREFIX)"/bin/suae ; \
	fi
Install:
	set -e ; if test -f "$(PREFIX)"/bin/uae ; then \
		$(MAKE) instbin BIN=uae ; \
	else \
		rm -f /usr/bin/uae ; \
	fi
	set -e ; if test -f "$(PREFIX)"/bin/suae ; then \
		chown root.console "$(PREFIX)"/bin/suae ; \
		chmod 4750 "$(PREFIX)"/bin/suae ; \
		$(MAKE) instbin BIN=suae ; \
	else \
		rm -f /usr/bin/suae ; \
	fi
Patch: <<EOT
######## begin gcc4-fixes.diff
diff -ur ../uae-0.8.25-orig/src/include/cia.h src/include/cia.h
--- ../uae-0.8.25-orig/src/include/cia.h	2001-07-07 22:51:37 +0900
+++ src/include/cia.h	2007-11-25 01:22:08 +0900
@@ -15,9 +15,3 @@
 
 extern void dumpcia (void);
 extern void rethink_cias (void);
-extern unsigned int ciaaicr,ciaaimask,ciabicr,ciabimask;
-extern unsigned int ciaacra,ciaacrb,ciabcra,ciabcrb;
-extern unsigned int ciabpra;
-extern unsigned long ciaata,ciaatb,ciabta,ciabtb;
-extern unsigned long ciaatod,ciabtod,ciaatol,ciabtol,ciaaalarm,ciabalarm;
-extern int ciaatlatch,ciabtlatch;
diff -ur ../uae-0.8.25-orig/src/include/drawing.h src/include/drawing.h
--- ../uae-0.8.25-orig/src/include/drawing.h	2005-07-02 00:53:26 +0900
+++ src/include/drawing.h	2007-11-25 01:22:08 +0900
@@ -31,7 +31,7 @@
 
 #define max_diwlastword (PIXEL_XPOS(maxhpos) + 16)
 
-extern int lores_factor, lores_shift, sprite_width;
+extern int lores_factor, lores_shift;
 
 STATIC_INLINE int coord_hw_to_window_x (int x)
 {
@@ -197,8 +197,6 @@
     int nr_color_changes, nr_sprites;
 };
 
-extern int next_sprite_entry;
-
 extern struct decision line_decisions[2 * (MAXVPOS+1) + 1];
 extern struct draw_info line_drawinfo[2][2 * (MAXVPOS+1) + 1];
 
diff -ur ../uae-0.8.25-orig/src/include/inputdevice.h src/include/inputdevice.h
--- ../uae-0.8.25-orig/src/include/inputdevice.h	2005-07-03 01:24:06 +0900
+++ src/include/inputdevice.h	2007-11-25 01:22:08 +0900
@@ -24,7 +24,6 @@
     int (*get_widget_type)(int,int,char*,uae_u32*);
     int (*get_widget_first)(int,int);
 };
-extern struct inputdevice_functions idev[3];
 extern struct inputdevice_functions inputdevicefunc_joystick;
 extern struct inputdevice_functions inputdevicefunc_mouse;
 extern struct inputdevice_functions inputdevicefunc_keyboard;
diff -ur ../uae-0.8.25-orig/src/include/memory.h src/include/memory.h
--- ../uae-0.8.25-orig/src/include/memory.h	2005-07-02 01:23:32 +0900
+++ src/include/memory.h	2007-11-25 01:22:08 +0900
@@ -72,7 +72,6 @@
 } addrbank;
 
 extern uae_u8 *filesysory;
-extern uae_u8 *rtarea;
 
 extern addrbank chipmem_bank;
 extern addrbank kickmem_bank;
diff -ur ../uae-0.8.25-orig/src/inputdevice.c src/inputdevice.c
--- ../uae-0.8.25-orig/src/inputdevice.c	2005-07-03 01:23:50 +0900
+++ src/inputdevice.c	2007-11-25 01:22:08 +0900
@@ -105,6 +105,8 @@
 static uae_u8 mouse_settings_reset[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
 static uae_u8 joystick_settings_reset[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
 
+static struct inputdevice_functions idev[3];
+
 static int isdevice (struct uae_input_device *id)
 {
     int i, j;
@@ -511,12 +513,12 @@
 
 /* Mousehack stuff */
 
-static int ievent_alive = 0;
-static int lastmx, lastmy;
+static int mousehack_ievent_alive = 0;
+static int mousehack_lastmx, mousehack_lastmy;
 
 int mousehack_alive (void)
 {
-    return ievent_alive > 0;
+    return mousehack_ievent_alive > 0;
 }
 
 uae_u32 mousehack_helper (void)
@@ -525,22 +527,22 @@
 
 #ifdef PICASSO96
     if (picasso_on) {
-	mousexpos = lastmx - picasso96_state.XOffset;
-	mouseypos = lastmy - picasso96_state.YOffset;
+	mousexpos = mousehack_lastmx - picasso96_state.XOffset;
+	mouseypos = mousehack_lastmy - picasso96_state.YOffset;
     } else
 #endif
     {
 	if (mouse_y[0] >= gfxvidinfo.height)
 	    mouse_y[0] = gfxvidinfo.height - 1;
-	mouseypos = coord_native_to_amiga_y (lastmy) << 1;
-	mousexpos = coord_native_to_amiga_x (lastmx);
+	mouseypos = coord_native_to_amiga_y (mousehack_lastmy) << 1;
+	mousexpos = coord_native_to_amiga_x (mousehack_lastmx);
     }
 
     switch (m68k_dreg (regs, 0)) {
     case 0:
-	return ievent_alive ? -1 : needmousehack ();
+	return mousehack_ievent_alive ? -1 : needmousehack ();
     case 1:
-	ievent_alive = 10;
+	mousehack_ievent_alive = 10;
 	if (!mousehack_allowed ())
 	    return 0;
 	return mousexpos;
@@ -1324,8 +1326,8 @@
     input_read = 1;
     input_vpos = 0;
     inputdevice_handle_inputcode ();
-    if (ievent_alive > 0)
-	ievent_alive--;
+    if (mousehack_ievent_alive > 0)
+	mousehack_ievent_alive--;
 #ifdef ARCADIA
     if (arcadia_rom)
 	arcadia_vsync ();
@@ -1334,7 +1336,7 @@
 
 void inputdevice_reset (void)
 {
-    ievent_alive = 0;
+    mousehack_ievent_alive = 0;
 }
 
 static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
@@ -1739,8 +1741,6 @@
     return 0;
 }
 
-static struct inputdevice_functions idev[3];
-
 void inputdevice_init (void)
 {
     idev[IDTYPE_JOYSTICK] = inputdevicefunc_joystick;
@@ -2264,9 +2264,9 @@
 	*oldm_p = data;
 	*mouse_p += d;
 	if (axis == 0)
-	    lastmx = data;
+	    mousehack_lastmx = data;
 	else
-	    lastmy = data;
+	    mousehack_lastmy = data;
     }
     v = (int)(d > 0 ? d + 0.5 : d - 0.5);
     fract1[mouse][axis] += d;
######## end gcc4-fixes.diff
######## begin nogui-missing-function-fix.diff
--- ../uae-0.8.25-orig/src/nogui.c	2001-12-30 23:41:47 +0900
+++ src/nogui.c	2005-09-05 17:58:56 +0900
@@ -59,6 +59,10 @@
 {
 }
 
+void gui_display (int shortcut)
+{
+}
+
 void gui_lock (void)
 {
 }
######## end nogui-missing-function-fix.diff
######## begin missing-header-fix.diff
--- ../uae-0.8.25-orig/src/cpu_prefetch.h	1970-01-01 09:00:00 +0900
+++ src/cpu_prefetch.h	2004-12-03 15:59:41 +0900
@@ -0,0 +1,5 @@
+#ifndef CPU_PREFETCH_H
+#define CPU_PREFETCH_H
+#define get_word_prefetch get_word
+#define get_long_prefetch get_long
+#endif
######## end missing-header-fix.diff
######## begin currprefs-stereo-fix.diff
--- ../uae-0.8.25-orig/src/sd-file/sound.c	2005-07-02 00:53:26 +0900
+++ src/sd-file/sound.c	2007-11-25 01:26:54 +0900
@@ -94,7 +94,7 @@
     buf[t+2] = (v>>16) & 255;
     buf[t+3] = (v>>24) & 255;
 
-    t = 20; v = 0x00010001 + (currprefs.stereo ? 0x10000 : 0);
+    t = 20; v = 0x00010001 + (currprefs.sound_stereo ? 0x10000 : 0);
     buf[t] = v & 255;
     buf[t+1] = (v>>8) & 255;
     buf[t+2] = (v>>16) & 255;
@@ -106,13 +106,13 @@
     buf[t+2] = (v>>16) & 255;
     buf[t+3] = (v>>24) & 255;
     t = 32; v = ((currprefs.sound_bits == 8 ? 1 : 2)
-		 * (currprefs.stereo ? 2 : 1)) + 65536*currprefs.sound_bits;
+		 * (currprefs.sound_stereo ? 2 : 1)) + 65536*currprefs.sound_bits;
     buf[t] = v & 255;
     buf[t+1] = (v>>8) & 255;
     buf[t+2] = (v>>16) & 255;
     buf[t+3] = (v>>24) & 255;
     t = 28; v = (currprefs.sound_freq * (currprefs.sound_bits == 8 ? 1 : 2)
-		 * (currprefs.stereo ? 2 : 1));
+		 * (currprefs.sound_stereo ? 2 : 1));
     buf[t] = v & 255;
     buf[t+1] = (v>>8) & 255;
     buf[t+2] = (v>>16) & 255;
@@ -123,10 +123,10 @@
 
     if (currprefs.sound_bits == 16) {
 	init_sound_table16 ();
-	sample_handler = currprefs.stereo ? sample16s_handler : sample16_handler;
+	sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler;
     } else {
 	init_sound_table8 ();
-	sample_handler = currprefs.stereo ? sample8s_handler : sample8_handler;
+	sample_handler = currprefs.sound_stereo ? sample8s_handler : sample8_handler;
     }
     sound_available = 1;
     sndbufsize = 44100;
######## end currprefs-stereo-fix.diff
######## begin extra-file-mode-support.diff
--- ../uae-0.8.25-orig/src/fsdb_unix.c	2001-02-26 00:21:48 +0900
+++ src/fsdb_unix.c	2007-11-25 01:30:48 +0900
@@ -36,7 +36,11 @@
     aino->dir = S_ISDIR (statbuf.st_mode) ? 1 : 0;
     aino->amigaos_mode = ((S_IXUSR & statbuf.st_mode ? 0 : A_FIBF_EXECUTE)
 			  | (S_IWUSR & statbuf.st_mode ? 0 : A_FIBF_WRITE)
-			  | (S_IRUSR & statbuf.st_mode ? 0 : A_FIBF_READ));
+			  | (S_IRUSR & statbuf.st_mode ? 0 : A_FIBF_READ)
+			  | (S_ISGID & statbuf.st_mode ? A_FIBF_DELETE : 0)
+			  | (S_ISVTX & statbuf.st_mode ? A_FIBF_PURE : 0)
+			  | (S_ISUID & statbuf.st_mode ? A_FIBF_SCRIPT : 0));
+    
 }
 
 int fsdb_set_file_attrs (a_inode *aino, int mask)
@@ -65,6 +69,21 @@
 	else
 	    mode |= S_IXUSR;
 
+	if (mask & A_FIBF_DELETE)
+	    mode |= S_ISGID;
+	else
+	    mode &= ~S_ISGID;
+
+	if (mask & A_FIBF_PURE)
+	    mode |= S_ISVTX;
+	else
+	    mode &= ~S_ISVTX;
+
+	if (mask & A_FIBF_SCRIPT)
+	    mode |= S_ISUID;
+	else
+	    mode &= ~S_ISUID;
+
 	chmod (aino->nname, mode);
     }
 
@@ -79,7 +98,7 @@
 {
     if (aino->dir)
 	return aino->amigaos_mode == 0;
-    return (aino->amigaos_mode & (A_FIBF_DELETE | A_FIBF_SCRIPT | A_FIBF_PURE)) == 0;
+    return 1;
 }
 
 char *fsdb_create_unique_nname (a_inode *base, const char *suggestion)
######## end extra-file-mode-support.diff
######## rest is local stuff
diff -urN ../uae-0.8.22-old/src/svga.c ./src/svga.c
--- ../uae-0.8.22-old/src/svga.c	2001-12-18 03:38:38 +0900
+++ ./src/svga.c	2002-11-23 15:05:19 +0900
@@ -166,21 +166,22 @@
 
 static uae_u8 dither_buf[1000]; /* I hate having to think about array bounds */
 
-#define MAX_SCREEN_MODES 9
+#define MAX_SCREEN_MODES 10
 
-static int x_size_table[MAX_SCREEN_MODES] = { 320, 320, 320, 640, 640, 800, 1024, 1152, 1280 };
-static int y_size_table[MAX_SCREEN_MODES] = { 200, 240, 400, 350, 480, 600, 768, 864, 1024 };
+static int x_size_table[MAX_SCREEN_MODES] = { 320, 320, 320, 400, 640, 640, 800, 1024, 1152, 1280 };
+static int y_size_table[MAX_SCREEN_MODES] = { 200, 240, 400, 301, 350, 480, 600, 768, 864, 1024 };
 
 static int vga_mode_table[MAX_SCREEN_MODES][MAX_COLOR_MODES+1] =
  { { G320x200x256, G320x200x32K, G320x200x64K, G320x200x256, G320x200x16, G320x200x16M32 },
    { G320x240x256, -1, -1, G320x240x256, -1, -1 },
    { G320x400x256, -1, -1, G320x400x256, -1, -1 },
+   { G400x300x256, G400x300x32K, G400x300x64K, -1, -1, G400x300x16M32 },
    { -1, -1, -1, -1, G640x350x16, -1 },
    { G640x480x256, G640x480x32K, G640x480x64K, G640x480x256, G640x480x16, G640x480x16M32 },
    { G800x600x256, G800x600x32K, G800x600x64K, G800x600x256, G800x600x16, G800x600x16M32 },
    { G1024x768x256, G1024x768x32K, G1024x768x64K, G1024x768x256, G1024x768x16, G1024x768x16M32 },
    { G1152x864x256, G1152x864x32K, G1152x864x64K, G1152x864x256, G1152x864x16, G1152x864x16M32 },
-   { G1280x1024x256, G1280x1024x32K, G1280x1024x64K, G1280x1024x256, G1280x1024x16, G1280x1024x16M32 }
+   { G1280x1024x256, G1280x1024x32K, G1280x1024x64K, G1280x1024x256, G1280x1024x16, G1280x1024x16M32 },
  };
 
 static int mode_bitdepth[MAX_COLOR_MODES+1][3] =
@@ -538,6 +539,11 @@
 
     vga_init();
 
+    vga_addtiming(18000, 400,416,448,512, 301,302,303,313, 0);
+    vga_mode_table[3][0] = vga_addmode(400,301,256,400,1);
+    vga_mode_table[3][1] = vga_addmode(400,301,32768,800,2);
+    vga_mode_table[3][2] = vga_addmode(400,301,65536,800,2);
+
     current_vgamode = TEXT;
 
     for (i = 0; i < MAX_SCREEN_MODES; i++) {
EOT

/pkg/uae/
/usr/bin/suae
/usr/bin/uae
