Re: [Chicken-hackers] [PATCH] fix: eval.scm: use soname only with when USES_SONAME present

2014-02-05 Thread Peter Bex
On Sat, Jan 25, 2014 at 10:36:43PM +0100, Peter Bex wrote:
 I believe this patch does basically the correct thing, so here's a
 signed-off copy.  However, it breaks the Cygwin and MingW builds because
 they have their own Makefile fragments for generating chicken-defaults.h
 and set CUSTOM_CHICKEN_DEFAULTS to override the generation of that
 file from defaults.make.

Here's another patch, updated for today's master.  The small patch which
adds C_INSTALL_POSTINSTALL_PROGRAM somewhere in the chicken-defaults.h
rule (which my patch modified completely) caused my old patch to fail to
apply.

I hope I didn't break anything by my mucking about by hand!

Cheers,
Peter
-- 
http://www.more-magic.net
From 72ba40794f6a229a84a64404bff378402f602617 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 1/3] 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.

Signed-off-by: Peter Bex peter@xs4all.nl
---
 defaults.make |7 +++
 eval.scm  |4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/defaults.make b/defaults.make
index f3c600b..a32dfbd 100644
--- a/defaults.make
+++ b/defaults.make
@@ -485,6 +485,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 a835394..ed1b92d 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 haiku 
hurd))
- (not (zero? binary-version))) ; allow configless build
+(if uses-soname?
 (string-append
  ##sys#load-library-extension
  . 
-- 
1.7.10.4

From 0890a33ae04d2ada3d4a81b8570e81c9c715fa9d Mon Sep 17 00:00:00 2001
From: Peter Bex peter@xs4all.nl
Date: Fri, 24 Jan 2014 23:24:29 +0100
Subject: [PATCH 2/3] Fix SONAME handling on Windows

This removes unnecessarily duplicated rules for chicken-defaults.h from Cygwin
Makefile and fixes MingW makefile to set the new USES_SONAME definition.

The only actual difference between Makefile.cygwin and defaults.make was that
it set TARGET_RUN_LIB_HOME to TARGET_PREFIX/bin - now make this dependent on
DLLSINPATH, which also controls where the library is copied during install.
---
 Makefile.cygwin |  138 ---
 Makefile.mingw  |   12 +++--
 csc.scm |   11 ++---
 defaults.make   |8 
 4 files changed, 20 insertions(+), 149 deletions(-)

diff --git a/Makefile.cygwin b/Makefile.cygwin
index 6989ab8..abe7fa0 100644
--- a/Makefile.cygwin
+++ b/Makefile.cygwin
@@ -80,7 +80,6 @@ APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
 
 # select default and internal settings
 
-CUSTOM_CHICKEN_DEFAULTS=1
 include $(SRCDIR)/defaults.make
 
 LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES)
@@ -127,141 +126,4 @@ ifdef HACKED_APPLY
 endif
cat chicken-defaults.h $@
 
-chicken-defaults.h:
-   echo /* generated */ $@
-   echo #define C_CHICKEN_PROGRAM \$(CHICKEN_PROGRAM)$(EXE)\ $@
-   echo #ifndef C_INSTALL_CC $@
-   echo # define C_INSTALL_CC \$(C_COMPILER)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_CXX $@
-   echo # define C_INSTALL_CXX \$(CXX_COMPILER)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_POSTINSTALL_PROGRAM $@
-   echo # define C_INSTALL_POSTINSTALL_PROGRAM 
\$(POSTINSTALL_PROGRAM)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_CFLAGS $@
-   echo # define C_INSTALL_CFLAGS \$(C_COMPILER_OPTIONS) 
$(C_COMPILER_OPTIMIZATION_OPTIONS)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_LDFLAGS $@
-   echo # define C_INSTALL_LDFLAGS \$(LINKER_OPTIONS) 
$(LINKER_OPTIMIZATION_OPTIONS)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_PREFIX $@
-   echo # define C_INSTALL_PREFIX \$(PREFIX)\ $@
-   echo #endif $@
-   echo #ifndef C_INSTALL_SHARE_HOME $@
-   echo # define C_INSTALL_SHARE_HOME 

[Chicken-hackers] [PATCH] Remove list argument check from C_u_i_memq

2014-02-05 Thread Moritz Heidkamp
This was erroneously added in 0a52536b7cb6b3d5a35ecc8f4c11131041ae873a

From 32bc17d3c3a313a4f869079f3777ed7dd2b8b9f4 Mon Sep 17 00:00:00 2001
From: Moritz Heidkamp mor...@twoticketsplease.de
Date: Wed, 5 Feb 2014 23:26:39 +0100
Subject: [PATCH] Remove list argument check from C_u_i_memq

This was erroneously added in 0a52536b7cb6b3d5a35ecc8f4c11131041ae873a
---
 runtime.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/runtime.c b/runtime.c
index 9575d80..f184d71 100644
--- a/runtime.c
+++ b/runtime.c
@@ -5600,9 +5600,6 @@ C_regparm C_word C_fcall C_u_i_memq(C_word x, C_word lst)
 else lst = C_u_i_cdr(lst);
   }
 
-  if(lst!=C_SCHEME_END_OF_LIST)
-barf(C_BAD_ARGUMENT_TYPE_ERROR, memv, lst);
-
   return C_SCHEME_FALSE;
 }
 
-- 
1.8.5.2

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


Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their safer counterparts

2014-02-05 Thread Mario Domenech Goulart
Hi,

On Thu, 23 Jan 2014 12:28:01 +0100 Christian Kellermann ck...@pestilenz.org 
wrote:

 I propose the following patch. It has been tested on OpenBSD and
 Linux. Should work without troubles on all other OSes as well.
 Please give it a try.

Sorry for taking so long to give it a try on Windows.  Unfortunately, it
seems to break things on that platform.

The environment variable tests in posix-tests.scm caught the issue.
Here's an example:

  #;1 (use posix)
  ; loading c:/local/chicken-master-mingw/lib/chicken/7/posix.import.so
  ; ...
  ; loading library posix ...
  #;2 (setenv FOO bar)
  #;3 (get-environment-variable FOO)
  x\x01=b\x03

Reverting 8efbbc50d050d28c34ea0c5a58d0de92ec9f918a makes tests pass
again.  Tested on cygwin, mingw (Windows XP 32bit).

Best wishes.
Mario
-- 
http://parenteses.org/mario

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


Re: [Chicken-hackers] [PATCH] fix: eval.scm: use soname only with when USES_SONAME present

2014-02-05 Thread Mario Domenech Goulart
On Wed, 5 Feb 2014 20:11:16 +0100 Peter Bex peter@xs4all.nl wrote:

 On Sat, Jan 25, 2014 at 10:36:43PM +0100, Peter Bex wrote:
 I believe this patch does basically the correct thing, so here's a
 signed-off copy.  However, it breaks the Cygwin and MingW builds because
 they have their own Makefile fragments for generating chicken-defaults.h
 and set CUSTOM_CHICKEN_DEFAULTS to override the generation of that
 file from defaults.make.

 Here's another patch, updated for today's master.  The small patch which
 adds C_INSTALL_POSTINSTALL_PROGRAM somewhere in the chicken-defaults.h
 rule (which my patch modified completely) caused my old patch to fail to
 apply.

 I hope I didn't break anything by my mucking about by hand!

Thanks Peter and Kristian.  I tested and applied your patches.  They
seem to work fine on Windows XP 32bit (mingw, mingw-msys and cygwin).  I
also tested them on Linux x86-64 (gcc and clang), just in case.

Best wishes.
Mario
-- 
http://parenteses.org/mario

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


Re: [Chicken-hackers] [PATCH] Replace unsafe string functions with their safer counterparts

2014-02-05 Thread Mario Domenech Goulart
On Wed, 05 Feb 2014 23:56:11 + Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 On Thu, 23 Jan 2014 12:28:01 +0100 Christian Kellermann ck...@pestilenz.org 
 wrote:

 I propose the following patch. It has been tested on OpenBSD and
 Linux. Should work without troubles on all other OSes as well.
 Please give it a try.

 Sorry for taking so long to give it a try on Windows.  Unfortunately, it
 seems to break things on that platform.

 The environment variable tests in posix-tests.scm caught the issue.
 Here's an example:

   #;1 (use posix)
   ; loading c:/local/chicken-master-mingw/lib/chicken/7/posix.import.so
   ; ...
   ; loading library posix ...
   #;2 (setenv FOO bar)
   #;3 (get-environment-variable FOO)
   x\x01=b\x03

 Reverting 8efbbc50d050d28c34ea0c5a58d0de92ec9f918a makes tests pass
 again.  Tested on cygwin, mingw (Windows XP 32bit).

I forgot to mention that on cygwin I had to define HAVE_STRLCAT and
HAVE_STRLCPY in Makefile.cygwin, otherwise I'd get errors like
http://paste.call-cc.org/paste?id=87b50bb84351693193183e7c58f2293b6cd52148

After defining HAVE_STRLCAT and STRLCPY and rebuilding chicken, I get
the environment variables issue.

Best wishes.
Mario
-- 
http://parenteses.org/mario

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


Re: [Chicken-hackers] [PATCH] Remove list argument check from C_u_i_memq

2014-02-05 Thread Peter Bex
On Wed, Feb 05, 2014 at 11:28:15PM +0100, Moritz Heidkamp wrote:
 This was erroneously added in 0a52536b7cb6b3d5a35ecc8f4c11131041ae873a

Thanks, I've pushed it.  Feel free to push patches that are as trivial
as this directly in the future.

Cheers,
Peter
-- 
http://www.more-magic.net

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