mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
Remove low memory globals hack (it doesn't work)
This commit is contained in:
parent
8353a9ed44
commit
e99d4e579c
@ -1,179 +0,0 @@
|
|||||||
2006-05-05 Gwenole Beauchesne <gb.public@free.fr>
|
|
||||||
|
|
||||||
* gtk/gtkaqua.c (gtk_aqua_draw_focus): Don't crash if "detail" is
|
|
||||||
NULL.
|
|
||||||
|
|
||||||
* gdk/MacCarbonEvents.c (mouse_motion_handler): Another NULL
|
|
||||||
pointer check.
|
|
||||||
|
|
||||||
2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
|
|
||||||
|
|
||||||
* glib-1.2.10/gmain.c (g_main_run): Don't block in
|
|
||||||
RunApplicationEventLoop(), code inspired from Inside Mac
|
|
||||||
technote.
|
|
||||||
|
|
||||||
This patch only suits Basilisk II needs. i.e. this may not work
|
|
||||||
for other programs.
|
|
||||||
|
|
||||||
2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
|
|
||||||
|
|
||||||
* glib-1.2.10/glibconfig.h (G_VA_COPY): Don't redefine.
|
|
||||||
|
|
||||||
--- gtk-osx-0.7/gdk/MacCarbonEvents.c Sat May 8 16:59:12 2004
|
|
||||||
+++ gtk-osx-0.7/gdk/MacCarbonEvents.c Fri May 5 07:48:45 2006
|
|
||||||
@@ -227,7 +227,7 @@ mouse_motion_handler (EventHandlerCallRe
|
|
||||||
local_point.v = global_point.v;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (gdk_window != g_win_containing_mouse)
|
|
||||||
+ if (gdk_window && gdk_window != g_win_containing_mouse)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(GDK_LEAVE_NOTIFY_MASK & ((GdkWindowPrivate*) g_win_containing_mouse)->event_mask) {
|
|
||||||
--- gtk-osx-0.7/glib-1.2.10/glibconfig.h Thu Jan 2 05:29:18 2003
|
|
||||||
+++ gtk-osx-0.7/glib-1.2.10/glibconfig.h Mon Apr 17 21:12:34 2006
|
|
||||||
@@ -62,8 +62,9 @@ G_GNUC_EXTENSION typedef unsigned long l
|
|
||||||
#define GLIB_MINOR_VERSION 2
|
|
||||||
#define GLIB_MICRO_VERSION 10
|
|
||||||
|
|
||||||
-
|
|
||||||
+#ifndef G_VA_COPY
|
|
||||||
#define G_VA_COPY __va_copy
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define G_HAVE_INLINE 1
|
|
||||||
--- gtk-osx-0.7/glib-1.2.10/gmain.c Sat Dec 27 22:23:06 2003
|
|
||||||
+++ gtk-osx-0.7/glib-1.2.10/gmain.c Mon Apr 17 22:12:15 2006
|
|
||||||
@@ -145,6 +145,7 @@ static gboolean g_idle_dispatch (
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
#ifdef MAC_CARBON_EVENTS
|
|
||||||
+static void mac_run_application_event_loop (GMainLoop *loop);
|
|
||||||
static void mac_handle_idle_action (EventLoopTimerRef timer_ref,
|
|
||||||
EventLoopIdleTimerMessage state,
|
|
||||||
void* user_data);
|
|
||||||
@@ -1116,7 +1117,7 @@ g_main_run (GMainLoop *loop)
|
|
||||||
loop->is_running = TRUE;
|
|
||||||
|
|
||||||
#ifdef MAC_CARBON_EVENTS
|
|
||||||
- RunApplicationEventLoop ();
|
|
||||||
+ mac_run_application_event_loop (loop);
|
|
||||||
#else
|
|
||||||
while (loop->is_running)
|
|
||||||
g_main_iterate (TRUE, TRUE);
|
|
||||||
@@ -1870,4 +1871,94 @@ mac_handle_g_main_iteration_action (Even
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
-#endif /* MAC_CARBON_EVENTS */
|
|
||||||
\ No newline at end of file
|
|
||||||
+static EventHandlerUPP g_quit_event_handler_upp;
|
|
||||||
+
|
|
||||||
+static pascal OSStatus QuitEventHandler(EventHandlerCallRef inHandlerCallRef,
|
|
||||||
+ EventRef inEvent, void *inUserData)
|
|
||||||
+{
|
|
||||||
+ OSStatus err;
|
|
||||||
+
|
|
||||||
+ if ((err = CallNextEventHandler(inHandlerCallRef, inEvent)) == noErr)
|
|
||||||
+ *((Boolean *)inUserData) = TRUE;
|
|
||||||
+
|
|
||||||
+ return err;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static EventHandlerUPP g_event_loop_event_handler_upp;
|
|
||||||
+
|
|
||||||
+static pascal OSStatus EventLoopEventHandler(EventHandlerCallRef inHandlerCallRef,
|
|
||||||
+ EventRef inEvent, void *inUserData)
|
|
||||||
+{
|
|
||||||
+ OSStatus err;
|
|
||||||
+ OSStatus junk;
|
|
||||||
+ EventHandlerRef installedHandler;
|
|
||||||
+ EventTargetRef theTarget;
|
|
||||||
+ EventRef theEvent;
|
|
||||||
+ EventTimeout timeToWaitForEvent;
|
|
||||||
+ Boolean quitNow;
|
|
||||||
+ GMainLoop * loop = (GMainLoop *)inUserData;
|
|
||||||
+ static const EventTypeSpec eventSpec = {kEventClassApplication, kEventAppQuit};
|
|
||||||
+
|
|
||||||
+ quitNow = false;
|
|
||||||
+
|
|
||||||
+ err = InstallEventHandler(GetApplicationEventTarget(),
|
|
||||||
+ g_quit_event_handler_upp,
|
|
||||||
+ 1, &eventSpec, &quitNow, &installedHandler);
|
|
||||||
+ if (err == noErr) {
|
|
||||||
+ theTarget = GetEventDispatcherTarget();
|
|
||||||
+ do {
|
|
||||||
+ timeToWaitForEvent = kEventDurationNoWait;
|
|
||||||
+ err = ReceiveNextEvent(0, NULL, timeToWaitForEvent,
|
|
||||||
+ true, &theEvent);
|
|
||||||
+ if (err == noErr) {
|
|
||||||
+ SendEventToEventTarget(theEvent, theTarget);
|
|
||||||
+ ReleaseEvent(theEvent);
|
|
||||||
+ }
|
|
||||||
+ YieldToAnyThread();
|
|
||||||
+ } while ( loop->is_running && ! quitNow );
|
|
||||||
+ junk = RemoveEventHandler(installedHandler);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return err;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+mac_run_application_event_loop (GMainLoop *loop)
|
|
||||||
+{
|
|
||||||
+ static const EventTypeSpec eventSpec = {'KWIN', 'KWIN' };
|
|
||||||
+ OSStatus err;
|
|
||||||
+ OSStatus junk;
|
|
||||||
+ EventHandlerRef installedHandler;
|
|
||||||
+ EventRef dummyEvent;
|
|
||||||
+
|
|
||||||
+ dummyEvent = nil;
|
|
||||||
+
|
|
||||||
+ err = noErr;
|
|
||||||
+ if (g_event_loop_event_handler_upp == nil)
|
|
||||||
+ g_event_loop_event_handler_upp = NewEventHandlerUPP(EventLoopEventHandler);
|
|
||||||
+ if (g_quit_event_handler_upp == nil)
|
|
||||||
+ g_quit_event_handler_upp = NewEventHandlerUPP(QuitEventHandler);
|
|
||||||
+ if (g_event_loop_event_handler_upp == nil || g_quit_event_handler_upp == nil)
|
|
||||||
+ err = memFullErr;
|
|
||||||
+
|
|
||||||
+ if (err == noErr) {
|
|
||||||
+ err = InstallEventHandler(GetApplicationEventTarget(),
|
|
||||||
+ g_event_loop_event_handler_upp,
|
|
||||||
+ 1, &eventSpec, loop, &installedHandler);
|
|
||||||
+ if (err == noErr) {
|
|
||||||
+ err = MacCreateEvent(nil, 'KWIN', 'KWIN', GetCurrentEventTime(),
|
|
||||||
+ kEventAttributeNone, &dummyEvent);
|
|
||||||
+ if (err == noErr)
|
|
||||||
+ err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
|
|
||||||
+ kEventPriorityHigh);
|
|
||||||
+ if (err == noErr)
|
|
||||||
+ RunApplicationEventLoop();
|
|
||||||
+
|
|
||||||
+ junk = RemoveEventHandler(installedHandler);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (dummyEvent != nil)
|
|
||||||
+ ReleaseEvent(dummyEvent);
|
|
||||||
+}
|
|
||||||
+#endif /* MAC_CARBON_EVENTS */
|
|
||||||
--- gtk-osx-0.7/gtk/gtkaqua.c Sat Dec 27 23:33:36 2003
|
|
||||||
+++ gtk-osx-0.7/gtk/gtkaqua.c Fri May 5 07:13:30 2006
|
|
||||||
@@ -2183,11 +2183,12 @@ gtk_aqua_draw_focus (GtkStyle *styl
|
|
||||||
g_return_if_fail (window != NULL);
|
|
||||||
|
|
||||||
// aqua button focus is not just a simple rectangle, so we don't draw anything here
|
|
||||||
- if ( strcmp( detail, "button" ) == 0 ) {
|
|
||||||
+ if (detail) {
|
|
||||||
+ if ( strcmp( detail, "button" ) == 0 )
|
|
||||||
return;
|
|
||||||
- } else if ( strcmp( detail, "checkbutton" ) == 0 ) {
|
|
||||||
+ else if ( strcmp( detail, "checkbutton" ) == 0 )
|
|
||||||
return;
|
|
||||||
- } else if ( strcmp( detail, "togglebutton" ) == 0 ) {
|
|
||||||
+ else if ( strcmp( detail, "togglebutton" ) == 0 )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
@ -1,253 +0,0 @@
|
|||||||
/*
|
|
||||||
* lowmem.c - enable access to low memory globals on Darwin
|
|
||||||
*
|
|
||||||
* Copyright (c) 2003 Michael Z. Sliczniak
|
|
||||||
*
|
|
||||||
* Basilisk II (C) 1997-2005 Christian Bauer
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <mach/vm_prot.h>
|
|
||||||
#include <mach-o/loader.h>
|
|
||||||
#include <mach-o/fat.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
static const char progname[] = "lowmem";
|
|
||||||
static const char *filename;
|
|
||||||
|
|
||||||
static int do_swap = 0;
|
|
||||||
|
|
||||||
static uint32_t target_uint32(uint32_t value)
|
|
||||||
{
|
|
||||||
if (do_swap)
|
|
||||||
value = OSSwapInt32(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pagezero_32(struct mach_header *machhead)
|
|
||||||
{
|
|
||||||
struct segment_command *sc_cmd;
|
|
||||||
|
|
||||||
if (target_uint32(machhead->filetype) != MH_EXECUTE) {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not appear to be an executable file\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (machhead->ncmds == 0) {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not contain any load commands\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
sc_cmd = (void *)&machhead[1];
|
|
||||||
if (target_uint32(sc_cmd->cmd) != LC_SEGMENT){
|
|
||||||
(void)fprintf(stderr, "%s: load segment not first command in %s\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (strncmp(sc_cmd->segname, "__PAGEZERO", sizeof (*sc_cmd->segname))) {
|
|
||||||
(void)fprintf(stderr, "%s: zero page not first segment in %s\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/* change the permissions */
|
|
||||||
sc_cmd->maxprot = target_uint32(VM_PROT_ALL);
|
|
||||||
sc_cmd->initprot = target_uint32(VM_PROT_ALL);
|
|
||||||
|
|
||||||
#ifdef MH_PIE
|
|
||||||
/* disable pie in header */
|
|
||||||
machhead->flags = target_uint32(target_uint32(machhead->flags) & ~MH_PIE);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
void pagezero_64(struct mach_header_64 *machhead)
|
|
||||||
{
|
|
||||||
struct segment_command_64 *sc_cmd;
|
|
||||||
|
|
||||||
if (target_uint32(machhead->filetype) != MH_EXECUTE) {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not appear to be an executable file\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (machhead->ncmds == 0) {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not contain any load commands\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
sc_cmd = (void *)&machhead[1];
|
|
||||||
if (target_uint32(sc_cmd->cmd) != LC_SEGMENT_64) {
|
|
||||||
(void)fprintf(stderr, "%s: load segment not first command in %s\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (strncmp(sc_cmd->segname, "__PAGEZERO", sizeof(*sc_cmd->segname))) {
|
|
||||||
(void)fprintf(stderr, "%s: zero page not first segment in %s\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/* change the permissions */
|
|
||||||
sc_cmd->maxprot = target_uint32(VM_PROT_ALL);
|
|
||||||
sc_cmd->initprot = target_uint32(VM_PROT_ALL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Under Mach there is very little assumed about the memory map of object
|
|
||||||
* files. It is the job of the loader to create the initial memory map of an
|
|
||||||
* executable. In a Mach-O executable there will be numerous loader commands
|
|
||||||
* that the loader must process. Some of these will create the initial memory
|
|
||||||
* map used by the executable. Under Darwin the static object file linker,
|
|
||||||
* ld, automatically adds the __PAGEZERO segment to all executables. The
|
|
||||||
* default size of this segment is the page size of the target system and
|
|
||||||
* the initial and maximum permissions are set to allow no access. This is so
|
|
||||||
* that all programs fault on a NULL pointer dereference. Arguably this is
|
|
||||||
* incorrect and the maximum permissions shoould be rwx so that programs can
|
|
||||||
* change this default behavior. Then programs could be written that assume
|
|
||||||
* a null string at the null address, which was the convention on some
|
|
||||||
* systems. In our case we need to have 8K mapped at zero for the low memory
|
|
||||||
* globals and this program modifies the segment load command in the
|
|
||||||
* basiliskII executable so that it can be used for data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
char *addr;
|
|
||||||
off_t file_size;
|
|
||||||
struct mach_header *machhead;
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
struct mach_header_64 *machhead64;
|
|
||||||
#endif
|
|
||||||
struct fat_header *fathead;
|
|
||||||
struct stat f;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
(void)fprintf(stderr, "Usage: %s executable\n", progname);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
filename = argv[1];
|
|
||||||
|
|
||||||
if (stat(filename, &f)) {
|
|
||||||
(void)fprintf(stderr, "%s: could not stat %s: %s\n",
|
|
||||||
progname, filename, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
file_size = f.st_size;
|
|
||||||
|
|
||||||
fd = open(filename, O_RDWR, 0);
|
|
||||||
if (fd == -1) {
|
|
||||||
(void)fprintf(stderr, "%s: could not open %s: %s\n",
|
|
||||||
progname, filename, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Size does not really matter, it will be rounded-up to a multiple
|
|
||||||
* of the page size automatically.
|
|
||||||
*/
|
|
||||||
addr = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
|
|
||||||
MAP_FILE | MAP_SHARED, fd, 0);
|
|
||||||
if (addr == NULL || addr == MAP_FAILED) {
|
|
||||||
(void)fprintf(stderr, "%s: could not mmap %s: %s\n",
|
|
||||||
progname, filename, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see if the Mach-O magic bytes are in the header.
|
|
||||||
*/
|
|
||||||
machhead = (void *)addr;
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
machhead64 = (void *)addr;
|
|
||||||
#endif
|
|
||||||
fathead = (void *)addr;
|
|
||||||
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
do_swap = machhead->magic == MH_CIGAM || fathead->magic == FAT_CIGAM || machhead64->magic == MH_CIGAM_64;
|
|
||||||
#else
|
|
||||||
do_swap = machhead->magic == MH_CIGAM || fathead->magic == FAT_CIGAM;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (target_uint32(machhead->magic) == MH_MAGIC) {
|
|
||||||
pagezero_32(machhead);
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
} else if (target_uint32(machhead64->magic) == MH_MAGIC_64) {
|
|
||||||
pagezero_64(machhead64);
|
|
||||||
#endif
|
|
||||||
} else if (target_uint32(fathead->magic) == FAT_MAGIC) {
|
|
||||||
struct fat_arch *arch = (void *)&fathead[1];
|
|
||||||
int saved_swap = do_swap;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < target_uint32(fathead->nfat_arch); ++i, ++arch) {
|
|
||||||
machhead = (void *)(addr + target_uint32(arch->offset));
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
machhead64 = (void *)(addr + target_uint32(arch->offset));
|
|
||||||
#endif
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
do_swap = machhead->magic == MH_CIGAM || machhead64->magic == MH_CIGAM_64;
|
|
||||||
#else
|
|
||||||
do_swap = machhead->magic == MH_CIGAM;
|
|
||||||
#endif
|
|
||||||
if (target_uint32(machhead->magic) == MH_MAGIC) {
|
|
||||||
pagezero_32(machhead);
|
|
||||||
#if defined(MH_MAGIC_64)
|
|
||||||
} else if (target_uint32(machhead64->magic) == MH_MAGIC_64) {
|
|
||||||
pagezero_64(machhead64);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not appear to be a Mach-O object file\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
do_swap = saved_swap;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
(void)fprintf(stderr, "%s: %s does not appear to be a Mach-O object file\n",
|
|
||||||
progname, filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We do not make __PAGEZERO 8K in this program because then
|
|
||||||
* all of the offsets would be wrong in the object file after
|
|
||||||
* this segment. Instead we use the -pagezero_size option
|
|
||||||
* to link the executable.
|
|
||||||
*/
|
|
||||||
if (msync(addr, file_size, MS_SYNC) == -1) {
|
|
||||||
(void)fprintf(stderr, "%s: could not sync %s: %s\n",
|
|
||||||
progname, filename, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (munmap(addr, file_size) == -1) {
|
|
||||||
(void)fprintf(stderr, "%s: could not unmap %s: %s\n",
|
|
||||||
progname, filename, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)close(fd);
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# mkstandalone - Make a standalone bundle with GTK runtime
|
|
||||||
#
|
|
||||||
# Basilisk II (C) 1997-2006 Christian Bauer
|
|
||||||
#
|
|
||||||
# mkstandalone Copyright (C) 2006 Gwenole Beauchesne
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
PROG="${1%.app}"
|
|
||||||
|
|
||||||
[ -n "$PROG" ] || {
|
|
||||||
echo "Usage: ${0##*/} <program|bundle>"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -d "$PROG.app" ] || {
|
|
||||||
echo "ERROR: $PROG.app bundle does not exist"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -x "$PROG.app/Contents/MacOS/$PROG" ] || {
|
|
||||||
echo "ERROR: $PROG.app is not a properly formed bundle"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Processing bundle $PROG.app"
|
|
||||||
|
|
||||||
FRAMEWORKS="GLib GDK GTK"
|
|
||||||
|
|
||||||
rm -r -f $PROG.app/Contents/Frameworks
|
|
||||||
mkdir -p $PROG.app/Contents/Frameworks
|
|
||||||
|
|
||||||
int_args=""
|
|
||||||
for fmk_path in `otool -L $PROG.app/Contents/MacOS/$PROG | \
|
|
||||||
sed -n '/ *\(\/.*\.framework\/.*\) ([^)]*)/s//\1/p'`
|
|
||||||
do
|
|
||||||
fmk_spath="${fmk_path%/Versions/*}"
|
|
||||||
fmk="${fmk_spath%.framework}"
|
|
||||||
fmk="${fmk##*/}"
|
|
||||||
|
|
||||||
case " $FRAMEWORKS " in
|
|
||||||
(*" $fmk "*) ;;
|
|
||||||
(*) continue ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo " Linking in framework $fmk"
|
|
||||||
fmk_dpath=$PROG.app/Contents/Frameworks/$fmk.framework
|
|
||||||
rm -rf $fmk_dpath
|
|
||||||
cp -Rf $fmk_spath $fmk_dpath
|
|
||||||
find $fmk_dpath -name "*Headers*" | xargs rm -rf
|
|
||||||
fmk_vpath="${fmk_path##*.framework/}"
|
|
||||||
|
|
||||||
# change library dependency
|
|
||||||
install_name_tool -change \
|
|
||||||
$fmk_spath/$fmk_vpath \
|
|
||||||
@executable_path/../Frameworks/$fmk.framework/$fmk_vpath \
|
|
||||||
$PROG.app/Contents/MacOS/$PROG
|
|
||||||
|
|
||||||
# change shared library id name
|
|
||||||
fmk_newid="@executable_path/../Frameworks/${fmk_path#*/Frameworks/}"
|
|
||||||
install_name_tool -id $fmk_newid $fmk_dpath/$fmk_vpath
|
|
||||||
|
|
||||||
# expand final install_name_tool args list
|
|
||||||
int_args="$int_args -change $fmk_path $fmk_newid"
|
|
||||||
|
|
||||||
# strip shared library
|
|
||||||
strip -x $fmk_dpath/$fmk_vpath
|
|
||||||
done
|
|
||||||
|
|
||||||
# change remaining dependency libs names
|
|
||||||
for f in $FRAMEWORKS; do
|
|
||||||
install_name_tool $int_args $PROG.app/Contents/Frameworks/$f.framework/$f
|
|
||||||
done
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* pagezero.c - test to see if low memory globals can be accessed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2003 Michael Z. Sliczniak
|
|
||||||
*
|
|
||||||
* Basilisk II (C) 1997-2003 Christian Bauer
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
volatile char *pagezero = (void *)0;
|
|
||||||
|
|
||||||
pagezero[0x1234] = pagezero[0x123];
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# testlmem.sh - test whether the Mach-O hack works
|
|
||||||
#
|
|
||||||
# Basilisk II (C) 1997-2005 Christian Bauer
|
|
||||||
#
|
|
||||||
# testlmem.sh Copyright (C) 2003 Michael Z. Sliczniak
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
PAGEZERO_SIZE=0x2000
|
|
||||||
[[ -n "$1" ]] && PAGEZERO_SIZE=$1
|
|
||||||
# You want all the output to go to stderr so that configure is quiet but
|
|
||||||
# config.log is verbose.
|
|
||||||
{ echo 'building lowmem utility' && \
|
|
||||||
make -f /dev/null Darwin/lowmem && \
|
|
||||||
echo 'building pagezero test' && \
|
|
||||||
make -f /dev/null LDFLAGS="-pagezero_size $PAGEZERO_SIZE" Darwin/pagezero && \
|
|
||||||
echo 'enabling low memory globals in pagezero' && \
|
|
||||||
Darwin/lowmem Darwin/pagezero && \
|
|
||||||
echo 'running pagezero test' && \
|
|
||||||
Darwin/pagezero; } 1>&2
|
|
Loading…
Reference in New Issue
Block a user