Fix #1004, 1005: Various meson problems
[geeqie.git] / doc / create-doxygen-lua-api.sh
1 #!/bin/sh
2
3 #**********************************************************************
4 # Copyright (C) 2022 - 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 Create the Lua API html document, which is part of
25 ## the Geeqie Help file.
26 ##
27 ## It is run during the generation of the help files.
28 ##
29 ## The generated Lua html files are placed in doc/html/lua-api
30 ##
31 ## The doxygen.conf file is modified to extract only those comments
32 ## that are useful as part of an API description.
33 ##
34
35 if ! command -v doxygen > /dev/null
36 then
37         printf '%s\n' "doxygen not installed"
38         exit 1
39 fi
40
41 export PROJECT="Geeqie"
42 VERSION=$(git tag --list v[1-9]* | tail -1)
43 export VERSION
44 export SRCDIR="$1"
45 export DOCDIR="$2"
46 export INLINE_SOURCES=NO
47 export STRIP_CODE_COMMENTS=YES
48
49 TMPFILE=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") || exit 1
50
51 # Modify the Geeqie doxygen.conf file to produce
52 # only the data needed for the lua API document
53 awk '
54 BEGIN {
55         FILE_PATTERNS_found = "FALSE"
56 }
57 {
58         if (FILE_PATTERNS_found == "TRUE")
59                 {
60                 if ($0 ~ /\\/)
61                         {
62                         next
63                         }
64                 else
65                         {
66                         FILE_PATTERNS_found = "FALSE"
67                         }
68                 }
69         if ($1 == SHOW_INCLUDE_FILES)
70                 {
71                 {print "SHOW_INCLUDE_FILES = NO"}
72                 }
73         else if ($1 == "FILE_PATTERNS")
74                 {
75                 print "FILE_PATTERNS = lua.c"
76                 FILE_PATTERNS_found = "TRUE"
77                 next
78                 }
79         else if ($1 == "EXCLUDE_SYMBOLS")
80                 {
81                 print "EXCLUDE_SYMBOLS = L \\"
82                 print "lua_callvalue \\"
83                 print "lua_check_exif \\"
84                 print "lua_check_image \\"
85                 print "lua_init \\"
86                 print "_XOPEN_SOURCE \\"
87                 print "LUA_register_global \\"
88                 print "LUA_register_meta"
89                 }
90         else if ($1 == "SOURCE_BROWSER")
91                 {
92                 print "SOURCE_BROWSER = NO"
93                 }
94         else if ($1 == "HAVE_DOT")
95                 {
96                 {print "HAVE_DOT = NO"}
97                 }
98         else
99                 {
100                 {print}
101                 }
102 }
103 ' ../doxygen.conf > "$TMPFILE"
104
105 doxygen "$TMPFILE"
106
107 rm "$TMPFILE"