First of all you want to make sure you meet the stdlib-build-requirements.
Then you should clone the GitHub repo, e.g. by
git clone https://github.com/SacBase/Stdlib.git
which will create a subdirectory named Stdlib which contains all the Stdlib sources. Before you start building them you need to make sure that
.sac2crcin your home directory for which you have write permissions.
sac2cwithin your path. This should be a symlink to the
sac2c_p), not the
sac2c_d), as compilation times would be excessive
Once that is done, you can simply follow the instructions from the README file contained in your copy from GitHub:
All development of the
stdlib is happening on GitHub as of this moment. Furthermore, a new build system has been implemented using CMake. Users still using a other version of stdlib (specifically contained within the Git repository branch
stdlib-follow) should skip this section and go to Previous Releases.
Work in progress — Hans-Nikolai Viessmann 2016/12/05 22:44
This section concerns itself primarily with the building of the
stdlib from the Git repository branch
You will need
autoconf and related tools to be installed in order to build the
stdlib; OSX / macOS users can find this in
Change your actual path to your check-out of stdlib. Then do
./bootstrap # this will scan through all source files # under /src and store their location for # later dependency generation. We also # call autotools and generate the # ./configure scripts ./configure # generate Makefiles make SUB_CONFIGURE_FLAGS=--disable-opencv # builds all modules for all (several?) # targets within the target/<..target..> # directory. The make command can # instruct the per-target configuration # to enable/disable some features. This # is done by setting the variable # SUB_CONFIGURE_FLAGS on the command # line. See `sub/configure --help` for # further features that can be # enabled/disabled. make EXCLUDEMODS="ArrayIO RGB" # the EXCLUDEMODS var can be used to # instruct the build system to NOT # compile the listed modules, even # against what has been configured. make INCLUDEMODS="ArrayBasics" # the INCLUDEMODS will completely # override the build system and only # compile the listed modules, including # their dependencies recursively. make COPT=2 # the COPT allows you to control what # optimisation level is used by the # compiler, e.g. COPT=1 equates to -O2 make LINKSETSIZE=25 # the LINKSETSIZE allows you to control # the SAC compilers `-linksetsize' flag, # e.g. LINKSETSIZE=15 equates to # -linksetsize 15 make install # moves all your targets into the # location of the sac2c compiler
Note, that any call to
sac2c will try to find any used or imported modules in the installed version of the stdlib that was installed with
sac2c of the very same revision number! So, if you have a newer version of
sac2c, be it installed or not, it will no longer find previously compiled and installed libraries! Likewise, if you modify your stdlib, compile it but do not install it, it will not be picked up!
To tackle these issues, you may want to add your stdlib-build-directory to your search pathes in
LIB_OUTPUTDIR. For convenience, we recommend that you create or add to your local sac2crc file
˜/.sac2crc the following lines and replace
STDLIB-BUILD_DIR by the absolute path to your own stdlib build:
target add_stdlib_local: TREE_OUTPUTDIR += ":STDLIB-BUILD_DIR/lib" LIB_OUTPUTDIR += ":STDLIB-BUILD_DIR/lib" target default_sbi :: add_default_sbi :: add_local :: add_stdlib_local:
If your aim is to primarily do stdlib development with no or almost no compiler development, we suggest you do not install a stdlib at all!
If you are doing primarily sac2c development we suggest you install a compiled version for each version
sac2c that you install. That way, you can try older compiler versions without being required to recompile the
In both cases you should put the above lines into your local
sac2cto use the locally compiled stdlib. All that is required is to shadow the installed stdlib by using
+=in your local
.sac2crc. However, this may entail encountering a sac2c error message similar to
abort: The module 'Array' (/Volumes/Users/sbs/stdlib/lib/tree/host/libArrayTree.dylib) uses an incompatible syntax tree layout. Please update the module and compiler to the most recent version. Compilation failed while Loading SAC program, 1 warning(s).
As a positive side effect, the suggested setup in
./sac2crc allows you to keep the rebuilds of the local stdlib to a minimum during compiler development. Despite changes in the compiler version (with and without commits), the stdlib only requires rebuilding when the syntax tree layout is being modified