gnu: swig: Fix build on i686.

* gnu/packages/patches/swig-guile-gc.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/swig.scm (swig)[source](patches): Use it.
This commit is contained in:
Marius Bakke 2018-10-18 19:13:13 +02:00
parent 16f14f63db
commit e8ef3cc4d6
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
3 changed files with 79 additions and 0 deletions

View file

@ -1154,6 +1154,7 @@ dist_patch_DATA = \
%D%/packages/patches/soundtouch-CVE-2018-1000223.patch \ %D%/packages/patches/soundtouch-CVE-2018-1000223.patch \
%D%/packages/patches/steghide-fixes.patch \ %D%/packages/patches/steghide-fixes.patch \
%D%/packages/patches/superlu-dist-scotchmetis.patch \ %D%/packages/patches/superlu-dist-scotchmetis.patch \
%D%/packages/patches/swig-guile-gc.patch \
%D%/packages/patches/swish-e-search.patch \ %D%/packages/patches/swish-e-search.patch \
%D%/packages/patches/swish-e-format-security.patch \ %D%/packages/patches/swish-e-format-security.patch \
%D%/packages/patches/synfigstudio-fix-ui-with-gtk3.patch \ %D%/packages/patches/synfigstudio-fix-ui-with-gtk3.patch \

View file

@ -0,0 +1,76 @@
Fix garbage collection for Guile versions >= 2.0.12. This issue showed
up when running the tests on i686-linux.
Taken from this upstream commit:
https://github.com/swig/swig/commit/38f2ab0c30e369e63bbd0a6152108488d0de68e1
diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg
index 274f197158..0d04cb7c62 100644
--- a/Lib/guile/guile_scm_run.swg
+++ b/Lib/guile/guile_scm_run.swg
@@ -99,6 +99,7 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
static int swig_initialized = 0;
static scm_t_bits swig_tag = 0;
static scm_t_bits swig_collectable_tag = 0;
+static scm_t_bits swig_finalized_tag = 0;
static scm_t_bits swig_destroyed_tag = 0;
static scm_t_bits swig_member_function_tag = 0;
static SCM swig_make_func = SCM_EOL;
@@ -163,7 +164,19 @@ SWIG_Guile_PointerType(SCM object)
}
else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
}
-
+
+SWIGINTERN int
+SWIG_Guile_IsValidSmob(SCM smob)
+{
+ /* We do not accept smobs representing destroyed pointers, but we have to
+ allow finalized smobs because Guile >= 2.0.12 sets all smob instances
+ to the 'finalized' type before calling their 'free' function. This change
+ was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
+ return SCM_SMOB_PREDICATE(swig_tag, smob)
+ || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
+ || SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
+}
+
SWIGINTERN int
SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
{
@@ -179,8 +192,7 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
*result = SCM_POINTER_VALUE(s);
return SWIG_OK;
#endif /* if SCM_MAJOR_VERSION >= 2 */
- } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
- /* we do not accept smobs representing destroyed pointers */
+ } else if (SWIG_Guile_IsValidSmob(smob)) {
from = (swig_type_info *) SCM_CELL_WORD_2(smob);
if (!from) return SWIG_ERROR;
if (type) {
@@ -239,7 +251,7 @@ SWIG_Guile_MarkPointerNoncollectable(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
if (!SCM_NULLP(smob)) {
- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
+ if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_tag);
}
else scm_wrong_type_arg(NULL, 0, s);
@@ -252,7 +264,7 @@ SWIG_Guile_MarkPointerDestroyed(SCM s)
{
SCM smob = SWIG_Guile_GetSmob(s);
if (!SCM_NULLP(smob)) {
- if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
+ if (SWIG_Guile_IsValidSmob(smob)) {
SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
}
else scm_wrong_type_arg(NULL, 0, s);
@@ -419,6 +431,8 @@ SWIG_Guile_Init ()
scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
scm_set_smob_free(swig_collectable_tag, free_swig);
+ /* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
+ swig_finalized_tag = swig_collectable_tag & ~0xff00;
}
if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
"destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {

View file

@ -22,6 +22,7 @@ (define-module (gnu packages swig)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix licenses) #:use-module (guix licenses)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages pcre) #:use-module (gnu packages pcre)
#:use-module (gnu packages guile) #:use-module (gnu packages guile)
#:use-module (gnu packages boost) #:use-module (gnu packages boost)
@ -37,6 +38,7 @@ (define-public swig
(uri (string-append "mirror://sourceforge/" name "/" name "/" (uri (string-append "mirror://sourceforge/" name "/" name "/"
name "-" version "/" name "-" version "/"
name "-" version ".tar.gz")) name "-" version ".tar.gz"))
(patches (search-patches "swig-guile-gc.patch"))
(sha256 (sha256
(base32 (base32
"0kf99ygrjs5616gsqhz1l7bib3a12izmxi7g48bwblbymr3z9ybw")))) "0kf99ygrjs5616gsqhz1l7bib3a12izmxi7g48bwblbymr3z9ybw"))))