Update documentation - increase Doxygen usage
[geeqie.git] / scripts / check-compiles.sh
1 #!/bin/bash
2
3 #/*
4 # * Copyright (C) 2021 The Geeqie Team
5 # *
6 # * Author: Colin Clark  
7 # *  
8 # * This program is free software; you can redistribute it and/or modify
9 # * it under the terms of the GNU General Public License as published by
10 # * the Free Software Foundation; either version 2 of the License, or
11 # * (at your option) any later version.
12 # *
13 # * This program is distributed in the hope that it will be useful,
14 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # * GNU General Public License for more details.
17 # *
18 # * You should have received a copy of the GNU General Public License along
19 # * with this program; if not, write to the Free Software Foundation, Inc.,
20 # * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 # */
22
23 ## @file
24 ## @brief Check that Geeqie compiles with both gcc and clang,
25 ## for both GTK2 and GTK3, and with and without optional modules.
26 ## 
27
28 compile()
29 {
30         # Cannot have --enable-debug-flags with --disable-gtk3
31
32         declare -A variant
33         variant[0]="$disable_list --disable-gtk3"
34         variant[1]="--disable-gtk3"
35         variant[2]="--enable-debug-flags $disable_list"
36         variant[3]="--enable-debug-flags"
37         variant[4]="$disable_list"
38         variant[5]=""
39
40         for ((i = 0; i <= 5; i++))
41         do
42                 if [[ "${variant[$i]}" =~ "gtk3" ]]; then
43                         gtk="GTK2"
44                 else
45                         gtk="GTK3"
46                 fi
47                 if [[ "${variant[$i]}" =~ "disable-threads" ]]; then
48                         disabled="all disabled"
49                 else
50                         disabled="none disabled"
51                 fi
52                 if [[ "${variant[$i]}" =~ "--enable-debug-flags" ]]; then
53                         debug_flags="enable-debug-flags"
54                 else
55                         debug_flags=""
56                 fi
57
58                 echo -e " \e[32m $1 $gtk $debug_flags $disabled "
59                 sudo make maintainer-clean > /dev/null 2>&1
60                 ./autogen.sh " ${variant[$i]}" > /dev/null 2>&1
61                 make -j > /dev/null
62         done
63 }
64
65 disable_list=" "$(awk -F'[\[\]]' '/AC_HELP_STRING\(\[--disable-/ {if ($2 != "gtk3") print $2}' configure.ac | tr '\n' ' ')
66
67 echo "Disabled list: :$disable_list"
68
69 export CFLAGS="-Wno-deprecated-declarations"
70
71 export CC=clang
72 export CXX=clang++
73 compile "clang"
74
75 export CC=
76 export CXX=
77 compile "gcc"