aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: e49481900a8a6a30b7f7efd6bb76aad3b1fe5ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Pack
====

Pack is a simple serialisation and deserialisation library for C.

Build health:

-   [![builds.sr.ht status][alpine-img]][alpine-web] - Alpine
-   [![builds.sr.ht status][archlinux-img]][archlinux-web] - Arch Linux
-   [![builds.sr.ht status][freebsd-img]][freebsd-web] - FreeBSD
-   [![builds.sr.ht status][openbsd-img]][openbsd-web] - OpenBSD

[alpine-img]: https://builds.sr.ht/~tk/pack/commits/alpine.yml.svg
[alpine-web]: https://builds.sr.ht/~tk/pack/commits/alpine.yml?
[archlinux-img]: https://builds.sr.ht/~tk/pack/commits/archlinux.yml.svg
[archlinux-web]: https://builds.sr.ht/~tk/pack/commits/archlinux.yml?
[freebsd-img]: https://builds.sr.ht/~tk/pack/commits/freebsd.yml.svg
[freebsd-web]: https://builds.sr.ht/~tk/pack/commits/freebsd.yml?
[openbsd-img]: https://builds.sr.ht/~tk/pack/commits/openbsd.yml.svg
[openbsd-web]: https://builds.sr.ht/~tk/pack/commits/openbsd.yml?

Dependencies
------------

Pack has no runtime dependencies. The following is a list of build dependencies:

-   An implementation of redo
    -   [Avery Pennarun's do][minimal-do] - Works for one-shot builds. Copy it
        to the source directory, make it executable and run it. For development,
        one of the other implementations is recommended.
    -   [Nils Dagsson Moskopp's redo][redo-sh] - Tested building and
        development. Slightly overzealous rebuilds. Performance issues with
        jobserver.
    -   [Jonathan de Boyne Pollard's redo][jdebp-redo] - Tested building and
        development. Bugs with jobserver. Uncommon definition of `$2`.
    -   [Avery Pennarun's redo][apenwarr-redo] - Tested for building. May have
        some bugs when used for development.
    -   [Leah Neukirchen's redo][leah-redo] - Tested for building.  Overzealous
        rebuilds but generally very fast.
-   A C11 compiler with GCC style parameters (clang works)
-   POSIX cat, find, rm, sed, sh and tr
-   xargs with support for the `-r` gnu extension
-   bash 4.4 or newer (parameter expansion transformations)
-   (optional) jq (for generating `compile_commands.json`)

[minimal-do]: https://raw.githubusercontent.com/apenwarr/redo/redo-0.42d/minimal/do
[redo-sh]: http://news.dieweltistgarnichtso.net/bin/redo-sh.html
[jdebp-redo]: https://jdebp.uk/Softwares/redo/
[apenwarr-redo]: https://github.com/apenwarr/redo
[leah-redo]: https://github.com/leahneukirchen/redo-c/

Compilation
-----------

Optionally run `./configure` (see `./configure -h` for options).

Some build hosts require calling `./configure` with `-B-lm` to pass `-lm` to the
linker for certain math.h functions.

Run `redo all` to build the library and tests.

### Cross Compilation

To cross compile, run `./configure` as normal and edit the resulting `config.rc`
to set `TCC` to the target compiler. Additional flags can be passed via the
arrays `TCFLAGS`, `TCPPFLAGS`, `TLDFLAGS`, and `TLDLIBS`. Host specific flags
can be passed via the corresponding `H<name>` arrays.

For example, to cross compile for windows using `i686-w64-mingw32-gcc` as the
target compiler and `clang` as the host compiler:

```
$ CC=clang ./configure
$ echo TCC=i686-w64-mingw32-gcc >>config.rc
$ redo all
```

Testing
-------

Run `./test` to run all the tests.

Installation
------------

Not implemented yet.

Development
-----------

Please configure with `-w` and ensure code compiles cleanly. Be aware that
different compiler versions can enable different warnings. If in doubt, ask.

If you use a tool such as `clangd` which makes use of `compile_commands.json`
then make sure you have `jq` installed and run `./configure` with `-f`.

Contributing
------------

Please email patches to [~tk/pack-patches@lists.sr.ht][patch-ml]
([archive][patch-ml-archive]).

If you've never used a mailing list for development, please [read this][new2ml].

Please email feature requests to [~tk/pack@todo.sr.ht][todo-mail] or use the
[web interface][todo-web].

When dealing with any email based communication please follow
[email etiquette][etiquette].

In general, stay on topic and respect differences in opinion and philosophy.

[patch-ml]: mailto:~tk/pack-patches@lists.sr.ht
[patch-ml-archive]: https://lists.sr.ht/~tk/pack-patches
[new2ml]: https://man.sr.ht/lists.sr.ht/#new-to-mailing-lists
[todo-mail]: mailto:~tk/pack@todo.sr.ht
[todo-web]: https://todo.sr.ht/~tk/pack
[etiquette]: https://man.sr.ht/lists.sr.ht/etiquette.md

Bugs
----

Bugs are tracked and can be reported [here][bugs].

[bugs]: https://todo.sr.ht/~tk/pack?search=status%3Aopen%20label%3A%22bug%22