File indexing completed on 2024-09-01 04:30:01

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
0004 # SPDX-License-Identifier: BSD-2-Clause OR MIT
0005 
0006 
0007 
0008 
0009 
0010 ################# Screenshots #################
0011 # -e exits on error,
0012 # -u errors on undefined variables,
0013 # and -o (for option) pipefail exits on command pipe failures
0014 set -euo pipefail
0015 errorcount=0
0016 
0017 
0018 
0019 
0020 
0021 ################# Configure #################
0022 # The “.” command will execute the given script within the context of
0023 # the current script, which is necessary in order to preserve the
0024 # environment variables that are set by the given script.
0025 . scripts/export-environment.sh
0026 
0027 
0028 
0029 
0030 
0031 ################# Build #################
0032 echo "Build generatescreenshots."
0033 # The “.” command will execute the given script within the context of
0034 # the current script, which is necessary in order to preserve the
0035 # environment variables that are set by the given script.
0036 . scripts/export-environment.sh
0037 echo Number of available CPU threads: $PARALLEL_PROCESSES
0038 mkdir --parents build
0039 cd build
0040 cmake -DBUILD_WITH_QT6=ON ..
0041 cmake --build . --target generatescreenshots --parallel $PARALLEL_PROCESSES
0042 cd ..
0043 echo "Build generatescreenshots finished."
0044 
0045 ################# Get fonts #################
0046 # Possible fonts for screenshot generation? As long as the font isn’t in the
0047 # repository, its license doesn’t matter. Otherwise, it has to comply with
0048 # https://community.kde.org/Policies/Licensing_Policy#Policy for either
0049 # public-API sources or application sources. As today’s free software fonts
0050 # use mostly the OFL (Open Font License), this isn’t easy. Here some
0051 # candidates:
0052 # - Linux Libertine
0053 #   https://sourceforge.net/projects/linuxlibertine/
0054 #   Seems to be GPL-2 only, which is not compliant with KDE licensing.
0055 #   GPL is a bad choice for font files (risque that resulting documents
0056 #   must be GPL also.)
0057 #   Has a Sans variant, but isn’t a typical UI font.
0058 # - GNU Freefont
0059 #   https://www.gnu.org/software/freefont/license.html
0060 #   GPL-3-or-later is compliant with KDE licensing.
0061 #   GPL is a bad choice for font files (risque that resulting documents
0062 #   must be GPL also.)
0063 #   Has a Sans variant that might work for UI.
0064 #   Big coverage, but is jsut collection of various free fonts, hasn’t a
0065 #   uniform design across scripts.
0066 # - Victor Mono
0067 #   https://github.com/rubjo/victor-mono/blob/e9c0f111221b7a871b97c51907d9bcbc58b7ce0d/LICENSE
0068 #   Older versions (see link above) where licensed under MIT license.
0069 #   Is a Monospace font, not a typical UI font.
0070 # - ET Book
0071 #   https://github.com/edwardtufte/et-book
0072 #   MIT license.
0073 #   Not a typical UI font (has serifs).
0074 # - Go fonts
0075 #   https://go.dev/blog/go-fonts
0076 #   https://stackoverflow.com/a/40664202
0077 #   https://go.googlesource.com/image/+/refs/heads/master/font/gofont/ttfs/
0078 #   https://github.com/golang/image/blob/master/font/gofont/ttfs/Go-Regular.ttf
0079 #   BSD-3-Clause.
0080 #   Likely the best choice!
0081 if ! [ -f .screenshotfont.ttf ]; then
0082   wget \
0083     --no-check-certificate \
0084     --output-document .screenshotfont.ttf \
0085     https://github.com/golang/image/raw/b6ac75bc5918c3a0a2200faa20aedebc76d5b349/font/gofont/ttfs/Go-Regular.ttf
0086 fi
0087 
0088 ################# Run #################
0089 mkdir --parents docs
0090 mkdir --parents docs/pics
0091 rm --recursive --force docs/pics/*
0092 cd docs/pics
0093 echo "Run generatescreenshots."
0094 ../../build/utils/generatescreenshots ../../.screenshotfont.ttf
0095 echo "Run generatescreenshots finished."
0096 echo "Run license generator."
0097 for FILE in *; do cp ../../docs/Doxyfile.external.license "$FILE.license"; done
0098 echo "Run license generator finished."