diff mbox

[v5,4/4] guile: Add new package

Message ID 1416869790-12988-5-git-send-email-paguilar@paguilar.org
State Accepted
Headers show

Commit Message

Pedro Aguilar Nov. 24, 2014, 10:56 p.m. UTC
Guile is an interpreter and compiler for the Scheme programming
language, a clean and elegant dialect of Lisp.

The patch guile-01-fix_arm_endianness.patch is based on guile's
git commit ^ffd3e55cfd

Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>

---
Changes v4 -> v5:
- Add depends on BR2_PACKAGE_LIBATOMIC_ARCH_SUPPORTS # bdwgc
- Break long line GUILE_CFLAGS to improve readability
(All changes suggested by Yann Morin)

Changes v3 -> v4:
- Fix formatting issues
(Suggested by Jerzy Grzegorek)

Changes v2 -> v3:
- Improve patches
- Remove unused dependencies
- Fix patches formatting
(All changes suggested by Thomas Petazzoni)

Changes v1 -> v2:
- Add all needed dependencies
- Explain GUILE_CONF_ENV arguments
- Remove PKG_CONFIG_HOST_BINARY
- Fix patches formatting
- Add thread comments in Config.in
(All changes suggested by Yann Morin)

---
 package/Config.in                                  |  1 +
 package/guile/Config.in                            | 17 ++++++++++
 package/guile/guile-01-fix_arm_endianness.patch    | 25 +++++++++++++++
 .../guile/guile-02-calculate-csqrt_manually.patch  | 16 ++++++++++
 package/guile/guile-03-remove_unused_funcs.patch   | 36 ++++++++++++++++++++++
 package/guile/guile.mk                             | 31 +++++++++++++++++++
 6 files changed, 126 insertions(+)
 create mode 100644 package/guile/Config.in
 create mode 100644 package/guile/guile-01-fix_arm_endianness.patch
 create mode 100644 package/guile/guile-02-calculate-csqrt_manually.patch
 create mode 100644 package/guile/guile-03-remove_unused_funcs.patch
 create mode 100644 package/guile/guile.mk

Comments

Thomas Petazzoni Nov. 26, 2014, 8:55 p.m. UTC | #1
Dear Pedro Aguilar,

On Mon, 24 Nov 2014 23:56:30 +0100, Pedro Aguilar wrote:
> Guile is an interpreter and compiler for the Scheme programming
> language, a clean and elegant dialect of Lisp.
> 
> The patch guile-01-fix_arm_endianness.patch is based on guile's
> git commit ^ffd3e55cfd
> 
> Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>

Applied to next, with a few changes:

    [Thomas:
     - rewrap comments and help text.
     - add missing host-gettext dependency, since gettext.m4 is needed for
       the package to autoreconf.
     - add missing host-pkgconf dependency.
     - add dependency on wchar, inherited from libunistring.]

Don't hesitate to test the next branch, and verify that guile is
building fine for you.

Thanks!

Thomas
Pedro Aguilar Nov. 30, 2014, 10:28 p.m. UTC | #2
Hi Thomas,

Thanks for helping me to fix and apply the patches!

I confirm you that guile is building and running fine for me, I used an 
Atmel SAMA5 processor.

Btw, do you use any script/tool for catching some of the missed things 
such as adding the wchar dependency to libunistring because it uses 
functions like wctomb()?

I would like to detect and fix these things before sending a patch so 
you don't have to check it again.

Regards,


On 26/11/2014 21:55, Thomas Petazzoni wrote:
> Dear Pedro Aguilar,
>
> On Mon, 24 Nov 2014 23:56:30 +0100, Pedro Aguilar wrote:
>> Guile is an interpreter and compiler for the Scheme programming
>> language, a clean and elegant dialect of Lisp.
>>
>> The patch guile-01-fix_arm_endianness.patch is based on guile's
>> git commit ^ffd3e55cfd
>>
>> Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>
>
> Applied to next, with a few changes:
>
>      [Thomas:
>       - rewrap comments and help text.
>       - add missing host-gettext dependency, since gettext.m4 is needed for
>         the package to autoreconf.
>       - add missing host-pkgconf dependency.
>       - add dependency on wchar, inherited from libunistring.]
>
> Don't hesitate to test the next branch, and verify that guile is
> building fine for you.
>
> Thanks!
>
> Thomas
>
Thomas Petazzoni Dec. 1, 2014, 9:03 a.m. UTC | #3
Dear Pedro Aguilar,

On Sun, 30 Nov 2014 23:28:41 +0100, Pedro Aguilar wrote:

> Thanks for helping me to fix and apply the patches!

You're welcome! Contributions are definitely welcome, and for a first
contribution, packaging guile was not the easiest task to tackle!

> I confirm you that guile is building and running fine for me, I used an 
> Atmel SAMA5 processor.

Thanks for testing again!

> Btw, do you use any script/tool for catching some of the missed things 
> such as adding the wchar dependency to libunistring because it uses 
> functions like wctomb()?
> 
> I would like to detect and fix these things before sending a patch so 
> you don't have to check it again.

I simply use the toolchain configurations available at
http://autobuild.buildroot.org/toolchains/configs/, which offer a
variety of configurations. Not all possible situations, but a few of
them, which allow to find certain problematic cases.

Best regards,

Thomas
Yann E. MORIN Dec. 1, 2014, 5:59 p.m. UTC | #4
Pedro, All,

On 2014-11-30 23:28 +0100, Pedro Aguilar spake thusly:
> I confirm you that guile is building and running fine for me, I used an
> Atmel SAMA5 processor.

I already noticed at least one build failure with bdwgc:
    http://autobuild.buildroot.net/results/529/529b0b6dd47744c13f56e59a4c669a3f5d56530d/

;-p

I have a fix I'll be sending sonish.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 1354c27..d45495d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -391,6 +391,7 @@  endmenu
 menu "Interpreter languages and scripting"
 	source "package/enscript/Config.in"
 	source "package/erlang/Config.in"
+	source "package/guile/Config.in"
 	source "package/haserl/Config.in"
 	source "package/jamvm/Config.in"
 	source "package/jimtcl/Config.in"
diff --git a/package/guile/Config.in b/package/guile/Config.in
new file mode 100644
index 0000000..8b75ca5
--- /dev/null
+++ b/package/guile/Config.in
@@ -0,0 +1,17 @@ 
+config BR2_PACKAGE_GUILE
+	bool "guile"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_PACKAGE_LIBATOMIC_ARCH_SUPPORTS # bdwgc
+	select BR2_PACKAGE_LIBUNISTRING
+	select BR2_PACKAGE_LIBFFI
+	select BR2_PACKAGE_GMP
+	select BR2_PACKAGE_BDWGC
+	help
+	  Guile is an interpreter and compiler for the Scheme 
+	  programming language, a clean and elegant dialect of Lisp.
+
+	  http://www.gnu.org/software/guile
+
+comment "guile needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
diff --git a/package/guile/guile-01-fix_arm_endianness.patch b/package/guile/guile-01-fix_arm_endianness.patch
new file mode 100644
index 0000000..67c0b60
--- /dev/null
+++ b/package/guile/guile-01-fix_arm_endianness.patch
@@ -0,0 +1,25 @@ 
+Fix support for ARM endianness, otherwise it gives the error
+"unknown CPU endianness"
+
+Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>
+
+diff -Nau guile-2.0.11.orig/module/system/base/target.scm guile-2.0.11/module/system/base/target.scm
+--- guile-2.0.11.orig/module/system/base/target.scm	2013-02-28 09:42:45.000000000 +0100
++++ guile-2.0.11/module/system/base/target.scm	2014-11-03 23:05:01.789338997 +0100
+@@ -70,7 +70,15 @@
+             ((member cpu '("sparc" "sparc64" "powerpc" "powerpc64" "spu"
+                            "mips" "mips64"))
+              (endianness big))
+-            ((string-match "^arm.*el" cpu)
++            ((string-match "^arm.*el" cpu)
++             (endianness little))
++            ((string-match "^arm.*eb" cpu)
++             (endianness big))
++            ((string-prefix? "arm" cpu)          ;ARMs are LE by default
++             (endianness little))
++            ((string-match "^aarch64.*be" cpu)
++             (endianness big))
++            ((string=? "aarch64" cpu)
+              (endianness little))
+             (else
+              (error "unknown CPU endianness" cpu)))))
diff --git a/package/guile/guile-02-calculate-csqrt_manually.patch b/package/guile/guile-02-calculate-csqrt_manually.patch
new file mode 100644
index 0000000..98bb0b6
--- /dev/null
+++ b/package/guile/guile-02-calculate-csqrt_manually.patch
@@ -0,0 +1,16 @@ 
+Avoid using scm_from_complex_double(csqrt()) when building with uclibc.
+
+Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>
+
+diff -Nau guile-2.0.11.orig/configure.ac guile-2.0.11/configure.ac
+--- guile-2.0.11.orig/configure.ac	2014-03-12 14:36:02.000000000 +0100
++++ guile-2.0.11/configure.ac	2014-11-03 23:59:51.897267207 +0100
+@@ -862,7 +862,7 @@
+ }]])],
+     [guile_cv_use_csqrt=yes],
+     [guile_cv_use_csqrt="no, glibc 2.3 bug"],
+-    [guile_cv_use_csqrt="yes, hopefully (cross-compiling)"])])
++    [guile_cv_use_csqrt="no (cross-compiling)"])])
+   case $guile_cv_use_csqrt in
+     yes*)
+       AC_DEFINE([HAVE_USABLE_CSQRT], 1, [Define to 1 if csqrt is bug-free])
diff --git a/package/guile/guile-03-remove_unused_funcs.patch b/package/guile/guile-03-remove_unused_funcs.patch
new file mode 100644
index 0000000..3d70ee9
--- /dev/null
+++ b/package/guile/guile-03-remove_unused_funcs.patch
@@ -0,0 +1,36 @@ 
+Remove unused static inline functions str_upcase_l() and 
+str_downcase_l() that cause the compilation error:
+'dereferencing pointer to incomplete type'.
+
+Signed-off-by: Pedro Aguilar <paguilar@paguilar.org>
+
+diff -Nau guile-2.0.11.orig/libguile/i18n.c guile-2.0.11/libguile/i18n.c
+--- guile-2.0.11.orig/libguile/i18n.c	2014-01-21 22:25:11.000000000 +0100
++++ guile-2.0.11/libguile/i18n.c	2014-11-04 23:18:52.675435613 +0100
+@@ -851,26 +851,6 @@
+   *dst = '\0';
+ }
+ 
+-#ifdef USE_GNU_LOCALE_API
+-static inline void
+-str_upcase_l (register char *dst, register const char *src,
+-	      scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = toupper_l (*src, locale);
+-  *dst = '\0';
+-}
+-
+-static inline void
+-str_downcase_l (register char *dst, register const char *src,
+-		scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = tolower_l (*src, locale);
+-  *dst = '\0';
+-}
+-#endif
+-
+ 
+ SCM_DEFINE (scm_string_locale_lt, "string-locale<?", 2, 1, 0,
+ 	    (SCM s1, SCM s2, SCM locale),
diff --git a/package/guile/guile.mk b/package/guile/guile.mk
new file mode 100644
index 0000000..661510d
--- /dev/null
+++ b/package/guile/guile.mk
@@ -0,0 +1,31 @@ 
+################################################################################
+#
+# guile
+#
+################################################################################
+
+GUILE_VERSION = 2.0.11
+GUILE_SOURCE = guile-$(GUILE_VERSION).tar.xz
+GUILE_SITE = $(BR2_GNU_MIRROR)/guile
+GUILE_INSTALL_STAGING = YES
+GUILE_LICENSE = LGPLv3+
+GUILE_LICENSE_FILES = LICENSE COPYING COPYING.LESSER
+GUILE_DEPENDENCIES = host-guile libunistring libffi gmp bdwgc
+
+HOST_GUILE_DEPENDENCIES = host-libunistring host-libffi host-gmp host-bdwgc host-flex host-libtool
+
+# The HAVE_GC* CFLAGS specify that we wil use internal callbacks instead 
+# of the ones provided by bdwgc. Eg. HAVE_GC_SET_FINALIZER_NOTIFIER specifies 
+# that we won't use bdwgc's GC_finalizer_notifier callback.
+# Trying to use these specific bdwgc's callbacks breaks guile's building.
+GUILE_CFLAGS = \
+	-DHAVE_GC_SET_FINALIZER_NOTIFIER \
+	-DHAVE_GC_GET_HEAP_USAGE_SAFE \
+	-DHAVE_GC_GET_FREE_SPACE_DIVISOR \
+	-DHAVE_GC_SET_FINALIZE_ON_DEMAND
+
+GUILE_CONF_ENV += GUILE_FOR_BUILD=$(HOST_DIR)/usr/bin/guile \
+	CFLAGS="$(TARGET_CFLAGS) $(GUILE_CFLAGS)"
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))