aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Yamin <plasmaroo@gentoo.org>2006-02-20 14:23:21 +0000
committerTim Yamin <plasmaroo@gentoo.org>2006-02-20 14:23:21 +0000
commit64c84bfc95d60bb4aa7f29b7ad3769c0572f164a (patch)
tree5d98ee25a8f4f84e1cc6d46c3990d00a27339ee6
parentSet up basic repo structure (diff)
downloaddevmanual-64c84bfc95d60bb4aa7f29b7ad3769c0572f164a.tar.gz
devmanual-64c84bfc95d60bb4aa7f29b7ad3769c0572f164a.tar.bz2
devmanual-64c84bfc95d60bb4aa7f29b7ad3769c0572f164a.zip
Initial commit :)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/devmanual/trunk@2 176d3534-300d-0410-8db8-84e73ed771c3
-rw-r--r--Makefile11
-rw-r--r--devbook.xsl721
-rw-r--r--ebuild-writing/ebuild-functions/src_unpack/epatch/text.xml13
-rw-r--r--ebuild-writing/ebuild-functions/src_unpack/text.xml14
-rw-r--r--ebuild-writing/ebuild-functions/text.xml14
-rw-r--r--ebuild-writing/text.xml14
-rw-r--r--general-concepts/autotools/diagram.pngbin0 -> 41702 bytes
-rw-r--r--general-concepts/autotools/diagram.svg102
-rw-r--r--general-concepts/autotools/text.xml53
-rw-r--r--general-concepts/config-protect/text.xml437
-rw-r--r--general-concepts/text.xml16
-rw-r--r--quickstart/text.xml437
-rw-r--r--str.tokenize.function.xsl91
-rw-r--r--text.xml33
14 files changed, 1956 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..59b6297
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+all: transform
+
+clean:
+ @find -name "index.html" | xargs rm
+
+transform:
+ @for file in $$(find -name text.xml) ; do \
+ htmlfile=$${file/text.xml/index.html} ; \
+ echo "Processing $${file} --> $${htmlfile}" ; \
+ xsltproc devbook.xsl $$file > $$htmlfile ; \
+ done
diff --git a/devbook.xsl b/devbook.xsl
new file mode 100644
index 0000000..6d22736
--- /dev/null
+++ b/devbook.xsl
@@ -0,0 +1,721 @@
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exslt="http://exslt.org/common"
+ extension-element-prefixes="str exslt xsl"
+ exclude-result-prefixes="str exslt xsl">
+
+<xsl:import href="str.tokenize.function.xsl"/>
+<xsl:output method="html" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/>
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:variable name="variable-start">${</xsl:variable>
+<xsl:variable name="variable-end">}</xsl:variable>
+
+<xsl:variable name="shellstatement-start">$(</xsl:variable>
+<xsl:variable name="shellstatement-end">)</xsl:variable>
+
+<xsl:variable name="commentChar">#</xsl:variable>
+ <xsl:template name="highlight-subtokenate">
+ <xsl:param name="data"/>
+ <xsl:choose>
+ <!-- Tokenate variables in the form ${...} -->
+ <xsl:when test="contains($data, '${')">
+ <!-- Tokenate anything before it... -->
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring-before($data, $variable-start)"/>
+ </xsl:call-template>
+ <xsl:variable name="data-slack" select="substring-after($data, $variable-start)"/>
+ <xsl:variable name="variable-name" select="substring-before($data-slack, $variable-end)"/>
+ <span class="Identifier">${<xsl:value-of select="$variable-name"/>}</span>
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring-after($data, $variable-end)"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="contains($data, '$(')">
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring-before($data, '$(')"/>
+ </xsl:call-template>
+ <span class="PreProc">$(</span>
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring-after($data, '$(')"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="substring($data, string-length($data)) = ')'">
+ <xsl:value-of select="substring($data, 1, string-length($data)-1)"/><span class="PreProc">)</span>
+ </xsl:when>
+
+ <!-- This must go before the other quote matchers -->
+ <xsl:when test="$data = '&quot;'">
+ <span class="Statement">&quot;</span>
+ </xsl:when>
+
+ <xsl:when test="substring($data, 1, 1) = '&quot;' and substring($data, string-length($data)) = '&quot;'">
+ <span class="Statement">&quot;</span>
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring($data, 2, string-length($data)-2)"/>
+ </xsl:call-template>
+ <span class="Statement">&quot;</span>
+ </xsl:when>
+
+ <xsl:when test="substring($data, 1, 1) = '&quot;'">
+ <span class="Statement">&quot;</span>
+ <xsl:value-of select="substring($data, 2)"/>
+ </xsl:when>
+
+ <xsl:when test="substring($data, string-length($data)) = '&quot;'">
+ <xsl:value-of select="substring($data, 0, string-length($data))"/>
+ <span class="Statement">&quot;</span>
+ </xsl:when>
+
+ <!-- Functioney highlighing -->
+ <!-- Default keywords -->
+ <xsl:when test="$data = 'use' or $data = 'has_version' or $data = 'best_version' or $data = 'use_with' or $data = 'use_enable' or
+ $data = 'check_KV' or $data = 'keepdir' or $data = 'econf' or $data = 'die' or $data = 'einstall' or $data = 'einfo' or
+ $data = 'ewarn' or $data = 'eerror' or $data = 'diropts' or $data = 'dobin' or $data = 'docinto' or $data = 'dodoc' or
+ $data = 'doexe' or $data = 'dohard' or $data = 'dohtml' or $data = 'doinfo' or $data = 'doins' or $data = 'dolib' or
+ $data = 'dolib$dataa' or $data = 'dolib$dataso' or $data = 'doman' or $data = 'dosbin' or $data = 'dosym' or $data = 'emake' or
+ $data = 'exeinto' or $data = 'exeopts' or $data = 'fowners' or $data = 'fperms' or $data = 'insinto' or $data = 'insopts' or
+ $data = 'into' or $data = 'libopts' or $data = 'newbin' or $data = 'newexe' or $data = 'newins' or $data = 'newman' or
+ $data = 'newsbin' or $data = 'prepall' or $data = 'prepalldocs' or $data = 'prepallinfo' or $data = 'prepallman' or
+ $data = 'prepallstrip' or $data = 'has' or $data = 'unpack' or $data = 'dopython' or $data = 'dosed' or $data = 'into' or
+ $data = 'doinitd' or $data = 'doconfd' or $data = 'doenvd' or $data = 'dojar' or $data = 'domo' or $data = 'dodir' or
+ $data = 'ebegin' or $data = 'eend' or $data = 'newconfd' or $data = 'newdoc' or $data = 'newenvd' or $data = 'newinitd' or
+ $data = 'newlib$dataa' or $data = 'newlib$dataso' or $data = 'hasq' or $data = 'hasv' or $data = 'useq' or $data = 'usev'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- Sandbox -->
+ <xsl:when test="$data = 'addread' or $data = 'addwrite' or $data = 'adddeny' or $data = 'addpredict'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- Recognised functions -->
+ <xsl:when test="$data = 'pkg_nofetch' or $data = 'pkg_setup' or $data = 'src_unpack' or $data = 'src_compile' or $data = 'src_test' or
+ $data = 'src_install' or $data = 'pkg_preinst' or $data = 'pkg_postinst' or $data = 'pkg_prerm' or $data = 'pkg_postrm' or
+ $data = 'pkg_config'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- Inherit -->
+ <xsl:when test="$data = 'inherit'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- eutils -->
+ <xsl:when test="$data = 'gen_usr_ldscript' or $data = 'draw_line' or $data = 'epatch' or $data = 'have_NPTL' or $data = 'get_number_of_jobs' or
+ $data = 'egetent' or $data = 'emktemp' or $data = 'enewuser' or $data = 'enewgroup' or $data = 'edos2unix' or
+ $data = 'make_desktop_entry' or $data = 'unpack_pdv' or $data = 'unpack_makeself' or $data = 'check_license' or
+ $data = 'cdrom_get_cds' or $data = 'cdrom_load_next' or $data = 'cdrom_locate_file_on_cd' or $data = 'strip-linguas' or
+ $data = 'epause' or $data = 'ebeep' or $data = 'built_with_use' or $data = 'make_session_desktop' or $data = 'domenu' or
+ $data = 'doicon' or $data = 'find_unpackable_file' or $data = 'unpack_pdv' or $data = 'set_arch_to_kernel' or
+ $data = 'set_arch_to_portage' or $data = 'preserve_old_lib' or $data = 'preserve_old_lib_notify' or $data = 'built_with_use' or
+ $data = 'epunt_cxx' or $data = 'dopamd' or $data = 'newpamd' or $data = 'make_wrapper'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- flag-o-matic -->
+ <xsl:when test="$data = 'setup-allowed-flags' or $data = 'filter-flags' or $data = 'filter-lfs-flags' or $data = 'append-lfs-flags' or
+ $data = 'append-flags' or $data = 'replace-flags' or $data = 'replace-cpu-flags' or $data = 'is-flag' or $data = 'filter-mfpmath' or
+ $data = 'strip-flags' or $data = 'test_flag' or $data = 'test_version_info' or $data = 'strip-unsupported-flags' or
+ $data = 'get-flag' or $data = 'has_hardened' or $data = 'has_pic' or $data = 'has_pie' or $data = 'has_ssp_all' or $data = 'has_ssp' or
+ $data = 'has_m64' or $data = 'has_m32' or $data = 'replace-sparc64-flags' or $data = 'append-ldflags' or $data = 'filter-ldflags' or
+ $data = 'fstack-flags' or $data = 'gcc2-flags'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- gcc -->
+ <xsl:when test="$data = 'gcc-getCC' or $data = 'gcc-getCXX' or $data = 'gcc-fullversion' or $data = 'gcc-version' or
+ $data = 'gcc-major-version' or $data = 'gcc-minor-version' or $data = 'gcc-micro-version' or
+ $data = 'gcc-libpath' or $data = 'gcc-libstdcxx-version' or $data = 'gcc-libstdcxx-major-version' or
+ $data = 'gcc2-flags'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- libtool -->
+ <xsl:when test="$data = 'elibtoolize' or $data = 'uclibctoolize' or $data = 'darwintoolize'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- fixheadtails -->
+ <xsl:when test="$data = 'ht_fix_file' or $data = 'ht_fix_all'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- fdo-mime -->
+ <xsl:when test="$data = 'fdo-mime_desktop_database_update' or $data = 'fdo-mime_mime_database_update'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- webapp -->
+ <xsl:when test="$data = 'webapp_checkfileexists' or $data = 'webapp_import_config' or $data = 'webapp_strip_appdir' or
+ $data = 'webapp_strip_d' or $data = 'webapp_strip_cwd' or $data = 'webapp_configfile' or $data = 'webapp_hook_script' or
+ $data = 'webapp_postinst_txt' or $data = 'webapp_postupgrade_txt' or $data = 'webapp_runbycgibin' or
+ $data = 'webapp_serverowned' or $data = 'webapp_server_configfile' or $data = 'webapp_sqlscript' or
+ $data = 'webapp_src_install' or $data = 'webapp_pkg_postinst' or $data = 'webapp_pkg_setup' or
+ $data = 'webapp_getinstalltype' or $data = 'webapp_src_preinst' or $data = 'webapp_pkg_prerm'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- versionator -->
+ <xsl:when test="$data = 'get_all_version_components' or $data = 'version_is_at_least' or $data = 'get_version_components' or
+ $data = 'get_major_version' or $data = 'get_version_component_range' or $data = 'get_after_major_version' or
+ $data = 'replace_version_separator' or $data = 'replace_all_version_separators' or $data = 'delete_version_separator' or
+ $data = 'delete_all_version_separators'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- cvs -->
+ <xsl:when test="$data = 'cvs_fetch' or $data = 'cvs_src_unpack'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- bash-completion -->
+ <xsl:when test="$data = 'dobashcompletion' or $data = 'bash-completion_pkg_postinst'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- vim-plugin -->
+ <xsl:when test="$data = 'vim-plugin_src_install' or $data = 'vim-plugin_pkg_postinst' or $data = 'vim-plugin_pkg_postrm' or
+ $data = 'update_vim_afterscripts' or $data = 'display_vim_plugin_help'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- vim-doc -->
+ <xsl:when test="update_vim_helptags">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- multilib -->
+ <xsl:when test="$data = 'has_multilib_profile' or $data = 'get_libdir' or $data = 'get_multilibdir' or $data = 'get_libdir_override' or
+ $data = 'get_abi_var' or $data = 'get_abi_CFLAGS' or $data = 'get_abi_LDFLAGS' or
+ $data = 'get_abi_CHOST' or $data = 'get_abi_FAKE_TARGETS' or $data = 'get_abi_CDEFINE' or
+ $data = 'get_abi_LIBDIR' or $data = 'get_install_abis ' or $data = 'get_all_abis' or $data = 'get_all_libdirs' or
+ $data = 'is_final_abi' or $data = 'number_abis' or $data = 'get_ml_incdir' or $data = 'prep_ml_includes' or
+ $data = 'create_ml_includes' or $data = 'create_ml_includes-absolute' or $data = 'create_ml_includes-tidy_path' or
+ $data = 'create_ml_includes-listdirs' or $data = 'create_ml_includes-makedestdirs' or $data = 'create_ml_includes-allfiles' or
+ $data = 'create_ml_includes-sym_for_dir'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- toolchain-funcs -->
+ <xsl:when test="$data = 'tc-getPROG' or $data = 'tc-getAR' or $data = 'tc-getAS' or $data = 'tc-getCC' or $data = 'tc-getCXX' or $data = 'tc-getLD' or $data = 'tc-getNM' or
+ $data = 'tc-getRANLIB' or $data = 'tc-getF77' or $data = 'tc-getGCJ' or $data = 'tc-getBUILD_CC' or
+ $data = 'tc-export' or $data = 'ninj' or $data = 'tc-is-cross-compiler' or $data = 'tc-ninja_magic_to_arch' or
+ $data = 'tc-arch-kernel' or $data = 'tc-arch' or $data = 'tc-endian' or $data = 'gcc-fullversion' or
+ $data = 'gcc-version' or $data = 'gcc-major-version' or $data = 'gcc-minor-version' or $data = 'gcc-micro-version'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- cron -->
+ <xsl:when test="$data = 'docrondir' or $data = 'docron' or $data = 'docrontab' or $data = 'cron_pkg_postinst'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- games -->
+ <xsl:when test="$data = 'egamesconf' or $data = 'egamesinstall' or $data = 'gameswrapper' or $data = 'dogamesbin' or $data = 'dogamessbin' or $data = 'dogameslib' or
+ $data = 'dogameslib$dataa' or $data = 'dogameslib$dataso' or $data = 'newgamesbin' or $data = 'newgamessbin' or
+ $data = 'gamesowners' or $data = 'gamesperms' or $data = 'prepgamesdirs' or $data = 'gamesenv' or $data = 'games_pkg_setup' or
+ $data = 'games_src_compile' or $data = 'games_pkg_postinst' or $data = 'games_ut_unpack' or $data = 'games_umod_unpack' or
+ $data = 'games_make_wrapper'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- subversion -->
+ <xsl:when test="$data = 'subversion_svn_fetch' or $data = 'subversion_bootstrap' or $data = 'subversion_src_unpack'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- alternatives -->
+ <xsl:when test="$data = 'alternatives_auto_makesym' or $data = 'alternatives_makesym' or $data = 'alternatives_pkg_postinst' or
+ $data = 'alternatives_pkg_postrm'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- rpm -->
+ <xsl:when test="$data = 'rpm_unpack' or $data = 'rpm_src_unpack'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- python -->
+ <xsl:when test="$data = 'python_version' or $data = 'python_tkinter_exists' or $data = 'python_mod_exists' or $data = 'python_mod_compile' or
+ $data = 'python_mod_optimize' or $data = 'python_mod_cleanup' or $data = 'python_makesym' or $data = 'python_disable_pyc' or
+ $data = 'python_enable_pyc'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- check-kernel -->
+ <xsl:when test="$data = 'check_version_h' or $data = 'get_KV_info' or $data = 'is_2_4_kernel' or $data = 'is_2_5_kernel' or $data = 'is_2_6_kernel' or
+ $data = 'kernel_supports_modules'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- perl-module -->
+ <xsl:when test="$data = 'perl-module_src_prep' or $data = 'perl-module_src_compile' or $data = 'perl-module_src_test' or
+ $data = 'perl-module_src_install' or $data = 'perl-module_pkg_setup' or $data = 'perl-module_pkg_preinst' or
+ $data = 'perl-module_pkg_postinst' or $data = 'perl-module_pkg_prerm' or $data = 'perl-module_pkg_postrm' or
+ $data = 'perlinfo' or $data = 'fixlocalpod' or $data = 'updatepod'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- distutils -->
+ <xsl:when test="$data = 'distutils_src_compile' or $data = 'distutils_src_install' or $data = 'distutils_pkg_postrm' or
+ $data = 'distutils_pkg_postinst' or $data = 'distutils_python_version' or $data = 'disutils_python_tkinter'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- depend$dataapache -->
+ <xsl:when test="$data = 'need_apache' or $data = 'need_apache1' or $data = 'need_apache2'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- apache-module -->
+ <xsl:when test="$data = 'apache-module_pkg_setup' or $data = 'apache-module_src_compile' or
+ $data = 'apache-module_src_install' or $data = 'apache-module_pkg_postinst' or $data = 'acache_cd_dir' or
+ $data = 'apache_mod_file' or $data = 'apache_doc_magic' or $data = 'apache1_src_compile' or $data = 'apache1_src_install' or
+ $data = 'apache1_pkg_postinst' or $data = 'apache2_pkg_setup' or $data = 'apache2_src_compile' or
+ $data = 'apache1_src_install' or $data = 'apache2_pkg_postinst'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- pam -->
+ <xsl:when test="$data = 'dopamd' or $data = 'newpamd' or $data = 'dopamsecurity' or $data = 'newpamsecurity' or $data = 'getpam_mod_dir' or
+ $data = 'dopammod' or $data = 'newpammod' or $data = 'pamd_mimic_system'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- virtualx -->
+ <xsl:when test="$data = 'virtualmake' or $data = 'Xmake' or $data = 'Xemake' or $data = 'Xeconf'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- gnome2 -->
+ <xsl:when test="$data = 'gnome2_src_configure' or $data = 'gnome2_src_compile' or $data = 'gnome2_src_install' or
+ $data = 'gnome2_gconf_install' or $data = 'gnome2_gconf_uninstal' or $data = 'gnome2_omf_fix' or
+ $data = 'gnome2_scrollkeeper_update' or $data = 'gnome2_pkg_postinst' or $data = 'gnome2_pkg_postrm'">
+ <span class="Statement"><xsl:value-of select="$data"/></span>
+ </xsl:when>
+
+ <!-- No match return -->
+ <xsl:otherwise>
+ <highlight-nomatch-sub><xsl:value-of select="$data"/></highlight-nomatch-sub>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-tokenate">
+ <xsl:param name="data"/>
+
+ <!-- Only tokenize spaces, this way we preserve tabs. -->
+ <xsl:variable name="tokenizedData" select="str:tokenize_plasmaroo($data, ' ')"/>
+
+ <!-- Scan for comments. If a comment is found then this is a positional
+ index that is non-zero that refers to the last node that is not
+ a comment. -->
+ <xsl:variable name="commentSeeker" select="count(str:tokenize_plasmaroo(substring-before($data, $commentChar)))"/>
+
+ <xsl:for-each select="exslt:node-set($tokenizedData)">
+ <xsl:variable name="myPos" select="position()"/>
+ <xsl:choose>
+ <!-- See if we should be processing comments by now; we need to test for
+ two possible cases: * commentSeeker != 0 (so we have a comment), or,
+ * the first token is a "#" -->
+ <xsl:when test="($commentSeeker != 0 and position() > $commentSeeker) or substring(../*[position()=1], 1, 1) = $commentChar">
+ <span class="Comment"><xsl:value-of select="."/></span>
+ </xsl:when>
+
+ <!-- Highlight functions;
+ @token_regexp = [^\w]+()
+ @pos = 1 -->
+ <xsl:when test="position() = 1 and substring(., string-length(.)-1) = '()'">
+ <span class="Special"><xsl:value-of select="."/></span>
+ </xsl:when>
+
+ <!-- Highlight variable assignments;
+ @regexp = [\w]=["']{...}['"] -->
+ <xsl:when test="contains(., '=')">
+ <span class="Identifier"><xsl:value-of select="substring-before(., '=')"/></span>
+ <span class="Constant">=</span>
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="substring-after(., '=')"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test=". = '{' or . = '}' or . = '\' or . = '(' or . = '#'">
+ <span class="PreProc"><xsl:value-of select="."/></span>
+ </xsl:when>
+
+ <xsl:when test=". = '||' or . = '&amp;&amp;'">
+ <span class="Statement"><xsl:value-of select="."/></span>
+ </xsl:when>
+
+ <!-- No match return -->
+ <xsl:otherwise>
+ <xsl:call-template name="highlight-subtokenate">
+ <xsl:with-param name="data" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- <xsl:text> </xsl:text> -->
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <h1><xsl:value-of select="title"/></h1>
+ <xsl:apply-templates select="(body|section)"/>
+ </xsl:template>
+
+ <xsl:template match="section">
+ <div class="section">
+ <h2><xsl:value-of select="title"/></h2>
+ <xsl:apply-templates select="(body|subsection)"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="subsection">
+ <div class="section">
+ <h3><xsl:value-of select="title"/></h3>
+ <xsl:apply-templates select="(body|subsection)"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="body">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="p">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <!-- FIXME: Handle lang=... -->
+ <xsl:template match="codesample">
+ <pre><span class="Constant">
+ <xsl:for-each select="str:tokenize_plasmaroo(., $newline)">
+ <xsl:choose>
+ <xsl:when test=". = $newline and position() = 1"/>
+ <xsl:when test=". = $newline"><xsl:value-of select='$newline'/></xsl:when>
+ <xsl:otherwise>
+ <!-- <xsl:if test="position() != 1"><xsl:value-of select='$newline'/></xsl:if> -->
+ <xsl:call-template name="highlight-tokenate">
+ <xsl:with-param name="data" select="."/>
+ </xsl:call-template>
+ <!-- <xsl:value-of select='.'/> -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </span></pre>
+ </xsl:template>
+
+ <xsl:template match="figure">
+ <div class="figure">
+ <div class="image"><img alt="{@short}" src="{@link}"/></div>
+ <p class="caption"><xsl:value-of select="."/></p>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="li">
+ <li><xsl:apply-templates/></li>
+ </xsl:template>
+
+ <xsl:template match="ol">
+ <ol><xsl:apply-templates/></ol>
+ </xsl:template>
+
+ <xsl:template match="ul">
+ <ul><xsl:apply-templates/></ul>
+ </xsl:template>
+
+ <xsl:template match="important">
+ <div class="important">
+ <p class="first admonition-title">Important</p>
+ <p class="last"><xsl:apply-templates/></p>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="note">
+ <div class="note">
+ <p class="first admonition-title">Note</p>
+ <p class="last"><xsl:apply-templates/></p>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="todo">
+ <div class="todo">
+ <p class="first admonition-title">Todo</p>
+ <p class="last"><xsl:apply-templates/></p>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="warning">
+ <div class="warning">
+ <p class="first admonition-title">Warning</p>
+ <p class="last"><xsl:apply-templates/></p>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="b">
+ <b><xsl:apply-templates/></b>
+ </xsl:template>
+
+ <xsl:template match="e">
+ <i><xsl:apply-templates/></i>
+ </xsl:template>
+
+ <xsl:template match="c">
+ <code class="docutils literal"><span class="pre"><xsl:apply-templates/></span></code>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Gentoo Development Guide</title>
+ <link rel="stylesheet" href="http://dev.gentoo.org/~plasmaroo/devmanual/styles/devmanual.css" type="text/css" />
+ </head>
+ <body>
+ <div class="main">
+ <h1>Gentoo Development Guide</h1>
+ <div class="navtop" style="text-align: center;">
+ <table style="border-top: 1px dashed #330066; margin-left: auto; margin-right: auto;
+ width: 100%;">
+
+ <col width="33%" />
+ <col width="34%" />
+ <col width="33%" />
+ <tr>
+ <td style="text-align: center; border-right: 1px dashed #330066;">&#x2190; <xsl:call-template name="findPrevious"/></td>
+ <td style="text-align: center;">&#x2191; <xsl:call-template name="findParent"/> &#x2191;</td>
+ <td style="text-align: center; border-left: 1px dashed #330066;"><xsl:call-template name="findNext"/> &#x2192;</td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="document">
+ <xsl:apply-templates/>
+ </div>
+
+ <div class="navtop" style="text-align: center;">
+ <table style="border-top: 1px dashed #330066; margin-left: auto; margin-right: auto;
+ width: 100%;">
+
+ <col width="33%" />
+ <col width="34%" />
+ <col width="33%" />
+ <tr>
+ <td style="text-align: center; border-right: 1px dashed #330066;">&#x2190; <xsl:call-template name="findPrevious"/></td>
+ <td style="text-align: center;">&#x2191; <xsl:call-template name="findParent"/> &#x2191;</td>
+ <td style="text-align: center; border-left: 1px dashed #330066;"><xsl:call-template name="findNext"/> &#x2192;</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+ <div class="footer">
+ <p>
+ <a href="http://validator.w3.org/check/referer"><img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-xhtml.png" alt="Valid XHTML 1.0" /></a>
+ <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-css.png" alt="Valid CSS" /></a>
+ <a href="http://www.gentoo.org/"><img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-gentoo.png" alt="Powered by Gentoo" /></a>
+ <a href="http://www.gnu.org/software/emacs/emacs.html"><img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-emacs.png" alt="Hacked together using Emacs" /></a>
+ <a href="http://creativecommons.org/licenses/by-sa/2.0/"><img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-creativecommons.png" alt="Creative Commons License" /></a>
+ <img src="http://dev.gentoo.org/~plasmaroo/.icon_mini-xml.png" alt="XML Powered!"/>
+ <br />
+ <br />
+ This is an <em>unofficial</em> document whose contents may not reflect
+ official Gentoo policy or the views of the Gentoo Foundation. The text of
+ this document is distributed under the <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons Attribution-ShareAlike 2.0 License</a>.
+ If you have any changes, suggestions or corrections please send them to the editors!
+ </p>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="str:repeatString">
+ <xsl:param name="string"/>
+ <xsl:param name="count"/>
+ <xsl:param name="append"/>
+ <xsl:choose>
+ <xsl:when test="$count != 0">
+ <xsl:call-template name="str:repeatString">
+ <xsl:with-param name="string" select="concat($string, $append)"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="append" select="$append"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="findNext">
+ <xsl:param name="self" select="/guide/@self"/>
+ <xsl:choose>
+ <!-- To find the "next" node:
+ * See if this node includes any subnodes... if it does, that is
+ our next node
+ * Look at our parent and see if it includes any nodes after us, if
+ it does use it.
+ * Repeat recursively, going down parents if needed.
+ * End at the root item if needed.
+ -->
+ <xsl:when test="count(/guide/include) &gt; 0">
+ <xsl:variable name="doc" select="/guide/include[1]/@href"/>
+ <a href="{concat(substring-before($doc, 'text.xml'), 'index.html')}"><xsl:value-of select="document($doc)/guide/chapter[1]/title"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- This document's path -->
+ <xsl:variable name="doc_self" select="concat($self, 'text.xml')"/>
+ <!-- Turn the absolute path into a relative path so we can find ourselves in
+ the parent -->
+ <xsl:variable name="path_self" select="concat(str:tokenize($self, '/')[last()], '/text.xml')"/>
+ <xsl:variable name="index_self" select="count(document(concat($self, '../text.xml'))/guide/include[@href=$path_self]/preceding-sibling::*)+1"/>
+ <!-- Go down a parent, lookup the item after us... -->
+ <xsl:variable name="parentItem_lookup" select="document(concat($self, '../text.xml'))/guide/include[$index_self]/@href"/>
+ <xsl:variable name="parentItem_next" select="concat(document(concat($self, '../text.xml'))/guide/@self, $parentItem_lookup)"/>
+ <xsl:choose>
+ <!-- If we have an item after us, or we are at the root node (termination condition) we need to
+ not recurse any further... -->
+ <xsl:when test="$parentItem_lookup != '' or document(concat($self, '../text.xml'))/guide/@root">
+ <xsl:variable name="parentItem_actual">
+ <xsl:choose>
+ <xsl:when test="$parentItem_next = ''">text.xml</xsl:when>
+ <xsl:otherwise><xsl:value-of select="$parentItem_next"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- This is where we do a little trickery. To count how many levels we need to go down,
+ we count how far up we currently are (remember that the absolute link we get is relative to /...) and
+ hence we can build a relative link... -->
+ <xsl:variable name="relative_path" select="substring-before($parentItem_actual, 'text.xml')"/>
+ <xsl:variable name="relative_path_depth" select="string-length(/guide/@self)-string-length(translate(/guide/@self, '/' , ''))"/>
+ <xsl:variable name="relative_path_depth_recursion">
+ <xsl:call-template name="str:repeatString">
+ <xsl:with-param name="count" select="$relative_path_depth"/>
+ <xsl:with-param name="append">../</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <a href="{concat($relative_path_depth_recursion, $relative_path, 'index.html')}"><xsl:value-of select="document($parentItem_actual)/guide/chapter[1]/title"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- We need to recurse downwards; so we need to strip off a directory element off our absolute path to feed
+ into the next iteration... -->
+ <xsl:variable name="relative_path_depth" select="string-length($self)-string-length(translate($self, '/' , ''))"/>
+ <xsl:variable name="relative_path_fixed">
+ <xsl:for-each select="str:tokenize_plasmaroo($self, '/')[position() &lt; (($relative_path_depth - 1)*2 + 1)]">
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="findNext">
+ <xsl:with-param name="self" select="$relative_path_fixed"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="contentsTree" name="contentsTree">
+ <xsl:param name="depth" select="0"/>
+ <xsl:param name="maxdepth">
+ <xsl:choose>
+ <xsl:when test="@maxdepth"><xsl:value-of select="@maxdepth"/></xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="path" select="/guide/@self"/>
+ <xsl:param name="path_rel"/>
+
+ <xsl:variable name="doc_self" select="concat($path, 'text.xml')"/>
+ <xsl:variable name="include" select="document($doc_self)/guide/include[last()]/@href"/>
+ <xsl:if test="count(document($doc_self)/guide/include) &gt; 0 and ($depth &lt; $maxdepth or $maxdepth = '0')">
+ <ul>
+ <xsl:for-each select="document($doc_self)/guide/include">
+ <li>
+ <a class="reference" href="{concat($path_rel, substring-before(@href, 'text.xml'), 'index.html')}"><xsl:value-of select="document(concat($path, @href))/guide/chapter[1]/title"/></a>
+ <xsl:call-template name="contentsTree">
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ <xsl:with-param name="maxdepth" select="$maxdepth"/>
+ <xsl:with-param name="path" select="concat($path, substring-before(@href, 'text.xml'))"/>
+ <xsl:with-param name="path_rel" select="concat($path_rel, substring-before(@href, 'text.xml'))"/>
+ </xsl:call-template>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="getLastNode">
+ <!-- This function recurses forward down nodes stopping at the very last include... -->
+ <xsl:param name="path"/>
+ <xsl:variable name="include" select="document($path)/guide/include[last()]/@href"/>
+ <xsl:choose>
+ <xsl:when test="$include">
+ <xsl:call-template name="getLastNode">
+ <xsl:with-param name="path" select="concat(substring-before($path, 'text.xml'), $include)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="findPrevious">
+ <xsl:choose>
+ <!-- To find the "previous" node:
+ * Go down to our parent
+ * See if there are any nodes before us
+ * If we have a valid node that is before us
+ * Fully recurse up the node to get the last extremity
+ * Otherwise list the parent -->
+ <xsl:when test="/guide/@root">
+ <a href="#"><xsl:value-of select="/guide/chapter[1]/title"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- This document's path -->
+ <xsl:variable name="doc_self" select="concat(/guide/@self, 'text.xml')"/>
+ <!-- Turn the absolute path we have into a relative path so we can find ourselves in the
+ parent -->
+ <!-- FIXME: Bombproof the doc_self so it still works if it's missing a '/' on the end -->
+ <xsl:variable name="path_self" select="concat(str:tokenize(/guide/@self, '/')[last()], '/text.xml')"/>
+ <xsl:variable name="index_self" select="count(document(concat(/guide/@self, '../text.xml'))/guide/include[@href=$path_self]/preceding-sibling::*)-1"/>
+ <xsl:choose>
+ <xsl:when test="$index_self &gt; 0">
+ <!-- Relative path of the parent -->
+ <xsl:variable name="parentItem_path" select="document(concat(/guide/@self, '../text.xml'))/guide/@self"/>
+ <!-- Previous item in the parent -->
+ <xsl:variable name="parentItem_next" select="document(concat(/guide/@self, '../text.xml'))/guide/include[$index_self]/@href"/>
+ <xsl:variable name="myItem_path">
+ <xsl:call-template name="getLastNode">
+ <xsl:with-param name="path" select="$parentItem_next"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Make a relative <a> link; we need an absolute reference for the XSLT processor though... -->
+ <a href="{concat('../', substring-before($myItem_path, 'text.xml'), 'index.html')}"><xsl:value-of select="document(concat($parentItem_path, $myItem_path))/guide/chapter[1]/title"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="../index.html"><xsl:value-of select="document(concat(/guide/@self, '../text.xml'))/guide/chapter[1]/title"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="findParent">
+ <xsl:choose>
+ <xsl:when test="not(/guide/@root)">
+ <a href="../index.html"><xsl:value-of select="document(concat(/guide/@self, '../text.xml'))/guide/chapter[1]/title"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="#"><xsl:value-of select="/guide/chapter[1]/title"/></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ebuild-writing/ebuild-functions/src_unpack/epatch/text.xml b/ebuild-writing/ebuild-functions/src_unpack/epatch/text.xml
new file mode 100644
index 0000000..cee1465
--- /dev/null
+++ b/ebuild-writing/ebuild-functions/src_unpack/epatch/text.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<guide self="ebuild-writing/ebuild-functions/src_unpack/epatch/">
+<chapter>
+<title>Patching with epatch</title>
+
+<body>
+<p>
+This section covers some general concepts with which you should be familiar when
+writing ebuilds or working with the portage tree.
+</p>
+</body>
+</chapter>
+</guide>
diff --git a/ebuild-writing/ebuild-functions/src_unpack/text.xml b/ebuild-writing/ebuild-functions/src_unpack/text.xml
new file mode 100644
index 0000000..0a72be5
--- /dev/null
+++ b/ebuild-writing/ebuild-functions/src_unpack/text.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<guide self="ebuild-writing/ebuild-functions/src_unpack/">
+<chapter>
+<title>src_unpack</title>
+
+<body>
+<p>
+This section covers some general concepts with which you should be familiar when
+writing ebuilds or working with the portage tree.
+</p>
+</body>
+</chapter>
+<include href="epatch/text.xml"/>
+</guide>
diff --git a/ebuild-writing/ebuild-functions/text.xml b/ebuild-writing/ebuild-functions/text.xml
new file mode 100644
index 0000000..5131b33
--- /dev/null
+++ b/ebuild-writing/ebuild-functions/text.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<guide self="ebuild-writing/ebuild-functions/">
+<chapter>
+<title>Ebuild Functions</title>
+
+<body>
+<p>
+This section covers some general concepts with which you should be familiar when
+writing ebuilds or working with the portage tree.
+</p>
+</body>
+</chapter>
+<include href="src_unpack/text.xml"/>
+</guide>
diff --git a/ebuild-writing/text.xml b/ebuild-writing/text.xml
new file mode 100644
index 0000000..b0227ea
--- /dev/null
+++ b/ebuild-writing/text.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<guide self="ebuild-writing/">
+<chapter>
+<title>Ebuild Writing</title>
+
+<body>
+<p>
+This section covers some general concepts with which you should be familiar when
+writing ebuilds or working with the portage tree.
+</p>
+</body>
+</chapter>
+<include href="ebuild-functions/text.xml"/>
+</guide>
diff --git a/general-concepts/autotools/diagram.png b/general-concepts/autotools/diagram.png
new file mode 100644
index 0000000..5ee2ab8
--- /dev/null
+++ b/general-concepts/autotools/diagram.png
Binary files differ
diff --git a/general-concepts/autotools/diagram.svg b/general-concepts/autotools/diagram.svg
new file mode 100644
index 0000000..1f3eda8
--- /dev/null
+++ b/general-concepts/autotools/diagram.svg
@@ -0,0 +1,102 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg viewBox="0 50 510 360" xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <desc>Autotools Build Process</desc>
+ <rect x="-10" y="-10" width="1000" height="1000" fill="#eeeeee" id="background" />
+
+ <rect x="0" y="70" width="470" height="122"
+ stroke-width="1" stroke="black" fill="none"
+ stroke-dasharray="5,5" rx="10" ry="10" />
+ <text style="text-anchor: middle; font-style: italic;"
+ x="400" y="150">Usually handled</text>
+ <text style="text-anchor: middle; font-style: italic;"
+ x="400" y="164">by upstream</text>
+
+ <rect x="130" y="197" width="330" height="63"
+ stroke-width="1" stroke="black" fill="none"
+ stroke-dasharray="5,5" rx="10" ry="10" />
+ <text style="text-anchor: middle; font-style: italic;"
+ x="410" y="225">Shipped with</text>
+ <text style="text-anchor: middle; font-style: italic;"
+ x="410" y="239">the package</text>
+
+ <rect x="10" y="150" width="80" height="30"
+ fill="#ccccff" stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="50" y="170">Makefile.am</text>
+
+ <line x1="90" y1="165" x2="130" y2="165" stroke-width="2" stroke="black" />
+ <line x1="130" y1="165" x2="122" y2="160" stroke-width="2" stroke="black" />
+ <line x1="130" y1="165" x2="122" y2="170" stroke-width="2" stroke="black" />
+
+ <polygon points="130,165 180,145 230,165 180,185" fill="#ffffff"
+ stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="180" y="169">automake</text>
+
+ <line x1="180" y1="185" x2="180" y2="215" stroke-width="2" stroke="black" />
+ <line x1="185" y1="207" x2="180" y2="215" stroke-width="2" stroke="black" />
+ <line x1="175" y1="207" x2="180" y2="215" stroke-width="2" stroke="black" />
+
+ <rect x="140" y="215" width="80" height="30"
+ fill="#ccffcc" stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="180" y="235">Makefile.in</text>
+
+ <line x1="220" y1="230" x2="260" y2="230" stroke-width="2" stroke="black" />
+ <line x1="260" y1="230" x2="252" y2="235" stroke-width="2" stroke="black" />
+ <line x1="260" y1="230" x2="252" y2="225" stroke-width="2" stroke="black" />
+
+ <polygon points="260,230 310,210 360,230 310,250" fill="#ccffcc"
+ stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="310" y="234">configure</text>
+
+ <line x1="310" y1="115" x2="310" y2="210" stroke-width="2" stroke="black" />
+ <line x1="315" y1="202" x2="310" y2="210" stroke-width="2" stroke="black" />
+ <line x1="305" y1="202" x2="310" y2="210" stroke-width="2" stroke="black" />
+
+ <polygon points="260,95 310,75 360,95 310,115" fill="#ffffff"
+ stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="310" y="99">autoconf</text>
+
+
+ <line x1="220" y1="95" x2="260" y2="95" stroke-width="2" stroke="black" />
+ <line x1="260" y1="95" x2="252" y2="90" stroke-width="2" stroke="black" />
+ <line x1="260" y1="95" x2="252" y2="100" stroke-width="2" stroke="black" />
+
+
+ <rect x="140" y="80" width="80" height="30"
+ fill="#ccccff" stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="180" y="93" >configure.in /</text>
+ <text style="text-anchor: middle;" x="180" y="105">configure.ac</text>
+
+ <line x1="90" y1="165" x2="130" y2="165" stroke-width="2" stroke="black" />
+ <line x1="130" y1="165" x2="122" y2="160" stroke-width="2" stroke="black" />
+ <line x1="130" y1="165" x2="122" y2="170" stroke-width="2" stroke="black" />
+
+ <line x1="310" y1="250" x2="310" y2="285" stroke-width="2" stroke="black" />
+ <line x1="315" y1="278" x2="310" y2="285" stroke-width="2" stroke="black" />
+ <line x1="305" y1="278" x2="310" y2="285" stroke-width="2" stroke="black" />
+
+ <rect x="270" y="285" width="80" height="30"
+ fill="#ccffcc" stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="310" y="305">Makefile</text>
+
+ <line x1="350" y1="300" x2="390" y2="300" stroke-width="2" stroke="black" />
+ <line x1="390" y1="300" x2="382" y2="295" stroke-width="2" stroke="black" />
+ <line x1="390" y1="300" x2="382" y2="305" stroke-width="2" stroke="black" />
+
+ <polygon points="390,300 440,280 490,300 440,320" fill="#ffffff"
+ stroke="black" stroke-width="2" />
+ <text style="text-anchor: middle;" x="440" y="304">make</text>
+
+ <line x1="440" y1="320" x2="440" y2="355" stroke-width="2" stroke="black" />
+ <line x1="435" y1="348" x2="440" y2="355" stroke-width="2" stroke="black" />
+ <line x1="445" y1="348" x2="440" y2="355" stroke-width="2" stroke="black" />
+
+ <ellipse cx="440" cy="375" rx="50" ry="20" stroke-width="2" stroke="black"
+ fill="#ffcccc" />
+ <text style="text-anchor: middle;" x="440" y="378">program</text>
+
+</svg>
+
+<!-- vim: set ft=xml sw=4 sts=4 et : -->
+
diff --git a/general-concepts/autotools/text.xml b/general-concepts/autotools/text.xml
new file mode 100644
index 0000000..3541d70
--- /dev/null
+++ b/general-concepts/autotools/text.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<guide self="general-concepts/autotools/">
+<chapter>
+<title>The Basics of Autotools</title>
+
+<body>
+<todo>
+This is too long for `General Concepts`_. It needs to be split up and
+moved somewhere, either to a top-level of its own or into `Appendices`_.
+</todo>
+
+<p>
+An understanding of GNU autotools (<c>automake</c>, <c>autoconf</c> etc.) can be useful
+when working with ebuilds:
+</p>
+
+<ul>
+ <li>
+ Finding and correcting build issues is often easier if the build system is
+ not seen simply as a scary black box.
+ </li>
+ <li>
+ The autotools input files can help when determining a package's build-time
+ dependencies.
+ </li>
+ <li>
+ The risk of accidentally breaking something by patching the wrong file at the
+ wrong time is greatly reduced if the relationship between the build system
+ files is understood.
+ </li>
+</ul>
+</body>
+
+<section>
+<title>Major Autotools Components</title>
+
+<body>
+<p>
+Autotools is a collection of related packages which, when used together, remove
+much of the difficulty involved in creating portable software. These tools,
+together with a few relatively simple upstream-supplied input files, are used to
+create the build system for a package.
+</p>
+
+<figure short="How autotools fits together" link="diagram.png">
+A basic overview of how the main autotools components fit together.
+</figure>
+
+</body>
+</section>
+
+</chapter>
+</guide>
diff --git a/general-concepts/config-protect/text.xml b/general-concepts/config-protect/text.xml
new file mode 100644
index 0000000..411613f
--- /dev/null
+++ b/general-concepts/config-protect/text.xml
@@ -0,0 +1,437 @@
+<?xml version="1.0"?>
+<guide self="general-concepts/config-protect/">
+<chapter>
+<title>Configuration File Protection</title>
+
+<body>
+<p>
+This page provides a <e>very</e> brief introduction to ebuild
+writing. It does not attempt to cover many of the details or problems
+that will be encountered by developers -- rather, it gives some
+trivial examples which may be of use when trying to grasp the basic
+idea of how ebuilds work.
+</p>
+
+<p>
+For proper coverage of all the ins and outs, see `Ebuild
+Writing`_. The `General Concepts`_ chapter will also be of use.
+</p>
+
+<p>
+Note that the examples used here, whilst based upon real tree ebuilds,
+have had several parts chopped out, changed and simplified.
+</p>
+</body>
+
+<section>
+<title>First Ebuild</title>
+
+<body>
+<p>
+We'll start with an ebuild for the <e>Exuberant Ctags</e> utility, a source code
+indexing tool. Here's a simplified <c>dev-util/ctags/ctags-5.5.4.ebuild</c> (you
+can see real ebuilds in the main tree).
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="Exuberant ctags generates tags files for quick source navigation"
+HOMEPAGE="http://ctags.sourceforge.net"
+SRC_URI="mirror://sourceforge/ctags/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~mips ~sparc ~x86"
+IUSE=""
+
+src_compile() {
+ econf --with-posix-regex || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+
+ dodoc FAQ NEWS README
+ dohtml EXTENDING.html ctags.html
+}
+</codesample>
+</body>
+
+<subsection>
+<title>Basic Format</title>
+
+<body>
+<p>
+As you can see, ebuilds are just <c>bash</c> scripts that are executed within a
+special environment.
+</p>
+
+<p>
+At the top of the ebuild is a header block. This is present in all ebuilds.
+</p>
+
+<p>
+Ebuilds are indented using tabs, with each tab representing four places. See
+`Ebuild File Format`_.
+</p>
+</body>
+</subsection>
+
+<subsection>
+<title>Information Variables</title>
+
+<body>
+<p>
+Next, there are a series of variables. These tell portage various things about
+the ebuild and package in question.
+</p>
+
+<p>
+The <c>DESCRIPTION</c> variable is set to a <e>short</e> description
+of the package and its purpose.
+</p>
+
+<p>
+The <c>HOMEPAGE</c> is a link to the package's homepage (remember to
+include the <c>http://</c> part).
+</p>
+
+<p>
+The <c>LICENSE</c> is <c>GPL-2</c> (the GNU General Public License version 2).
+</p>
+
+<p>
+The <c>SRC_URI</c> tells Portage the address to use for downloading
+the source tarball. Here, <c>mirror://sourceforge/</c> is a special
+notation meaning &quot;any of the Sourceforge mirrors&quot;. The
+<c>${P}</c> is a read-only variable set by Portage which is the package's
+name and version -- in this case, it would be <c>ctags-5.5.4</c>.
+</p>
+
+<p>
+The <c>SLOT</c> variable tells portage which slot this package installs to. If
+you've not seen slots before, either just use <c>&quot;0&quot;</c> or read `Slotting`_.
+</p>
+
+<p>
+The <c>KEYWORDS</c> variable is set to archs upon which this ebuild has been
+tested. We use <c>~</c> keywords for newly written ebuilds -- packages are not
+committed straight to stable, even if they seem to work. See `Keywording`_ for
+details.
+</p>
+</body>
+</subsection>
+
+<subsection>
+<title>Build Functions</title>
+
+<body>
+<p>
+Next, a function named <c>src_compile</c>. Portage will call this
+function when it wants to <e>compile</e> the package. The <c>econf</c>
+function is a wrapper for calling <c>./configure</c>, and <c>emake</c>
+is a wrapper for <c>make</c>. In both cases, the common <c>|| die
+&quot;something went wrong&quot;</c> idiom is used -- this is to
+ensure that if for some reason an error occurs, portage will stop
+rather than trying to continue with the install.
+</p>
+
+<p>
+The <c>src_install</c> function is called by portage when it wants
+to <e>install</e> the package. A slight subtlety here -- rather than
+installing straight to the live filesystem, we must install to a
+special location which is given by the <c>${D}</c> variable (portage sets
+this -- see `Install Destinations`_ and `Sandbox`_). Again, we check
+for errors.
+</p>
+
+<note>
+The canonical install method is <c>make DESTDIR=&quot;${D}&quot;
+install</c>. This will work with any properly written standard
+<c>Makefile</c>. If this gives sandbox errors, try <c>einstall</c>
+instead. If this still fails, see `src_install`_ for how to do
+manual installs.
+</note>
+
+<p>
+The <c>dodoc</c> and <c>dohtml</c> are helper functions for installing
+files into the relevant part of <c>/usr/share/doc</c>.
+</p>
+
+<p>
+Ebuilds can define other functions (see `Ebuild Functions`_). In all cases,
+portage provides a reasonable default implementation which quite often does the
+'right thing'. There was no need to define a <c>src_unpack</c> function here, for
+example -- this function is used to do any unpacking of tarballs or patching of
+source files, but the default implementation does everything we need.
+</p>
+</body>
+</subsection>
+
+</section>
+
+<section>
+<title>Ebuild with Dependencies</title>
+
+<body>
+<p>
+In the ctags example, we didn't tell portage about any dependencies. As it
+happens, that's ok, because ctags only needs a basic toolchain to compile and
+run (see `Implicit System Dependency`_ for why we don't need to depend upon
+those explicitly). However, life is rarely that simple.
+</p>
+
+<p>
+Here's <c>app-misc/detox/detox-1.1.1.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="detox safely removes spaces and strange characters from filenames"
+HOMEPAGE="http://detox.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~hppa mips sparc x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ sys-devel/flex
+ sys-devel/bison"
+RDEPEND="dev-libs/popt"
+
+src_compile() {
+ econf --with-popt || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+ dodoc README CHANGES
+}
+</codesample>
+
+<p>
+Again, you can see the ebuild header and the various informational variables. In
+<c>SRC_URI</c>, <c>${PN}</c> is used to get the package's
+name <e>without</e> the version suffix (there are more of these
+variables -- see `Predefined Read-Only Variables`_).
+</p>
+
+<p>
+Again, we define <c>src_compile</c> and <c>src_install</c> functions.
+</p>
+
+<p>
+The <c>DEPEND</c> and <c>RDEPEND</c> variables are how portage determines which
+packages are needed to build and run the package. The <c>DEPEND</c> variable lists
+compile-time dependencies, and the <c>RDEPEND</c> lists runtime dependencies. See
+`Dependencies`_ for some more complex examples.
+</p>
+
+</body>
+</section>
+
+<section>
+<title>Ebuild with Patches</title>
+
+<body>
+<p>
+Often we need to apply patches. This is done in the <c>src_unpack</c> function
+using the <c>epatch</c> helper function. To use <c>epatch</c> one must first tell
+portage that the <c>eutils</c> eclass (an eclass is like a library) is required --
+this is done via <c>inherit eutils</c> at the top of the ebuild. Here's
+<c>app-misc/detox/detox-1.1.0.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="detox safely removes spaces and strange characters from filenames"
+HOMEPAGE="http://detox.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~hppa ~mips ~sparc ~x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ sys-devel/flex
+ sys-devel/bison"
+RDEPEND="dev-libs/popt"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-destdir.patch
+ epatch "${FILESDIR}"/${P}-parallel_build.patch
+}
+
+src_compile() {
+ econf --with-popt || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+ dodoc README CHANGES
+}
+</codesample>
+
+<p>
+Note the <c>${FILESDIR}/${P}-destdir.patch</c> -- this refers to
+<c>detox-1.1.0-destdir.patch</c>, which lives in the <c>files/</c>
+subdirectory in the portage tree. Larger patch files must go on the
+mirrors rather than in <c>files/</c> -- see `Basic epatch Usage`_.
+</p>
+
+</body>
+</section>
+
+<section>
+<title>Ebuild with USE Flags</title>
+
+<body>
+<p>
+Now for some <c>USE</c> flags. Here's <c>dev-libs/libiconv/libiconv-1.9.2.ebuild</c>, a
+replacement iconv for <c>libc</c> implementations which don't have their own.
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="GNU charset conversion library for libc which doesn't implement it"
+SRC_URI="ftp://ftp.gnu.org/pub/gnu/libiconv/${P}.tar.gz"
+HOMEPAGE="http://www.gnu.org/software/libiconv/"
+
+SLOT="0"
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="nls"
+
+DEPEND="virtual/libc
+ !sys-libs/glibc"
+
+src_compile() {
+ econf $(use_enable nls) || die "econf failed"
+ emake || die
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+}
+</codesample>
+
+<p>
+Note the <c>IUSE</c> variable. This lists all (non-special) use flags that are used
+by the ebuild. This is used for the <c>emerge -pv</c> output, amongst other things.
+</p>
+
+<p>
+The package's <c>./configure</c> script takes the usual <c>--enable-nls</c> or
+<c>--disable-nls</c> argument. We use the <c>use_enable</c> utility function to
+generate this automatically (see `Query Functions Reference`_).
+</p>
+
+<p>
+Another more complicated example, this time based upon
+<c>mail-client/sylpheed/sylpheed-1.0.4.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="A lightweight email client and newsreader"
+HOMEPAGE="http://sylpheed.good-day.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86"
+SLOT="0"
+
+IUSE="crypt gnome imlib ipv6 ldap nls pda ssl xface"
+
+DEPEND="=x11-libs/gtk+-1.2*
+ nls? ( >=sys-devel/gettext-0.12.1 )
+ crypt? ( >=app-crypt/gpgme-0.4.5 )
+ gnome? ( media-libs/gdk-pixbuf )
+ imlib? ( media-libs/imlib )
+ ldap? ( >=net-nds/openldap-2.0.11 )
+ pda? ( app-pda/jpilot )
+ ssl? ( dev-libs/openssl )
+ xface? ( >=media-libs/compface-1.4 )"
+RDEPEND="${DEPEND}
+ app-misc/mime-types
+ x11-misc/shared-mime-info"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-namespace.diff
+ epatch "${FILESDIR}"/${PN}-procmime.diff
+}
+
+src_compile() {
+
+ econf \
+ $(use_enable nls) \
+ $(use_enable ssl) \
+ $(use_enable crypt gpgme) \
+ $(use_enable pda jpilot) \
+ $(use_enable ldap) \
+ $(use_enable ipv6) \
+ $(use_enable imlib) \
+ $(use_enable gnome gdk-pixbuf) \
+ $(use_enable xface compface) \
+ || die
+
+ emake || die
+}
+
+src_install() {
+ einstall || die "einstall failed"
+ dodir /usr/share/pixmaps
+ insinto /usr/share/pixmaps
+ doins *.png
+
+ if use gnome ; then
+ dodir /usr/share/gnome/apps/Internet
+ insinto /usr/share/gnome/apps/Internet
+ doins sylpheed.desktop
+ fi
+
+ dodoc [A-Z][A-Z]* ChangeLog*
+}
+</codesample>
+
+<p>
+Note the optional dependencies. Some of the <c>use_enable</c> lines use the
+two-argument version -- this is helpful when the USE flag name does not exactly
+match the <c>./configure</c> argument.
+</p>
+</body>
+</section>
+
+</chapter>
+</guide>
diff --git a/general-concepts/text.xml b/general-concepts/text.xml
new file mode 100644
index 0000000..6c7a5c9
--- /dev/null
+++ b/general-concepts/text.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<guide self="general-concepts/">
+<chapter>
+<title>General Concepts</title>
+
+<body>
+<p>
+This section covers some general concepts with which you should be familiar when
+writing ebuilds or working with the portage tree.
+</p>
+</body>
+</chapter>
+
+<include href="autotools/text.xml"/>
+<include href="config-protect/text.xml"/>
+</guide>
diff --git a/quickstart/text.xml b/quickstart/text.xml
new file mode 100644
index 0000000..5eb5753
--- /dev/null
+++ b/quickstart/text.xml
@@ -0,0 +1,437 @@
+<?xml version="1.0"?>
+<guide self="quickstart/">
+<chapter>
+<title>Quickstart Ebuild Guide</title>
+
+<body>
+<p>
+This page provides a <e>very</e> brief introduction to ebuild
+writing. It does not attempt to cover many of the details or problems
+that will be encountered by developers -- rather, it gives some
+trivial examples which may be of use when trying to grasp the basic
+idea of how ebuilds work.
+</p>
+
+<p>
+For proper coverage of all the ins and outs, see `Ebuild
+Writing`_. The `General Concepts`_ chapter will also be of use.
+</p>
+
+<p>
+Note that the examples used here, whilst based upon real tree ebuilds,
+have had several parts chopped out, changed and simplified.
+</p>
+</body>
+
+<section>
+<title>First Ebuild</title>
+
+<body>
+<p>
+We'll start with an ebuild for the <e>Exuberant Ctags</e> utility, a source code
+indexing tool. Here's a simplified <c>dev-util/ctags/ctags-5.5.4.ebuild</c> (you
+can see real ebuilds in the main tree).
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="Exuberant ctags generates tags files for quick source navigation"
+HOMEPAGE="http://ctags.sourceforge.net"
+SRC_URI="mirror://sourceforge/ctags/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~mips ~sparc ~x86"
+IUSE=""
+
+src_compile() {
+ econf --with-posix-regex || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+
+ dodoc FAQ NEWS README
+ dohtml EXTENDING.html ctags.html
+}
+</codesample>
+</body>
+
+<subsection>
+<title>Basic Format</title>
+
+<body>
+<p>
+As you can see, ebuilds are just <c>bash</c> scripts that are executed within a
+special environment.
+</p>
+
+<p>
+At the top of the ebuild is a header block. This is present in all ebuilds.
+</p>
+
+<p>
+Ebuilds are indented using tabs, with each tab representing four places. See
+`Ebuild File Format`_.
+</p>
+</body>
+</subsection>
+
+<subsection>
+<title>Information Variables</title>
+
+<body>
+<p>
+Next, there are a series of variables. These tell portage various things about
+the ebuild and package in question.
+</p>
+
+<p>
+The <c>DESCRIPTION</c> variable is set to a <e>short</e> description
+of the package and its purpose.
+</p>
+
+<p>
+The <c>HOMEPAGE</c> is a link to the package's homepage (remember to
+include the <c>http://</c> part).
+</p>
+
+<p>
+The <c>LICENSE</c> is <c>GPL-2</c> (the GNU General Public License version 2).
+</p>
+
+<p>
+The <c>SRC_URI</c> tells Portage the address to use for downloading
+the source tarball. Here, <c>mirror://sourceforge/</c> is a special
+notation meaning &quot;any of the Sourceforge mirrors&quot;. The
+<c>${P}</c> is a read-only variable set by Portage which is the package's
+name and version -- in this case, it would be <c>ctags-5.5.4</c>.
+</p>
+
+<p>
+The <c>SLOT</c> variable tells portage which slot this package installs to. If
+you've not seen slots before, either just use <c>&quot;0&quot;</c> or read `Slotting`_.
+</p>
+
+<p>
+The <c>KEYWORDS</c> variable is set to archs upon which this ebuild has been
+tested. We use <c>~</c> keywords for newly written ebuilds -- packages are not
+committed straight to stable, even if they seem to work. See `Keywording`_ for
+details.
+</p>
+</body>
+</subsection>
+
+<subsection>
+<title>Build Functions</title>
+
+<body>
+<p>
+Next, a function named <c>src_compile</c>. Portage will call this
+function when it wants to <e>compile</e> the package. The <c>econf</c>
+function is a wrapper for calling <c>./configure</c>, and <c>emake</c>
+is a wrapper for <c>make</c>. In both cases, the common <c>|| die
+&quot;something went wrong&quot;</c> idiom is used -- this is to
+ensure that if for some reason an error occurs, portage will stop
+rather than trying to continue with the install.
+</p>
+
+<p>
+The <c>src_install</c> function is called by portage when it wants
+to <e>install</e> the package. A slight subtlety here -- rather than
+installing straight to the live filesystem, we must install to a
+special location which is given by the <c>${D}</c> variable (portage sets
+this -- see `Install Destinations`_ and `Sandbox`_). Again, we check
+for errors.
+</p>
+
+<note>
+The canonical install method is <c>make DESTDIR=&quot;${D}&quot;
+install</c>. This will work with any properly written standard
+<c>Makefile</c>. If this gives sandbox errors, try <c>einstall</c>
+instead. If this still fails, see `src_install`_ for how to do
+manual installs.
+</note>
+
+<p>
+The <c>dodoc</c> and <c>dohtml</c> are helper functions for installing
+files into the relevant part of <c>/usr/share/doc</c>.
+</p>
+
+<p>
+Ebuilds can define other functions (see `Ebuild Functions`_). In all cases,
+portage provides a reasonable default implementation which quite often does the
+'right thing'. There was no need to define a <c>src_unpack</c> function here, for
+example -- this function is used to do any unpacking of tarballs or patching of
+source files, but the default implementation does everything we need.
+</p>
+</body>
+</subsection>
+
+</section>
+
+<section>
+<title>Ebuild with Dependencies</title>
+
+<body>
+<p>
+In the ctags example, we didn't tell portage about any dependencies. As it
+happens, that's ok, because ctags only needs a basic toolchain to compile and
+run (see `Implicit System Dependency`_ for why we don't need to depend upon
+those explicitly). However, life is rarely that simple.
+</p>
+
+<p>
+Here's <c>app-misc/detox/detox-1.1.1.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="detox safely removes spaces and strange characters from filenames"
+HOMEPAGE="http://detox.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~hppa mips sparc x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ sys-devel/flex
+ sys-devel/bison"
+RDEPEND="dev-libs/popt"
+
+src_compile() {
+ econf --with-popt || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+ dodoc README CHANGES
+}
+</codesample>
+
+<p>
+Again, you can see the ebuild header and the various informational variables. In
+<c>SRC_URI</c>, <c>${PN}</c> is used to get the package's
+name <e>without</e> the version suffix (there are more of these
+variables -- see `Predefined Read-Only Variables`_).
+</p>
+
+<p>
+Again, we define <c>src_compile</c> and <c>src_install</c> functions.
+</p>
+
+<p>
+The <c>DEPEND</c> and <c>RDEPEND</c> variables are how portage determines which
+packages are needed to build and run the package. The <c>DEPEND</c> variable lists
+compile-time dependencies, and the <c>RDEPEND</c> lists runtime dependencies. See
+`Dependencies`_ for some more complex examples.
+</p>
+
+</body>
+</section>
+
+<section>
+<title>Ebuild with Patches</title>
+
+<body>
+<p>
+Often we need to apply patches. This is done in the <c>src_unpack</c> function
+using the <c>epatch</c> helper function. To use <c>epatch</c> one must first tell
+portage that the <c>eutils</c> eclass (an eclass is like a library) is required --
+this is done via <c>inherit eutils</c> at the top of the ebuild. Here's
+<c>app-misc/detox/detox-1.1.0.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="detox safely removes spaces and strange characters from filenames"
+HOMEPAGE="http://detox.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~hppa ~mips ~sparc ~x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ sys-devel/flex
+ sys-devel/bison"
+RDEPEND="dev-libs/popt"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-destdir.patch
+ epatch "${FILESDIR}"/${P}-parallel_build.patch
+}
+
+src_compile() {
+ econf --with-popt || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+ dodoc README CHANGES
+}
+</codesample>
+
+<p>
+Note the <c>${FILESDIR}/${P}-destdir.patch</c> -- this refers to
+<c>detox-1.1.0-destdir.patch</c>, which lives in the <c>files/</c>
+subdirectory in the portage tree. Larger patch files must go on the
+mirrors rather than in <c>files/</c> -- see `Basic epatch Usage`_.
+</p>
+
+</body>
+</section>
+
+<section>
+<title>Ebuild with USE Flags</title>
+
+<body>
+<p>
+Now for some <c>USE</c> flags. Here's <c>dev-libs/libiconv/libiconv-1.9.2.ebuild</c>, a
+replacement iconv for <c>libc</c> implementations which don't have their own.
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="GNU charset conversion library for libc which doesn't implement it"
+SRC_URI="ftp://ftp.gnu.org/pub/gnu/libiconv/${P}.tar.gz"
+HOMEPAGE="http://www.gnu.org/software/libiconv/"
+
+SLOT="0"
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="nls"
+
+DEPEND="virtual/libc
+ !sys-libs/glibc"
+
+src_compile() {
+ econf $(use_enable nls) || die "econf failed"
+ emake || die
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+}
+</codesample>
+
+<p>
+Note the <c>IUSE</c> variable. This lists all (non-special) use flags that are used
+by the ebuild. This is used for the <c>emerge -pv</c> output, amongst other things.
+</p>
+
+<p>
+The package's <c>./configure</c> script takes the usual <c>--enable-nls</c> or
+<c>--disable-nls</c> argument. We use the <c>use_enable</c> utility function to
+generate this automatically (see `Query Functions Reference`_).
+</p>
+
+<p>
+Another more complicated example, this time based upon
+<c>mail-client/sylpheed/sylpheed-1.0.4.ebuild</c>:
+</p>
+
+<codesample lang="ebuild">
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="A lightweight email client and newsreader"
+HOMEPAGE="http://sylpheed.good-day.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86"
+SLOT="0"
+
+IUSE="crypt gnome imlib ipv6 ldap nls pda ssl xface"
+
+DEPEND="=x11-libs/gtk+-1.2*
+ nls? ( >=sys-devel/gettext-0.12.1 )
+ crypt? ( >=app-crypt/gpgme-0.4.5 )
+ gnome? ( media-libs/gdk-pixbuf )
+ imlib? ( media-libs/imlib )
+ ldap? ( >=net-nds/openldap-2.0.11 )
+ pda? ( app-pda/jpilot )
+ ssl? ( dev-libs/openssl )
+ xface? ( >=media-libs/compface-1.4 )"
+RDEPEND="${DEPEND}
+ app-misc/mime-types
+ x11-misc/shared-mime-info"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-namespace.diff
+ epatch "${FILESDIR}"/${PN}-procmime.diff
+}
+
+src_compile() {
+
+ econf \
+ $(use_enable nls) \
+ $(use_enable ssl) \
+ $(use_enable crypt gpgme) \
+ $(use_enable pda jpilot) \
+ $(use_enable ldap) \
+ $(use_enable ipv6) \
+ $(use_enable imlib) \
+ $(use_enable gnome gdk-pixbuf) \
+ $(use_enable xface compface) \
+ || die
+
+ emake || die
+}
+
+src_install() {
+ einstall || die "einstall failed"
+ dodir /usr/share/pixmaps
+ insinto /usr/share/pixmaps
+ doins *.png
+
+ if use gnome ; then
+ dodir /usr/share/gnome/apps/Internet
+ insinto /usr/share/gnome/apps/Internet
+ doins sylpheed.desktop
+ fi
+
+ dodoc [A-Z][A-Z]* ChangeLog*
+}
+</codesample>
+
+<p>
+Note the optional dependencies. Some of the <c>use_enable</c> lines use the
+two-argument version -- this is helpful when the USE flag name does not exactly
+match the <c>./configure</c> argument.
+</p>
+</body>
+</section>
+
+</chapter>
+</guide>
diff --git a/str.tokenize.function.xsl b/str.tokenize.function.xsl
new file mode 100644
index 0000000..b7dc5eb
--- /dev/null
+++ b/str.tokenize.function.xsl
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!-- This is the EXSLT implementation of str:tokenize by Jeni Tennison,
+ I've modified it to keep the tokens since we need them - plasmaroo -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:func="http://exslt.org/functions"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str func exsl">
+
+<func:function name="str:tokenize_plasmaroo">
+ <xsl:param name="string" select="''" />
+ <xsl:param name="delimiters" select="' &#x9;&#xA;'" />
+ <xsl:choose>
+ <xsl:when test="not($string)">
+ <func:result select="/.." />
+ </xsl:when>
+ <xsl:when test="not(function-available('exsl:node-set'))">
+ <xsl:message terminate="yes">
+ ERROR: EXSLT - Functions implementation of str:tokenize relies on exsl:node-set().
+ </xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tokens">
+ <xsl:choose>
+ <xsl:when test="not($delimiters)">
+ <xsl:call-template name="str:_tokenize-characters">
+ <xsl:with-param name="string" select="$string" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="str:_tokenize-delimiters">
+ <xsl:with-param name="string" select="$string" />
+ <xsl:with-param name="delimiters" select="$delimiters" />
+ <xsl:with-param name="scope" select="0" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <func:result select="exsl:node-set($tokens)/*" />
+ </xsl:otherwise>
+ </xsl:choose>
+</func:function>
+
+<xsl:template name="str:_tokenize-characters">
+ <xsl:param name="string" />
+ <xsl:if test="$string">
+ <token><xsl:value-of select="substring($string, 1, 1)" /></token>
+ <xsl:call-template name="str:_tokenize-characters">
+ <xsl:with-param name="string" select="substring($string, 2)" />
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="str:_tokenize-delimiters">
+ <xsl:param name="string"/>
+ <xsl:param name="delimiters"/>
+ <xsl:param name="scope" select="1"/>
+ <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)" />
+ <xsl:choose>
+ <xsl:when test="not($delimiter)">
+ <token><xsl:value-of select="$string" /></token>
+ </xsl:when>
+ <xsl:when test="contains($string, $delimiter)">
+ <xsl:if test="not(starts-with($string, $delimiter))">
+ <xsl:call-template name="str:_tokenize-delimiters">
+ <xsl:with-param name="string" select="substring-before($string, $delimiter)" />
+ <xsl:with-param name="delimiters" select="substring($delimiters, 2)" />
+ </xsl:call-template>
+ <xsl:value-of select="$delimiter"/>
+ </xsl:if>
+ <xsl:if test="$scope = 0">
+ <delimiter><xsl:value-of select="$delimiter"/></delimiter>
+ </xsl:if>
+ <xsl:call-template name="str:_tokenize-delimiters">
+ <xsl:with-param name="string" select="substring-after($string, $delimiter)"/>
+ <xsl:with-param name="delimiters" select="$delimiters"/>
+ <xsl:with-param name="scope" select="$scope"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="str:_tokenize-delimiters">
+ <xsl:with-param name="string" select="$string" />
+ <xsl:with-param name="delimiters" select="substring($delimiters, 2)" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/text.xml b/text.xml
new file mode 100644
index 0000000..2d2cde2
--- /dev/null
+++ b/text.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<guide root="true">
+<chapter>
+<title>Master Index</title>
+
+<body>
+<p>
+This document is an ongoing work in progress. It contains gaps, inaccuracies, omissions, typos and the occasional outright lie. The intent is to make an handbook giving developers and users correct, detailed, up to date technical content.
+</p>
+<p>
+Contributions are encouraged. See the Contributing to This Document section for how to get started. Thanks for Ciaran for permitting me to continue this and sending me the RST source and needed scripts.
+</p>
+</body>
+
+<section>
+<title>Contents</title>
+<body>
+<contentsTree maxdepth="1"/>
+</body>
+</section>
+
+<section>
+<title>Full Contents</title>
+<body>
+<contentsTree/>
+</body>
+</section>
+</chapter>
+
+<include href="quickstart/text.xml"/>
+<include href="general-concepts/text.xml"/>
+<include href="ebuild-writing/text.xml"/>
+</guide>