gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: GCL working on MacOS X


From: Aurelien Chanudet
Subject: [Gcl-devel] Re: GCL working on MacOS X
Date: Mon, 14 Jul 2003 22:19:05 +0200

I realize that I might have screwed up everything with my previous attachment because I didn't receive it correctly. Here is the text again.

---

Hi all,

Sorry for the delay replying, I was away for one week. The main difficulty in getting GCL to work on Mac OS X relates to the peculiarities of Mac OS X executable file format. The executable format on Mac OS X (named Mach-O) is based on that of NeXT but the two executable formats are not exactly similar. In a nutshell, I had to deal with two machine dependent issues :

The first one involves unexecing. I first tried out with the code in NeXTunixsave.c but this didn't work. As it turned out, Emacs, which has been ported to Mac OS X thanks to the work of Christian Swinehart, has unexec too and I just had to apply Christian's patches to obtain a working version of unexec for GCL (see attached file).

The second one involves fasloading. bfd does not seem to be supported on Mac OS X. dlopening, although available as a convenience, is not regarded as the preferred way to load code dynamically on Mac OS X. I'm currently working on this and I'm unable to say anything more at this stage.

Below is a list of the patches I've made so far. For my own convenience, I've inserted some -I and -L flags straight into o/makefile and unixport/makefile. Attached are the files powerpc-macosx.{h,defs} that I'm using along with the code for unexec grabbed from Emacs sources. I'm giving the following arguments to configure :
--enable-machine=powerpc-macosx --enable-dlopen --disable-statsysbfd.

Any feedback is appreciated :-)

Aurelien

--- o/makefile.old Mon Jan 13 06:34:55 2003
+++ o/makefile Mon Jul 14 20:00:48 2003
@@ -9,7 +9,7 @@
MPDIR = ../mp


#OFLAG = -O
-DEFS = -I../h -I../gcl-tk
+DEFS = -I../h -I../gcl-tk -I/sw/include
ODIR = .
GCLIB = ${ODIR}/gcllib.a
RANLIB=ranlib


--- unixport/makefile.old Thu Mar 20 16:29:39 2003
+++ unixport/makefile Mon Jul 14 19:57:38 2003
@@ -17,6 +17,7 @@


libgclp.a: $(ODIR)/gcllib.a
cp $< $@
+ ranlib $@


gmpfiles: $(shell find ../$(GMPDIR) -name "*.o" |grep -v '\.lib')
rm -rf gmp
@@ -80,15 +81,16 @@
init_%.lsp: init_%.lsp.tmp


cat $< | sed \
- -e "s,@LI-VERS@,(`cat ../majvers`.`cat ../minvers`) `date`,1" \
- -e "s,@LI-MINVERS@,`cat ../minvers`,1" \
- -e "s,@LI-MAJVERS@,`cat ../majvers`,1" \
- -e "s,@LI-CC@,\"$(CC) -c $(FINAL_CFLAGS)\",1" \
- -e "s,@LI-LD@,\"$(CC) -o \",1" \
- -e "s,@LI-LD-LIBS@,\"$(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)\",1" \
- -e "s,@LI-OPT-THREE@,\"$(O3FLAGS)\",1" \
- -e "s,@LI-OPT-TWO@,\"$(O2FLAGS)\",1" \
- -e "s,@LI-INIT-LSP@,\"address@hidden",1" >$@
+ -e "s,@LI-VERS@,(`cat ../majvers`.`cat ../minvers`) `date`," \
+ -e "s,@LI-MINVERS@,`cat ../minvers`," \
+ -e "s,@LI-MAJVERS@,`cat ../majvers`," \
+ -e "s,@LI-CC@,\"$(CC) -c $(FINAL_CFLAGS)\"," \
+ -e "s,@LI-LD@,\"$(CC) -o \"," \
+ -e "s,@LI-LD-LIBS@,\"$(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)\"," \
+ -e "s,@LI-OPT-THREE@,\"$(O3FLAGS)\"," \
+ -e "s,@LI-OPT-TWO@,\"$(O2FLAGS)\"," \
+ -e "s,@LI-INIT-LSP@,\"address@hidden"," >$@
+# on MacOS X, `sed' chockes on the flag (`1') that terminates the substitution pattern


saved_%:raw_% $(RSYM) init_%.lsp \
$(CMPDIR)/cmpmain.lsp \
@@ -108,7 +110,9 @@


libgcl.a: $(FIRST_FILE) $(OBJS) sys_gcl.o $(LAST_FILE) gmpfiles bfdfiles
rm -rf $@
- ar rs $@ $(filter %.o,$^) $(shell find gmp bfd -name "*.o")
+# `ar rs' doesnt work on MacOS X for such a long file list (dont know what the issue is)
+# this one is Apple's libtool, not to be confused with GNU libtool (shipped as glibtool)
+ libtool -static -o $@ $(filter %.o,$^) $(shell find gmp bfd -name "*.o")


libxgcl.a: libgcl.a
ln -snf $< $@
@@ -123,7 +127,7 @@


raw_%: lib%.a libgclp.a $(SYSTEM_OBJS) $(EXTRAS)
$(CC) -o raw_$*$(EXE) $(filter %.o,$^) \
- -L. $(EXTRA_LD_LIBS) $(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)
+ -L. -L/sw/lib $(EXTRA_LD_LIBS) $(LD_LIBS_PRE) -l$* $(LD_LIBS_POST)


clean:
rm -rf saved_*$(EXE) raw_*$(EXE) *.o core a.out $(RSYM) \


--- usig.c.old Tue Feb 18 03:32:03 2003
+++ usig.c Mon Jul 14 19:59:29 2003
@@ -127,7 +127,7 @@
sigprocmask( SIG_UNBLOCK,&set,0);
}
#else
- current_mask = sigblock(0);
+ int current_mask = sigblock(0);
return sigsetmask(~(sigmask(SIGIO))&~(sigmask(SIGUSR1)) & current_mask);
#endif
}


--- unixtime.c.old Sat Feb 15 01:38:28 2003
+++ unixtime.c Mon Jul 14 20:40:07 2003
@@ -71,8 +71,10 @@
#include <sys/times.h>
#endif
#include <sys/time.h>
+#ifndef DARWIN
static struct timeb beginning;
-#endif
+#endif /* DARWIN */
+#endif /* BSD */


#ifdef ATT
#include <sys/times.h>
@@ -213,7 +215,12 @@
init_unixtime(void)
{
#ifdef BSD
+#ifndef DARWIN
+/* On MacOS X, ftime is obsoleted by gettimeofday. It is available from the
+ compatibility library, libcompat. But I don't have libcompat on my box.
+ Besides, there seems to be no need for `beginning' when `BSD' is defined. */
ftime(&beginning);
+#endif /* DARWIN */
#endif
#ifdef ATT
beginning = time(0);


----------

# powerpc-macosx.defs
# For MacOS X
#

# Disable Apple's custom C preprocessor which gets confused when
# preprocessing some of the *.d files in the o/ subdirectory.
CC = gcc -no-cpp-precomp

# Set this to avoid warnings when linking against libncurses.
LIBS = -lSystem -lreadline -ldl

# Set this for the linker to operate correctly.
MACOSX_DEPLOYMENT_TARGET = 10.2

# LDCC = ld -X -seglinkedit -segprot __TEXT rwx rwx /lib/crt0.o

reply via email to

[Prev in Thread] Current Thread [Next in Thread]