File: wrap-profiles.sh

package info (click to toggle)
vips 8.14.1-3%2Bdeb12u2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 35,912 kB
  • sloc: ansic: 165,449; cpp: 10,987; python: 4,462; xml: 4,212; sh: 471; perl: 40; makefile: 23
file content (38 lines) | stat: -rwxr-xr-x 1,010 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
#!/bin/bash

# code up the binary files in $1 as a set of name / string pairs 
# in $2

# we have to use arrays for the strings, since MSVC won't allow string
# literals larger than 64kb

in=$1
out=$2

echo "/* this file generated automatically, do not edit */" > $out
echo "" >> $out
echo "#include \"profiles.h\"" >> $out
echo "" >> $out

profile_names=
for file in $in/*.icm; do
  root=${file%.icm}
  base=${root##*/} 
  profile_name=vips__profile_fallback_$base
  profile_names="$profile_names $profile_name"
  echo "static VipsProfileFallback $profile_name = {" >> $out
  echo "    \"$base\"," >> $out
  echo "    $(stat --format=%s $file)," >> $out
  echo "    {" >> $out
  pigz -c -z -11 $file | hexdump -v -e '" 0x" 1/1 "%02X,"' | fmt >> $out
  echo "    }" >> $out
  echo "};" >> $out
  echo  >> $out
done

echo "VipsProfileFallback *vips__profile_fallback_table[] = {" >> $out
for profile_name in $profile_names; do
  echo "    &$profile_name," >> $out
done
echo "    NULL" >> $out
echo "};" >> $out