| 1 |
@node Building ECL |
| 2 |
@section Building ECL |
| 3 |
|
| 4 |
Due to its portable nature, ECL works on every (at least) 32-bit |
| 5 |
architecture which provides a proper C99 compliant compiler. |
| 6 |
|
| 7 |
Operating systems on which ECL is reported to work: Linux, Darwin (Mac |
| 8 |
OS X), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Windows and |
| 9 |
Android. On each of them ECL supports native threads. |
| 10 |
|
| 11 |
In the past Juanjo José García-Ripoll maintained a test farm which |
| 12 |
performed ECL tests for each release on number of platforms and |
| 13 |
architectures. Due to lack of the resources we can't afford such doing, |
| 14 |
however each release is tested by volunteers with an excellent package |
| 15 |
@uref{https://common-lisp.net/project/cl-test-grid,cl-test-grid} created |
| 16 |
and maintained by Anton Vodonosov. |
| 17 |
|
| 18 |
@subsection Autoconf based configuration |
| 19 |
|
| 20 |
ECL, like many other FOSS programs, can be built and installed with a |
| 21 |
GNU tool called Autoconf. This is a set of automatically generated |
| 22 |
scripts that detect the features of your machine, such as the compiler |
| 23 |
type, existing libraries, desired installation path, and configures ECL |
| 24 |
accordingly. The following procedure describes how to build ECL using |
| 25 |
this procedure and it applies to all platforms except for the Windows |
| 26 |
ports using Microsoft Visual Studio compilers (however you may build ECL |
| 27 |
with cygwin or mingw using the autoconf as described here). |
| 28 |
|
| 29 |
To build @ecl{} you need to |
| 30 |
|
| 31 |
@enumerate |
| 32 |
@item |
| 33 |
Extract the source code and enter it's directory |
| 34 |
|
| 35 |
@example |
| 36 |
$ tar -xf ecl-xx.x.x.tgz |
| 37 |
$ cd ecl-xx.x.x |
| 38 |
@end example |
| 39 |
|
| 40 |
@item |
| 41 |
Run the configuration file, build the program and install it |
| 42 |
|
| 43 |
@example |
| 44 |
$ ./configure --prefix=/usr/local |
| 45 |
$ make # -jX if you have X cores |
| 46 |
$ make install |
| 47 |
@end example |
| 48 |
|
| 49 |
@item |
| 50 |
Make sure the program is installed and ready to run: |
| 51 |
|
| 52 |
@example |
| 53 |
$ /usr/local/bin/ecl |
| 54 |
|
| 55 |
ECL (Embeddable Common-Lisp) 16.0.0 |
| 56 |
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya |
| 57 |
Copyright (C) 1993 Giuseppe Attardi |
| 58 |
Copyright (C) 2000 Juan J. Garcia-Ripoll |
| 59 |
Copyright (C) 2015 Daniel Kochmanski |
| 60 |
ECL is free software, and you are welcome to redistribute it |
| 61 |
under certain conditions; see file 'Copyright' for details. |
| 62 |
Type :h for Help. |
| 63 |
Top level in: #<process TOP-LEVEL>. |
| 64 |
> |
| 65 |
@end example |
| 66 |
@end enumerate |
| 67 |
|
| 68 |
@subsection Platform specific instructions |
| 69 |
@subsubsection MSVC based configuration |
| 70 |
|
| 71 |
You need Microsoft Visual Studio 2015 or better to compile ECL, |
| 72 |
which flavor(Professional, Community, etc) does not matter. |
| 73 |
|
| 74 |
You also need @uref{http://yasm.tortall.net,yasm} optionally to build gmp, |
| 75 |
fetch yasm-1.3.0-win64.exe and yasm-1.3.0-win32.exe, |
| 76 |
and put them in your system PATH directory. |
| 77 |
|
| 78 |
In the Visual Studio's startup menu, click |
| 79 |
@uref{https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs,Developer |
| 80 |
Command Prompt for Visual Studio} to open the console |
| 81 |
window. Alternatively, open the developer console from the start menu |
| 82 |
through "Visual Studio 20xx" -> "Visual Studio Tools" -> "VC" and |
| 83 |
select "x64 Native Tools Command Prompt for VS 20xx" or "x86 Native |
| 84 |
Tools Command Prompt for VS 20xx", depending on whether you want to |
| 85 |
build 32 or 64bit versions of ECL. |
| 86 |
|
| 87 |
@enumerate |
| 88 |
@item |
| 89 |
Change to the msvc directory. |
| 90 |
@item |
| 91 |
Run nmake to build ECL. |
| 92 |
@item |
| 93 |
Run nmake install prefix=d:\Software\ECL where the prefix is the |
| 94 |
directory where you want to install ECL. |
| 95 |
@item |
| 96 |
If you want to build debug version, add ECL_DEBUG=1 to nmake command line. |
| 97 |
@item |
| 98 |
If you want to build 64bit version, add ECL_WIN64=1 to nmake command line, |
| 99 |
you can also set GMP_TYPE=AMD64 to use specific assembly codes. |
| 100 |
@item |
| 101 |
Optionally, if you want to build a self-installing executable, you can |
| 102 |
install NSIS and run nmake windows-nsi. |
| 103 |
@end enumerate |
| 104 |
|
| 105 |
|
| 106 |
@c @node BSD systems |
| 107 |
@c @subsubsection BSD systems |
| 108 |
|
| 109 |
@subsubsection Android |
| 110 |
|
| 111 |
Cross compiling ECL for Android requires first configuring the cross |
| 112 |
compilation toolchain. This requires the Android NDK version 22 or |
| 113 |
higher. |
| 114 |
|
| 115 |
@example |
| 116 |
@verbatim |
| 117 |
export NDK_PATH=/opt/android-ndk |
| 118 |
export ANDROID_API=23 |
| 119 |
export TOOLCHAIN_PATH=${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64 # use darwin instead of linux if compiling on Mac OS host |
| 120 |
export TARGET=armv7a-linux-androideabi |
| 121 |
@end verbatim |
| 122 |
@end example |
| 123 |
|
| 124 |
Here, @code{ANDROID_API} is the minimum Android API version ECL will |
| 125 |
run on. Moreover, an existing installation ECL is required. This installation |
| 126 |
has to be the same version as the one you are attempting to build. |
| 127 |
Assuming you have installed in "/usr/local": |
| 128 |
|
| 129 |
@example |
| 130 |
@verbatim |
| 131 |
export ECL_TO_RUN=/usr/local/bin/ecl |
| 132 |
@end verbatim |
| 133 |
@end example |
| 134 |
|
| 135 |
Finally, we can build and install the target ECL: |
| 136 |
|
| 137 |
@example |
| 138 |
@verbatim |
| 139 |
export CC="${TOOLCHAIN_PATH}/bin/clang --target=${TARGET}${ANDROID_API}" |
| 140 |
export LD=${TOOLCHAIN_PATH}/bin/ld |
| 141 |
export AR=${TOOLCHAIN_PATH}/bin/llvm-ar |
| 142 |
export RANLIB=${TOOLCHAIN_PATH}/bin/llvm-ranlib |
| 143 |
export ECL_TO_RUN=/usr/local/bin/ecl |
| 144 |
./configure --host=${TARGET} \ |
| 145 |
--prefix=`pwd`/ecl-android \ |
| 146 |
--disable-c99complex \ |
| 147 |
--with-cross-config=`pwd`/src/util/android-arm.cross_config |
| 148 |
make -j9 |
| 149 |
make install |
| 150 |
@end verbatim |
| 151 |
@end example |
| 152 |
|
| 153 |
Library and assets are installed in the "ecl-android" directory |
| 154 |
and are ready to run on the Android system. |
| 155 |
|
| 156 |
@subsubsection iOS |
| 157 |
|
| 158 |
The cross-compilation steps for iOS are similar to those for Android. |
| 159 |
|
| 160 |
@example |
| 161 |
@verbatim |
| 162 |
export ECL_TO_RUN=/usr/local/bin/ecl |
| 163 |
@end verbatim |
| 164 |
@end example |
| 165 |
|
| 166 |
Configure the toolchain: |
| 167 |
@example |
| 168 |
@verbatim |
| 169 |
export IOS_VERSION_MIN="8.0" |
| 170 |
export IOS_SDK_DIR="`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/" |
| 171 |
|
| 172 |
export CC="clang" |
| 173 |
export CXX="clang++" |
| 174 |
|
| 175 |
export CFLAGS="-arch arm64 -miphoneos-version-min=${IOS_VERSION_MIN} -isysroot ${IOS_SDK_DIR}" |
| 176 |
export CFLAGS="$CFLAGS -pipe -Wno-trigraphs -Wreturn-type -Wunused-variable" |
| 177 |
export CFLAGS="$CFLAGS -fpascal-strings -fasm-blocks -fmessage-length=0 -fvisibility=hidden" |
| 178 |
export CFLAGS="$CFLAGS -O2 -DNO_ASM" |
| 179 |
|
| 180 |
export LD="ld" |
| 181 |
export LDFLAGS="-arch arm64 -pipe -std=c99 -gdwarf-2 -isysroot ${IOS_SDK_DIR}" |
| 182 |
export LIBS="-framework Foundation" |
| 183 |
@end verbatim |
| 184 |
@end example |
| 185 |
|
| 186 |
Build and install the target library: |
| 187 |
@example |
| 188 |
@verbatim |
| 189 |
export CFLAGS="$CFLAGS -DGC_DISABLE_INCREMENTAL -DECL_RWLOCK" |
| 190 |
export CXXFLAGS="$CFLAGS" |
| 191 |
./configure --host=aarch64-apple-darwin \ |
| 192 |
--prefix=`pwd`/ecl-iOS \ |
| 193 |
--disable-c99complex \ |
| 194 |
--disable-shared \ |
| 195 |
--with-cross-config=`pwd`/src/util/iOS-arm64.cross_config |
| 196 |
make -j9 |
| 197 |
make install |
| 198 |
@end verbatim |
| 199 |
@end example |
| 200 |
|
| 201 |
Library and assets in the "ecl-iOS" directory are ready to run on the iOS system. |