1
0
Fork 0
dosbox-staging/.github/scripts/shrink-msys2.sh
krcroft 30b5246f9f Refactor and expand the CI workflows
- For each OS, builds of the default compiler plus the
  latest-supported compilers are run. When multiple operating systems
  are supported (such as Ubuntu 16.04 and latest), a build on
  the oldest OS using its default compiler is also performed.

- Debug builds are used because they often are more thorough at
  detecting coding issues (debug warning counts are higher).

- Runtime dynamic sanitizers are added and serialized per-compiler.
  Their build and runtime log-files are xz-compressed, and then
  GitHub's asset upload Zips the log directory.

- Each workflow now holds the maximum allowed compiler warnings
  per-build, so we can have tighter control of when new warnings
  are introduced (that would otherwise pass if still below the
  maximum)

- Use of github's new 'cache' feature has been leveraged to restore
  the brew, macports, and msys2 environments to eliminate the
  lenghthy setup times for those environments.  If a new cache
  is needed, then we simply increment the cache `key:` value and
  the next CI run will archive new caches. (Note that GitHub has a
  400MB limit on cache size however they have already said they
  are raising it - so we might be able to cache out longest running
  job which is MSYS+Clang)

- Where it makes sense, multi-line workflow statements have been
  broken out into .github/scripts as files to make the workflow YAML
  leaner and more readable, while giving us a richer environment in
  the scripts.
2019-11-24 15:16:44 +01:00

44 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# Copyright (c) 2019 Kevin R Croft <krcroft@gmail.com>
# SPDX-License-Identifier: GPL-2.0-or-later
# This script reduces the size of an MSYS2 and MingGW installation
# under Windows. Its main use is to shrink these areas to fit within
# GitHub's cache limits; however it can also be used by end-users wanting
# to save space.
#
# Usage: ./shrink-msys2.sh
#
set -xuo pipefail
set +e
# Clean all the package archives from pacman
pacman -Scc --noconfirm
# Strip binaries using their associated striping tool
for dir in /usr /mingw32 /mingw64; do
# Enter our directory if we have it
cd "${dir}" || continue
# Check if we have an associated stripping tool
if [[ ! -f "bin/strip.exe" ]]; then continue; fi
# Start stripping
find . -type f \
\( -iname '*.exe' \
-or -iname '*.a' \
-or -iname '*.dll' \
-or -iname '*.so' \
\) \
-a ! -iname 'strip.exe' \
-print0 \
| xargs -0 ./bin/strip.exe --strip-unneeded
done
# Delete MinGW's share directories
rm -rf /mingw*/share
# This entire script is best-effort, so always return success
exit 0