File: mkdatabase.sh

package info (click to toggle)
golang-github-zyedidia-tcell 0.0~git20190212.5c58b4e-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,828 kB
  • sloc: sh: 16; makefile: 2
file content (50 lines) | stat: -rwxr-xr-x 1,526 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
40
41
42
43
44
45
46
47
48
49
50
#!/bin/ksh

# Copyright 2015 The TCell Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use file except in compliance with the License.
# You may obtain a copy of the license at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# This shell script builds the Go database, which is somewhat minimal for
# size reasons (it only contains the most commonly used entries), and
# then builds the complete JSON database.
#

terms=/tmp/terms.$$

# This script is not very efficient, but there isn't really a better way without
# writing code to decode the terminfo binary format directly.  Its not worth
# worrying about.

# now get the rest
all=`toe -a | cut -f1`
echo Scanning terminal definitions
echo > $terms
for f in $all; do
	infocmp $f | awk -v FS="|" -v OFS=" " '/^[^#	]/ { print $1; for (i = 2; i < NF; i++) print $i "=" $1; }' |sort >> $terms
	printf "."
done
echo

# make sure we have mkinfo
echo "Building mkinfo"
go build mkinfo.go

# first make the database.go file
echo "Building Go database"
./mkinfo -go database.go `cat models.txt aliases.txt`
go fmt database.go

echo "Building JSON database"

./mkinfo -nofatal -quiet -json database.json `cat $terms`