before_deploy.bash
This file
Path
ci/before_deploy.bash
179 lines · 5.6 KiB · Shell
Last changed by
Added gcc_prefix to make_deb() function.Jason Heerisbefore adoption040c57e
History of this fileTake it
The walk stopped after 200 commits: lines older than f064ee5 point at it.
Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 1–19why, one step back1#!/usr/bin/env bash2# Building and packaging for release34set -ex56build() {7 cargo build --target "$TARGET" --release --verbose8}910pack() {11 local tempdir12 local out_dir13 local package_name14 local gcc_prefix1516 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)17 out_dir=$(pwd)18 package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"19Add ARM static binary #320 (arm-unknown-linux-musleabihf)Duncan Finneybefore adoption831f517
line 20why, one step back20 if [[ $TARGET == arm-unknown-linux-* ]]; thenProperly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 21–57why, one step back21 gcc_prefix="arm-linux-gnueabihf-"22 else23 gcc_prefix=""24 fi2526 # create a "staging" directory27 mkdir "$tempdir/$package_name"28 mkdir "$tempdir/$package_name/autocomplete"2930 # copying the main binary31 cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"32 "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"3334 # manpage, readme and license35 cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name"36 cp README.md "$tempdir/$package_name"37 cp LICENSE-MIT "$tempdir/$package_name"38 cp LICENSE-APACHE "$tempdir/$package_name"3940 # various autocomplete41 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"42 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"43 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"4445 # archiving46 pushd "$tempdir"47 tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*48 popd49 rm -r "$tempdir"50}5152make_deb() {53 local tempdir54 local architecture55 local version56 local dpkgname57 local conflictnameAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 58–59why, one step back58 local homepage59 local maintainerAdded gcc_prefix to make_deb() function.Jason Heerisbefore adoption040c57e
line 60why, one step back60 local gcc_prefixProperly use .ignore files, see #156sharkdpbefore adoptionf064ee5
line 61why, one step back61Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 62–64why, one step back62 homepage="https://github.com/sharkdp/fd"63 maintainer="David Peter <mail@david-peter.de>"64Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 65–67why, one step back65 case $TARGET in66 x86_64*)67 architecture=amd64Added gcc_prefix to make_deb() function.Jason Heerisbefore adoption040c57e
line 68why, one step back68 gcc_prefix=""Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 69–71why, one step back69 ;;70 i686*)71 architecture=i386Added gcc_prefix to make_deb() function.Jason Heerisbefore adoption040c57e
line 72why, one step back72 gcc_prefix=""Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
line 73why, one step back73 ;;Added armhf build to CI.Jason Heerisbefore adoption4182331
lines 74–77why, one step back74 arm*hf)75 architecture=armhf76 gcc_prefix="arm-linux-gnueabihf-"77 ;;Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 78–95why, one step back78 *)79 echo "make_deb: skipping target '${TARGET}'" >&280 return 081 ;;82 esac83 version=${TRAVIS_TAG#v}84 if [[ $TARGET = *musl* ]]; then85 dpkgname=$PROJECT_NAME-musl86 conflictname=$PROJECT_NAME87 else88 dpkgname=$PROJECT_NAME89 conflictname=$PROJECT_NAME-musl90 fi9192 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)9394 # copy the main binary95 install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"Added gcc_prefix to make_deb() function.Jason Heerisbefore adoption040c57e
line 96why, one step back96 "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 97–105why, one step back9798 # manpage99 install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"100 gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"101102 # readme and license103 install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"104 install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"105 install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 106–109why, one step back106 cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF107Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/108Upstream-Name: $PROJECT_NAME109Source: $homepageProperly use .ignore files, see #156sharkdpbefore adoptionf064ee5
line 110why, one step back110Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 111–112why, one step back111Files: *112Copyright: $maintainerUse dual license on DebianLaurent Arnoudbefore adoption35945c4
lines 113–114why, one step back113License: Apache-2.0 or MIT114Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 115why, one step back115License: Apache-2.0Use dual license on DebianLaurent Arnoudbefore adoption35945c4
lines 116–142why, one step back116 On Debian systems, the complete text of the Apache-2.0 can be found in the117 file /usr/share/common-licenses/Apache-2.0.118119License: MIT120 Permission is hereby granted, free of charge, to any121 person obtaining a copy of this software and associated122 documentation files (the "Software"), to deal in the123 Software without restriction, including without124 limitation the rights to use, copy, modify, merge,125 publish, distribute, sublicense, and/or sell copies of126 the Software, and to permit persons to whom the Software127 is furnished to do so, subject to the following128 conditions:129 .130 The above copyright notice and this permission notice131 shall be included in all copies or substantial portions132 of the Software.133 .134 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF135 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED136 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A137 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT138 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY139 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION140 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR141 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER142 DEALINGS IN THE SOFTWARE.Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 143–144why, one step back143EOF144Properly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 145–156why, one step back145 # completions146 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash "$tempdir/usr/share/bash-completion/completions/${PROJECT_NAME}"147 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.fish "$tempdir/usr/share/fish/completions/$PROJECT_NAME.fish"148 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/_$PROJECT_NAME "$tempdir/usr/share/zsh/vendor-completions/_$PROJECT_NAME"149150 # Control file151 mkdir "$tempdir/DEBIAN"152 cat > "$tempdir/DEBIAN/control" <<EOF153Package: $dpkgname154Version: $version155Section: utils156Priority: optionalAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 157why, one step back157Maintainer: $maintainerProperly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 158–160why, one step back158Architecture: $architecture159Provides: $PROJECT_NAME160Conflicts: $conflictnameAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 161why, one step back161Homepage: $homepageProperly use .ignore files, see #156sharkdpbefore adoptionf064ee5
lines 162–179why, one step back162Description: Simple, fast and user-friendly alternative to find163 While fd does not seek to mirror all of find's powerful functionality, it164 provides sensible (opinionated) defaults for 80% of the use cases.165EOF166167 fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"168}169170171main() {172 build173 pack174 if [[ $TARGET = *linux* ]]; then175 make_deb176 fi177}178179main