blob: 011a99bddcf055b11324e0566a1a60eacbe51ed3 (
plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# Maintainer: Super Bo <supernbo at gmail dot com>
# Maintainer: glider <samtron1412 {at} gmail {dot} com>
pkgname=nerd-fonts-complete
pkgver=1.1.0
pkgrel=1
pkgdesc="collection of over 20 patched fonts (complete variant) for \
powerline, devicons, and vim-devicons: includes Droid Sans, \
Meslo, AnonymousPro, ProFont, Inconsolta, and many more"
arch=('any')
url="https://github.com/ryanoasis/nerd-fonts"
license=('MIT')
depends=('fontconfig' 'xorg-font-utils')
makedepends=('wget')
conflicts=('nerd-fonts-git' 'nerd-fonts-complete-mono-glyphs')
install=$pkgname.install
source=("$pkgname-$pkgver.tar.gz::https://github.com/ryanoasis/nerd-fonts/archive/v$pkgver.tar.gz")
sha256sums=('ee7ae13f09ec576e2fb3da71b8aa217eae152a64e375697f16529b7182cedb27')
prepare() {
extension="otf"
nerdfonts_dir="$srcdir/nerd-fonts-$pkgver/patched-fonts"
fonts_dir="\"$nerdfonts_dir\""
#
# Start constructing `find` expression
#
implode() {
# $1 is return variable name
# $2 is sep
# $3... are the elements to join
local retname=$1 sep=$2 ret=$3
shift 3 || shift $(($#))
printf -v "$retname" "%s" "$ret${@/#/$sep}"
}
find_include="-and -name '*Complete*'"
find_exclude=
# Exclude everything we didn’t include
exclude=("Font Awesome" "Font Linux" "Octicons" "Pomicons" "Nerd Font*Mono" "Windows Compatible")
for delete in "${include[@]}"; do
exclude=( "${exclude[@]/$delete}" )
done
# Delete empty elements
for i in "${!exclude[@]}"; do
[ "${exclude[$i]}" = '' ] && unset exclude[$i]
done
if [ ! -z "${exclude[*]}" ]; then
implode find_exclude "*' -and \! -name '*" "${exclude[@]}"
find_exclude="-and \! -name '*${find_exclude}*'"
fi
# Put it all together into the find command we want
find_command="find $fonts_dir \( \( -name '*.[o,t]tf' -or -name '*.pcf.gz' \) $find_include $find_exclude \) -type f -print0"
# Find all the font files and store in array
files=()
while IFS= read -r -d $'\0'; do
files+=("$REPLY")
done < <(eval "$find_command")
#
# Remove duplicates (i.e. when both otf and ttf version present)
#
# Get list of file names without extensions
files_dedup=( "${files[@]}" )
for i in "${!files_dedup[@]}"; do
files_dedup[$i]="${files_dedup[$i]%.*}"
done
# Remove duplicates
for i in "${!files_dedup[@]}"; do
for j in "${!files_dedup[@]}"; do
[ $i = $j ] && continue
if [ "${files_dedup[$i]}" = "${files_dedup[$j]}" ]; then
ext="${files[$i]##*.}"
# Only remove if the extension is the one we don’t want
if [ "$ext" != "$extension" ]; then
unset files[$i]
fi
fi
done
done
# Copy fonts to the NerdFonts directory
mkdir -p "$srcdir/NerdFonts"
cp -f "${files[@]}" "$srcdir/NerdFonts"
}
package() {
install -Dm644 -t $pkgdir/usr/share/fonts/OTF $srcdir/NerdFonts/*.otf
install -Dm644 -t $pkgdir/usr/share/fonts/TTF $srcdir/NerdFonts/*.ttf
install -Dm644 -t $pkgdir/usr/share/licenses/$pkgname $srcdir/nerd-fonts-$pkgver/LICENSE
}
|