Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / png / contrib / libtests / gentests.sh
blobf0f8d2395a5377cce9385cf9cdf3c12612b07f98
1 #!/bin/sh
3 # Copyright (c) 2013 John Cunningham Bowler
5 # Last changed in libpng 1.6.0 [February 14, 2013]
7 # This code is released under the libpng license.
8 # For conditions of distribution and use, see the disclaimer
9 # and license in png.h
11 # Generate a set of PNG test images. The images are generated in a
12 # sub-directory called 'tests' by default, however a command line argument will
13 # change that name. The generation requires a built version of makepng in the
14 # current directory.
16 usage(){
17 exec >&2
18 echo "$0 [<directory>]"
19 echo ' Generate a set of PNG test files in "directory" ("tests" by default)'
20 exit 1
23 mp="$PWD/makepng"
24 test -x "$mp" || {
25 exec >&2
26 echo "$0: the 'makepng' program must exist"
27 echo " in the directory within which this program:"
28 echo " $mp"
29 echo " is executed"
30 usage
33 # Just one argument: the directory
34 testdir="tests"
35 test $# -gt 1 && {
36 testdir="$1"
37 shift
39 test $# -eq 0 || usage
41 # Take care not to clobber something
42 if test -e "$testdir"
43 then
44 test -d "$testdir" || usage
45 else
46 # mkdir -p isn't portable, so do the following
47 mkdir "$testdir" 2>/dev/null || mkdir -p "$testdir" || usage
50 # This fails in a very satisfactory way if it's not accessible
51 cd "$testdir"
52 :>"test$$.png" || {
53 exec >&2
54 echo "$testdir: directory not writable"
55 usage
57 rm "test$$.png" || {
58 exec >&2
59 echo "$testdir: you have create but not write privileges here."
60 echo " This is unexpected. You have a spurion; "'"'"test$$.png"'"'"."
61 echo " You need to remove this yourself. Try a different directory."
62 exit 1
65 # Now call makepng ($mp) to create every file we can think of with a
66 # reasonable name
67 doit(){
68 for gamma in "" --sRGB --linear --1.8
70 case "$gamma" in
71 "")
72 gname=;;
73 --sRGB)
74 gname="-srgb";;
75 --linear)
76 gname="-lin";;
77 --1.8)
78 gname="-18";;
80 gname="-$gamma";;
81 esac
82 "$mp" $gamma "$1" "$2" "test-$1-$2$gname.png"
83 done
86 for ct in gray palette
88 for bd in 1 2 4 8
90 doit "$ct" "$bd"
91 done
92 done
94 doit "gray" "16"
96 for ct in gray-alpha rgb rgb-alpha
98 for bd in 8 16
100 doit "$ct" "$bd"
101 done
102 done