Import the newer scripts from DeforaOS configure
This commit is contained in:
parent
f29338bf63
commit
df68815cb5
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -25,17 +25,19 @@
|
||||||
|
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
|
CONFIGSH="${0%/pkgconfig.sh}/../config.sh"
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
[ -f "../config.sh" ] && . "../config.sh"
|
|
||||||
DEBUG="_debug"
|
|
||||||
DEVNULL="/dev/null"
|
DEVNULL="/dev/null"
|
||||||
PROGNAME="pkgconfig.sh"
|
PROGNAME="pkgconfig.sh"
|
||||||
#executables
|
#executables
|
||||||
|
DEBUG="_debug"
|
||||||
INSTALL="install -m 0644"
|
INSTALL="install -m 0644"
|
||||||
MKDIR="mkdir -m 0755 -p"
|
MKDIR="mkdir -m 0755 -p"
|
||||||
RM="rm -f"
|
RM="rm -f"
|
||||||
SED="sed"
|
SED="sed"
|
||||||
|
|
||||||
|
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
#debug
|
#debug
|
||||||
|
@ -66,7 +68,7 @@ _usage()
|
||||||
clean=0
|
clean=0
|
||||||
install=0
|
install=0
|
||||||
uninstall=0
|
uninstall=0
|
||||||
while getopts "ciuP:" name; do
|
while getopts "ciuO:P:" name; do
|
||||||
case $name in
|
case $name in
|
||||||
c)
|
c)
|
||||||
clean=1
|
clean=1
|
||||||
|
@ -79,6 +81,9 @@ while getopts "ciuP:" name; do
|
||||||
install=0
|
install=0
|
||||||
uninstall=1
|
uninstall=1
|
||||||
;;
|
;;
|
||||||
|
O)
|
||||||
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
P)
|
P)
|
||||||
PREFIX="$OPTARG"
|
PREFIX="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
@ -89,7 +94,7 @@ while getopts "ciuP:" name; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -lt 0 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
@ -103,6 +108,16 @@ if [ -z "$VERSION" ]; then
|
||||||
_error "The VERSION variable needs to be set"
|
_error "The VERSION variable needs to be set"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
|
||||||
|
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||||
|
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
|
||||||
|
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
|
||||||
|
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
|
||||||
|
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
||||||
|
if [ -z "$SYSCONFDIR" ]; then
|
||||||
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
|
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
||||||
|
fi
|
||||||
|
|
||||||
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
|
@ -136,10 +151,10 @@ while [ $# -gt 0 ]; do
|
||||||
if [ "$PREFIX" != "/usr" ]; then
|
if [ "$PREFIX" != "/usr" ]; then
|
||||||
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin)
|
"Darwin")
|
||||||
RPATH="-Wl,-rpath,\${libdir}"
|
RPATH="-Wl,-rpath,\${libdir}"
|
||||||
;;
|
;;
|
||||||
SunOS)
|
"SunOS")
|
||||||
RPATH="-Wl,-R\${libdir}"
|
RPATH="-Wl,-R\${libdir}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -148,10 +163,19 @@ while [ $# -gt 0 ]; do
|
||||||
#create
|
#create
|
||||||
source="${target#$OBJDIR}"
|
source="${target#$OBJDIR}"
|
||||||
source="${source}.in"
|
source="${source}.in"
|
||||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;" \
|
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2
|
||||||
-e "s;@VERSION@;$VERSION;" \
|
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
|
||||||
-e "s;@PREFIX@;$PREFIX;" \
|
-e "s;@VERSION@;$VERSION;g" \
|
||||||
-e "s;@RPATH@;$RPATH;" \
|
-e "s;@PREFIX@;$PREFIX;g" \
|
||||||
|
-e "s;@BINDIR@;$BINDIR;g" \
|
||||||
|
-e "s;@DATADIR@;$DATADIR;g" \
|
||||||
|
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
|
||||||
|
-e "s;@LIBDIR@;$LIBDIR;g" \
|
||||||
|
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
||||||
|
-e "s;@MANDIR@;$MANDIR;g" \
|
||||||
|
-e "s;@PWD@;$PWD;g" \
|
||||||
|
-e "s;@RPATH@;$RPATH;g" \
|
||||||
|
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
||||||
-- "$source" > "$target"
|
-- "$source" > "$target"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
$DEBUG $RM -- "$target"
|
$DEBUG $RM -- "$target"
|
||||||
|
|
154
doc/gtkdoc.sh
154
doc/gtkdoc.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
|
CONFIGSH="${0%/gtkdoc.sh}/../config.sh"
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
PROGNAME="gtkdoc.sh"
|
PROGNAME="gtkdoc.sh"
|
||||||
#executables
|
#executables
|
||||||
|
@ -38,9 +39,10 @@ GTKDOC_SCAN="gtkdoc-scan"
|
||||||
INSTALL="install -m 0644"
|
INSTALL="install -m 0644"
|
||||||
MKDIR="mkdir -m 0755 -p"
|
MKDIR="mkdir -m 0755 -p"
|
||||||
RM="rm -f"
|
RM="rm -f"
|
||||||
|
RMDIR="rmdir"
|
||||||
TOUCH="touch"
|
TOUCH="touch"
|
||||||
|
|
||||||
[ -f "../config.sh" ] && . "../config.sh"
|
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -60,6 +62,77 @@ _error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gtkdoc_fixxref
|
||||||
|
_gtkdoc_fixxref()
|
||||||
|
{
|
||||||
|
module="$1"
|
||||||
|
moduledir="$2"
|
||||||
|
htmldir="$3"
|
||||||
|
outputdir="$4"
|
||||||
|
|
||||||
|
(cd "$outputdir" &&
|
||||||
|
$DEBUG $GTKDOC_FIXXREF \
|
||||||
|
--module="$module" \
|
||||||
|
--module-dir="$moduledir" \
|
||||||
|
--html-dir="$htmldir") || exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gtkdoc_mkdb
|
||||||
|
_gtkdoc_mkdb()
|
||||||
|
{
|
||||||
|
module="$1"
|
||||||
|
sourcedir="$2"
|
||||||
|
outputdir="$3"
|
||||||
|
|
||||||
|
(cd "$sourcedir" &&
|
||||||
|
$DEBUG $GTKDOC_MKDB --module="$module" \
|
||||||
|
--output-dir="$outputdir" \
|
||||||
|
--output-format="xml" --tmpl-dir="tmpl")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gtkdoc_mkhtml
|
||||||
|
_gtkdoc_mkhtml()
|
||||||
|
{
|
||||||
|
module="$1"
|
||||||
|
path="$2"
|
||||||
|
driver="$3"
|
||||||
|
outputdir="$4"
|
||||||
|
|
||||||
|
(cd "$outputdir" &&
|
||||||
|
$DEBUG $GTKDOC_MKHTML --path "$path" "$module" "$driver")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gtkdoc_mktmpl
|
||||||
|
_gtkdoc_mktmpl()
|
||||||
|
{
|
||||||
|
module="$1"
|
||||||
|
sourcedir="$2"
|
||||||
|
outputdir="$3"
|
||||||
|
|
||||||
|
(cd "$sourcedir" &&
|
||||||
|
$DEBUG $GTKDOC_MKTMPL --module="$module" \
|
||||||
|
--output-dir="$outputdir")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gtkdoc_scan
|
||||||
|
_gtkdoc_scan()
|
||||||
|
{
|
||||||
|
module="$1"
|
||||||
|
sourcedir="$2"
|
||||||
|
outputdir="$3"
|
||||||
|
|
||||||
|
(cd ".." &&
|
||||||
|
$DEBUG $GTKDOC_SCAN --module="$module" \
|
||||||
|
--source-dir="$sourcedir" \
|
||||||
|
--output-dir="$outputdir")
|
||||||
|
# --rebuild-types
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
|
@ -72,7 +145,7 @@ _usage()
|
||||||
clean=0
|
clean=0
|
||||||
install=0
|
install=0
|
||||||
uninstall=0
|
uninstall=0
|
||||||
while getopts "ciuP:" name; do
|
while getopts "ciO:uP:" name; do
|
||||||
case "$name" in
|
case "$name" in
|
||||||
c)
|
c)
|
||||||
clean=1
|
clean=1
|
||||||
|
@ -81,6 +154,9 @@ while getopts "ciuP:" name; do
|
||||||
uninstall=0
|
uninstall=0
|
||||||
install=1
|
install=1
|
||||||
;;
|
;;
|
||||||
|
O)
|
||||||
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
u)
|
u)
|
||||||
install=0
|
install=0
|
||||||
uninstall=1
|
uninstall=1
|
||||||
|
@ -95,7 +171,7 @@ while getopts "ciuP:" name; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
@ -126,23 +202,28 @@ while [ $# -gt 0 ]; do
|
||||||
file="${i##*/}"
|
file="${i##*/}"
|
||||||
$DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2
|
$DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2
|
||||||
done
|
done
|
||||||
|
if [ -d "$instdir/$MODULE" ]; then
|
||||||
|
$DEBUG $RMDIR -- "$instdir/$MODULE" || exit 2
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#create
|
#create
|
||||||
case "$target" in
|
case "$target" in
|
||||||
gtkdoc/html.stamp)
|
gtkdoc/html.stamp)
|
||||||
driver="../$MODULE-docs.xml"
|
|
||||||
if [ -n "$OBJDIR" ]; then
|
|
||||||
driver="gtkdoc/$MODULE-docs.xml"
|
|
||||||
$DEBUG $CP -- "$driver" "${OBJDIR}gtkdoc" \
|
|
||||||
|| exit 2
|
|
||||||
fi
|
|
||||||
output="${OBJDIR}gtkdoc/html"
|
output="${OBJDIR}gtkdoc/html"
|
||||||
$DEBUG $MKDIR -- "$output" || exit 2
|
$DEBUG $MKDIR -- "$output" || exit 2
|
||||||
(cd "$output" &&
|
driver="$MODULE-docs.xml"
|
||||||
$DEBUG $GTKDOC_MKHTML "$MODULE" \
|
oldpath="$PWD"
|
||||||
"${OBJDIR}$driver")
|
[ -n "$OBJDIR" ] && for file in \
|
||||||
|
"gtkdoc/$driver" \
|
||||||
|
"gtkdoc/xml/gtkdocentities.ent"; do
|
||||||
|
[ -f "$file" ] || continue
|
||||||
|
$DEBUG $CP -- "$file" \
|
||||||
|
"${OBJDIR}$file" || exit 2
|
||||||
|
done
|
||||||
|
_gtkdoc_mkhtml "$MODULE" "${oldpath%/*}" "../$driver" \
|
||||||
|
"$output"
|
||||||
#detect when gtk-doc is not available
|
#detect when gtk-doc is not available
|
||||||
res=$?
|
res=$?
|
||||||
if [ $res -eq 127 ]; then
|
if [ $res -eq 127 ]; then
|
||||||
|
@ -153,24 +234,7 @@ while [ $# -gt 0 ]; do
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
output="${OBJDIR}gtkdoc"
|
output="${OBJDIR}gtkdoc"
|
||||||
(cd "$output" &&
|
_gtkdoc_fixxref "$MODULE" "html" "$instdir" "$output"
|
||||||
$DEBUG $GTKDOC_FIXXREF \
|
|
||||||
--module="$MODULE" \
|
|
||||||
--module-dir="html" \
|
|
||||||
--html-dir="$instdir") || exit 2
|
|
||||||
;;
|
|
||||||
gtkdoc/sgml.stamp)
|
|
||||||
output="xml"
|
|
||||||
if [ -n "$OBJDIR" ]; then
|
|
||||||
output="${OBJDIR}gtkdoc/xml"
|
|
||||||
$DEBUG $MKDIR -- "$output" || exit 2
|
|
||||||
fi
|
|
||||||
(cd "${OBJDIR}gtkdoc" &&
|
|
||||||
$DEBUG $GTKDOC_MKDB \
|
|
||||||
--module="$MODULE" \
|
|
||||||
--output-dir="$output" \
|
|
||||||
--output-format="xml" \
|
|
||||||
--tmpl-dir="tmpl")
|
|
||||||
;;
|
;;
|
||||||
gtkdoc/tmpl.stamp)
|
gtkdoc/tmpl.stamp)
|
||||||
output="tmpl"
|
output="tmpl"
|
||||||
|
@ -178,22 +242,28 @@ while [ $# -gt 0 ]; do
|
||||||
output="${OBJDIR}gtkdoc/tmpl"
|
output="${OBJDIR}gtkdoc/tmpl"
|
||||||
$DEBUG $MKDIR -- "$output" || exit 2
|
$DEBUG $MKDIR -- "$output" || exit 2
|
||||||
fi
|
fi
|
||||||
(cd "${OBJDIR}gtkdoc" &&
|
_gtkdoc_mktmpl "$MODULE" "${OBJDIR}gtkdoc" "$output"
|
||||||
$DEBUG $GTKDOC_MKTMPL \
|
;;
|
||||||
--module="$MODULE" \
|
gtkdoc/xml.stamp)
|
||||||
--output-dir="$output")
|
output="xml"
|
||||||
|
if [ -n "$OBJDIR" ]; then
|
||||||
|
output="${OBJDIR}gtkdoc"
|
||||||
|
sections="gtkdoc/$MODULE-sections.txt"
|
||||||
|
$DEBUG $MKDIR -- "$output/xml" || exit 2
|
||||||
|
$DEBUG $CP -- "$sections" "$output" \
|
||||||
|
|| exit 2
|
||||||
|
_gtkdoc_scan "$MODULE" "include" "$output"
|
||||||
|
output="${OBJDIR}gtkdoc/xml"
|
||||||
|
fi
|
||||||
|
_gtkdoc_mkdb "$MODULE" "${OBJDIR}gtkdoc" "$output"
|
||||||
;;
|
;;
|
||||||
gtkdoc/*.types)
|
gtkdoc/*.types)
|
||||||
output="doc/gtkdoc" || exit 2
|
output="$PWD/gtkdoc" || exit 2
|
||||||
if [ -n "$OBJDIR" ]; then
|
if [ -n "$OBJDIR" ]; then
|
||||||
output="${OBJDIR}gtkdoc"
|
output="${OBJDIR}gtkdoc"
|
||||||
$DEBUG $MKDIR -- "$output" || exit 2
|
$DEBUG $MKDIR -- "$output" || exit 2
|
||||||
fi
|
fi
|
||||||
(cd ".." &&
|
_gtkdoc_scan "$MODULE" "include" "$output"
|
||||||
$DEBUG $GTKDOC_SCAN \
|
|
||||||
--module="$MODULE" \
|
|
||||||
--source-dir="include" \
|
|
||||||
--output-dir="$output")
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_error "$target: Unknown type"
|
_error "$target: Unknown type"
|
||||||
|
@ -205,7 +275,7 @@ while [ $# -gt 0 ]; do
|
||||||
_error "$target: Could not create documentation"
|
_error "$target: Could not create documentation"
|
||||||
install=0
|
install=0
|
||||||
fi
|
fi
|
||||||
$TOUCH "$target"
|
$TOUCH "${OBJDIR}$target"
|
||||||
|
|
||||||
#install
|
#install
|
||||||
if [ "$install" -eq 1 ]; then
|
if [ "$install" -eq 1 ]; then
|
||||||
|
|
156
tests/fixme.sh
156
tests/fixme.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2017 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2017-2020 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -25,22 +25,30 @@
|
||||||
|
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
|
CONFIGSH="${0%/fixme.sh}/../config.sh"
|
||||||
PROGNAME="fixme.sh"
|
PROGNAME="fixme.sh"
|
||||||
PROJECTCONF="../project.conf"
|
PROJECTCONF="../project.conf"
|
||||||
|
REGEXP_ERROR="FIXME"
|
||||||
|
REGEXP_WARNING="\\(TODO\|XXX\\)"
|
||||||
#executables
|
#executables
|
||||||
DATE="date"
|
DATE="date"
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
FIND="find"
|
FIND="find"
|
||||||
GREP="grep"
|
GREP="grep"
|
||||||
|
HEAD="head"
|
||||||
|
MKDIR="mkdir -p"
|
||||||
SORT="sort -n"
|
SORT="sort -n"
|
||||||
TR="tr"
|
TR="tr"
|
||||||
|
|
||||||
|
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
#fixme
|
#fixme
|
||||||
_fixme()
|
_fixme()
|
||||||
{
|
{
|
||||||
ret=0
|
res=0
|
||||||
|
subdirs=
|
||||||
|
|
||||||
$DATE
|
$DATE
|
||||||
echo
|
echo
|
||||||
|
@ -55,68 +63,134 @@ _fixme()
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < "$PROJECTCONF"
|
done < "$PROJECTCONF"
|
||||||
|
if [ ! -n "$subdirs" ]; then
|
||||||
|
_error "Could not locate directories to analyze"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
for subdir in $subdirs; do
|
for subdir in $subdirs; do
|
||||||
[ -d "../$subdir" ] || continue
|
[ -d "../$subdir" ] || continue
|
||||||
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||||
callback=
|
callback=$(_fixme_callback "$filename")
|
||||||
case "$filename" in
|
|
||||||
*.asm|*.S)
|
|
||||||
callback="_fixme_asm"
|
|
||||||
;;
|
|
||||||
*.c|*.h|*.js)
|
|
||||||
callback="_fixme_c"
|
|
||||||
;;
|
|
||||||
*.conf|*.sh)
|
|
||||||
callback="_fixme_sh"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
[ -n "$callback" ] || continue
|
[ -n "$callback" ] || continue
|
||||||
$callback "$filename" 2>&1
|
($callback "$filename") 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||||
ret=2
|
res=2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
return $ret
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
_fixme_asm()
|
_fixme_callback()
|
||||||
{
|
{
|
||||||
retc=0
|
filename="$1"
|
||||||
|
ext=${filename##*/}
|
||||||
|
ext=${ext%.in}
|
||||||
|
ext=${ext##*.}
|
||||||
|
callback=
|
||||||
|
|
||||||
|
case "$ext" in
|
||||||
|
asm|S)
|
||||||
|
echo "_fixme_callback_asm"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
c|cc|cpp|cxx|h|js|v)
|
||||||
|
echo "_fixme_callback_c"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
conf|sh)
|
||||||
|
echo "_fixme_callback_sh"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
py)
|
||||||
|
echo "_fixme_callback_python"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
htm|html|xml|xsl)
|
||||||
|
echo "_fixme_callback_xml"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case $($HEAD -n 1 "$filename") in
|
||||||
|
"#!/bin/sh"*|"#! /bin/sh"*|\
|
||||||
|
"#!/usr/bin/env bash"*|"#! /usr/bin/env bash"*)
|
||||||
|
echo "_fixme_callback_sh"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"#!/usr/bin/env python"*|"#! /usr/bin/env python"*)
|
||||||
|
echo "_fixme_callback_python"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"<html"*|"<?xml"*)
|
||||||
|
echo "_fixme_callback_xml"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
_fixme_callback_asm()
|
||||||
|
{
|
||||||
|
res=0
|
||||||
filename="$1"
|
filename="$1"
|
||||||
|
|
||||||
#warnings
|
#warnings
|
||||||
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename"
|
$GREP -nH "/\\*.*$REGEXP_WARNING" "$filename"
|
||||||
#failures
|
#failures
|
||||||
$GREP -nH '/\*.*FIXME' "$filename" && retc=2
|
$GREP -nH "/\\*.*$REGEXP_ERROR" "$filename" && res=2
|
||||||
return $retc
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
_fixme_c()
|
_fixme_callback_c()
|
||||||
{
|
{
|
||||||
retc=0
|
res=0
|
||||||
filename="$1"
|
filename="$1"
|
||||||
|
|
||||||
#warnings
|
#warnings
|
||||||
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename"
|
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_WARNING" "$filename"
|
||||||
#failures
|
#failures
|
||||||
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && retc=2
|
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_ERROR" "$filename" && res=2
|
||||||
return $retc
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
_fixme_sh()
|
_fixme_callback_python()
|
||||||
{
|
{
|
||||||
retsh=0
|
res=0
|
||||||
filename="$1"
|
filename="$1"
|
||||||
#XXX avoid matching the regexp
|
|
||||||
comment="#"
|
comment="#"
|
||||||
|
|
||||||
#warnings
|
#warnings
|
||||||
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename"
|
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
|
||||||
#failures
|
#failures
|
||||||
$GREP -nH "$comment.*FIXME" "$filename" && retsh=2
|
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
|
||||||
return $retsh
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
|
_fixme_callback_sh()
|
||||||
|
{
|
||||||
|
res=0
|
||||||
|
filename="$1"
|
||||||
|
comment="#"
|
||||||
|
|
||||||
|
#warnings
|
||||||
|
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
|
||||||
|
#failures
|
||||||
|
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
|
_fixme_callback_xml()
|
||||||
|
{
|
||||||
|
res=0
|
||||||
|
filename="$1"
|
||||||
|
|
||||||
|
#XXX limited to a single line
|
||||||
|
#warnings
|
||||||
|
$GREP -nH "<!--.*$REGEXP_WARNING" "$filename"
|
||||||
|
#failures
|
||||||
|
$GREP -nH "<!--.*$REGEXP_ERROR" "$filename" && res=2
|
||||||
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,6 +206,14 @@ _debug()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#error
|
||||||
|
_error()
|
||||||
|
{
|
||||||
|
echo "$PROGNAME: $@" 1>&2
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
|
@ -169,9 +251,15 @@ fi
|
||||||
[ $clean -ne 0 ] && exit 0
|
[ $clean -ne 0 ] && exit 0
|
||||||
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
|
ret=0
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
target="$1"
|
target="$1"
|
||||||
|
dirname="${target%/*}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
_fixme > "$target" || exit 2
|
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||||
|
$MKDIR -- "$dirname" || ret=$?
|
||||||
|
fi
|
||||||
|
_fixme > "$target" || ret=$?
|
||||||
done
|
done
|
||||||
|
exit $ret
|
||||||
|
|
Loading…
Reference in New Issue
Block a user