bat/ci/before_deploy.bash
2# Building and packaging for release
5# Ensure environment variables exist.
6if [[ -z "$PROJECT_NAME" ]]; then
7 export PROJECT_NAME="bat"
11 cargo build --bins --target "$TARGET" --release --verbose
20 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
22 package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
24 if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
25 gcc_prefix="arm-linux-gnueabihf-"
26 elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
27 gcc_prefix="aarch64-linux-gnu-"
32 # create a "staging" directory
33 mkdir "$tempdir/$package_name"
34 mkdir "$tempdir/$package_name/autocomplete"
36 # copying the main binary
37 cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
38 "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
40 # manpage, readme and license
41 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/$package_name/$PROJECT_NAME.1"
42 cp README.md "$tempdir/$package_name"
43 cp LICENSE-MIT "$tempdir/$package_name"
44 cp LICENSE-APACHE "$tempdir/$package_name"
46 # various autocomplete
47 # TODO: disabled for now, see issue #372
48 # cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
49 # cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
50 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/$package_name/autocomplete/$PROJECT_NAME.fish"
51 # cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
55 tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
70 homepage="https://github.com/sharkdp/bat"
71 maintainer="David Peter <mail@david-peter.de>"
84 gcc_prefix="aarch64-linux-gnu-"
88 gcc_prefix="arm-linux-gnueabihf-"
91 echo "make_deb: skipping target '${TARGET}'" >&2
95 version=${TRAVIS_TAG#v}
96 if [[ $TARGET = *musl* ]]; then
97 dpkgname=$PROJECT_NAME-musl
98 conflictname=$PROJECT_NAME
100 dpkgname=$PROJECT_NAME
101 conflictname=$PROJECT_NAME-musl
104 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
106 # copy the main binary
107 install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
108 "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
111 install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
112 gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
115 install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/usr/share/fish/vendor_completions.d/$PROJECT_NAME.fish"
118 install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
119 install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
120 install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
121 cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
122Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
123Upstream-Name: $PROJECT_NAME
127Copyright: $maintainer
128License: Apache-2.0 or MIT
131 On Debian systems, the complete text of the Apache-2.0 can be found in the
132 file /usr/share/common-licenses/Apache-2.0.
135 Permission is hereby granted, free of charge, to any
136 person obtaining a copy of this software and associated
137 documentation files (the "Software"), to deal in the
138 Software without restriction, including without
139 limitation the rights to use, copy, modify, merge,
140 publish, distribute, sublicense, and/or sell copies of
141 the Software, and to permit persons to whom the Software
142 is furnished to do so, subject to the following
145 The above copyright notice and this permission notice
146 shall be included in all copies or substantial portions
149 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
150 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
151 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
152 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
153 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
154 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
155 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
156 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
157 DEALINGS IN THE SOFTWARE.
161 mkdir "$tempdir/DEBIAN"
162 cat > "$tempdir/DEBIAN/control" <<EOF
167Maintainer: $maintainer
169Architecture: $architecture
170Provides: $PROJECT_NAME
171Conflicts: $conflictname
172Description: A cat(1) clone with wings.
173 A cat(1) clone with syntax highlighting and Git integration.
176 fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
183 if [[ $TARGET = *linux* ]]; then
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list