commit:     5d11e566d57fd1102c27a9a7628a6d5b788c050d
Author:     Akinori Hattori <hattya <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 10:17:18 2016 +0000
Commit:     Akinori Hattori <hattya <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 10:17:18 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d11e566

dev-scheme/gauche: fix build

Gentoo-Bug: 600976

Package-Manager: portage-2.3.0

 dev-scheme/gauche/files/gauche-0.9.5-main.patch | 116 ------------------------
 dev-scheme/gauche/gauche-0.9.5.ebuild           |  22 +++--
 2 files changed, 12 insertions(+), 126 deletions(-)

diff --git a/dev-scheme/gauche/files/gauche-0.9.5-main.patch 
b/dev-scheme/gauche/files/gauche-0.9.5-main.patch
deleted file mode 100644
index 20f7070..00000000
--- a/dev-scheme/gauche/files/gauche-0.9.5-main.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-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")
- 

diff --git a/dev-scheme/gauche/gauche-0.9.5.ebuild 
b/dev-scheme/gauche/gauche-0.9.5.ebuild
index 2e6fe55..b4bd7c8 100644
--- a/dev-scheme/gauche/gauche-0.9.5.ebuild
+++ b/dev-scheme/gauche/gauche-0.9.5.ebuild
@@ -25,17 +25,19 @@ DEPEND="${RDEPEND}
        )"
 S="${WORKDIR}/${MY_P}"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-rpath.patch
+       "${FILESDIR}"/${PN}-gauche.m4.patch
+       "${FILESDIR}"/${PN}-ext-ldflags.patch
+       "${FILESDIR}"/${PN}-xz-info.patch
+       "${FILESDIR}"/${PN}-rfc.tls.patch
+       "${FILESDIR}"/${P}-libressl.patch
+       "${FILESDIR}"/${P}-bsd.patch
+       "${FILESDIR}"/${P}-unicode.patch
+)
+
 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
+       default
 
        use ipv6 && sed -i "s/ -4//" ext/tls/ssltest-mod.scm
 

Reply via email to