Skip to content

Commit 5f2feb9

Browse files
committed
Building documentation
1 parent 58790b9 commit 5f2feb9

1 file changed

Lines changed: 22 additions & 32 deletions

File tree

BUILDING.md

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,39 @@
11
# How to build ws4sql
22

3-
The build system uses `make`. There are two kinds of targets:
3+
The build system uses `make`.
44

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)
76

8-
All linux binaries generated for distribution are statically linked. MacOS and Windows binaries are dynamically linked.
7+
### `make build-nostatic`
98

10-
## Direct targets
9+
Builds a dinamically linked binary under the current architecture/os, in the `bin/` folder.
1110

12-
#### make build
11+
### `make build-static-linux`
1312

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).
1516

16-
#### make build-static
17+
### `make build-static-windows`
1718

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.
1920

20-
#### make dist*:
21+
### `make build-static-macos`
2122

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.
2425

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)
2827

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.
3031

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`
3234

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`.
3436

35-
*NB: buildx must be installed/enabled*
37+
## Docker
3638

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

Comments
 (0)