3 # SPDX-License-Identifier: BSD-2-Clause
5 # Copyright (c) 2018-2021 Gavin D. Howard and contributors.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are met:
10 # * Redistributions of source code must retain the above copyright notice, this
11 # list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
30 # This script requires some non-POSIX utilities, but that's okay because it's
31 # really for maintainer use only.
33 # The non-POSIX utilities include:
51 # All this fancy stuff takes the sha512 and sha256 sums and signs it. The
52 # output after this point is what I usually copy into the release notes.
53 # (See manuals/release.md for more information.)
54 printf '$ sha512sum %s\n' "$f"
57 printf '$ sha256sum %s\n' "$f"
60 printf "$ stat -c '%%s %%n'\n" "$f"
63 if [ -f "$f.sig" ]; then
67 gpg --detach-sig -o "$f.sig" "$f" 2> /dev/null
70 printf '$ sha512sum %s.sig\n' "$f"
73 printf '$ sha256sum %s.sig\n' "$f"
76 printf "$ stat -c '%%s %%n'\n" "$f.sig"
77 stat -c '%s %n' "$f.sig"
81 scriptdir=$(dirname "$script")
88 if [ ! -f "../vs.zip" ]; then
89 printf 'Must have Windows builds!\n'
93 # We want the absolute path for later.
96 # This convoluted mess does pull the version out. If you change the format of
97 # include/version.h, you may have to change this line.
98 version=$(cat include/version.h | grep "VERSION " - | awk '{ print $3 }' -)
100 tag_msg="Version $version"
101 projver="${proj}-${version}"
103 tempdir="/tmp/${projver}"
107 make clean_tests > /dev/null 2> /dev/null
109 # Delete the tag and recreate it. This is the part of the script that makes it
110 # so you cannot run it twice on the same version, unless you know what you are
111 # doing. In fact, you cannot run it again if users have already started to use
112 # the old version of the tag.
113 if git rev-parse "$version" > /dev/null 2>&1; then
114 git push --delete origin "$version" > /dev/null 2> /dev/null
115 git tag --delete "$version" > /dev/null 2> /dev/null
118 git push > /dev/null 2> /dev/null
119 git tg "$version" -m "$tag_msg" > /dev/null 2> /dev/null
120 git push --tags > /dev/null 2> /dev/null
122 # This line grabs the names of all of the files in .gitignore that still exist.
123 ignores=$(git check-ignore * **/*)
129 # Delete all the ignored files.
130 for i in $ignores; do
134 # This is a list of files that end users (including *software packagers* and
135 # *distro maintainers*!) do not care about. In particular, they *do* care about
136 # the testing infrastructure for the regular test suite because distro
137 # maintainers probably want to ensure the test suite runs. However, they
138 # probably don't care about fuzzing or other randomized testing. Also, I
139 # technically can't distribute tests/bc/scripts/timeconst.bc because it's from
140 # the Linux kernel, which is GPL.
148 manuals/benchmarks.md
149 manuals/development.md
150 manuals/header_bcl.txt
151 manuals/header_bc.txt
152 manuals/header_dc.txt
166 scripts/release_settings.txt
168 scripts/test_settings.sh
169 scripts/test_settings.txt
173 tests/bc/scripts/timeconst.bc
186 if [ -f "$projver.tar.gz" ]; then
187 rm -rf "$projver.tar.gz"
190 if [ -f "$projver.tar.gz.sig" ]; then
191 rm -rf "$projver.tar.gz.sig"
194 if [ -f "$projver.tar.xz" ]; then
195 rm -rf "$projver.tar.xz"
198 if [ -f "$projver.tar.xz.sig" ]; then
199 rm -rf "$projver.tar.xz.sig"
202 # Tar and compress and move into the parent directory of the repo.
203 tar cf "$projver.tar" "$projver/"
204 gzip -k "$projver.tar"
205 mv "$projver.tar.gz" "$parent"
206 xz -z -v -9 -e "$projver.tar" > /dev/null 2> /dev/null
207 mv "$projver.tar.xz" "$parent"
211 # Clean up old Windows stuff.
212 if [ -d windows ]; then
216 if [ -f windows.zip ]; then
217 rm -rf $projver-windows.zip
220 # Prepare Windows stuff.
221 unzip vs.zip > /dev/null
224 # Remove unneeded Windows stuff.
225 rm -rf windows/*.vcxproj.user
229 rm -rf windows/*.vcxproj
230 rm -rf windows/*.vcxproj.filters
232 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/*.obj
233 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/*.iobj
234 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.exe.recipe
235 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.ilk
236 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.log
237 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.tlog
238 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.pdb
239 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.ipdb
240 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/bc.vcxproj.FileListAbsolute.txt
241 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/strgen.exe
242 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/vc142.idb
243 rm -rf windows/bin/{Win32,x64}/{Debug,Release}/vc142.pdb
245 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/*.obj
246 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.lib.recipe
247 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.log
248 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.tlog
249 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.idb
250 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.pdb
251 rm -rf windows/lib/{Win32,x64}/{Debug,ReleaseMD,ReleaseMT}/bcl.vcxproj.FileListAbsolute.txt
253 # Zip the Windows stuff.
254 zip -r $projver-windows.zip windows > /dev/null
257 shasum "$projver.tar.gz"
259 shasum "$projver.tar.xz"
261 shasum "$projver-windows.zip"