Skip to content

Commit

Permalink
dev-scheme/gauche: new upstream release
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.3.0
  • Loading branch information
hattya committed Nov 27, 2016
1 parent e050d5d commit b031eef
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-scheme/gauche/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DIST Gauche-0.9.3.3.tgz 5042189 SHA256 3d8b70075faa0f7a24f8d112cc102ee3e1066680cdd19d324d59f33fab79caac SHA512 5743781d88454d579d853a50c5c7651c52bdcea8b7b2130408e1c7761cee73edfdebaf258342e837ef7d5a3886e08bbb33b2862d1e19585f519ada5cb7475d1c WHIRLPOOL 7b11d62dc3917c3559897833da1248a3f54644159465df0d628fc5b761773ff59740231f57a7add62f2d0b03952f4f18daaf1be7598940d3b0a4719db2c767ab
DIST Gauche-0.9.4.tgz 5601987 SHA256 7b18bcd70beaced1e004594be46c8cff95795318f6f5830dd2a8a700410fc149 SHA512 815e719d78950a31c238fd7879e09f40d6b3a83a3ebf9d5f7cd3cc7ada081e5f20fbc6b432900e3455bc59e5e60014bf77605b8c9c5f27def53f89284b9cfca3 WHIRLPOOL 354ef81913c6f617589590299f616a50dc1e1313e00d61f0918c9b6c20c0358878cd505f3fb02efa4615730380a6db6bd790e241871fde6cd6e11a662efb113c
DIST Gauche-0.9.5.tgz 6458675 SHA256 4c8a53213de112708bbda5fa9648c21497d43ebf809ed5b32b15f21266b4e73c SHA512 6d853d734c7a56a86f0015b1bfef378803d6acc1e0405ed841eab5afc08d1edef736d85df10c86d75fd5fb6b2def684bb1f2095a019133b9f497192f5511197a WHIRLPOOL b29a81a920fac514866dd4a4e2911f2336d37b84ef3b9b3f50a5386f01dacea05580799ff7941e58ba4e29a9eac9289ca5037cd1b49d28a1b05e5bb2a892a907
25 changes: 25 additions & 0 deletions dev-scheme/gauche/files/gauche-0.9.5-bsd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
commit da2ea76503e8f1784d0f0be26435d4c8e0d1b12f
Author: Shiro Kawai <[email protected]>
Date: Sat Oct 15 11:44:28 2016 -1000

Avoid preprocessor symbols redefinition on OpenBSD

https://sourceforge.net/p/gauche/mailman/message/35429549/

diff --git a/ext/net/gauche-net.h b/ext/net/gauche-net.h
index d4f1dcd..decba64 100644
--- a/ext/net/gauche-net.h
+++ b/ext/net/gauche-net.h
@@ -362,8 +362,12 @@ extern ScmObj Scm_GetAddrinfo(const char *nodename,
struct addrinfo *hints);
extern ScmObj Scm_GetNameinfo(ScmSockAddr *addr, int flags);

+#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
+#endif
+#ifndef NI_MAXSERV
#define NI_MAXSERV 32
+#endif

#endif /* HAVE_IPV6 */

19 changes: 19 additions & 0 deletions dev-scheme/gauche/files/gauche-0.9.5-libressl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
commit c26a4836e767807dd8c98d280c4d9e742b759edd
Author: Shiro Kawai <[email protected]>
Date: Sun Oct 9 02:04:19 2016 -1000

rfc.tls - Detect LibreSSL as well

diff --git a/ext/tls/test.scm b/ext/tls/test.scm
index 63a1d04..efbfbca 100644
--- a/ext/tls/test.scm
+++ b/ext/tls/test.scm
@@ -37,7 +37,7 @@
[(not gauche.os.windows)
(guard (e [(<process-abnormal-exit> e)
(no-openssl "couldn't run openssl command")])
- (if-let1 m ($ #/OpenSSL\s+([\d\.]+\w*)/
+ (if-let1 m ($ #/(?:OpenSSL|LibreSSL)\s+([\d\.]+\w*)/
$ process-output->string `(,openssl-cmd "version"))
(let1 vers (m 1)
(unless (version>=? vers "1.0.1")
116 changes: 116 additions & 0 deletions dev-scheme/gauche/files/gauche-0.9.5-main.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
commit 97196adb9dab30e7ab610daf4cc486bfc01ed403
Author: Shiro Kawai <[email protected]>
Date: Mon Oct 17 11:00:44 2016 -1000

Fix main.c to call 'main' proc properly

https://github.com/shirok/Gauche/issues/244

diff --git a/src/core.c b/src/core.c
index 923d116..fc01211 100644
--- a/src/core.c
+++ b/src/core.c
@@ -653,9 +653,14 @@ void Scm_SimpleMain(int argc, const char *argv[],
ScmModule *user = Scm_UserModule();
ScmObj mainproc = Scm_GlobalVariableRef(user, SCM_SYMBOL(SCM_INTERN("main")), 0);
if (SCM_PROCEDUREP(mainproc)) {
- ScmObj r = Scm_ApplyRec1(mainproc, args);
- if (SCM_INTP(r)) Scm_Exit(SCM_INT_VALUE(r));
- else Scm_Exit(70);
+ static ScmObj run_main_proc = SCM_UNDEFINED;
+ SCM_BIND_PROC(run_main_proc, "run-main", Scm_GaucheInternalModule());
+ SCM_ASSERT(SCM_PROCEDUREP(run_main_proc));
+
+ ScmEvalPacket epak;
+ int r = Scm_Apply(run_main_proc, SCM_LIST2(mainproc, args), &epak);
+ SCM_ASSERT(r == 1 && SCM_INTP(epak.results[0]));
+ Scm_Exit(SCM_INT_VALUE(epak.results[0]));
} else {
Scm_Exit(70);
}
diff --git a/src/libeval.scm b/src/libeval.scm
index 2a2c1fc..279fd7f 100644
--- a/src/libeval.scm
+++ b/src/libeval.scm
@@ -370,6 +370,17 @@
(loop1)))))

;;;
+;;; Kick 'main' procedure
+;;; Returns an integer suitable for the exit code.
+;;; This is mainly to display proper stack trace in case 'main'
+;;; raises an error.
+(select-module gauche.internal)
+(define (run-main main args)
+ (guard (e [else (report-error e) 70])
+ (let1 r (main args)
+ (if (fixnum? r) r 70))))
+
+;;;
;;; Macros
;;;

diff --git a/src/main.c b/src/main.c
index 46223a6..55660c9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -502,22 +502,14 @@ int execute_script(const char *scriptfile, ScmObj args)
SCM_BINDING_STAY_IN_MODULE);
}
if (SCM_PROCEDUREP(mainproc)) {
-#if 0 /* Temporarily turned off due to the bug that loses stack traces. */
+ static ScmObj run_main_proc = SCM_UNDEFINED;
+ SCM_BIND_PROC(run_main_proc, "run-main", Scm_GaucheInternalModule());
+ SCM_ASSERT(SCM_PROCEDUREP(run_main_proc));
+
ScmEvalPacket epak;
- int r = Scm_Apply(mainproc, SCM_LIST1(args), &epak);
- if (r > 0) {
- ScmObj res = epak.results[0];
- if (SCM_INTP(res)) return SCM_INT_VALUE(res);
- else return 70; /* EX_SOFTWARE, see SRFI-22. */
- } else {
- Scm_ReportError(epak.exception);
- return 70; /* EX_SOFTWARE, see SRFI-22. */
- }
-#else
- ScmObj r = Scm_ApplyRec1(mainproc, args);
- if (SCM_INTP(r)) return SCM_INT_VALUE(r);
- else return 70;
-#endif
+ int r = Scm_Apply(run_main_proc, SCM_LIST2(mainproc, args), &epak);
+ SCM_ASSERT(r == 1 && SCM_INTP(epak.results[0]));
+ return SCM_INT_VALUE(epak.results[0]);
}
return 0;
}
diff --git a/test/scripts.scm b/test/scripts.scm
index 44bb44b..4e6777b 100644
--- a/test/scripts.scm
+++ b/test/scripts.scm
@@ -58,6 +58,25 @@
(process-output->string '("./gosh" "-ftest" "test.o")))
(delete-files "test.o")))

+;; This caused assertion failure in 0.9.5, because 'main' was called
+;; via Scm_ApplyRec without base VM running.
+;; See https://github.com/shirok/Gauche/issues/244
+(test* "proper error handling of 'main'" "ok"
+ (unwind-protect
+ (begin
+ (delete-files "test.o")
+ (with-output-to-file "test.o"
+ (^[]
+ (write
+ '(use gauche.partcont))
+ (write
+ '(define (main args)
+ (reset (shift k (call-with-input-file "gauche.h" k)))
+ (print 'ok)
+ 0))))
+ (process-output->string '("./gosh" "-ftest" "test.o")))
+ (delete-files "test.o")))
+
;;=======================================================================
(test-section "gauche-config")

19 changes: 19 additions & 0 deletions dev-scheme/gauche/files/gauche-0.9.5-unicode.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
commit d31eb5c02b65514e695b45c0c01cbd45a36bac4a
Author: OOHASHI Daichi <[email protected]>
Date: Thu Oct 20 10:48:17 2016 +0900

(char-general-category #\x20000) should be Lo

diff --git a/src/gauche/char_utf_8.h b/src/gauche/char_utf_8.h
index 082e764..5f92d13 100644
--- a/src/gauche/char_utf_8.h
+++ b/src/gauche/char_utf_8.h
@@ -294,7 +294,7 @@ static inline unsigned char Scm__LookupCharCategory(ScmChar ch)
{
if (ch == SCM_CHAR_INVALID || ch >= 0x10ffff) {
return SCM_CHAR_CATEGORY_Cn;
- } else if (ch <= 0x20000) {
+ } else if (ch < 0x20000) {
return ucs_general_category_00000[ch];
} else {
return ucs_general_category_20000(ch);
11 changes: 11 additions & 0 deletions dev-scheme/gauche/files/gauche-ext-ldflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/ext/Makefile.ext.in
+++ b/ext/Makefile.ext.in
@@ -22,7 +22,7 @@
LIBS = $(XLIBS) @LIBS@
CFLAGS = @CFLAGS@ @SHLIB_SO_CFLAGS@ $(XCFLAGS)
CPPFLAGS = @CPPFLAGS@ $(XCPPFLAGS)
-LDFLAGS = $(LOCAL_LFLAGS) $(XLDFLAGS) @SHLIB_SO_LDFLAGS@
+LDFLAGS = $(LOCAL_LFLAGS) $(XLDFLAGS) @LDFLAGS@ @SHLIB_SO_LDFLAGS@

# These are set by configure
DEFS = @DEFS@
18 changes: 18 additions & 0 deletions dev-scheme/gauche/files/gauche-gauche.m4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/m4/gauche.m4
+++ b/m4/gauche.m4
@@ -103,13 +103,10 @@
AS_CASE(["$target"],
[i686-*], [I686OPT="-DUSE_I686_PREFETCH"])
AS_CASE(["$CC"],
- [gcc*], [ dnl some systems may have gcc-2.95, gcc-3, etc.
+ [*gcc*], [ dnl some systems may have gcc-2.95, gcc-3, etc.
AS_CASE(["$target"],
[*mingw*], [],
- [GCCOPT="-fomit-frame-pointer"])
- AS_CASE(["$target"],
- [i586-*], [GCCOPT="$GCCOPT -march=i586"],
- [i686-*], [GCCOPT="$GCCOPT -march=i686"])])])
+ [GCCOPT="-fomit-frame-pointer"])])])
OPTFLAGS="$GCCOPT $I686OPT"
AC_SUBST(OPTFLAGS)
])
12 changes: 12 additions & 0 deletions dev-scheme/gauche/files/gauche-rfc.tls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/ext/tls/ssltest-mod.scm
+++ b/ext/tls/ssltest-mod.scm
@@ -53,7 +53,8 @@
($ format #t "~a\n" $ regexp-replace-all* line
#/\.\.\/ssl\// srcpath-replace
#/openssl / kicker-replace
- #/system/ "safe_system")))
+ #/system/ "safe_system"
+ #/(s_server) / "\\1 -4 ")))

(p "#include <errno.h>"
"int safe_system(const char *commands)"
10 changes: 10 additions & 0 deletions dev-scheme/gauche/files/gauche-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/configure.ac
+++ b/configure.ac
@@ -709,7 +709,6 @@
fi
if test "$RPATH_FLAG" != ""; then
RPATH_TMP=$RPATH_FLAG'`pwd`'
- RPATH_REAL=$RPATH_FLAG'$(LIB_INSTALL_DIR)'
fi
fi
AC_SUBST(RPATH_FLAG)
31 changes: 31 additions & 0 deletions dev-scheme/gauche/files/gauche-xz-info.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- a/lib/gauche/interactive/info.scm
+++ b/lib/gauche/interactive/info.scm
@@ -137,7 +137,8 @@
:paths paths
:pred (^p (or (file-is-readable? p)
(file-is-readable? #"~|p|.gz")
- (file-is-readable? #"~|p|.bz2"))))
+ (file-is-readable? #"~|p|.bz2")
+ (file-is-readable? #"~|p|.xz"))))
(errorf "couldn't find info file ~s in paths: ~s" *info-file* paths))
))

--- a/lib/text/info.scm
+++ b/lib/text/info.scm
@@ -64,6 +64,7 @@

;; Find bzip2 location
(define bzip2 (find-file-in-paths "bzip2"))
+(define xz (find-file-in-paths "xz"))

;; Read an info file FILE, and returns a list of strings splitted by ^_ (#\u001f)
;; If FILE is not found, look for compressed one.
@@ -78,6 +79,8 @@
(close-input-port zp)))))]
[(and bzip2 (file-exists? #"~|file|.bz2"))
(with-input-from-process #"~bzip2 -c -d ~|file|.bz2" thunk)]
+ [(and xz (file-exists? #"~|file|.xz"))
+ (with-input-from-process #"~xz -c -d ~|file|.xz" thunk)]
[else (error "can't find info file" file)]))
(with-input-from-info
(lambda ()
59 changes: 59 additions & 0 deletions dev-scheme/gauche/gauche-0.9.5.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="6"

inherit autotools eutils

MY_P="${P^g}"

DESCRIPTION="A Unix system friendly Scheme Interpreter"
HOMEPAGE="http://practical-scheme.net/gauche/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tgz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-macos"
IUSE="ipv6 libressl test"

RDEPEND="sys-libs/gdbm"
DEPEND="${RDEPEND}
test? (
!libressl? ( dev-libs/openssl:0 )
libressl? ( dev-libs/libressl )
)"
S="${WORKDIR}/${MY_P}"

src_prepare() {
epatch "${FILESDIR}"/${PN}-rpath.patch
epatch "${FILESDIR}"/${PN}-gauche.m4.patch
epatch "${FILESDIR}"/${PN}-ext-ldflags.patch
epatch "${FILESDIR}"/${PN}-xz-info.patch
epatch "${FILESDIR}"/${PN}-rfc.tls.patch
epatch "${FILESDIR}"/${P}-libressl.patch
epatch "${FILESDIR}"/${P}-bsd.patch
epatch "${FILESDIR}"/${P}-main.patch
epatch "${FILESDIR}"/${P}-unicode.patch
eapply_user

use ipv6 && sed -i "s/ -4//" ext/tls/ssltest-mod.scm

eautoconf
}

src_configure() {
econf \
$(use_enable ipv6) \
--with-libatomic-ops=no \
--with-slib="${EPREFIX}"/usr/share/slib
}

src_test() {
emake -j1 -s check
}

src_install() {
emake DESTDIR="${D}" install-pkg install-doc
dodoc AUTHORS ChangeLog HACKING README
}

0 comments on commit b031eef

Please sign in to comment.