Simplify util_clip_region()
[geeqie.git] / doc / create-doxygen-lua-api.sh
index c43d6ab..4c3402f 100755 (executable)
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/sh
 
 #**********************************************************************
-# Copyright (C) 2021 - The Geeqie Team
+# Copyright (C) 2022 - The Geeqie Team
 #
 # Author: Colin Clark
 #
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #**********************************************************************
-#
-# This script will create the Lua API html document, which is part of
-# the Geeqie Help file.
-#
-# It is run during the generation of the help files.
-#
-# The generated Lua html files are placed in doc/html/lua-api
-#
-# The doxygen.conf file is modified to extract only those comments
-# that are useful as part of an API description.
-#
-#**********************************************************************
+
+## @file
+## @brief Create the Lua API html document, which is part of
+## the Geeqie Help file.
+##
+## It is run during the generation of the help files.
+##
+## The generated Lua html files are placed in doc/html/lua-api
+##
+## The doxygen.conf file is modified to extract only those comments
+## that are useful as part of an API description.
+##
+
+if ! command -v doxygen > /dev/null
+then
+       printf '%s\n' "doxygen not installed"
+       exit 1
+fi
 
 export PROJECT="Geeqie"
-export VERSION=$(git tag --list v[1-9]* | tail -1)
-export SRCDIR="$PWD/.."
-export DOCDIR="$PWD/html/lua-api"
+VERSION=$(git tag --list v[1-9]* | tail -1)
+export VERSION
+export SRCDIR="$1"
+export DOCDIR="$2"
 export INLINE_SOURCES=NO
 export STRIP_CODE_COMMENTS=YES
 
-TMPFILE=$(mktemp) || exit 1
+TMPFILE=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") || exit 1
 
 # Modify the Geeqie doxygen.conf file to produce
 # only the data needed for the lua API document
@@ -65,7 +72,7 @@ BEGIN {
                }
        else if ($1 == "FILE_PATTERNS")
                {
-               print "FILE_PATTERNS = lua.c"
+               print "FILE_PATTERNS = lua.cc"
                FILE_PATTERNS_found = "TRUE"
                next
                }
@@ -93,7 +100,7 @@ BEGIN {
                {print}
                }
 }
-' ../doxygen.conf > "$TMPFILE"
+' "$SRCDIR"/doxygen.conf > "$TMPFILE"
 
 doxygen "$TMPFILE"