Skip to content

Commit

Permalink
this version should compile for iPhone. It compiles with thread suppo…
Browse files Browse the repository at this point in the history
…rt but there are crashes. run make-iphone
  • Loading branch information
Raymond Daly authored and Raymond Daly committed Mar 27, 2009
1 parent 83bdb57 commit 1c4936f
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 19 deletions.
33 changes: 33 additions & 0 deletions configure-iphoneos
@@ -0,0 +1,33 @@
#!/bin/sh
DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
sh ./configure \
--prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneOS/ \
--host=arm-apple-darwin \
--target=arm-apple \
--without-profile \
--without-cmp \
--with-asdf \
--without-defsystem \
--enable-debug \
--without-serve-event \
--with-tcp \
--without-rt \
--disable-threads \
--without-gmp \
dynamic_ffi=no
CC="$DEVROOT/usr/bin/gcc-4.0 -arch armv6" \
AR=$DEVROOT/usr/bin/ar \
RANLIB=$DEVROOT/usr/bin/ranlib \
NM=$DEVROOT/usr/bin/nm \
CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
LDFLAGS="-arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
CPP=$DEVROOT/usr/bin/cpp \
ac_cv_path_NM=$DEVROOT/usr/bin/nm \
ac_cv_func_setpgrp_void=yes \
LIBPOSTFIX=_iPhoneOS


# CPPFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk"
# --disable-shared \

#
24 changes: 24 additions & 0 deletions configure-sameopts
@@ -0,0 +1,24 @@
#!/bin/sh
DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
./configure \
--prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/ \
--without-profile \
--without-cmp \
--without-asdf \
--without-defsystem \
--enable-debug \
--disable-shared \
--without-serve-event \
--with-tcp \
--without-rt \
--enable-threads \
--without-gmp \
dynamic_ffi=no \
CC="$DEVROOT/usr/bin/gcc" \
AR=$DEVROOT/usr/bin/ar \
RANLIB=$DEVROOT/usr/bin/ranlib \
NM=$DEVROOT/usr/bin/nm \
CPP=$DEVROOT/usr/bin/cpp \
ac_cv_path_NM=$DEVROOT/usr/bin/nm

# --with-system-gmp \
5 changes: 4 additions & 1 deletion cross_config_iPhoneOS
Expand Up @@ -32,11 +32,14 @@ ECL_NEWLINE=LF
### 3 = (f)->_cnt
ECL_FILE_CNT=0

### 1.6) How many bits constitute a long long?
ECL_LONG_LONG_BITS=64

### 2) To cross-compile ECL so that it runs on the system
### arm-apple-darwin
### you need to first compile ECL on the system in which you are building
### the cross-compiled files, that is
### i686-apple-darwin9.6.0
### By default we assume that ECL can be accessed from some directory in
### the path.
ECL_TO_RUN=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/bin/ecl
#ECL_TO_RUN=/Users/red/Projects/ecl/ecl-git/install_iPhoneSimulator/bin/ecl
72 changes: 72 additions & 0 deletions make-iphone
@@ -0,0 +1,72 @@
#!/bin/sh
make distclean
echo "=================================================="
echo "Making the build-platform ECL to be used for cross compilation:"
echo "=================================================="
THIS_DIR=`pwd`
DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
./configure \
--prefix=$THIS_DIR/install_iPhoneSimulator/ \
--without-profile \
--without-cmp \
--without-asdf \
--without-defsystem \
--enable-debug \
--disable-shared \
--without-serve-event \
--with-tcp \
--without-rt \
--enable-threads \
--without-gmp \
dynamic_ffi=no \
CC="$DEVROOT/usr/bin/gcc" \
AR=$DEVROOT/usr/bin/ar \
RANLIB=$DEVROOT/usr/bin/ranlib \
NM=$DEVROOT/usr/bin/nm \
CPP=$DEVROOT/usr/bin/cpp \
ac_cv_path_NM=$DEVROOT/usr/bin/nm

make
make install
chmod -R 775 ./install_iPhoneSimulator/lib/

echo "=================================================="
echo "Making the host-platform ECL to be used on the iPhone:"
echo "=================================================="
mkdir build
cp cross_config_iPhoneOS build/cross_config
echo "ECL_TO_RUN=`pwd`/install_iPhoneSimulator/bin/ecl"

DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
sh ./configure \
--prefix=/Users/red/Projects/ecl/ecl-git/install_iPhoneOS/ \
--host=arm-apple-darwin \
--target=arm-apple \
--without-profile \
--without-cmp \
--with-asdf \
--without-defsystem \
--enable-debug \
--without-serve-event \
--with-tcp \
--without-rt \
--disable-threads \
--without-gmp \
dynamic_ffi=no
CC="$DEVROOT/usr/bin/gcc-4.0 -arch armv6" \
AR=$DEVROOT/usr/bin/ar \
RANLIB=$DEVROOT/usr/bin/ranlib \
NM=$DEVROOT/usr/bin/nm \
CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -miphoneos-version-min=2.0 -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
LDFLAGS="-arch armv6 -pipe -std=c99 -gdwarf-2 -mthumb -I/Library/iPhone/include -isysroot $DEVROOT/SDKs/iPhoneOS2.0.sdk" \
CPP=$DEVROOT/usr/bin/cpp \
ac_cv_path_NM=$DEVROOT/usr/bin/nm \
ac_cv_func_setpgrp_void=yes \
LIBPOSTFIX=_iPhoneOS

make
make install

echo "=================================================="
echo "Finished compiling! Inspect the output for errors"
echo "=================================================="
16 changes: 8 additions & 8 deletions src/Makefile.in
Expand Up @@ -71,11 +71,11 @@ bin/ecl$(EXE): ecl_min$(EXE) compile.lsp sysfun.lsp ecl/external.h BUILD-STAMP
ECLDIR=`pwd`/ ./ecl_min compile; \
fi

ecl_min$(EXE): $(LIBRARIES) .gdbinit @LIBPREFIX@eclmin.@LIBEXT@
ecl_min$(EXE): $(LIBRARIES) .gdbinit @LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@
if [ -f CROSS-COMPILER ]; then \
touch $@; \
else \
$(CC) $(LDFLAGS) -o $@ cinit.o c/all_symbols.o -L./ @LIBPREFIX@eclmin.@LIBEXT@ $(CORE_LIBS) $(LIBS) $(FASL_LIBS);\
$(CC) $(LDFLAGS) -o $@ cinit.o c/all_symbols.o -L./ @LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@ $(CORE_LIBS) $(LIBS) $(FASL_LIBS);\
fi

.gdbinit: $(srcdir)/util/gdbinit
Expand All @@ -95,22 +95,22 @@ bin/ecl-config: bin/ecl-config.pre
-e 's,@includedir\\@,$(includedir),' bin/ecl-config.pre > bin/ecl-config


@LIBPREFIX@eclmin.@LIBEXT@: @LIBPREFIX@eclgmp.@LIBEXT@ @LIBPREFIX@eclgc.@LIBEXT@ lsp/config.lsp cmp/cmpdefs.lsp ecl/external.h
@LIBPREFIX@eclmin@LIBPOSTFIX@.@LIBEXT@: @LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@ @LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@ lsp/config.lsp cmp/cmpdefs.lsp ecl/external.h
cd c; $(MAKE)
@LIBPREFIX@eclgc.@LIBEXT@:
@LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@:
test -d ecl/gc || mkdir ecl/gc
test -d ecl/gc/private || mkdir ecl/gc/private
if (echo $(SUBDIRS) | grep gc); then \
cd gc && $(MAKE) install && cd .. && \
cp -rf $(srcdir)/gc/include/gc_{mark,inline,tiny_fl}.h ecl/gc/ && \
cp -rf $(srcdir)/gc/include/private/*.h ecl/gc/private/ && \
mv @LIBPREFIX@gc.@LIBEXT@ @LIBPREFIX@eclgc.@LIBEXT@; \
mv @LIBPREFIX@gc.@LIBEXT@ @LIBPREFIX@eclgc@LIBPOSTFIX@.@LIBEXT@; \
fi
@LIBPREFIX@eclgmp.@LIBEXT@:
@LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@:
if (echo $(SUBDIRS) | grep gmp); then \
cd gmp && $(MAKE) install && \
cd .. && mv include/gmp.h ecl/ && rmdir include && \
mv ./@LIBPREFIX@gmp.@LIBEXT@ ./@LIBPREFIX@eclgmp.@LIBEXT@; \
mv ./@LIBPREFIX@gmp.@LIBEXT@ ./@LIBPREFIX@eclgmp@LIBPOSTFIX@.@LIBEXT@; \
fi
sysfun.lsp:
$(LN_S) $(srcdir)/cmp/sysfun.lsp ./
Expand Down Expand Up @@ -156,7 +156,7 @@ install-base:
$(INSTALL_PROGRAM) $$i $(DESTDIR)$(libdir); \
fi \
done
if [ "x@SONAME@" != "x" ]; then \
if [ "x@SONAME@" != "x" ] && [ "@enabled_shared@" = "yes" ] ; then \
( cd $(DESTDIR)$(libdir) && rm -f @SONAME3@ @SONAME2@ @SONAME1@ && \
mv @SONAME@ @SONAME3@ && \
$(LN_S) @SONAME3@ @SONAME2@ && \
Expand Down
18 changes: 18 additions & 0 deletions src/aclocal.m4
Expand Up @@ -13,6 +13,8 @@ else
ac_cv_c_long_long=no)
fi
if test $ac_cv_c_long_long = yes; then
if test -z "$ECL_LONG_LONG_BITS" ; then
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
int main() {
const char *int_type;
Expand All @@ -27,6 +29,8 @@ int main() {
exit(0);
}]])],[eval "`cat conftestval`"],[],[])
fi
fi
if test -z "$ECL_LONG_LONG_BITS"; then
AC_MSG_RESULT(not available)
else
Expand Down Expand Up @@ -101,13 +105,21 @@ ECL_NEWLINE=LF
### 3 = (f)->_cnt
ECL_FILE_CNT=0
### 1.6) How many bits constitute a long long?
ECL_LONG_LONG_BITS=64
### 2) To cross-compile ECL so that it runs on the system
### ${host}
### you need to first compile ECL on the system in which you are building
### the cross-compiled files, that is
### ${build}
### By default we assume that ECL can be accessed from some directory in
### the path.
###
### Ensure that you cross-compile ECL with a version of ECL compiled with
### the same options, otherwise you will run into inconsistencies between
### symbol tables of the two versions
ECL_TO_RUN=`which ecl`
EOF
cat ${with_cross_config}
Expand Down Expand Up @@ -178,6 +190,7 @@ AC_SUBST(MACHINE_VERSION)dnl Version of the machine
AC_SUBST(LDRPATH)dnl Sometimes the path for finding DLLs must be hardcoded.
AC_SUBST(LIBPREFIX)dnl Name components of a statically linked library
AC_SUBST(LIBPOSTFIX)dnl e.g. libecl_POSTFIX.a
AC_SUBST(LIBEXT)
AC_SUBST(SHAREDEXT)dnl Name components of a dynamically linked library
AC_SUBST(SHAREDPREFIX)
Expand All @@ -189,6 +202,7 @@ LDRPATH='~*'
SHAREDEXT='so'
SHAREDPREFIX='lib'
LIBPREFIX='lib'
LIBPOSTFIX=''
LIBEXT='a'
PICFLAG='-fPIC'
THREAD_CFLAGS=''
Expand Down Expand Up @@ -670,6 +684,8 @@ dnl functions?
dnl
AC_DEFUN([ECL_FFI],[
AC_MSG_CHECKING([whether we can dynamically build calls to C functions])
if test -z "${dynamic_ffi}" ; then
case "${host_cpu}" in
i686 | i586 | pentium* | athlon* )
EXTRA_OBJS="${EXTRA_OBJS} ffi_x86.o"
Expand All @@ -692,6 +708,8 @@ case "${host_cpu}" in
dynamic_ffi=no
;;
esac
fi
AC_MSG_RESULT([${dynamic_ffi}])
if test "$dynamic_ffi" = "yes" ; then
AC_DEFINE(ECL_DYNAMIC_FFI, 1, [we can build calls to foreign functions])
Expand Down
2 changes: 1 addition & 1 deletion src/c/Makefile.in
Expand Up @@ -74,7 +74,7 @@ ffi_x86_64.c: arch/ffi_x86_64.d $(DPP) $(HFILES)
$(RANLIB) $@

clean:
$(RM) $(DPP) *.c *.h $(OBJS) all_symbols.o all_symbols2.o ../libecl.a cinit.o core a.out
$(RM) $(DPP) *.c *.h $(OBJS) all_symbols.o all_symbols2.o ../@LIBPREFIX@ecl@LIBPOSTFIX@.a cinit.o core a.out

# Build rules

Expand Down
10 changes: 10 additions & 0 deletions src/c/threads.d
Expand Up @@ -67,6 +67,7 @@ ecl_process_env(void)
struct cl_env_struct *rv = pthread_getspecific(cl_env_key);
if (rv)
return rv;
printf("Getting pthread key %i returned %i\n", (int)cl_env_key, (int)rv);
FElibc_error("pthread_getspecific() failed.", 0);
return NULL;
#endif
Expand All @@ -82,8 +83,17 @@ ecl_set_process_env(cl_env_ptr env)
# ifdef ECL_WINDOWS_THREADS
TlsSetValue(cl_env_key, env);
# else
printf("Setting pthread key %i to %i\n", (int)cl_env_key, (int)env);
if (pthread_setspecific(cl_env_key, env))
FElibc_error("pthread_setcspecific() failed.", 0);

struct cl_env_struct *rv = pthread_getspecific(cl_env_key);
if (rv != env || 1)
{
printf("Getting pthread key %i returned %i immediately afterwards. should match.\n", (int)cl_env_key, (int)rv);
}


# endif
#endif
}
Expand Down

0 comments on commit 1c4936f

Please sign in to comment.