Import the newer scripts from DeforaOS configure
This commit is contained in:
parent
fcc46d5da8
commit
2d202a7457
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2011-2014 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
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -25,22 +25,25 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/pkgconfig.sh}/../config.sh"
|
||||
PREFIX="/usr/local"
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
DEBUG="_debug"
|
||||
DEVNULL="/dev/null"
|
||||
PROGNAME="pkgconfig.sh"
|
||||
#executables
|
||||
DEBUG="_debug"
|
||||
INSTALL="install -m 0644"
|
||||
MKDIR="mkdir -m 0755 -p"
|
||||
RM="rm -f"
|
||||
SED="sed"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
@ -48,7 +51,7 @@ _debug()
|
|||
#error
|
||||
_error()
|
||||
{
|
||||
echo "pkgconfig.sh: $@" 1>&2
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
@ -56,7 +59,7 @@ _error()
|
|||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: pkgconfig.sh [-c|-i|-u][-P prefix] target..." 1>&2
|
||||
echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -65,7 +68,7 @@ _usage()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciuO:P:" name; do
|
||||
case $name in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -78,6 +81,9 @@ while getopts "ciuP:" name; do
|
|||
install=0
|
||||
uninstall=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
P)
|
||||
PREFIX="$OPTARG"
|
||||
;;
|
||||
|
@ -88,7 +94,7 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 0 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
@ -102,8 +108,19 @@ if [ -z "$VERSION" ]; then
|
|||
_error "The VERSION variable needs to be set"
|
||||
exit $?
|
||||
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"
|
||||
exec 3>&1
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
shift
|
||||
|
@ -121,7 +138,11 @@ while [ $# -gt 0 ]; do
|
|||
if [ "$install" -eq 1 ]; then
|
||||
source="${target#$OBJDIR}"
|
||||
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
|
||||
$DEBUG $INSTALL "$target" "$PKGCONFIG/$source" || exit 2
|
||||
basename="$source"
|
||||
if [ "${source##*/}" != "$source" ]; then
|
||||
basename="${source##*/}"
|
||||
fi
|
||||
$DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -130,10 +151,10 @@ while [ $# -gt 0 ]; do
|
|||
if [ "$PREFIX" != "/usr" ]; then
|
||||
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
||||
case $(uname -s) in
|
||||
Darwin)
|
||||
"Darwin")
|
||||
RPATH="-Wl,-rpath,\${libdir}"
|
||||
;;
|
||||
SunOS)
|
||||
"SunOS")
|
||||
RPATH="-Wl,-R\${libdir}"
|
||||
;;
|
||||
esac
|
||||
|
@ -142,10 +163,19 @@ while [ $# -gt 0 ]; do
|
|||
#create
|
||||
source="${target#$OBJDIR}"
|
||||
source="${source}.in"
|
||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;" \
|
||||
-e "s;@VERSION@;$VERSION;" \
|
||||
-e "s;@PREFIX@;$PREFIX;" \
|
||||
-e "s;@RPATH@;$RPATH;" \
|
||||
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2
|
||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
|
||||
-e "s;@VERSION@;$VERSION;g" \
|
||||
-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"
|
||||
if [ $? -ne 0 ]; then
|
||||
$DEBUG $RM -- "$target"
|
||||
|
|
157
doc/gtkdoc.sh
157
doc/gtkdoc.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$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
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/gtkdoc.sh}/../config.sh"
|
||||
PREFIX="/usr/local"
|
||||
PROGNAME="gtkdoc.sh"
|
||||
#executables
|
||||
|
@ -38,16 +39,17 @@ GTKDOC_SCAN="gtkdoc-scan"
|
|||
INSTALL="install -m 0644"
|
||||
MKDIR="mkdir -m 0755 -p"
|
||||
RM="rm -f"
|
||||
RMDIR="rmdir"
|
||||
TOUCH="touch"
|
||||
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -72,7 +145,7 @@ _usage()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciO:uP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -81,6 +154,9 @@ while getopts "ciuP:" name; do
|
|||
uninstall=0
|
||||
install=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
u)
|
||||
install=0
|
||||
uninstall=1
|
||||
|
@ -95,7 +171,7 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
@ -110,6 +186,7 @@ MODULE="$PACKAGE"
|
|||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||
instdir="$DATADIR/gtk-doc/html"
|
||||
|
||||
exec 3>&1
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
target="${target#$OBJDIR}"
|
||||
|
@ -125,23 +202,28 @@ while [ $# -gt 0 ]; do
|
|||
file="${i##*/}"
|
||||
$DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2
|
||||
done
|
||||
if [ -d "$instdir/$MODULE" ]; then
|
||||
$DEBUG $RMDIR -- "$instdir/$MODULE" || exit 2
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
#create
|
||||
case "$target" in
|
||||
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"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
(cd "$output" &&
|
||||
$DEBUG $GTKDOC_MKHTML "$MODULE" \
|
||||
"${OBJDIR}$driver")
|
||||
driver="$MODULE-docs.xml"
|
||||
oldpath="$PWD"
|
||||
[ -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
|
||||
res=$?
|
||||
if [ $res -eq 127 ]; then
|
||||
|
@ -152,24 +234,7 @@ while [ $# -gt 0 ]; do
|
|||
exit 2
|
||||
fi
|
||||
output="${OBJDIR}gtkdoc"
|
||||
(cd "$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_fixxref "$MODULE" "html" "$instdir" "$output"
|
||||
;;
|
||||
gtkdoc/tmpl.stamp)
|
||||
output="tmpl"
|
||||
|
@ -177,22 +242,28 @@ while [ $# -gt 0 ]; do
|
|||
output="${OBJDIR}gtkdoc/tmpl"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
fi
|
||||
(cd "${OBJDIR}gtkdoc" &&
|
||||
$DEBUG $GTKDOC_MKTMPL \
|
||||
--module="$MODULE" \
|
||||
--output-dir="$output")
|
||||
_gtkdoc_mktmpl "$MODULE" "${OBJDIR}gtkdoc" "$output"
|
||||
;;
|
||||
gtkdoc/xml.stamp)
|
||||
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)
|
||||
output="doc/gtkdoc" || exit 2
|
||||
output="$PWD/gtkdoc" || exit 2
|
||||
if [ -n "$OBJDIR" ]; then
|
||||
output="${OBJDIR}gtkdoc"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
fi
|
||||
(cd ".." &&
|
||||
$DEBUG $GTKDOC_SCAN \
|
||||
--module="$MODULE" \
|
||||
--source-dir="include" \
|
||||
--output-dir="$output")
|
||||
_gtkdoc_scan "$MODULE" "include" "$output"
|
||||
;;
|
||||
*)
|
||||
_error "$target: Unknown type"
|
||||
|
@ -204,7 +275,7 @@ while [ $# -gt 0 ]; do
|
|||
_error "$target: Could not create documentation"
|
||||
install=0
|
||||
fi
|
||||
$TOUCH "$target"
|
||||
$TOUCH "${OBJDIR}$target"
|
||||
|
||||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user