To bootstrap/install C2C the following tools are needed:
- gcc or clang
- make (gmake on FreeBSD/OpenBSD)
The fastest way to just get c2c up and running is just following the next steps. The explanation of what that does is below. This installs everything in a code/ subdirectory. Once you understand what is happening, you can deviate.
Make sure ~/bin is in your $PATH
cd
mkdir ~/bin
ln -s ~/c2compiler/output/c2c/c2c ~/bin/c2c
ln -s ~/c2compiler/output/c2tags/c2tags ~/bin/c2tags
ln -s ~/c2compiler/libs ~/c2_libs
mkdir code
git clone --recurse-submodules [email protected]:c2lang/c2compiler.git
cd c2compiler
. ./env.sh
make -C bootstrap
./install_plugins.sh
./output/tester/tester test
To be usable, c2c needs to be in your $PATH. This is done above by adding it to ~/bin. This directory should be in your $PATH, otherwise c2c and c2tags cannot be found.
c2c uses the following enviroment variables:
- C2_LIBDIR - used to find libraries for compilation. Currently a subdir 'libs' of c2compiler/
- C2_PLUGINDIR - used to find plugins for the compiler
The easiest way to set these is to source env.sh in the c2compiler archive top-level directory.
The install_plugins.sh script simply copies the compiled plugins to ~/c2_plugins.
the bootstrap/ directory contain the C sources of the bootstrap C2 compiler. This must be used because c2c itself is written in C2.