Debian Codegraph @

etc/ci/before_deploy.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Building and packaging for release
3
4 set -ex
5
6 packscip-shell shell shell-project 0.0.0 pack().() {
7 local tempdir
8 local out_dir
9 local package_name
10 local gcc_prefix
11
12 tempdir=$(mktempscip-shell system . . mktemp. -d 2>/dev/nullscip-shell filesystem . . `/dev/null`. || mktempscip-shell system . . mktemp. -d -t tmp)
13 out_dir=$(pwdscip-shell system . . pwd.)
14 package_name="$PROJECT_NAME-${GITHUB_REF/refs\/tags\//}-$TARGET"
15
16 if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
17 gcc_prefix="arm-linux-gnueabihf-"
18 elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
19 gcc_prefix="aarch64-linux-gnu-"
20 else
21 gcc_prefix=""
22 fi
23
24 # create a "staging" directory
25 mkdirscip-shell system . . mkdir. "$tempdir/$package_name"
26
27 # copying the main binary
28 cpscip-shell system . . cp. "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
29 if [scip-shell system . . `[`. "$OS_NAME" != windows-latest ]; then
30 "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
31 fi
32
33 # manpage, readme and license
34 cpscip-shell system . . cp. README.md "$tempdir/$package_name"
35 cpscip-shell system . . cp. LICENSE "$tempdir/$package_name"
36
37 # archiving
38 pushd "$tempdir"
39 if [scip-shell system . . `[`. "$OS_NAME" = windows-latest ]; then
40 7z a "$out_dir/$package_name.zip" "$package_name"/*
41 else
42 tarscip-shell system . . tar. czf "$out_dir/$package_name.tar.gz" "$package_name"/*
43 fi
44 popd
45 rmscip-shell system . . rm. -r "$tempdir"
46 }
47
48 make_debscip-shell shell shell-project 0.0.0 make_deb().() {
49 local tempdir
50 local architecture
51 local version
52 local dpkgname
53 local conflictname
54 local gcc_prefix
55 local homepage
56 local maintainer
57
58 homepage="https://github.com/dandavison/delta"
59 maintainer="Dan Davison <[email protected]>"
60 copyright_years="2019 - "$(datescip-shell system . . date. "+%Y")
61
62 case $TARGET in
63 x86_64*)
64 architecture=amd64
65 gcc_prefix=""
66 library_dir=""
67 ;;
68 i686*)
69 architecture=i386
70 gcc_prefix=""
71 library_dir=""
72 ;;
73 aarch64*)
74 architecture=arm64
75 gcc_prefix="aarch64-linux-gnu-"
76 library_dir="-l/usr/aarch64-linux-gnu/lib"
77 ;;
78 arm*hf)
79 architecture=armhf
80 gcc_prefix="arm-linux-gnueabihf-"
81 library_dir="-l/usr/arm-linux-gnueabihf/lib"
82 ;;
83 *)
84 echoscip-shell system . . echo. "make_deb: skipping target '${TARGET}'" >&2
85 return 0
86 ;;
87 esac
88 version=${GITHUB_REF/refs\/tags\//}
89
90 if [[ $TARGET = *musl* ]]; then
91 dpkgname=$PACKAGE_NAME-musl
92 conflictname=$PROJECT_NAME
93 else
94 dpkgname=$PACKAGE_NAME
95 conflictname=$PROJECT_NAME-musl
96 fi
97
98 tempdir=$(mktempscip-shell system . . mktemp. -d 2>/dev/nullscip-shell filesystem . . `/dev/null`. || mktempscip-shell system . . mktemp. -d -t tmp)
99
100 # copy the main binary
101 installscip-shell system . . install. -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
102 "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
103
104 # Work out shared library dependencies
105 # dpkg-shlibdeps requires debian/control file. Dummy it and clean up
106 mkdirscip-shell system . . mkdir. "./debian"
107 touchscip-shell system . . touch. "./debian/control"
108 depends="$(dpkg-shlibdepsscip-shell system . . dpkg-shlibdeps. $library_dir -O "$tempdir/usr/bin/$PROJECT_NAME" 2> /dev/nullscip-shell filesystem . . `/dev/null`. | sedscip-shell system . . sed. 's/^shlibs:Depends=//')"
109 rmscip-shell system . . rm. -rf "./debian"
110
111 # readme and license
112 installscip-shell system . . install. -Dm644 README.md "$tempdir/usr/share/doc/$dpkgname/README.md"
113 catscip-shell system . . cat. > "$tempdir/usr/share/doc/$dpkgname/copyright" <<EOF
114 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
115 Upstream-Name: $PROJECT_NAME
116 Source: $homepage
117
118 Files: *
119 Copyright: $copyright_years $maintainer
120 License: MIT
121
122 License: MIT
123 Permission is hereby granted, free of charge, to any
124 person obtaining a copy of this software and associated
125 documentation files (the "Software"), to deal in the
126 Software without restriction, including without
127 limitation the rights to use, copy, modify, merge,
128 publish, distribute, sublicense, and/or sell copies of
129 the Software, and to permit persons to whom the Software
130 is furnished to do so, subject to the following
131 conditions:
132 .
133 The above copyright notice and this permission notice
134 shall be included in all copies or substantial portions
135 of the Software.
136 .
137 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
138 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
139 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
140 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
141 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
142 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
143 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
144 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
145 DEALINGS IN THE SOFTWARE.
146 EOF
147 chmodscip-shell system . . chmod. 644 "$tempdir/usr/share/doc/$dpkgname/copyright"
148
149 # Control file
150 mkdirscip-shell system . . mkdir. "$tempdir/DEBIAN"
151 catscip-shell system . . cat. > "$tempdir/DEBIAN/control" <<EOF
152 Package: $dpkgname
153 Version: $version
154 Section: utils
155 Priority: optional
156 Maintainer: Dan Davison <[email protected]>
157 Architecture: $architecture
158 Depends: $depends
159 Conflicts: $conflictname
160 Description: Syntax highlighter for git
161 Delta provides language syntax-highlighting, within-line insertion/deletion
162 detection, and restructured diff output for git on the command line.
163 EOF
164
165 fakerootscip-shell system . . fakeroot. dpkg-deb -Zxz --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
166 }
167
168
169 mainscip-shell shell shell-project 0.0.0 main().() {
170 packscip-shell shell shell-project 0.0.0 pack().
171 if [[ $TARGET = *linux* ]]; then
172 make_debscip-shell shell shell-project 0.0.0 make_deb().
173 fi
174 }
175
176 mainscip-shell shell shell-project 0.0.0 main().