`doc/` folder.
The `doc/man/` folder contains the man pages. You can install them in
-your system by running `make install-doc`.
-
-Unless you cloned the git repository, there is a html version in
-`doc/html/`, that you can regenerate by executing the `doc/man2html.sh`
-script. This requires mandoc.
+your system by running `make install-doc`. Official releases also have a
+`doc/html/` folder with an html version.
Installation
### Option 1: grab the sources
The easiest way to use Monocypher is to include `src/monocypher.h` and
-`src/monocypher.c` directly into your project. They compile as C99,
-C11, C++98, C++11, C++14, and C++17.
+`src/monocypher.c` directly into your project. They compile as C (since
+C99) and C++ (since C++98).
### Option 2: grab the library
-Alternatively, you can run `make`, then grab the `src/monocypher.h`
-header and the `lib/libmonocypher.a` or `lib/libmonocypher.so` library.
-The default compiler is `gcc -std=gnu99`, and the default flags are
-`-pedantic -Wall -Wextra -O3 -march=native`. If they don't work on your
-platform, you can change them like this:
+Run `make`, then grab the `src/monocypher.h` header and either the
+`lib/libmonocypher.a` or `lib/libmonocypher.so` library. The default
+compiler is `gcc -std=gnu99`, and the default flags are `-pedantic -Wall
+-Wextra -O3 -march=native`. If they don't work on your platform, you
+can change them like this:
$ make CC="clang -std=c99" CFLAGS="-O2"
*Do not* use Monocypher without running those tests at least once.
-The same test suite can be run under clang sanitisers and valgrind, and
+The same test suite can be run under Clang sanitisers and Valgrind, and
be checked for code coverage:
$ tests/test.sh
Contributor notes
-----------------
-If you just cloned the GitHub repository, you will miss a couple files
-that ship with the tarball releases:
+If you are reading this, you cloned the GitHub repository. You miss a
+couple files that ship with the tarball releases:
- The `test/vectors.h` header. Generating it requires Libsodium. Go
to `test/gen/`, then run `make`.
set -e
VERSION=`git describe --tags`
+FOLDER=monocypher-$VERSION
+TARBALL=$FOLDER.tar.gz
+# Run the tests before we do anything. It's not enough (we ought to run
+# the tests from the tarball itself, including the TIS interpreter), but
+# it should prevent the most egregious errors.
+tests/test.sh
+
+# Generate documentation for users who don't have mandoc
doc/man2html.sh
-rsync -avd --exclude-from=tarball_ignore ./ monocypher-$VERSION
+
+# Delete the destination folder just to make sure everything is clean.
+# May be needed if we unpack the tarball in place for testing purposes,
+# then run the release script again.
+rm -rf $FOLDER
+
+# copy everything except ignored files to the
+rsync -ad --exclude-from=tarball_ignore ./ $FOLDER
+
+# Replace version markers by the actual version number (from tags)
for file in `find monocypher-$VERSION -type f`
do
sed -i "s/__git__/$VERSION/g" $file
done
-tar -czf monocypher-$VERSION.tar.gz monocypher-$VERSION
-rm -rf monocypher-$VERSION
+
+# Remove the dist target from the makefile (no recursive releases!)
+sed '/dist:/,$d' makefile > $FOLDER/makefile
+
+# Remove contributor notes from the README
+sed '/Contributor notes/,$d' README.md > $FOLDER/README.md
+
+# Make the actual tarball
+tar -cvzf $TARBALL $FOLDER
+
+# Remove the temporary folder
+rm -rf $FOLDER