Hi folks,

In the process of trying to ease the Android build cycle, I stumbled across
sonames. I don't know what they are or what they do, but I know Android
doesn't like them. In eval.scm, the binary version number is appended on
all linux software-versions, which includes Android.

This patch tries to fix and clean that up. Hopefully the patch commit
message makes sense.

Kristian
From efb08c433a023cda20ad151445aa42051de10d92 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianl...@gmail.com>
Date: Fri, 3 Jan 2014 15:16:51 +0100
Subject: [PATCH] fix: eval.scm: use soname only with when USES_SONAME present
 in Makefile

Android, who'se software-version is 'linux, does not use sonames and
crashes with (use <unit>) because the binary-version is incorrectly
appended to the shared library filename.

This patch explicitly propagates the Makefiles' USES_SONAME property
through to eval for this to work properly.
---
 defaults.make | 7 +++++++
 eval.scm      | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/defaults.make b/defaults.make
index cf1aa08..c1d32af 100644
--- a/defaults.make
+++ b/defaults.make
@@ -479,6 +479,13 @@ endif
 	echo "#ifndef C_BINARY_VERSION" >>$@
 	echo "# define C_BINARY_VERSION $(BINARYVERSION)" >>$@
 	echo "#endif" >>$@
+	echo "#ifndef C_USES_SONAME" >>$@
+ifdef USES_SONAME
+	echo "# define C_USES_SONAME 1" >>$@
+else
+	echo "# define C_USES_SONAME 0" >>$@
+endif
+	echo "#endif" >>$@
 	echo "/* END OF FILE */" >>$@
 endif
 
diff --git a/eval.scm b/eval.scm
index b6d72fd..f5d533c 100644
--- a/eval.scm
+++ b/eval.scm
@@ -57,6 +57,7 @@
 (define-foreign-variable install-egg-home c-string "C_INSTALL_EGG_HOME")
 (define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
 (define-foreign-variable binary-version int "C_BINARY_VERSION")
+(define-foreign-variable uses-soname? bool "C_USES_SONAME")
 (define-foreign-variable install-lib-name c-string "C_INSTALL_LIB_NAME")
 
 (define ##sys#core-library-modules
@@ -1066,8 +1067,7 @@
 
 (define dynamic-load-libraries 
   (let ((ext
-	 (if (and (memq (software-version) '(linux netbsd openbsd freebsd))
-		  (not (zero? binary-version))) ; allow "configless" build
+	 (if uses-soname?
 	     (string-append
 	      ##sys#load-library-extension
 	      "." 
-- 
1.8.5.2

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to