aboutsummaryrefslogtreecommitdiff
path: root/resources/scripts/helpers/build
diff options
context:
space:
mode:
authorPaul Koenig <paukoen@gmail.com>2016-05-23 13:58:06 -0400
committerLeah Woods <info@minifree.org>2016-05-26 02:56:18 +0100
commitc6563ccc64050070b2c35a281c034a460dbae586 (patch)
treec9e1d788f833161e87d9f3bc22e7795d6eeaf299 /resources/scripts/helpers/build
parent4aca93689bfff1be7a6a5a5c623af75dc6ce621a (diff)
downloadlibrebootfr-c6563ccc64050070b2c35a281c034a460dbae586.tar.gz
librebootfr-c6563ccc64050070b2c35a281c034a460dbae586.zip
docs: build scripts
also update libreboot.texi to use absolute paths for references to images, logs, etc.
Diffstat (limited to 'resources/scripts/helpers/build')
-rwxr-xr-xresources/scripts/helpers/build/docs/alldocs29
-rwxr-xr-xresources/scripts/helpers/build/docs/clean7
-rwxr-xr-xresources/scripts/helpers/build/docs/dvi24
-rwxr-xr-xresources/scripts/helpers/build/docs/html26
-rwxr-xr-xresources/scripts/helpers/build/docs/html-by-section24
-rwxr-xr-xresources/scripts/helpers/build/docs/html-one-page21
-rwxr-xr-xresources/scripts/helpers/build/docs/index133
-rwxr-xr-xresources/scripts/helpers/build/docs/info23
-rwxr-xr-xresources/scripts/helpers/build/docs/pdf23
-rwxr-xr-xresources/scripts/helpers/build/docs/plaintext20
-rwxr-xr-xresources/scripts/helpers/build/docs/postscript22
-rwxr-xr-xresources/scripts/helpers/build/docs/texinfo-gz17
12 files changed, 369 insertions, 0 deletions
diff --git a/resources/scripts/helpers/build/docs/alldocs b/resources/scripts/helpers/build/docs/alldocs
new file mode 100755
index 00000000..3f82bdce
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/alldocs
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: alldocs
+#
+# The build script has an 'all' option which doesn't work
+# for docs--the html index needs to be built last.
+#
+
+script_dir="./resources/scripts/helpers/build/docs/"
+build_docs ()
+{
+ ${script_dir}$1
+ echo
+}
+
+# postscript and dvi are broken; need images in .eps format
+# pdf works at least on Trisquel
+build_docs clean
+build_docs html
+build_docs html-by-section
+build_docs html-one-page
+build_docs info
+build_docs plaintext
+build_docs pdf
+#build_docs postscript
+#build_docs dvi
+build_docs index
+
+
diff --git a/resources/scripts/helpers/build/docs/clean b/resources/scripts/helpers/build/docs/clean
new file mode 100755
index 00000000..c0525525
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/clean
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+basedir="docs/manual"
+
+echo "Cleaning $basedir..."
+if [ -d $basedir ]; then rm -Rf $basedir; fi
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/dvi b/resources/scripts/helpers/build/docs/dvi
new file mode 100755
index 00000000..77ae5900
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/dvi
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: dvi
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.dvi"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+# Options: quiet, clean (remove TeX compilation directory)
+# and expand macros using makeinfo
+texi2dvi -q -c -e -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Done."
+
+
diff --git a/resources/scripts/helpers/build/docs/html b/resources/scripts/helpers/build/docs/html
new file mode 100755
index 00000000..e2a88978
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/html
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: html-by-node
+#
+# Note: currently the manual generated by this script does
+# not display images correctly
+#
+# './build docs html' is short for ./build docs html-by-node
+# name the output accordingly for clarity
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basefile="`basename "$0"`-by-node"
+basedir="docs/manual/"
+outdir="${basedir}libreboot_${basefile}"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outdir..."
+makeinfo --html --no-warn --split=node -o $outdir $texinfo_src
+
+echo "Making $outdir.tar.gz..."
+tar -czf $outdir.tar.gz $outdir
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/html-by-section b/resources/scripts/helpers/build/docs/html-by-section
new file mode 100755
index 00000000..c5795c1c
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/html-by-section
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: html-by-section
+#
+# Note: currently the manual generated by this script does
+# not display images correctly
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basefile=`basename "$0"`
+basedir="docs/manual/"
+outdir="${basedir}libreboot_${basefile}"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outdir..."
+makeinfo --html --no-warn --split=section -o $outdir $texinfo_src
+
+echo "Making $outdir.tar.gz..."
+tar -czf $outdir.tar.gz $outdir
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/html-one-page b/resources/scripts/helpers/build/docs/html-one-page
new file mode 100755
index 00000000..7c4f0180
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/html-one-page
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: html-one-page
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basefile=`basename "$0"`
+basedir="docs/manual/"
+outfile="${basedir}libreboot_${basefile}.html"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+makeinfo --html --no-warn --no-split -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/index b/resources/scripts/helpers/build/docs/index
new file mode 100755
index 00000000..c8f10bf7
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/index
@@ -0,0 +1,133 @@
+#!/bin/sh -e
+
+# Libreboot documentation build script: index
+#
+# This script borrows from gendocs.sh, part of gnulib, the GNU
+# Portability Library (https://www.gnu.org/software/gnulib/). The
+# objective is to generate a html document which indexes the libreboot
+# documentation in its various formats.
+#
+# This script does not assume a certain set of formats have been
+# generated. It generates the index based on which files are located
+# in $man_dir.
+
+# The relevant portion of gendocs.sh:
+#
+# curdate=`$SETLANG date '+%B %d, %Y'`
+# sed \
+# -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
+# -e "s!%%EMAIL%%!$EMAIL!g" \
+# -e "s!%%PACKAGE%%!$PACKAGE!g" \
+# -e "s!%%DATE%%!$curdate!g" \
+# -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
+# -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
+# -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
+# -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
+# -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
+# -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
+# -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
+# -e "s!%%PDF_SIZE%%!$pdf_size!g" \
+# -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
+# -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
+# -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
+# -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
+# -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
+# -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
+# -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
+# -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
+# -e "s,%%SCRIPTURL%%,$scripturl,g" \
+# -e "s!%%SCRIPTNAME%%!$prog!g" \
+# -e "$CONDS" \
+# $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
+
+# TODO: Implement total size for directories (see e.g.
+# http://www.gnu.org/software/findutils/manual/find.html)
+
+man_dir="docs/manual/"
+template_dir="docs/templates/"
+pkg_title="GNU Libreboot manual"
+pkg_email="example@libreboot.org" #sample
+pkg_name="libreboot"
+curdate=`date '+%B %d, %Y'`
+
+# FUNCTION COPIED FROM gendocs.sh
+# Function to return size of $1 in something resembling kilobytes.
+calcsize()
+{
+ size=`ls -ksl $1 | awk '{print $1}'`
+ echo $size
+}
+# END FUNCTION COPIED FROM gendocs.sh
+
+concat_index()
+{
+ if [ -e $man_dir$1 ]; then
+ if [ -d $man_dir$1 ]; then
+ echo "<li><a href=\"$1/index.html\">$2</a>$3</li>" >> "${man_dir}index.html"
+ else
+ echo "<li><a href=\"$1\">$2</a>$3</li>" >> "${man_dir}index.html"
+ fi
+ fi
+}
+
+echo "Building index..."
+
+sed \
+ -e "s!%%TITLE%%!$pkg_title!g" \
+ -e "s!%%PACKAGE%%!$pkg_name!g" \
+ -e "s!%%DATE%%!$curdate!g" \
+${template_dir}gendocs_template_header >"${man_dir}index.html"
+
+for i in $(ls $man_dir); do
+ [ -d $man_dir$i ] || size=`calcsize "${man_dir}${i}"`
+ case $i in
+ ${pkg_name}.dvi.gz)
+ dvi_gz_size=$size;;
+ ${pkg_name}_html-by-node.tar.gz)
+ html_node_tgz_size=$size;;
+ ${pkg_name}_html-by-section.tar.gz)
+ html_section_tgz_size=$size;;
+ ${pkg_name}_html-one-page.html)
+ html_mono_size=$size;;
+ ${pkg_name}_html-one-page.html.gz)
+ html_mono_gz_size=$size;;
+ ${pkg_name}.info.gz)
+ info_gz_size=$size;;
+ ${pkg_name}.pdf)
+ pdf_size=$size;;
+ ${pkg_name}.pdf.gz)
+ pdf_gz_size=$size;;
+ ${pkg_name}.ps)
+ ps_size=$size;;
+ ${pkg_name}.ps.gz)
+ ps_gz_size=$size;;
+ ${pkg_name}.txt)
+ plaintext_size=$size;;
+ ${pkg_name}.txt.gz)
+ plaintext_gz_size=$size;;
+ ${pkg_name}.texi.gz)
+ texinfo_gz_size=$size;;
+ *)
+ :;; # if a directory, do nothing (see TODO)
+ esac
+done
+
+concat_index "${pkg_name}_html-one-page.html" "HTML (${html_mono_size}K bytes)" " - entirely on one web page."
+concat_index "${pkg_name}_html-by-node" "HTML" " - with one web page per node."
+concat_index "${pkg_name}_html-by-section" "HTML" " - with one web page per section."
+concat_index "${pkg_name}_html-one-page.html.gz" "HTML compressed (${html_mono_gz_size}K gzipped characters)" " - entirely on one web page."
+concat_index "${pkg_name}_html-by-node.tar.gz" "HTML (${html_node_tgz_size}K gzipped tar file)" " - with one web page per node."
+concat_index "${pkg_name}_html-by-section.tar.gz" "HTML (${html_section_tgz_size}K gzipped tar file)" " - with one web page per section."
+concat_index "${pkg_name}.info.gz" "Info document (${info_gz_size}K bytes gzipped)."
+concat_index "${pkg_name}.txt" "ASCII text (${plaintext_size}K bytes)."
+concat_index "${pkg_name}.txt.gz" "ASCII text (${plaintext_gz_size}K bytes gzipped)."
+concat_index "${pkg_name}.dvi.gz" "TeX dvi file (${dvi_gz_size}K bytes gzipped)."
+concat_index "${pkg_name}.pdf" "PDF file (${pdf_size}K bytes)."
+concat_index "${pkg_name}.pdf.gz" "PDF file compressed (${pdf_gz_size}K bytes gzipped)."
+concat_index "${pkg_name}.ps" "Postscript file (${ps_size}K bytes)."
+concat_index "${pkg_name}.ps.gz" "Postscript file compressed (${ps_gz_size}K bytes gzipped)."
+concat_index "${pkg_name}.texi.gz" "Texinfo source (${texinfo_gz_size}K bytes gzipped)."
+
+sed -e "s!%%EMAIL%%!$pkg_email!g" ${template_dir}gendocs_template_footer >>"$man_dir/index.html"
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/info b/resources/scripts/helpers/build/docs/info
new file mode 100755
index 00000000..d3be299b
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/info
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: info
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.info"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+makeinfo --no-warn --no-split -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Removing $outfile..."
+rm -f $outfile
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/pdf b/resources/scripts/helpers/build/docs/pdf
new file mode 100755
index 00000000..c4c2e7c0
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/pdf
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: pdf
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.pdf"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+# Options: quiet, clean (remove TeX compilation directory)
+# and expand macros using makeinfo
+texi2dvi -q -c -e -p -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Done."
+
diff --git a/resources/scripts/helpers/build/docs/plaintext b/resources/scripts/helpers/build/docs/plaintext
new file mode 100755
index 00000000..4f15ff70
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/plaintext
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: plaintext
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.txt"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+makeinfo --no-warn --no-split --plaintext -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/postscript b/resources/scripts/helpers/build/docs/postscript
new file mode 100755
index 00000000..eb754e40
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/postscript
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: postscript
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.ps"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Writing manual: $outfile..."
+# Options: quiet, clean (remove TeX compilation directory)
+# and expand macros using makeinfo
+texi2dvi -q -c -e --ps -o $outfile $texinfo_src
+
+echo "Making $outfile.gz..."
+gzip -f -9 -c $outfile > $outfile.gz
+
+echo "Done."
diff --git a/resources/scripts/helpers/build/docs/texinfo-gz b/resources/scripts/helpers/build/docs/texinfo-gz
new file mode 100755
index 00000000..aaf88834
--- /dev/null
+++ b/resources/scripts/helpers/build/docs/texinfo-gz
@@ -0,0 +1,17 @@
+#!/bin/sh -e
+#
+# Libreboot documentation build script: texinfo-gz
+#
+
+echo "@set librebootbase `pwd`" > docs/constants.texi
+
+basedir="docs/manual/"
+outfile="${basedir}libreboot.texi.gz"
+texinfo_src="docs/libreboot.texi"
+
+[ -d docs/manual ] || mkdir docs/manual
+
+echo "Making $outfile..."
+gzip -f -9 -c $texinfo_src > $outfile
+
+echo "Done."