recipes: docbook/sgml-common: Fix build against newer automake
[dragora.git] / recipes / docbook / sgml-common / recipe
blobea442cd5f158916bd11a75eb9c58bb7fb176ed57
1 # Build recipe for sgml-common.
3 # Copyright (c) 2019, 2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=sgml-common
21 version=0.6.3
22 arch=noarch
23 release=3
25 # Define a category for the output of the package name
26 pkgcategory=docbook
28 tarname=${program}-${version}.tgz
30 # Remote source(s)
31 fetch=https://sourceware.org/ftp/docbook-tools/new-trials/SOURCES/$tarname
33 description="
34 The SGML common package contains install-catalog.
36 This is useful for creating and maintaining centralized SGML catalogs.
39 homepage=https://www.docbook.org/xml/
40 license=GPLv3+
42 # Source documentation
43 docs="AUTHORS COPYING ChangeLog NEWS README"
44 docsdir="${docdir}/${program}-${version}"
46 build()
48     unpack "${tardir}/$tarname"
50     cd "$srcdir"
52     # Apply patches and updates from Fedora
53     patch -Np1 -i "${worktree}/patches/sgml-common/sgml-common-quotes.patch"
54     patch -Np1 -i "${worktree}/patches/sgml-common/sgml-common-umask.patch"
55     patch -Np1 -i "${worktree}/patches/sgml-common/sgml-common-xmldir.patch"
57     # Apply patch from Beyond Linux From Scratch
58     patch -Np1 -i "${worktree}/patches/sgml-common/sgml-common-0.6.3-manpage-1.patch"
60     # Replace bogus links with files (Adapted from "Fedora")
61     automakedir="$(ls -1 -d /usr/share/automake-* | head -n 1)"
62     for file in COPYING INSTALL install-sh missing mkinstalldirs
63     do
64         rm -- $file
65         cp -L -p "${automakedir}"/$file .
66     done
67     unset -v automakedir file
69     autoreconf -vif
71     # Set sane permissions
72     chmod -R u+w,go-w,a+rX-s .
74     ./configure $configure_args \
75      --libdir=/usr/lib${libSuffix} \
76      --infodir=$infodir \
77      --mandir=$mandir \
78      --docdir=$docsdir \
79      --build="$(gcc -dumpmachine)"
81     make -j${jobs} V=1 docdir=$docsdir
82     make -j${jobs} docdir=$docsdir DESTDIR="$destdir" install
84     touch "${destdir}/etc/sgml/.graft-config"
86     mkdir -p "${destdir}/usr/share/sgml/sgml-iso-entities-8879.1986"
88     # Compress and link man pages (if needed)
89     if test -d "${destdir}/$mandir"
90     then
91         (
92             cd "${destdir}/$mandir"
93             find . -type f -exec lzip -9 {} +
94             find . -type l | while read -r file
95             do
96                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
97                 rm -- "$file"
98             done
99         )
100     fi
102     # Copy documentation
103     mkdir -p "${destdir}${docsdir}"
104     cp -p $docs "${destdir}${docsdir}"