recipes: docbook/openjade: Fix wrong symlink to manpage
[dragora.git] / recipes / docbook / openjade / recipe
bloba8612288e4c1bb5c7a98b670d8997aa89e04c67a
1 # Build recipe for openjade.
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=openjade
21 version=1.3.2
22 release=2
24 # Define a category for the output of the package name
25 pkgcategory=docbook
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://downloads.sourceforge.net/project/openjade/openjade/${version}/$tarname
32 description="
33 An implementation of DSSSL, a language to format SGML or XML documents.
35 OpenJade contains backends for various formats (RTF, HTML, TeX, MIF,
36 SGML2SGML, and FOT).
39 homepage=https://openjade.sourceforge.net
40 license=MIT
42 # Source documentation
43 docs="COPYING ChangeLog NEWS README VERSION"
44 docsdir="${docdir}/${program}-${version}"
46 build()
48     unpack "${tardir}/$tarname"
50     cd "$srcdir"
52     # Set sane permissions
53     chmod -R u+w,go-w,a+rX-s .
55     # Update using patches from Gentoo
56     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-deplibs.patch"
57     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-ldflags.patch"
58     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-respect-ldflags.patch"
59     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-msggen.pl.patch"
60     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-libosp-la.patch"
61     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-gcc46.patch"
62     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-no-undefined.patch"
63     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-wchar_t-uint.patch"
64     patch -Np1 -i "${worktree}/patches/openjade/openjade-1.3.2-chmod.patch"
66     # Update for hosts based on musl
67     cp -f "${worktree}/archive/common/config.guess" config/config.guess
68     cp -f "${worktree}/archive/common/config.sub" config/config.sub
70     ./configure CXXFLAGS="$QICXXFLAGS -fno-lifetime-dse" \
71     LDFLAGS="$QILDFLAGS" \
72      $configure_args \
73      --libdir=/usr/lib${libSuffix} \
74      --mandir=$mandir \
75      --datadir=/usr/share/sgml/openjade-${version} \
76      --enable-default-catalog=/etc/sgml/catalog \
77      --enable-default-search-path=/usr/share/sgml \
78      --enable-splibdir=/usr/lib${libSuffix} \
79      --enable-http \
80      --build="$(gcc -dumpmachine)"
82     make -j${jobs} V=1
83     mkdir -p "${destdir}/etc/sgml"
84     make -j${jobs} DESTDIR="$destdir" install install-man
86     # Remove libtool .la files
87     rm -f "${destdir}/usr/lib${libSuffix}"/*.la
89     # Create Jade equivalents
91     ln -sf openjade        "${destdir}/usr/bin/jade"
92     ln -sf openjade.1      "${destdir}${mandir}/man1/jade.1"
94     # Catalogs
96     cp -p dsssl/catalog "${destdir}/usr/share/sgml/openjade-${version}"
97     for file in dsssl/*.dtd dsssl/*.dsl dsssl/*.sgm
98     do
99         cp -p "$file" "${destdir}/usr/share/sgml/openjade-${version}/${file##*/}"
100     done
101     unset -v file
102     chmod 644 "${destdir}/usr/share/sgml/openjade-${version}"/*
104     # Compress and link man pages (if needed)
105     if test -d "${destdir}/$mandir"
106     then
107         (
108             cd "${destdir}/$mandir"
109             find . -type f -exec lzip -9 {} +
110             find . -type l | while read -r file
111             do
112                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
113                 rm -- "$file"
114             done
115         )
116     fi
118     # Copy documentation
119     mkdir -p "${destdir}${docsdir}"
120     cp -p $docs "${destdir}${docsdir}"
122     # Insert post-install script manually
124     mkdir -p "${destdir}/var/lib/qi"
125     cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
127 echo ""
128 echo "Updating etc/sgml/catalog ..."
130 install-catalog --add etc/sgml/openjade-${version}.cat \\
131  /usr/share/sgml/openjade-${version}/catalog
133 install-catalog --add etc/sgml/sgml-docbook.cat \\
134  /etc/sgml/openjade-${version}.cat