From 0b62821b748b1ba7f40ca7e86b07b0475d51bde2 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 27 Jan 2023 02:07:52 +0800 Subject: [PATCH] Fixes for PPC and Macports diff --git a/Makefile b/Makefile index aba8398..c0b4f70 100644 --- a/Makefile +++ b/Makefile @@ -6,26 +6,38 @@ ARCH="$(shell uname -m)" OS="$(shell uname -s)" ifeq ($(ARCH), "i386") -CC=gcc +CC=@CC@ endif ifeq ($(ARCH), "i686") -CC=gcc +CC=@CC@ endif ifeq ($(ARCH), "x86_64") -CC=gcc +CC=@CC@ ifeq ($(OS), "Darwin") -CC=gcc -Wno-parentheses-equality -Wno-unused-value -Wno-parentheses -Wno-empty-body +CC=@CC@ -Wno-parentheses-equality -Wno-unused-value -Wno-parentheses -Wno-empty-body endif endif ifeq ($(ARCH), "armv7l") -CC=gcc +CC=@CC@ endif ifeq ($(ARCH), "aarch64") -CC=gcc +CC=@CC@ +endif + +ifeq ($(ARCH), "ppc") +CC=@CC@ +endif + +ifeq ($(ARCH), "ppc64") +CC=@CC@ +endif + +ifeq ($(ARCH), "Power Macintosh") +CC=@CC@ endif ifeq ($(CC), "none") @@ -34,29 +46,22 @@ endif #------------ Debug value ------------- DEBUG=yes -#------------ Debian values ----------- -DESTDIR= + +DESTDIR=@DESTROOT@ VERSION=1.20 NODEPENDS= -PKGDIR=$(DESTDIR)/usr/share/algol68toc -DOCDIR=$(DESTDIR)/usr/share/doc/algol68toc -BINDIR=$(DESTDIR)/usr/bin -LIBDIR=$(DESTDIR)/usr/lib -INFODIR=$(DESTDIR)/usr/share/info -MANDIR=$(DESTDIR)/usr/share/man/man1 -INCDIR=$(DESTDIR)/usr/include/algol68 -APPDIR=$(DESTDIR)/usr/share/applications #------------ macOS values ------------- ifeq ($(OS), "Darwin") -PKGDIR=$(DESTDIR)/usr/local/share/algol68toc -DOCDIR=$(DESTDIR)/usr/local/share/doc/algol68toc -BINDIR=$(DESTDIR)/usr/local/bin -LIBDIR=$(DESTDIR)/usr/local/lib -INFODIR=$(DESTDIR)/usr/local/share/info -MANDIR=$(DESTDIR)/usr/local/share/man/man1 -INCDIR=$(DESTDIR)/usr/local/include/algol68 -APPDIR=$(DESTDIR)/usr/local/share/applications +PREFIX=@PREFIX@ +PKGDIR=$(DESTDIR)$(PREFIX)/share/algol68toc +DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/algol68toc +BINDIR=$(DESTDIR)$(PREFIX)/bin +LIBDIR=$(DESTDIR)$(PREFIX)/lib +INFODIR=$(DESTDIR)$(PREFIX)/share/info +MANDIR=$(DESTDIR)$(PREFIX)/share/man/man1 +INCDIR=$(DESTDIR)$(PREFIX)/include/algol68 +APPDIR=$(DESTDIR)$(PREFIX)/share/applications endif #------------- Absolute directories ------------ @@ -88,9 +93,9 @@ A68_LIB:=$(ACD) #------------ Flags ------------ ifeq ($(DEBUG),no) -override CFLAGS=-O0 +override CFLAGS=@ARCHFLAGS@ -O0 else -override CFLAGS=-O0 -g +override CFLAGS=@ARCHFLAGS@ -O0 -g endif NOR=$(CFLAGS) $(INCS) CTSTAR=59LR diff --git a/include/algol68/Aalloc.h b/include/algol68/Aalloc.h index b951a96..d929316 100644 --- a/include/algol68/Aalloc.h +++ b/include/algol68/Aalloc.h @@ -104,8 +104,18 @@ # define A_FUNNY_STEPAREAPTR */ +/* +** FIXME: There are some issues to be solved with GC here: +** https://github.com/coolbikerdad/Algol-68RS-Source/issues/1 +** As a temporary solution, disable it on PPC. +*/ +#if defined(__APPLE__) && defined(__POWERPC__) +#define A_NO_GARBAGE_COLLECT +#define A_GC_METHOD none +#endif + #if !defined(A_GC_METHOD) -#if defined(__LP64__) || defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) +#if defined(__LP64__) || defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__) || defined(__ppc64__) # define MAX_CACHE 0 /* disable caching of small allocations, leave to BDW */ # define A_BDW_GARBAGE_COLLECT # define A_GC_METHOD BDW @@ -117,7 +127,7 @@ ** */ #if !defined(A_GC_METHOD) -#if defined(__i386__) || defined(__i686__) || defined(__arm__) +#if defined(__i386__) || defined(__i686__) || defined(__arm__) || defined(__ppc__) # define A_GARBAGE_COLLECT # define A_GC_METHOD A68TOC #endif @@ -156,7 +166,7 @@ ** Check we have a GC method selected */ #if !defined(A_GC_METHOD) -#error Unable to determine garnage collection method in Aalloc.h +#error Unable to determine garbage collection method in Aalloc.h #endif /* diff --git a/include/algol68/gc/gc_tiny_fl.h b/include/algol68/gc/gc_tiny_fl.h index 0382b41..715a53b 100644 --- a/include/algol68/gc/gc_tiny_fl.h +++ b/include/algol68/gc/gc_tiny_fl.h @@ -50,7 +50,7 @@ || defined(__s390x__) \ || (defined(__x86_64__) && !defined(__ILP32__)) \ || defined(__alpha__) || defined(__powerpc64__) \ - || defined(__arch64__) + || defined(__arch64__) || defined(__ppc64__) # define GC_GRANULE_BYTES 16 # define GC_GRANULE_WORDS 2 # else diff --git a/scripts/ca b/scripts/ca index 0fe1ab3..12c3012 100755 --- a/scripts/ca +++ b/scripts/ca @@ -15,19 +15,28 @@ ECHO=":" case $ARCH in "i386") - CC="gcc" + CC=@CC@ ;; "i686") - CC="gcc" + CC=@CC@ ;; "x86_64") - CC="gcc" + CC=@CC@ ;; "armv7l") - CC="gcc" + CC=@CC@ ;; "aarch64") - CC="gcc" + CC=@CC@ + ;; + "ppc") + CC=@CC@ + ;; + "ppc64") + CC=@CC@ + ;; + "Power Macintosh") + CC=@CC@ ;; *) echo "Architecture not supported" @@ -36,9 +45,10 @@ case $ARCH in esac if [ "$OS" = "Darwin" ]; then -PROGRAM=/usr/local/bin/a68toc -ROOT=/usr/local/share/algol68toc -INCLUDES="-I/usr/local/include/algol68 -I/usr/include" +PREFIX=@PREFIX@ +PROGRAM=${PREFIX}/bin/a68toc +ROOT=${PREFIX}/share/algol68toc +INCLUDES="-I${PREFIX}/include/algol68 -I${PREFIX}/include" else PROGRAM=/usr/bin/a68toc ROOT=/usr/share/algol68toc @@ -48,7 +58,7 @@ fi A68DIRS="-dir ${ROOT}" CHECK=-DA68_CHECK DEBUG= -DESTDIR=${HOME}/lib +DESTDIR=${PREFIX}/lib LIBRARIES=-L${DESTDIR} MUNGE=n UNAME="-uname seedfile"