Index News Docs Issues Source

Building Chawan

Chawan uses GNU make for builds. To build and install it, you’ll typically want to run make and then make install.

Variables

Unless noted otherwise, variables can be passed either in the environment (e.g. PREFIX=/usr make) or as arguments to make (e.g. make PREFIX=/usr).

It is recommended to pass the same variables to both the default target (make) and the install target (make install). The easiest way to accomplish this is to export the appropriate variables beforehand (e.g. export PREFIX=/usr).

Following is a list of variables which may be set.

This list does not include the CC variable, because Nim only supports a limited set of C compilers. If you want to override the C compiler:

  1. Set CC to the respective compiler anyways, because it is used by chaseccomp.
  2. If your compiler is supported by Nim, then set e.g. FLAGS=--cc:clang. Check the list of supported compilers with nim --cc:help.
  3. If your compiler is not supported by Nim, but emulates another compiler driver, then add e.g. FLAGS=--gcc.path=/usr/local/musl/bin --gcc.exe=musl-gcc --gcc.linkerexe=musl-gcc

Phony targets

Cross-compiling

Apparently it’s possible. From user cutenice (with dependencies updated):

With the latest changes, I could simply run CFLAGS=-m32 LDFLAGS=-m32 FLAGS=--cpu:i386 make to cross-compile!

I don’t know if I have any additional insight from today’s exploration.. On Arch I needed these things:

Static linking

Tested with musl as follows:

cc:gcc
gcc.path = "/usr/local/musl/bin"
gcc.exe = "musl-gcc"
gcc.linkerexe = "musl-gcc"
$ export PKG_CONFIG_PATH=/usr/local/musl/lib/pkgconfig:/usr/local/musl/lib64/pkgconfig
$ export CC=musl-gcc STATIC_LINK=1
$ make distclean
$ make