Initial import

This commit is contained in:
Pierre Pronchery 2012-05-17 23:18:49 +00:00
commit b0cf8c1b63
8 changed files with 241 additions and 0 deletions

38
Makefile Normal file
View File

@ -0,0 +1,38 @@
PACKAGE = DMP
VERSION = 0.0.0
SUBDIRS = doc
RM ?= rm -f
LN ?= ln -f
TAR ?= tar -czvf
all: subdirs
subdirs:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done
clean:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
distclean:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) distclean) || exit; done
dist:
$(RM) -r -- $(PACKAGE)-$(VERSION)
$(LN) -s -- . $(PACKAGE)-$(VERSION)
@$(TAR) $(PACKAGE)-$(VERSION).tar.gz -- \
$(PACKAGE)-$(VERSION)/doc/Makefile \
$(PACKAGE)-$(VERSION)/doc/manual/manual.xml \
$(PACKAGE)-$(VERSION)/doc/manual/manual.xsl \
$(PACKAGE)-$(VERSION)/doc/project.conf \
$(PACKAGE)-$(VERSION)/Makefile \
$(PACKAGE)-$(VERSION)/project.conf
$(RM) -- $(PACKAGE)-$(VERSION)
install:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done
uninstall:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done
.PHONY: all subdirs clean distclean dist install uninstall

5
config.sh Normal file
View File

@ -0,0 +1,5 @@
PACKAGE="DMP"
VERSION="0.0.0"
PREFIX="/usr/local"
LIBDIR="${PREFIX}/lib"

25
doc/Makefile Normal file
View File

@ -0,0 +1,25 @@
TARGETS = manual/manual.html
PREFIX = /usr/local
DESTDIR =
RM ?= rm -f
LN ?= ln -f
MKDIR ?= mkdir -p
INSTALL ?= install
all: $(TARGETS)
manual/manual.html: manual/manual.xml manual/manual.xsl ../config.sh
./docbook.sh -P "$(PREFIX)" -- "manual/manual.html"
clean:
$(RM) -- $(manual/manual.html_OBJS)
distclean: clean
$(RM) -- $(TARGETS)
install: $(TARGETS)
uninstall:
.PHONY: all clean distclean install uninstall

129
doc/docbook.sh Executable file
View File

@ -0,0 +1,129 @@
#!/bin/sh
#$Id$
#Copyright (c) 2012 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:
#
# * 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 --xinclude"
#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"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
instdir="$DATADIR/doc/$ext/$PACKAGE"
;;
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
$RM -- "$target"
break
fi
#install
if [ "$install" -eq 1 ]; then
$DEBUG $MKDIR -- "$instdir" || exit 2
$DEBUG $INSTALL -- "$target" "$instdir/$target" || exit 2
fi
done

27
doc/manual/manual.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY configure1 "../../../../../Apps/Devel/src/configure/doc/configure.xml">
<!ENTITY makepasswd1 "../../../../../Apps/Unix/src/makepasswd/doc/makepasswd.xml">
<!ENTITY projectconf5 "../../../../../Apps/Devel/src/configure/doc/project.conf.xml">
]>
<book><?dbhtml filename="manual.html"?>
<title>DeforaOS Manual Pages</title>
<chapter>
<title>For users</title>
<section>
<title>Unix utilities</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="&makepasswd1;"/>
</section>
</chapter>
<chapter>
<title>For developers</title>
<section>
<title>configure build system</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="&configure1;"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="&projectconf5;"/>
</section>
</chapter>
</book>
<!-- vim: set noet ts=1 sw=1 sts=1 tw=80: -->

4
doc/manual/manual.xsl Normal file
View File

@ -0,0 +1,4 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
</xsl:stylesheet>

7
doc/project.conf Normal file
View File

@ -0,0 +1,7 @@
targets=manual/manual.html
dist=Makefile,manual/manual.xml,manual/manual.xsl
[manual/manual.html]
type=script
script=./docbook.sh
depends=manual/manual.xml,manual/manual.xsl,../config.sh

6
project.conf Normal file
View File

@ -0,0 +1,6 @@
package=DMP
version=0.0.0
config=sh
subdirs=doc
dist=Makefile