From 5d9ba8976960ff0047d6a6018f8e64fc1ad7769c Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 16 May 2012 23:23:06 +0000 Subject: [PATCH] Installing more documentation --- Makefile | 21 +++++ doc/Makefile | 15 +++- doc/project.conf | 1 + doc/scripts/Makefile | 33 ++++++++ doc/scripts/appbroker.sh | 56 ++++++++++++++ doc/scripts/docbook.sh | 127 ++++++++++++++++++++++++++++++ doc/scripts/gettext.sh | 161 +++++++++++++++++++++++++++++++++++++++ doc/scripts/gtkdoc.sh | 160 ++++++++++++++++++++++++++++++++++++++ doc/scripts/pkgconfig.sh | 109 ++++++++++++++++++++++++++ doc/scripts/project.conf | 16 ++++ project.conf | 9 +++ 11 files changed, 705 insertions(+), 3 deletions(-) create mode 100644 doc/scripts/Makefile create mode 100755 doc/scripts/appbroker.sh create mode 100755 doc/scripts/docbook.sh create mode 100755 doc/scripts/gettext.sh create mode 100755 doc/scripts/gtkdoc.sh create mode 100755 doc/scripts/pkgconfig.sh create mode 100644 doc/scripts/project.conf diff --git a/Makefile b/Makefile index b76baab..4a870e3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ PACKAGE = configure VERSION = 0.0.7 SUBDIRS = doc src tools +PREFIX = /usr/local +DESTDIR = +MKDIR ?= mkdir -p +INSTALL ?= install +RM ?= rm -f RM ?= rm -f LN ?= ln -f TAR ?= tar -czvf @@ -25,6 +30,13 @@ dist: $(PACKAGE)-$(VERSION)/doc/docbook.sh \ $(PACKAGE)-$(VERSION)/doc/configure.xml \ $(PACKAGE)-$(VERSION)/doc/project.conf \ + $(PACKAGE)-$(VERSION)/doc/scripts/Makefile \ + $(PACKAGE)-$(VERSION)/doc/scripts/appbroker.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/docbook.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/gettext.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/gtkdoc.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/pkgconfig.sh \ + $(PACKAGE)-$(VERSION)/doc/scripts/project.conf \ $(PACKAGE)-$(VERSION)/src/configure.c \ $(PACKAGE)-$(VERSION)/src/makefile.c \ $(PACKAGE)-$(VERSION)/src/settings.c \ @@ -49,8 +61,17 @@ dist: install: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure + $(INSTALL) -m 0644 -- BUGS $(DESTDIR)$(PREFIX)/share/doc/configure/BUGS + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure + $(INSTALL) -m 0644 -- CHANGES $(DESTDIR)$(PREFIX)/share/doc/configure/CHANGES + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure + $(INSTALL) -m 0644 -- README $(DESTDIR)$(PREFIX)/share/doc/configure/README uninstall: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/BUGS + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/CHANGES + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/README .PHONY: all subdirs clean distclean dist install uninstall diff --git a/doc/Makefile b/doc/Makefile index 5fb4066..3af5060 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,3 +1,4 @@ +SUBDIRS = scripts TARGETS = configure.html PREFIX = /usr/local DESTDIR = @@ -7,21 +8,29 @@ MKDIR ?= mkdir -p INSTALL ?= install -all: $(TARGETS) +all: subdirs $(TARGETS) + +subdirs: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done configure.html: configure.xml ./docbook.sh -P "$(PREFIX)" -- "configure.html" clean: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done $(RM) -- $(configure.html_OBJS) -distclean: clean +distclean: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) distclean) || exit; done + $(RM) -- $(configure.html_OBJS) $(RM) -- $(TARGETS) install: $(TARGETS) + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done ./docbook.sh -P "$(DESTDIR)$(PREFIX)" -i -- "configure.html" uninstall: + @for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done ./docbook.sh -P "$(DESTDIR)$(PREFIX)" -u -- "configure.html" -.PHONY: all clean distclean install uninstall +.PHONY: all subdirs clean distclean install uninstall diff --git a/doc/project.conf b/doc/project.conf index 08adf5e..ac41d92 100644 --- a/doc/project.conf +++ b/doc/project.conf @@ -1,3 +1,4 @@ +subdirs=scripts targets=configure.html dist=Makefile,docbook.sh,configure.xml diff --git a/doc/scripts/Makefile b/doc/scripts/Makefile new file mode 100644 index 0000000..ed460a5 --- /dev/null +++ b/doc/scripts/Makefile @@ -0,0 +1,33 @@ +PREFIX = /usr/local +DESTDIR = +MKDIR ?= mkdir -p +INSTALL ?= install +RM ?= rm -f + + +all: + +clean: + +distclean: clean + +install: + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 -- appbroker.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/appbroker.sh + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 -- docbook.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/docbook.sh + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 -- gettext.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gettext.sh + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 -- gtkdoc.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gtkdoc.sh + $(MKDIR) $(DESTDIR)$(PREFIX)/share/doc/configure/scripts + $(INSTALL) -m 0644 -- pkgconfig.sh $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/pkgconfig.sh + +uninstall: + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/appbroker.sh + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/docbook.sh + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gettext.sh + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/gtkdoc.sh + $(RM) -- $(DESTDIR)$(PREFIX)/share/doc/configure/scripts/pkgconfig.sh + +.PHONY: all clean distclean install uninstall diff --git a/doc/scripts/appbroker.sh b/doc/scripts/appbroker.sh new file mode 100755 index 0000000..c98177d --- /dev/null +++ b/doc/scripts/appbroker.sh @@ -0,0 +1,56 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2011 Pierre Pronchery +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#functions +#usage +_usage() +{ + echo "Usage: appbroker.sh target" 1>&2 + return 1 +} + + +#main +while getopts P: name; do + case "$name" in + P) + #we can ignore it + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $(($OPTIND - 1)) +if [ $# -ne 1 ]; then + _usage + exit $? +fi + +APPINTERFACE="${1%%.h}.interface" +AppBroker -o "$1" "$APPINTERFACE" diff --git a/doc/scripts/docbook.sh b/doc/scripts/docbook.sh new file mode 100755 index 0000000..e296cee --- /dev/null +++ b/doc/scripts/docbook.sh @@ -0,0 +1,127 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2012 Pierre Pronchery +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#variables +PREFIX="/usr/local" +. "../config.sh" +DEBUG="_debug" +INSTALL="install -m 0644" +MKDIR="mkdir -p" +RM="rm -f" +XSLTPROC="xsltproc --nonet" + + +#functions +#debug +_debug() +{ + echo $@ + $@ +} + + +#usage +_usage() +{ + echo "Usage: docbook.sh [-i|-u][-P prefix] target" 1>&2 + return 1 +} + + +#main +install=0 +uninstall=0 +while getopts "iuP:" "name"; do + case "$name" in + i) + uninstall=0 + install=1 + ;; + u) + install=0 + uninstall=1 + ;; + P) + PREFIX="$2" + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $((OPTIND - 1)) +if [ $# -eq 0 ]; then + _usage + exit $? +fi + +[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" +[ -z "$MANDIR" ] && MANDIR="$DATADIR/man" + +while [ $# -gt 0 ]; do + target="$1" + source="${target%.*}.xml" + shift + + #determine the type + ext="${target##*.}" + ext="${ext#.}" + case "$ext" in + html) + XSL="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl" + instdir="$DATADIR/doc/$ext/${target%%.*}" + ;; + 1|2|3|4|5|6|7|8|9) + XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" + instdir="$MANDIR/man$ext" + ;; + *) + echo "$0: $target: Unknown type" 1>&2 + exit 2 + ;; + esac + + #uninstall + if [ "$uninstall" -eq 1 ]; then + $DEBUG $RM "$instdir/$target" || exit 2 + continue + fi + + #create + $DEBUG $XSLTPROC -o "$target" "$XSL" "$source" + #XXX ignore errors + if [ $? -ne 0 ]; then + echo "$0: $target: Could not create page" 1>&2 + install=0 + fi + + #install + if [ "$install" -eq 1 ]; then + $DEBUG $MKDIR "$instdir" || exit 2 + $DEBUG $INSTALL "$target" "$instdir/$target" || exit 2 + fi +done diff --git a/doc/scripts/gettext.sh b/doc/scripts/gettext.sh new file mode 100755 index 0000000..30cf694 --- /dev/null +++ b/doc/scripts/gettext.sh @@ -0,0 +1,161 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2011 Pierre Pronchery +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#variables +PREFIX="/usr/local" +. "../config.sh" +DEBUG="_debug" +INSTALL="install -m 0644" +LOCALEDIR="$PREFIX/share/locale" +MKDIR="mkdir -p" +MSGFMT="msgfmt" +MSGINIT="msginit" +MSGMERGE="msgmerge" +RM="rm -f" +POTFILES="POTFILES" +XGETTEXT="xgettext --force-po" + + +#functions +#debug +_debug() +{ + echo $@ + $@ +} + + +#usage +_usage() +{ + echo "Usage: gettext.sh [-i|-u][-P prefix] " 1>&2 + return 1 +} + + +#gettext_mo +_gettext_mo() +{ + package="$1" + lang="$2" + + _gettext_po "$package" "$lang" || return 1 + $DEBUG $MSGFMT -c -v -o "$lang.mo" "$lang.po" || return 1 +} + + +#gettext_po +_gettext_po() +{ + package="$1" + lang="$2" + + if [ -f "$lang.po" ]; then + $DEBUG $MSGMERGE -U "$lang.po" "$package.pot" || return 1 + else + $DEBUG $MSGINIT -l "$lang" -o "$lang.po" -i "$package.pot" \ + || return 1 + fi +} + + +#gettext_pot +_gettext_pot() +{ + package="$1" + + $DEBUG $XGETTEXT -d "$package" -o "$package.pot" --keyword="_" \ + --keyword="N_" -f "$POTFILES" || return 1 +} + + +#main +install=0 +uninstall=0 +while getopts iuP: name; do + case "$name" in + i) + uninstall=0 + install=1 + ;; + u) + install=0 + uninstall=1 + ;; + P) + PREFIX="$2" + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $(($OPTIND - 1)) +if [ $# -eq 0 ]; then + _usage + exit $? +fi + +LOCALEDIR="$PREFIX/share/locale" +while [ $# -gt 0 ]; do + target="$1" + lang="${target%%.mo}" + lang="${lang%%.po}" + shift + + #uninstall + if [ "$uninstall" -eq 1 ]; then + $DEBUG $RM "$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \ + || exit 2 + continue + fi + + #create + case "$target" in + *.mo) + _gettext_mo "$PACKAGE" "$lang" || exit 2 + ;; + *.po) + _gettext_po "$PACKAGE" "$lang" || exit 2 + ;; + *.pot) + _gettext_pot "${target%%.pot}" || exit 2 + ;; + *) + exit 2 + ;; + esac + + #install + if [ "$install" -eq 1 ]; then + $DEBUG $MKDIR "$LOCALEDIR/$lang/LC_MESSAGES" || exit 2 + $DEBUG $INSTALL "$target" \ + "$LOCALEDIR/$lang/LC_MESSAGES/$PACKAGE.mo" \ + || exit 2 + fi +done diff --git a/doc/scripts/gtkdoc.sh b/doc/scripts/gtkdoc.sh new file mode 100755 index 0000000..0902187 --- /dev/null +++ b/doc/scripts/gtkdoc.sh @@ -0,0 +1,160 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2012 Pierre Pronchery +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#variables +PREFIX="/usr/local" +. "../config.sh" +DEBUG="_debug" +GTKDOC_FIXXREF="gtkdoc-fixxref" +GTKDOC_MKDB="gtkdoc-mkdb" +GTKDOC_MKHTML="gtkdoc-mkhtml" +GTKDOC_MKTMPL="gtkdoc-mktmpl" +GTKDOC_SCAN="gtkdoc-scan" +INSTALL="install -m 0644" +MKDIR="mkdir -p" +MODULE="$PACKAGE" +RM="rm -f" +TOUCH="touch" + + +#functions +#debug +_debug() +{ + echo $@ + $@ +} + + +#usage +_usage() +{ + echo "Usage: gtkdoc.sh [-i|-u][-P prefix] target" 1>&2 + return 1 +} + + +#main +install=0 +uninstall=0 +while getopts "iuP:" "name"; do + case "$name" in + i) + uninstall=0 + install=1 + ;; + u) + install=0 + uninstall=1 + ;; + P) + PREFIX="$2" + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $((OPTIND - 1)) +if [ $# -eq 0 ]; then + _usage + exit $? +fi + +[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" +instdir="$DATADIR/gtk-doc/html" + +while [ $# -gt 0 ]; do + target="$1" + shift + + #uninstall + if [ "$uninstall" -eq 1 ]; then + for i in gtkdoc/html/*.*; do + file="${i##*/}" + echo $DEBUG $RM "$instdir/$MODULE/$file" \ + || exit 2 + done + continue + fi + + #create + case "$target" in + gtkdoc/html.stamp) + $MKDIR "gtkdoc/html" && + (cd "gtkdoc/html" && + $DEBUG $GTKDOC_MKHTML "$MODULE" \ + "../$MODULE-docs.xml") && + (cd "gtkdoc" && + $DEBUG $GTKDOC_FIXXREF \ + --module="$MODULE" \ + --module-dir="html" \ + --html-dir="$instdir") + ;; + gtkdoc/sgml.stamp) + (cd "gtkdoc" && + $DEBUG $GTKDOC_MKDB \ + --module="$MODULE" \ + --output-dir="xml" \ + --output-format="xml" \ + --tmpl-dir="tmpl") + ;; + gtkdoc/tmpl.stamp) + (cd "gtkdoc" && + $DEBUG $GTKDOC_MKTMPL \ + --module="$MODULE" \ + --output-dir="tmpl") + ;; + gtkdoc/*.types) + (cd ".." && + $DEBUG $GTKDOC_SCAN \ + --module="$MODULE" \ + --source-dir="include" \ + --output-dir="doc/gtkdoc") + ;; + *) + echo "$0: $target: Unknown type" 1>&2 + exit 2 + ;; + esac + #XXX ignore errors + if [ $? -ne 0 ]; then + echo "$0: $target: Could not create documentation" 1>&2 + install=0 + fi + $TOUCH "$target" + + #install + if [ "$install" -eq 1 ]; then + $DEBUG $MKDIR "$instdir/$MODULE" || exit 2 + for i in gtkdoc/html/*.*; do + file="${i##*/}" + $DEBUG $INSTALL "$i" "$instdir/$MODULE/$file" \ + || exit 2 + done + fi +done diff --git a/doc/scripts/pkgconfig.sh b/doc/scripts/pkgconfig.sh new file mode 100755 index 0000000..28210bf --- /dev/null +++ b/doc/scripts/pkgconfig.sh @@ -0,0 +1,109 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2011 Pierre Pronchery +#All rights reserved. +# +#Redistribution and use in source and binary forms, with or without +#modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +#variables +PREFIX="/usr/local" +. "../config.sh" +DEBUG="_debug" +DEVNULL="/dev/null" +INSTALL="install -m 0644" +MKDIR="mkdir -p" +RM="rm -f" +SED="sed" + + +#functions +#debug +_debug() +{ + echo $@ + $@ +} + + +#usage +_usage() +{ + echo "Usage: pkgconfig.sh [-i|-u][-P prefix] target" 1>&2 + return 1 +} + + +#main +install=0 +uninstall=0 +while getopts iuP: name; do + case $name in + i) + uninstall=0 + install=1 + ;; + u) + install=0 + uninstall=1 + ;; + P) + PREFIX="$2" + ;; + ?) + _usage + exit $? + ;; + esac +done +shift $(($OPTIND - 1)) +if [ $# -eq 0 ]; then + _usage + exit $? +fi + +PKGCONFIG="$PREFIX/lib/pkgconfig" +while [ $# -gt 0 ]; do + target="$1" + shift + + #uninstall + if [ "$uninstall" -eq 1 ]; then + $DEBUG $RM -- "$PKGCONFIG/$target" || exit 2 + continue + fi + + #install + if [ "$install" -eq 1 ]; then + $DEBUG $MKDIR -- "$PKGCONFIG" || exit 2 + $DEBUG $INSTALL "$target" "$PKGCONFIG/$target" || exit 2 + continue + fi + + #create + $SED -e "s,PREFIX,$PREFIX," -e "s,VERSION,$VERSION," "$target.in" \ + > "$target" + if [ $? -ne 0 ]; then + $RM -- "$target" 2> "$DEVNULL" + exit 2 + fi +done diff --git a/doc/scripts/project.conf b/doc/scripts/project.conf new file mode 100644 index 0000000..d149e34 --- /dev/null +++ b/doc/scripts/project.conf @@ -0,0 +1,16 @@ +dist=Makefile,appbroker.sh,docbook.sh,gettext.sh,gtkdoc.sh,pkgconfig.sh + +[appbroker.sh] +install=$(PREFIX)/share/doc/configure/scripts + +[docbook.sh] +install=$(PREFIX)/share/doc/configure/scripts + +[gettext.sh] +install=$(PREFIX)/share/doc/configure/scripts + +[gtkdoc.sh] +install=$(PREFIX)/share/doc/configure/scripts + +[pkgconfig.sh] +install=$(PREFIX)/share/doc/configure/scripts diff --git a/project.conf b/project.conf index 06a2304..0598db6 100644 --- a/project.conf +++ b/project.conf @@ -4,3 +4,12 @@ config=h,sh subdirs=doc,src,tools dist=Makefile,AUTHORS,BUGS,CHANGES,COPYING,config.h,INSTALL,README + +[BUGS] +install=$(PREFIX)/share/doc/configure + +[CHANGES] +install=$(PREFIX)/share/doc/configure + +[README] +install=$(PREFIX)/share/doc/configure