How to Build and Install Cozenage¶
Get the Source¶
Git Clone¶
The quickest and easiest way to get the source is to simply clone the GitHub repo:
$ git clone https://github.com/DarrenKirby/cozenage.git
This command will download the source tree and git metadata to a directory cozenage in the PWD. The git source will
contain at least two branches. main is the currently stable branch. This branch will always match the code in the
most current release available from GitHub. The develop branch contains the code under active development. While
the code from this branch is guaranteed to build and run, this is the branch that I push the most recent new features to,
and it is not as thoroughly tested as main. If you want the latest, this is the branch to build.
Static Source downloads¶
If you don’t want to bother with git you can download a zip file or tar file (compressed with .gz or .xz
compression) from GitHub. The latest of these source packages will always match the code in the current main branch.
It is best to avoid the ‘Source Code’ zip and tar.gz downloads. These are automatically generated by GitHub when a new
release is created and generally contain a bunch of unneeded cruft. Instead, download one of the cozenage-* packages
from the same page. You will also find the associated sha256sums to verify the download.
Install dependencies¶
Cozenage requires ICU for Unicode.
It requires libgc for garbage collection.
It requires GNU GMP for bigint support,
and (may) soon require GNU MPFR for bigfloat support.
CMake build¶
$ make
This will create a build/ directory in the source root which contains all the intermediate object
files. The main cozenage binary will be placed in the top-level of the source tree. The library modules will be
placed in a lib/ subdirectory of the source tree. On macOS systems, these modules will be suffixed with .dylib
extensions. All other systems will suffix them with the .so extension.
The default build specifies an -02 optimized binary. You can specify a non-optimized build with debugging symbols by running:
$ make DEBUG=ON
GNU make build¶
If you do not have Cmake installed, or prefer not to use it, you can run:
$ make nocmake
Building the testrunner¶
Cozenage comes with an (incomplete) set of end-to-end tests. To build this suite, and run the tests:
$ make test
$ ./run_tests
The tests require the Criterion framework to build and run.
System installation¶
To install the cozenage binary and library modules to the system, run:
$ make install
This will install cozenage to /usr/local/bin, and the modules to
/usr/local/lib/cozenage by default. To change this default, add the PREFIX variable to
the command:
$ make install PREFIX=/my/custom/path
Cleaning and rebuilding the source tree¶
Running
$ make clean
will remove the cozenage binary, the run_tests binary (if it exists), and remove the build/ object directory. You can also run
$ make rebuild
which is shorthand for
$ make clean
$ make
Tip
The unified Makefile uses GNU-extensions that will cause an error on most *BSD systems that have standard make
installed. On such systems, replace all the make commands above with gmake, if GNU Make is installed. If not,
CMake must be used manually to build. For example, from the top of the source directory:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ mv cozenage ..
Portability¶
Cozenage is regularly tested on macOS, Linux, and FreeBSD. I do not have any Windows systems, so Windows support is unknown, and likely broken. If you would like to help with this please see this issue.