]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/bsptool-shaderfun.sh
Fix macOS SDL2 framework permissions
[xonotic/xonotic.git] / misc / tools / bsptool-shaderfun.sh
1 #!/bin/sh
2
3 # input: a .shader file
4 # parameters: in and out .bsp file
5
6 BSPTOOL="${0%/*}"/bsptool.pl
7 LF="
8 "
9
10 in=$1
11 out=$2
12
13 shaders=`"$BSPTOOL" "$in" -S`
14
15 newshaders=`cat | grep '^[^     {}]'`
16
17 set --
18
19 list=
20 for shader in $shaders; do
21         if [ -z "$list" ]; then
22                 echo >&2 "Filling list..."
23                 list=`echo "$newshaders" | sort -R`$LF
24         fi
25         case "$shader" in
26                 noshader|NULL|textures/common/*)
27                         ;;
28                 *)
29                         item=${list%%$LF*}
30                         list=${list#*$LF}
31                         set -- "$@" "-S$shader=$item"
32                         ;;
33         esac
34 done
35
36 set -- "$BSPTOOL" "$in" "$@" -o"$out"
37 "$@"