librsync
2.3.4
|
Instructions and conventions for people wanting to work on librsync. Please consider these guidelines even if you're doing your own fork.
There are a bunch of tools and libraries that are useful for development or that librsync depends on. In addition to the standard cmake/gcc/make/etc C development tools, the following packages are recommended;
USE_LIBB2
is set to ON
in cmake. If this is not avalable librsync will use its included copy of blake2 (which may be older... or newer).make doc
can be run to generate all the docs.make tidy
.make tidyc
.make clang-tidy
.#include
checker and fixer. If installed includes can be checked with make iwyu
, and automatically fixed with make iwyu-fix
. Note on some platforms this package is missing a dependency and also needs libclang-common-9-dev
to be installed.These can all be installed on Debian/Ubuntu systems by running;
Not all the recommended packages are easily available on windows. Cygwin and MSYS2 provide a development environment similar to Linux. Some packages can also be found on Chocolatey. For native development using standard MSVC tools, libpopt can be found on vcpkg and installed by running;
For cmake to find the installed libpopt you need to add -D CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
to the cmake cmdline. This configures cmake to correctly search the vcpkg install locations to find libraries.
MacOS is generally more similar to Linux than Windows, and several packages are available on homebrew. The libpopt library can be installed by running;
The minimal instructions to fetch, configure, compile, and test everything using a in-place default Debug build with trace enabled using the internal blake2 implementation is;
For cmake, -B
can be used to select a separate build directory, and -G
can select a different make system. Also the following settings can be changed with -D <setting>=<value>
arguments when generating the project with cmake;
Debug
.-v
. Trace output can help with debugging but its a little faster with ENABLE_TRACE=OFF. Defaults to ON for Debug builds, and OFF for others.So for a Release build in a separate directory using Ninja, clang, static linking, and libb2 with trace enabled, do this instead;
You can also use ccmake or cmake-gui to interactively configure and generate into a separate build directory with;
The prefered style for code is equivalent to using GNU indent with the following arguments;
The preferred style for non-docbook comments are as follows;
The preferred style for docbook comments is javadoc with autobrief as follows;
There is a make tidy
target that will use GNU indent to reformat all code and non-docbook comments, doing some pre/post processing with sed to handle some corner cases indent doesn't handle well.
There is a make tidyc
target that will reformat all code and comments with tidyc. This will also correctly reformat all docbook comments, equivalent to running tidyc with the following arguments;
There is make clang-tidy
and make iwyu
targets for checking for coding errors and incorrect #include
statements. Note that the iwyu check gets confused by and will emit warnings about fileutil.c
which has extra conditional includes necessary to find working functions on various platforms. Other than fileutil.c
both checks should be clean.
If iwyu finds problems, make ifwu-fix
can be run to automatically fix them, followed by make tidyc
to reformat the result to our preferred style. Note that this doesn't always produce an ideal result and may require manual intervention.
Please try to update docs and tests in parallel with code changes.
Using make check
will compile and run all tests. Additional code correctness checks can be run with make clang-tidy
and make iwyu
.
Note that assert()
is used extensively within the code for verifying the correctness of internal operations using a roughly design-by-contract approach. These are only enabled for Debug builds, so testing with a Debug build will give a better chance of identifying problems during development. Once you are confident the code is correct, a Release build will turn these off giving faster execution.
There are also GitHub Actions configured for the librsync project to configure, build, test, and lint everything on a variety of different platforms with a variety of different settings. These are run against any pull request or commit, and are a good way to check things are not broken for other platforms.
Test results for builds of public github branches are at https://github.com/librsync/librsync/actions.
NEWS.md contains a list of user-visible changes in the library between release versions. This includes changes to the way it's packaged, bug fixes, portability notes, changes to the API, and so on. Add and update items under a "Changes in X.Y.Z" heading at the top of the file. Do this as you go along, so that we don't need to work out what happened when it's time for a release.
TODO.md contains a list of ideas and proposals for the future. Ideally entries should be formated in a way that can be just moved into NEWS.md when they are done. Regularly check to see if there is anything that needs removing or updating.
Fixes or improvements in pull requests are welcome. Please:
NEWS.md
to say what you changed.tests/
that passes or fails, and is hooked into CMakeLists.txt
.rs_
prefix.If you are making a new tarball release of librsync, follow this checklist:
CMakeLists.txt
- version is correct.librsync.spec
- make sure version and URL are right.make all doc check
in a clean checkout of the release pull request branch. Also check the GitHub Actions check and lint status of the last commit on github. If it all looks good merge the release pull request on github.Source code (tar.gz)
release asset. Go to "Actions", find the workflow run for the "Check" corresponding to the merge of the release pull request, and download the install results windows-latest Release
artifact renamed to librsync-win64-X.Y.Z.zip
. Edit the release, and upload the source code and windows artifacts. This ensures that the release includes a stable tarball (See https://github.com/librsync/librsync/issues/146 for details) and win64 install.make doc
on a clean checkout of the new release tag and cp -av html/*
into a rm -Rf *
emptied checkout of librsync.github.io and check it in. This ensures it includes deletes of obsolete files as well as new and updated files. Push this to update the online docs.CMakeLists.txt
.NOT RELEASED YET
version entry in NEWS.md
changelog
entry in librsync.spec
.