1#!/bin/bash 2# 3# Copyright 2022 The Fuchsia Authors 4# 5# Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 6# <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT 7# license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. 8# This file may not be copied, modified, or distributed except according to 9# those terms. 10 11set -eo pipefail 12 13COPYRIGHT_HEADER=$(mktemp) 14BODY=$(mktemp) 15DISCLAIMER_FOOTER=$(mktemp) 16 17cat > $COPYRIGHT_HEADER <<'EOF' 18<!-- Copyright 2022 The Fuchsia Authors 19 20Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 21<LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT 22license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. 23This file may not be copied, modified, or distributed except according to 24those terms. 25 26WARNING: DO NOT EDIT THIS FILE. It is generated automatically. Edits should be 27made in the doc comment on `src/lib.rs` or in `generate-readme.sh`. 28--> 29 30EOF 31 32# This uses the `cargo readme` tool, which you can install via `cargo install 33# cargo-readme --version 3.2.0`. 34# 35# The `sed` command is used to strip code links like: 36# 37# /// Here is a link to [`Vec`]. 38# 39# These links don't work in a Markdown file, and so we remove the `[` and `]` 40# characters to convert them to non-link code snippets. 41cargo readme --no-license | sed 's/\[\(`[^`]*`\)]/\1/g' > $BODY 42 43cat > $DISCLAIMER_FOOTER <<'EOF' 44 45## Disclaimer 46 47Disclaimer: Zerocopy is not an officially supported Google product. 48EOF 49 50cat $COPYRIGHT_HEADER $BODY $DISCLAIMER_FOOTER 51