#!/bin/sh #################################################################################################################################### # Prepare the distribution so the tarball can be built and installed without the code generation or documentation tooling: remove # everything that is not needed to build, generate the code files, copy the man pages and HTML documentation into doc, copy the # distribution README, and write the dist marker that tells the build to use the shipped generated files. # # The generator reads its inputs from the source tree and writes the generated files into the distribution, since the declarations # it reads are not shipped in the tarball. #################################################################################################################################### set -eu # Remove everything that is not needed to build pgbackrest. The trimming is done here rather than with export-ignore in # .gitattributes so the source archives that GitHub generates for a tag remain complete and can be built by anyone willing to run # the code generation tooling. Keep src, the root meson files, and LICENSE. The code generation tooling in build and the # documentation source in doc are removed because the generated files are added below instead. The smoke test (test/smoke.py) and # the meson.build that runs it are kept so packagers can verify a build; the rest of test is removed. find "$MESON_DIST_ROOT" -mindepth 1 -maxdepth 1 \ ! -name LICENSE ! -name meson.build ! -name meson_options.txt ! -name src ! -name test -exec rm -rf {} + find "$MESON_DIST_ROOT/test" -mindepth 1 -maxdepth 1 ! -name meson.build ! -name smoke.py -exec rm -rf {} + build_code="$MESON_SOURCE_ROOT/build/build.py" "$build_code" help --repo-path="$MESON_SOURCE_ROOT" --build-path="$MESON_DIST_ROOT" "$build_code" postgres --repo-path="$MESON_SOURCE_ROOT" --build-path="$MESON_DIST_ROOT" # Copy the man pages and HTML documentation generated by doc/release.py --dist into doc/man and doc/html mkdir -p "$MESON_DIST_ROOT/doc" for doc in man html; do doc_src="$MESON_SOURCE_ROOT/doc/output/$doc" if [ ! -d "$doc_src" ]; then echo "dist: $doc_src not found; run 'doc/release.py --dist' before meson dist" >&2 exit 1 fi cp -R "$doc_src" "$MESON_DIST_ROOT/doc/" done # Copy the distribution README into the tarball root cp "$MESON_SOURCE_ROOT/doc/DIST.md" "$MESON_DIST_ROOT/README.md" # Write the dist marker to the root. Its presence is what switches the build to the shipped generated files; it records the version # for traceability. version=$(basename "$MESON_DIST_ROOT") echo "${version#pgbackrest-}" > "$MESON_DIST_ROOT/dist"