From e7946d6f6e406e53345fb8b3f4a7a1b3bd53238c Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 16 Feb 2018 19:35:18 +0000
Subject: clisp: initial inclusion

---
 abs/extra/clisp/PKGBUILD                           | 49 ++++++++++++++++++++++
 abs/extra/clisp/clisp-gcc5.patch                   | 38 +++++++++++++++++
 .../clisp/patch-modules_readline_readline.lisp     | 15 +++++++
 3 files changed, 102 insertions(+)
 create mode 100644 abs/extra/clisp/PKGBUILD
 create mode 100644 abs/extra/clisp/clisp-gcc5.patch
 create mode 100644 abs/extra/clisp/patch-modules_readline_readline.lisp

diff --git a/abs/extra/clisp/PKGBUILD b/abs/extra/clisp/PKGBUILD
new file mode 100644
index 0000000..9a133f2
--- /dev/null
+++ b/abs/extra/clisp/PKGBUILD
@@ -0,0 +1,49 @@
+# $Id$
+# Maintainer: Juergen Hoetzel <juergen@archlinux.org>
+pkgname=clisp
+pkgver=2.49
+pkgrel=6
+pkgdesc="ANSI Common Lisp interpreter, compiler and debugger"
+arch=('x86_64')
+license=('GPL')
+url="http://clisp.cons.org/"
+depends=('readline' 'libsigsegv')
+provides=('common-lisp')
+makedepends=('ffcall')
+options=('!makeflags' '!emptydirs')
+source=("http://downloads.sourceforge.net/sourceforge/clisp/clisp-${pkgver}.tar.bz2"
+        "clisp-gcc5.patch"
+        "patch-modules_readline_readline.lisp")
+md5sums=('1962b99d5e530390ec3829236d168649'
+         'e3008f96f6cd3059717d4a930b8c0e9c'
+         '5b29c9301ab7c1b683da70c2f805609f')
+
+prepare() {
+  cd $srcdir/${pkgname}-${pkgver}
+  patch -Np1 -i ../clisp-gcc5.patch
+  patch -Np0 -i ../patch-modules_readline_readline.lisp
+
+  # https://sourceforge.net/p/clisp/clisp/ci/cebd289dfc19de4aa504113dfcb0284657787430/
+  # http://hg.slitaz.org/wok/rev/d5a39f30f9f1#l2.28
+  sed -i 's/clisp\.cons\.org/clisp.org/' src/cfgunix.lisp
+}
+
+build() {
+  cd $srcdir/${pkgname}-${pkgver}
+  ./configure --prefix=/usr --with-readline --with-ffcall src
+  cd src
+  ./makemake --prefix=/usr --with-readline --with-ffcall --with-dynamic-ffi > Makefile
+  make
+  sed -i 's,http://www.lisp.org/HyperSpec/,http://www.lispworks.com/reference/HyperSpec/,g' config.lisp
+  make
+}
+
+check() {
+  cd $srcdir/${pkgname}-${pkgver}/src
+  make check
+}
+
+package() {
+  cd $srcdir/${pkgname}-${pkgver}/src
+  make DESTDIR=$pkgdir install
+}
diff --git a/abs/extra/clisp/clisp-gcc5.patch b/abs/extra/clisp/clisp-gcc5.patch
new file mode 100644
index 0000000..79ffa74
--- /dev/null
+++ b/abs/extra/clisp/clisp-gcc5.patch
@@ -0,0 +1,38 @@
+--- ./src/makemake.in.orig	2013-02-16 15:26:28.000000000 -0700
++++ ./src/makemake.in	2015-02-11 17:20:00.000000000 -0700
+@@ -1217,7 +1217,7 @@ if [ $XCC_GCC = true ] ; then
+   if [ $CROSS = false ] ; then
+     case "$XCC_GCC_VERSION" in
+       # gcc 2.7 introduced an annoying warning, but gcc 2.8 has a workaround:
+-      2.[8-9]* | 3.* | 4.* | egcs-2.*)
++      2.[8-9]* | 3.* | 4.* | 5.* | 6.* | 7.* | 8.* | egcs-2.*)
+         XCFLAGS=$XCFLAGS' -Wno-sign-compare -Wno-format-nonliteral'
+         ;;
+       * ) ;;
+@@ -1226,7 +1226,7 @@ if [ $XCC_GCC = true ] ; then
+   if [ $CROSS = false -a $CC_CPLUSPLUS = true ] ; then
+     case "$XCC_GCC_VERSION" in
+       # g++ 3.4 introduced an annoying warning, but has a workaround:
+-      3.[4-9]* | 4.*)
++      3.[4-9]* | 4.* | 5.* | 6.* | 7.* | 8.*)
+         XCFLAGS=$XCFLAGS' -Wno-invalid-offsetof'
+         ;;
+       * ) ;;
+@@ -1241,7 +1241,7 @@ if [ $XCC_GCC = true ] ; then
+             # gcc-2.7.2 has a strength-reduction bug (fixed in gcc-2.7.2.1,
+             # also fixed through the specs file of some Linux distributions).
+             XCFLAGS=$XCFLAGS' -O2 -fexpensive-optimizations -fno-strength-reduce' ;;
+-          2.3.[2-9]* | 2.[4-9]* | 3.* | 4.* | egcs-2.*)
++          2.3.[2-9]* | 2.[4-9]* | 3.* | 4.* | 5.* | 6.* | 7.* | 8.* | egcs-2.*)
+             XCFLAGS=$XCFLAGS' -O2 -fexpensive-optimizations' ;;
+           * )
+             XCFLAGS=$XCFLAGS' -O' ;;
+@@ -1295,7 +1295,7 @@ if [ $XCC_GCC = true ] ; then
+     esac
+   fi # with_debug
+   case "$XCC_GCC_VERSION" in
+-    3* | 4*)
++    3* | 4* | 5* | 6* | 7* | 8*)
+       # When not optimizing on linux, or with Apple's gcc 4 on MacOS X,
+       # or with GCC 4 when "gcc -Os" is used:
+       #   C_CODE_ALIGNMENT is wrong. &EVAL-WHEN = 0x806D512
diff --git a/abs/extra/clisp/patch-modules_readline_readline.lisp b/abs/extra/clisp/patch-modules_readline_readline.lisp
new file mode 100644
index 0000000..19c54f9
--- /dev/null
+++ b/abs/extra/clisp/patch-modules_readline_readline.lisp
@@ -0,0 +1,15 @@
+$NetBSD: patch-modules_readline_readline.lisp,v 1.1 2016/09/20 14:10:25 wiz Exp $
+
+rl_readline_state changed from int to unsigned long in readline-7.0.
+
+--- modules/readline/readline.lisp.orig	2010-01-06 22:18:03.000000000 +0000
++++ modules/readline/readline.lisp
+@@ -424,7 +424,7 @@ name in ~/.inputrc. This is preferred wa
+    "The version of this incarnation of the readline library, e.g., 0x0402."))
+ (def-c-var gnu-readline-p (:name "rl_gnu_readline_p") (:type int)
+   (:documentation "True if this is real GNU readline."))
+-(def-c-var readline-state (:name "rl_readline_state") (:type int)
++(def-c-var readline-state (:name "rl_readline_state") (:type ulong)
+   (:documentation "Flags word encapsulating the current readline state."))
+ (def-c-var editing-mode (:name "rl_editing_mode") (:type int)
+   (:documentation "Says which editing mode readline is currently using.
-- 
cgit v0.12

