File: create-defs.sh

package info (click to toggle)
gle-graphics-manual 4.3.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,876 kB
  • sloc: perl: 67; sh: 24; makefile: 14
file content (39 lines) | stat: -rwxr-xr-x 1,179 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# create-defs.sh   -- creates the defs.tex file needed for the manual by running gle
#
# Extract version number
version=$(gle -info | grep "GLE version" | awk -F: '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//')
# Extract Cairo support status and convert to 1 or 0
cairo_raw=$(gle -info | grep "Cairo rendering support" | awk -F: '{print $2}' | xargs)
echo $cairo_raw
cairo=
if [[ "$cairo_raw" == "Yes" ]]; then
  cairo=#1
fi

# Detect if running on macOS
# define the APPLE command to elimnate the countour plots for macOS in utilities\countour.tex
# the coutour figures cause a seg fault in GLE and this workaround eliminates
# them so the workflow finishes on GitHub.  Need to fix.
apple=""
if [[ "$(uname)" == "Darwin" ]]; then
  apple="\\def\\APPLE{1}"
fi

# Handle command-line argument for extrafont.tex
extrafonts=
if [[ "$1" == "1" ]]; then
  extrafonts=#1
fi

# Write commands to defs.tex
{
  echo "%"
  echo "% defs.tex - automatically generated.  All changes will be lost."
  echo "%"
  echo "\\newcommand{\\gleversion}{$version}"
  echo "\\newcommand{\\hascairo}[1]{$cairo}"
  echo "\\newcommand{\\extrafonts}[1]{$extrafonts}"
  echo "$apple"
} > defs.tex