dev-scheme/slib: Fix compilation with >=sys-apps/texinfo-5 (bug #465348)
authorSebastian Pipping <sping@gentoo.org>
Wed, 12 Aug 2015 23:42:34 +0000 (01:42 +0200)
committerSebastian Pipping <sping@gentoo.org>
Thu, 13 Aug 2015 00:20:45 +0000 (02:20 +0200)
Signed-off-by: Sebastian Pipping <sping@gentoo.org>
dev-scheme/slib/files/slib-3.2.2-fix-texinfo.awk [new file with mode: 0644]
dev-scheme/slib/slib-3.2.2.ebuild

diff --git a/dev-scheme/slib/files/slib-3.2.2-fix-texinfo.awk b/dev-scheme/slib/files/slib-3.2.2-fix-texinfo.awk
new file mode 100644 (file)
index 0000000..6bc3ce8
--- /dev/null
@@ -0,0 +1,123 @@
+# Fixes Texinfo input to compile with Texinfo 5 or later
+#
+# Written by Sebastian Pipping <sebastian@pipping.org>
+# Licensed under CC0 1.0 Universal Public Domain Dedication
+# https://creativecommons.org/publicdomain/zero/1.0/
+#
+# Version 0_p20150813_p0418
+
+BEGIN {
+       inside_deffn = 0
+       inside_defmac = 0
+       inside_defop = 0
+       inside_deftp = 0
+       inside_defun = 0
+}
+
+/^@deffn / {
+       if (inside_deffn) {
+               print "@end deffn"
+       }
+       inside_deffn = 1
+}
+
+/^@deffnx / {
+       if (inside_deffn) {
+               print "@end deffn"
+       }
+       sub(/^@deffnx/, "@deffn")
+       inside_deffn = 1
+}
+
+/^@defmac / {
+       if (inside_defmac) {
+               print "@end defmac"
+       }
+       inside_defmac = 1
+}
+
+/^@defmacx / {
+       if (inside_defmac) {
+               print "@end defmac"
+       }
+       sub(/^@defmacx/, "@defmac")
+       inside_defmac = 1
+}
+
+/^@defop / {
+       if (inside_defop) {
+               print "@end defop"
+       }
+       inside_defop = 1
+}
+
+/^@defopx / {
+       if (inside_defop) {
+               print "@end defop"
+       }
+       sub(/^@defopx/, "@defop")
+       inside_defop = 1
+}
+
+/^@deftp / {
+       if (inside_deftp) {
+               print "@end deftp"
+       }
+       inside_deftp = 1
+}
+
+/^@deftpx / {
+       if (inside_deftp) {
+               print "@end deftp"
+       }
+       sub(/^@deftpx/, "@deftp")
+       inside_deftp = 1
+}
+
+/^@defun / {
+       if (inside_defun) {
+               print "@end defun"
+       }
+       inside_defun = 1
+}
+
+/^@defunx / {
+       if (inside_defun) {
+               print "@end defun"
+       }
+       sub(/^@defunx/, "@defun")
+       inside_defun = 1
+}
+
+/^@end deffn/ {
+       inside_deffn = 0
+}
+
+/^@end defmac/ {
+       inside_defmac = 0
+}
+
+/^@end defop/ {
+       inside_defop = 0
+}
+
+/^@end deftp/ {
+       inside_deftp = 0
+}
+
+/^@end defun/ {
+       inside_defun = 0
+}
+
+/^@subsubsection/ {
+       if (inside_deffn) {
+               print "@end deffn"
+               print $0
+               print "@deffn {Dummy} Dummy"
+               next
+       }
+}
+
+{
+       print
+}
index f821d58bab4af3e9ed42c080c143a4763ece19f3..a418aa1a7b91d46122694e9ae6aa6c940697382a 100644 (file)
@@ -29,6 +29,13 @@ DEPEND="app-arch/unzip"
 
 INSTALL_DIR="/usr/share/slib/"
 
+_fix_txi_file() {
+       local inplace_filename="${1}"
+       local tempfile="$(mktemp)"
+       awk -f "${FILESDIR}"/slib-3.2.2-fix-texinfo.awk < "${inplace_filename}" > "${tempfile}"
+       mv "${tempfile}" "${inplace_filename}" || die
+}
+
 src_prepare() {
        sed "s:prefix = /usr/local/:prefix = ${ED}/usr/:" -i Makefile || die
        sed 's:libdir = $(exec_prefix)lib/:libdir = $(exec_prefix)share/:' -i Makefile || die
@@ -40,6 +47,11 @@ src_prepare() {
 #      diff -u Makefile.old Makefile
 
        sed 's:(lambda () "/usr/local/share/gambc/")):(lambda () "'"${EPREFIX}"'/usr/share/gambit")):' -i gambit.init || die
+
+       einfo "Fixing Texinfo files..."
+       for i in *.txi *.texi ; do
+               _fix_txi_file "${i}" || die
+       done
 }
 
 src_compile() {