|
1 | 1 | # How to build ws4sql |
2 | 2 |
|
3 | | -The build system uses `make`. There are two kinds of targets: |
| 3 | +The build system uses `make`. |
4 | 4 |
|
5 | | -- "direct" builds, that use go(lang) tooling and [xgo](https://github.com/techknowlogick/xgo) to build a statically or dinamically linked binary or set of binaries; |
6 | | -- docker image builds, that build docker images. |
| 5 | +## Targets (normal builds) |
7 | 6 |
|
8 | | -All linux binaries generated for distribution are statically linked. MacOS and Windows binaries are dynamically linked. |
| 7 | +### `make build-nostatic` |
9 | 8 |
|
10 | | -## Direct targets |
| 9 | +Builds a dinamically linked binary under the current architecture/os, in the `bin/` folder. |
11 | 10 |
|
12 | | -#### make build |
| 11 | +### `make build-static-linux` |
13 | 12 |
|
14 | | -Builds a dinamically linked binary under the current architecture, in the `bin/` folder. |
| 13 | +Builds an almost-statically linked binary for Linux, under the current architecture, in the `bin/` folder. |
| 14 | +It's not fully static, as duckdb is a bit tricky to compile statically. The CI does this using `musl` (see |
| 15 | +below). |
15 | 16 |
|
16 | | -#### make build-static |
| 17 | +### `make build-static-windows` |
17 | 18 |
|
18 | | -Builds a statically linked binary under the current architecture, in the `bin/` folder. |
| 19 | +Builds a statically linked binary for Windows, under the current architecture, in the `bin/` folder. |
19 | 20 |
|
20 | | -#### make dist*: |
| 21 | +### `make build-static-macos` |
21 | 22 |
|
22 | | -Builds binaries for the 6 supported OSs/architectures, also creating the distribution archives in |
23 | | -the `bin/` folder. Uses [xgo](https://github.com/techknowlogick/xgo) for cross compiling. |
| 23 | +Builds a somewhat-statically linked binary for Mac OS, under the current architecture, in the `bin/` folder. |
| 24 | +It's not fully static, as Mac OS doesn't allow statically linking against OS libraries. |
24 | 25 |
|
25 | | -It's actually a two-stage process: the first time use `make dist-pre` to setup the environment; |
26 | | -then `make dist` to build the binaries and package them. Root password required, to re-own the |
27 | | -files (xgo produces them as root). |
| 26 | +## Targets (CI builds) |
28 | 27 |
|
29 | | -## Docker targets |
| 28 | +The Github Actions script (`.github/workflows/main.yml`) compiles the linux binaries fully statically, |
| 29 | +in an Alpine linux chroot, and using a precompiled version of the `libduckdb_bundle.a` that is static and |
| 30 | +platform-independent (`-fPIC`). If you have an Alpine Linux environment, you can use the following targets. |
30 | 31 |
|
31 | | -The docker files assume that the `make dist*` stuff described above was performed. |
| 32 | +- `build-static-ci-linux-musl-amd64` |
| 33 | +- `build-static-ci-linux-musl-arm64` |
32 | 34 |
|
33 | | -Docker images are based on the `debian:stable-slim` official docker image. |
| 35 | +Required packages are `musl-dev go g++ make openssl openssl-dev openssl-libs-static zstd`. |
34 | 36 |
|
35 | | -*NB: buildx must be installed/enabled* |
| 37 | +## Docker |
36 | 38 |
|
37 | | -#### make docker |
38 | | - |
39 | | -Builds a docker image (tagged `local_ws4sql:latest`) in the current architecture. |
40 | | - |
41 | | -#### make docker-multiarch |
42 | | - |
43 | | -Builds docker images for AMD64 and ARM64v8. The images are named like the official ones, i.e. |
44 | | -`germanorizzo/ws4sql:v0.xx.xx-xxx`. |
45 | | - |
46 | | -#### make docker-publish |
47 | | -#### make docker-devel |
48 | | - |
49 | | -Reserved, for publishing in Docker Hub. |
| 39 | +The provided `Dockerfile` assumes that a `ws4sql` static binary is in the `bin/` directory. |
0 commit comments