Dear chicken-hackers,

I occasionally use CHICKEN under Android on my Nexus 9 tablet. I use the
Termux App (http://termux.com), which is a terminal emulator and package manager
for Android. 

I'd like to submit the attached patch for review.

The environment has the following pecularities:
- Programs live under /data/data/com.termux/files/usr/bin rather than /bin and 
/usr/bin.
  This also applies to bash.
- The Android dynamic linker does not support hardcoded library paths 
  (via -R/path/to/lib). Using this option results in the program
  emitting an warning message, that causes the test suite to fail. Warning 
messages
  look like this: 
  WARNING: linker: ../csi: unused DT entry: type 0xf arg 0x51e
  WARNING: linker: /data/data/com.termux/files/home/chickens/4.11.0rc1/\
                   lib/chicken/8/posix.import.so: \
                   unused DT entry: type 0xf arg 0x1eb

- Instead LD_LIBRARY_PATH must be explicitly set to include the chicken 
  library directory.

The patch attempts to address these problems. It is relative to the relase 
4.11.0.
I would be happy for any suggestions or improvements to this patch.
Many thanks in advance for your help!

Best Regards,

Alexander
--- chicken-4.11.0rc1/Makefile.android
+++ chicken-4.11.0rc1.patched/Makefile.android
@@ -42,8 +42,8 @@
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared 
-Wl,-R"$(RUNTIME_LINKER_PATH)"
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = 
 # Android NDK build system currently does not understand
 # versioned sonames, so don't try to embed a soname.
 #LIBCHICKEN_SO_LINKER_OPTIONS = 
-Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
--- chicken-4.11.0rc1/chicken.h
+++ chicken-4.11.0rc1.patched/chicken.h
@@ -712,7 +712,9 @@
 # define C_BUILD_PLATFORM "unknown"
 #endif
 
-#if defined(__linux__)
+#if defined(__ANDROID__)
+# define C_SOFTWARE_VERSION "android"
+#elif defined(__linux__)
 # define C_SOFTWARE_VERSION "linux"
 #elif defined(__FreeBSD__)
 # define C_SOFTWARE_VERSION "freebsd"
--- chicken-4.11.0rc1/identify.sh
+++ chicken-4.11.0rc1.patched/identify.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/data/data/com.termux/files/usr/bin/sh -e
 #
 # identify.sh - check for .git directory and obtain checked out revision and 
branch
 #
@@ -14,8 +14,8 @@
 branchname0=`cat buildbranch || echo ""`
 tag0=`cat buildtag.h || echo ""`
 buildtime=`date +%Y-%m-%d`
-host=`hostname`
-usys=`uname`
+host=`uname -n`
+usys=`uname -o`
 
 if test -d "$1/.git"; then
     rev=`GIT_DIR="$1/.git" git rev-parse --short HEAD 2>/dev/null`
--- chicken-4.11.0rc1/tests/runtests.sh
+++ chicken-4.11.0rc1.patched/tests/runtests.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/data/data/com.termux/files/usr/bin/sh
 # runtests.sh - run CHICKEN testsuite
 #
 # - Note: this needs a proper shell, so it will not work with plain mingw
@@ -13,9 +13,9 @@
     # MSYS /c/blabla "pseudo-paths" which break when used in syscalls.
     TEST_DIR=`pwd -W`
 fi
-OS_NAME=`uname -s`
+OS_NAME=`uname -o`
 DYLD_LIBRARY_PATH=${TEST_DIR}/..
-LD_LIBRARY_PATH=${TEST_DIR}/..
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${TEST_DIR}/..
 LIBRARY_PATH=${TEST_DIR}/..:${LIBRARY_PATH}
 # Cygwin uses LD_LIBRARY_PATH for dlopen(), but the dlls linked into
 # the binary are read by the OS itself, which uses $PATH (mingw too)
@@ -52,7 +52,7 @@
 CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall
 ASMFLAGS=
 FAST_OPTIONS="-O5 -d0 -b -disable-interrupts"
-COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. 
-L${TEST_DIR}/.. -rpath ${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
+COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. 
-L${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
 
 TEST_DIR_SEXPR=`../csi -n -include-path .. -e "(use posix) (write 
(current-directory))"`
 SETUP_PREFIX="-e (use files setup-api)"
_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to