The functionality of SPRAAK can be further extended when the link libraries and header files for the following components are available:
On all *nix distributions on which SPRAAK was tested, all dependencies could be solved with standard packages that came with the *nix distribution. See the documentation of the distribution on how to install additional packages.
For compiling SPRAAK on Windows, we advise the MSYS2 build enviroment (good for building SPRAAK as native Windows applications, but not a complete *nix on Windows enviroment). Optionally, the Cygwin environment (a close to complete *nix enviroment on Windows) can be used to compile the SPRAAK applications as Cygwin applications (untested) and/or for deploying SPRAAK on Windows machines (either using the native Windows binaries or the Cygwin binaries).
SPRAAK can be compiled on OSX. The required extra tools can be readily obtained via macports and other open software package managers such as fink. Hereunder, the different steps when using macports are described.
SPRAAK depend on standard libraries and open-source tools only, so migration to other platforms should be possible. Hereunder, we list some of the more challenging tools to obtain.
SPRAAK uses 'scons' (a Python build-tool) the compile and install the software.
All user configurable settings (location of the different files, compiler options, ...) are grouped in the file 'config.py' in the root directory of the SPRAAK package. See the comments in config.py and the section Package structure for more info.
The default configuration of SPRAAK allows multiple versions (32 and 64 bits versions; different operating systems and/or processors; debug, release and profile versions; ...) to be installed and maintained in parallel on a single shared file system. Hence, the default directory structure differs somewhat from what is typical in packages ment for local installation only. See Package structure for more details.
will make a build using the default option (CONFIG=release, COMPILER=gcc, ARCH=auto, EXPORT=developer). This results in a library and executables that are aimed for final release (don't contain debug, profile, ... information). At the same time, the header files and the documentation are aimed at developers, i.e. they expose everything.
By default, the resulting SPRAAK binaries will run on recent CPUs (less than 10 years old) only. If older CPUs must be supported, add the 'ARCH=compatible' option. On the other hand, by targetting a specific CPU (adding option 'ARCH=native'), somewhat faster binaries can be obtained at the expense of compatibility.
On Linux, the clang/llvm compiler results in somewhat faster (and smaller) binaries, especially on modern CPUs (with support for 256bit vectors or better).
In order to be able to run the programs, users have to adjust their login scripts so that the PATH environment variable includes the location of the SPRAAK executables. On systems which do not support locating dynamic library files relative w.r.t. the executables, the LD_LIBRARY_PATH environment variable (or equivalent) must be adjusted to include the location of the SPRAAK library as well.
Upon building (using the default settings), the following directory structure will be created:
The <arch> infix combines information about the operating system, CPU and configuration (debug, release, ...) into a single name.
In order to facilitate package management, SPRAAK also allows for setting symbolic links from the 'export' directories to some final destination directories (e.g. /usr/bin, /usr/lib and /usr/include). This way, all files from the SPRAAK package can be kept in a single directory while users still can have access to the full functionality without having the expand their PATH, LD_LIBRARY_PATH, ...). Furthermore, when SPRAAK is removed, upgraded, ... the worst that can happen is some dangling links in the /usr/bin, /usr/lib, and /usr/include/ directories. See the comments in config.py for more info.
not_windows = (spraak.os!="Windows")
spraak.prefix = '.'
spraak.bindir = spraak.prefix+'/bin'
spraak.bindir_arch = spraak.prefix+'/bin/'+spraak.arch
spraak.libdir = (spraak.prefix+'/lib' if(not_windows) else spraak.bindir)
spraak.libdir_arch = (spraak.prefix+'/lib/'+spraak.arch if(not_windows) else spraak.bindir_arch)
spraak.includedir = spraak.prefix+'/include'
spraak.docdir_html = spraak.prefix+'/doc/html'
spraak.docdir_pdf = spraak.prefix+'/doc/pdf'
spraak.datadir = spraak.prefix+'/data'
spraak.bindir_link = None
spraak.libdir_link = None
spraak.includedir_link = None
spraak.symlink_support = not_windows
spraak.builddir = spraak.prefix+'/build'
spraak.Nthreads = 2
spraak.python = None
spraak.python_h = None
spraak.zlib = "auto"
spraak.zlib_h = "auto"
spraak.bzlib = None
spraak.bzlib_h = None
spraak.flac = None
spraak.flac_h = None
spraak.gcrypt = None
spraak.gcrypt_h = None
spraak.arpack = "auto"
spraak.arpack_h = "auto"
spraak.readline = "auto"
spraak.readline_h = "auto"
spraak.editline = "auto"
spraak.editline_h = "auto"
def select_best_match(opt_dict,spraak):
sel = [spraak.os,spraak.cpu,spraak.cc,str(spraak.cc_ver[0]),spraak.config];
best_opt = None;
best_cnt = 9;
for opt_str,opt_val in opt_dict.iteritems():
cnt = 6;
for ndx,val in enumerate(opt_str.split()):
if(val == sel[ndx]):
cnt -= 1;
elif(val != "*"):
opt_val = None;
if((opt_val!=None) and (cnt<best_cnt)):
best_opt = opt_val;
best_cnt = cnt;
if(best_opt == None):
print "ERROR No match found for %s %s %s %s %s"%(spraak.os,spraak.cpu,spraak.cc,str(spraak.cc_ver[0]),spraak.config)
spraak.signal_error = 1;
return(best_opt);
cflags_opt = { "* * gcc * release" : "-O2",
"* * gcc * debug" : "-O2 -g",
"* * gcc * regression" : "-O2 -g -DSPR_REGRESSION=1",
"* * gcc * profile" : "-O2 -pg",
"* * gcc * coverage" : "-O1 -ftest-coverage -fprofile-arcs",
"* x86_64 gcc * release" : "-O3 -fno-keep-static-consts -maccumulate-outgoing-args -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"* x86_64 gcc * debug" : "-g -O3 -maccumulate-outgoing-args -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"* i686 gcc * release" : "-O3 -fno-keep-static-consts -maccumulate-outgoing-args -fstrict-aliasing -fomit-frame-pointer -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"* i686 gcc * debug" : "-g -O3 -maccumulate-outgoing-args -fstrict-aliasing -fomit-frame-pointer -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"Windows i686 gcc * release" : "-O3 -fno-tree-vectorize -fno-keep-static-consts -maccumulate-outgoing-args -fstrict-aliasing -fomit-frame-pointer -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"Windows i686 gcc * debug" : "-g -O3 -fno-tree-vectorize -maccumulate-outgoing-args -fstrict-aliasing -fomit-frame-pointer -ffast-math -fno-finite-math-only -mieee-fp -funroll-loops -fpeel-loops -funswitch-loops -finline-limit=250 --param max-unroll-times=4",
"OSX * gcc * release" : "-O3 -ffast-math -fno-finite-math-only -mieee-fp",
"OSX * gcc * debug" : "-g -O3 -ffast-math -fno-finite-math-only -mieee-fp",
"* * clang * release" : "-O3 -ffast-math",
"* * clang * debug" : "-g -O3 -ffast-math",
"* x86_64 clang * release" : "-O3 -ffast-math -mieee-fp",
"* x86_64 clang * debug" : "-g -O3 -ffast-math -mieee-fp",
"* i686 clang * release" : "-O3 -ffast-math -mieee-fp",
"* i686 clang * debug" : "-g -O3 -ffast-math -mieee-fp",
}
cpu_x86_nbits = {"i686":"-m32 ", "x86_64":"-m64 "}.get(spraak.cpu,"");
cpu_x86_nbits = {"m32":"-m32 ", "m64":"-m64 "}.get(env["CROSS"],cpu_x86_nbits);
arch_gcc_i686 = cpu_x86_nbits + {"auto":"-march=core2 -mtune=core2 -malign-double ", "native":"-march=native -mtune=native -malign-double ", "compatible":""}[env["ARCH"]];
arch_clang_i686 = cpu_x86_nbits + {"auto":"-march=core2 -mtune=core2 ", "native":"-march=native -mtune=native ", "compatible":""}[env["ARCH"]];
arch_x86 = cpu_x86_nbits + {"auto":"-march=core2 -msse3 -mtune=native ", "native":"-march=native -mtune=native ", "compatible":""}[env["ARCH"]];
cflags_cfg = { "* * * * *" : "",
"* * gcc * *" : "-std=gnu99 -fpic -fsigned-char",
"* i686 gcc * *" : "-std=gnu99 -fpic " + arch_gcc_i686 + "-W -Wall -Wno-uninitialized -Wno-unused-value -fsigned-char -fasynchronous-unwind-tables",
"Windows i686 gcc * *" : "-std=gnu99 " + arch_gcc_i686 + "-W -Wall -Wno-uninitialized -Wno-unused-value -fsigned-char",
"* x86_64 gcc * *" : "-std=gnu99 -fpic " + arch_x86 + "-W -Wall -Wno-uninitialized -Wno-unused-value -fsigned-char -fasynchronous-unwind-tables",
"Windows x86_64 gcc * *" : "-std=gnu99 " + arch_x86 + "-W -Wall -Wno-uninitialized -Wno-unused-value -fsigned-char",
"* i686 clang * *" : "-std=c99 -fpic " + arch_clang_i686 + "-W -Wall -Wno-incompatible-pointer-types-discards-qualifiers -fsigned-char -fasynchronous-unwind-tables",
"Windows i686 clang * *" : "-std=c99 " + arch_clang_i686 + "-W -Wall -Wno-incompatible-pointer-types-discards-qualifiers -fsigned-char",
"* x86_64 clang * *" : "-std=c99 -fpic " + arch_x86 + "-W -Wall -Wno-incompatible-pointer-types-discards-qualifiers -fsigned-char -fasynchronous-unwind-tables",
"Windows x86_64 clang * *" : "-std=c99 " + arch_x86 + "-W -Wall -Wno-incompatible-pointer-types-discards-qualifiers -fsigned-char",
}
cflags_shobj ={ "* * * * *" : "-DSPR_INCL_LVL=-1",
"Linux * * * *" : "-DSPR_INCL_LVL=-1 -fvisibility=hidden -fno-common",
"OSX * * * *" : "-DSPR_INCL_LVL=-1 -fno-common",
"Windows * * * *" : "-DSPR_INCL_LVL=-1 -fno-common",
}
spraak.cflags = select_best_match(cflags_cfg,spraak)+' '+select_best_match(cflags_opt,spraak)
spraak.shcflags = select_best_match(cflags_shobj,spraak)+' '+spraak.cflags
ldlibs = { "Linux * * * *" : "m dl rt pthread",
"Linux * gcc * *" : "m dl rt pthread gcc_s",
"OSX * * * *" : "m dl pthread",
"Windows * * * *" : "m wsock32 winmm",
}
ldpath = { "* * * * *" : "",
"Windows * gcc * *" : "extern/lib",
}
ldcpph = { "* * * * *" : "",
"Windows * gcc * *" : "extern/include",
}
spraak.ldlibs = select_best_match(ldlibs,spraak)
spraak.ldpath = select_best_match(ldpath,spraak)
spraak.ldcpph = select_best_match(ldcpph,spraak)
ldflags = { "Linux * * * *" : cpu_x86_nbits + "-rdynamic -Wl,-z,origin -Wl,-rpath,'$$ORIGIN/lib'",
"Linux * * * profile" : cpu_x86_nbits + "-pg -rdynamic -Wl,-z,origin -Wl,-rpath,'$$ORIGIN/lib'",
"Linux * * * coverage" : cpu_x86_nbits + "-ftest-coverage -fprofile-arcs -rdynamic -Wl,-z,origin -Wl,-rpath,'$$ORIGIN/lib'",
"OSX * * * *" : cpu_x86_nbits + "-rdynamic",
"Windows * * * *" : cpu_x86_nbits + "-static-libgcc -Wl,--disable-stdcall-fixup -Wl,--enable-auto-import",
"* * * * *" : ""
}
spraak.ldflags = select_best_match(ldflags,spraak)
ldlibflags = { "* * * * *" : "",
"Linux * * * *" : cpu_x86_nbits + "-rdynamic -Wl,-O -Wl,--enable-new-dtags -Wl,--as-needed",
"OSX * * * *" : cpu_x86_nbits + "-dynamiclib -install_name @executable_path/lib/libspraak.dylib",
"Windows * * * *" : cpu_x86_nbits + "-static-libgcc -Wl,--out-implib=spraak.dll.a -Wl,--enable-stdcall-fixup -Wl,--export-all-symbols -Wl,--enable-auto-import",
}
spraak.ldlibflags = select_best_match(ldlibflags,spraak)
cppflags = { "* * * * *" : "",
"* * gcc * *" : "-D_XOPEN_SOURCE=600 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT",
"* * clang * *" : "-D_XOPEN_SOURCE=600 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT",
}
spraak.cppflags = select_best_match(cppflags,spraak)
bugs = { "* * * * *" : [],
"* x86_64 * * *" : (["x86_twin48_18"] if(env["ARCH"]=="compatible") else [])
}
for bug in select_best_match(bugs,spraak):
setattr(spraak,'sysdep_bug_'+bug,True);
spraak.sysdep_bug_sphere_shortpack_v0 = True;