MacPorts gcl27 package and private patches
"Chun Tian (binghe)" <[email protected]> Wed, 16 Apr 2025 10:34:27 +1000
| Newsgroups | gmane.lisp.gcl.devel |
|---|---|
| Organization | The Australian National University |
| Message-ID | <[email protected]> |
Hello,
yesterday I've sent to MacPorts a port definition for "gcl27" [1], together with
some macOS specific patches. I'm physically using macOS Big Sur (11.7.10) on an
Intel Mac, and currently GCL 2.7 doesn't build on ARM Mac yet, so perhaps very
few people can actually use this "gcl27" package at this moment.
[1] https://github.com/macports/macports-ports/pull/28141
Anyway, I have GCL 2.7.1 installed at /opt/local by a locally built MacPorts
package, and now I can start gcl in both ANSI and CLtL1 (by default) modes,
aligned with the Debian testing "gcl27" package (there's no support of GCL_PROF).
$ gcl
GCL (GNU Common Lisp) 2.7.1 Thu Apr 10 09:38:27 PM EDT 2025 CLtL1 git:
Version_2_7_1
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License: GPL due to GPL'ed components: (READLINE UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter
Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to
/var/folders/8h/4sglq7954pb36vkz51v4br7r0000gn/T/
>(quit)
$ GCL_ANSI=1 gcl
GCL (GNU Common Lisp) 2.7.1 Thu Apr 10 09:38:27 PM EDT 2025 ANSI git:
Version_2_7_1
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License: GPL due to GPL'ed components: (READLINE UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter
Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to
/var/folders/8h/4sglq7954pb36vkz51v4br7r0000gn/T/
>(quit)
$ which gcl
/opt/local/bin/gcl
Beside the official patch (upstream-small-release-errata), I need to modify some
other places in the source code to get the build done. The main purpose of this
email is to explain these patches (they are in attach), to see if some of them
can be part of the upstream source code.
1. o/sfaslmacho.c (see section_64.patch in attach)
At Line 212 there's the following line accessing the "sh_addr" and "sh_size"
members of the "section_64" structure (related to Mach-O format):
bzero((void *)sec->sh_addr,sec->sh_size);
But the compiler complains that no such members exist. I think maybe the
following modification should be done:
bzero((void *)sec->addr,sec->size);
2. Makefile.in|am (part of binutils.patch)
The macOS linker doesn't support "-z" option (by calling gcc with
"-Wl,-z,relro"). I checked documentation of "-z" option of "ld" on Linux and
found it's related to ELF format, thus perhaps on macOS we don't need it? (by
deleting this option the building process can continue.)
3. Makefile.in|am (part of binutils.patch)
Some shell commands used in this file involve the grammar <(...), which is
beyond the vanilla (BSD?) "/bin/sh" on macOS. I had to set "SHELL = /bin/bash"
at the beginning of Makefile.in|am and remove the default generated "SHELL =
/bin/sh" in the middle.
4. xbin/ar_merge (part of binutils.patch)
The macOS "ar" command, unfortunately, doesn't support "--output" option,
therefore "ar x" can only extract the archive to the current directory. I ever
tried to depend on GNU binutils (available in MacPorts) but it seems that macOS
linker doesn't understand its output format. After some experiments I wrote the
following working "ar_merge" achieving the same goal but does't rely on "ar
--output":
+fullfile=
+filename=
+
TMPDIR=$(mktemp -d)
while [ $# -gt 0 ] ; do
case $(basename $1) in
*.o) cp $1 $TMPDIR;;
*.go) cp $1 $TMPDIR/$(echo $(basename $1)|sed 's,\.go,.o,g');;
- *.a) ar x $1 --output $TMPDIR;;
+ *.a)
+ fullfile=$1;
+ filename="${fullfile##*/}";
+ cp $fullfile $TMPDIR;
+ pushd $TMPDIR;
+ ar -x $filename;
+ rm $filename;
+ popd;;
Regards,
Chun Tian
binutils.patch
(text/plain, 1.5 KB)
diff -ur gcl-2.7.1.orig/Makefile.in gcl-2.7.1/Makefile.in
--- gcl-2.7.1.orig/Makefile.in 2025-04-11 16:05:19.000000000 +1000
+++ gcl-2.7.1/Makefile.in 2025-04-15 12:14:35.000000000 +1000
@@ -14,8 +14,7 @@
@SET_MAKE@
-
-
+SHELL = /bin/bash
VPATH = @srcdir@
am__is_gnu_make = { \
@@ -768,7 +767,6 @@
RL_LIB = @RL_LIB@
RL_OBJS = @RL_OBJS@
SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
STRIP = @STRIP@
TCLSH = @TCLSH@
TCL_INCLUDE = @TCL_INCLUDE@
@@ -4556,7 +4554,7 @@
rm -rf sb_$*
unixport/raw_%: unixport/lib%.a
- $(CC) $(AM_LDFLAGS) -rdynamic -Wl,-z,relro $(LDFLAGS) -o $@ $< $(LIBS) #FIXME relro
+ $(CC) $(AM_LDFLAGS) -rdynamic $(LDFLAGS) -o $@ $< $(LIBS)
unixport/gcl_cmpnopt_gcl_gprof.lsp unixport/gcl_cmpnopt_ansi_gcl_gprof.lsp:\
unixport/gcl_cmpnopt_%_gprof.lsp: unixport/gcl_cmpnopt_%.lsp
diff -ur gcl-2.7.1.orig/xbin/ar_merge gcl-2.7.1/xbin/ar_merge
--- gcl-2.7.1.orig/xbin/ar_merge 2025-04-11 04:21:26.000000000 +1000
+++ gcl-2.7.1/xbin/ar_merge 2025-04-15 11:27:09.000000000 +1000
@@ -5,12 +5,22 @@
ARCHIVE=$1
shift
+fullfile=
+filename=
+
TMPDIR=$(mktemp -d)
while [ $# -gt 0 ] ; do
case $(basename $1) in
*.o) cp $1 $TMPDIR;;
*.go) cp $1 $TMPDIR/$(echo $(basename $1)|sed 's,\.go,.o,g');;
- *.a) ar x $1 --output $TMPDIR;;
+ *.a)
+ fullfile=$1;
+ filename="${fullfile##*/}";
+ cp $fullfile $TMPDIR;
+ pushd $TMPDIR;
+ ar -x $filename;
+ rm $filename;
+ popd;;
recompile);;
*) echo Bad arg $1 ; exit 1 ;;
esac
section_64.patch
(text/plain, 418 B)
diff -ur gcl-2.7.1.orig/o/sfaslmacho.c gcl-2.7.1/o/sfaslmacho.c
--- gcl-2.7.1.orig/o/sfaslmacho.c 2025-04-11 04:21:26.000000000 +1000
+++ gcl-2.7.1/o/sfaslmacho.c 2025-04-15 10:18:32.000000000 +1000
@@ -208,7 +208,7 @@
if (LOAD_SEC(sec))
memcpy((void *)sec->addr,v1+sec->offset,sec->size);
else
- bzero((void *)sec->sh_addr,sec->sh_size);
+ bzero((void *)sec->addr,sec->size);
}
if (**got) {
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEES+aY+4laoC0TwmVKFUkg2jrYR8gFAmf++xMACgkQFUkg2jrY R8g9cA//XeX0lHNWr0i+GdzYD3aruLg3thBB+UUMqxPxFU+AUKpYHQHE2kF22htE DFeLBy5YE+16LjqcQSXu9CrPzcQKTseAbJHKt1ENLAOl0gk5rJjfgDlNXRv2sEbX xO4tHqMz3McO2k4O9Z4IOeVzX0IT6RDRhxh7ZJRL8skXunncHzjwuFPzygoT0lmR InVRH8bUJ1SxuVBzzOig5NGoK+0jmRXBRe6yfn2ObU39OGELF2P9AFzWnvWbHP24 i3nghyy31KTM7QwpAmTfTyvWrH5pOYhp9f3kMzhsGE2wNETx/Pzbak4ARR8quH+C u861Edqbh3KU/zhGwD60BISaDCk/a1vsZsOuLvum3Xe1C3cUehVZrqX6cOph1rND +aQbQeY+s202EmR5PUUa7r1XelfmVWzIuaRnRQpj5+Yo2YMu8LojiYcl7OSzkpUF 2oliI0luLq8K+FWzDimjUw1xtahBe5I7QaUCAfHnueLoeYbmjm/9PmIGDbHup0/p RR0io0FkHN+Y/Pws2Tj1AHSIfZKA3GKtOWZnRc2wMlMQpJkYCC/pBsMTsOFt2q3E IIIqVg6Bf69C1a+aOb7c4A5hbTQ9Y5B53zj2kfBtzk3TzZoQnCN7jLnxjHvt0l3h XZw+s/oySM3vkFrL1EXmHQAplRa57eqCG9MxJ6iT2ejphRCNkYQ= =kX+J -----END PGP SIGNATURE-----