termux-packages/packages/docbook-xml/build.sh

146 lines
5.4 KiB
Bash
Raw Normal View History

TERMUX_PKG_HOMEPAGE=https://www.oasis-open.org/docbook/
TERMUX_PKG_DESCRIPTION="A widely used XML scheme for writing documentation and help"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_VERSION=4.5
Copy LICENSE file for some licenses instead of using generic one (#5478) * termux-licenses: remove licenses that contain copyright information These licenses cannot be taken from the common termux-licenses package as the copyright information needs to be distributed with the package as well. 271 packages in the main repository needs to be rebuilt after this change. * termux_step_install_license: remove duplicated comment * Bump packages that has a license with copyright information We need to include this copyright information in the package so need to rebuild them now that termux_step_install_license has been modified. The affected licenses are: MIT, ISC, PythonPL, Openfont-1.1, ZLIB, Libpng, BSD, BSD 2-Clause, BSD 3-Clause. * zlib: extract license file from zlib.h * xorgproto: include all individual license files in package * libgcrypt: include LICENSE file in package It contains some copyright information so needs to be included in package * libcrypt: add a dummy BSD 2-Clause license According to homepage it is suppose to be BSD 2-Clause, but original project did not include a license file * libandroid-spawn: add LICENSE file to package * libandroid-glob: add license file to package * licenses: allow for comma separated TERMUX_PKG_LICENSE_FILE %ci:no-build * libicu: fix so that termux_step_install_license finds license file %ci:no-build * termux_step_install_license: check for license file as "License" %ci:no-build * libtiff: specify TERMUX_PKG_LICENSE_FILE %ci:no-build * asciidoctor: install license to standard location * krb5: specify license file * libdb: specify path to license file %ci:no-build * libprotobuf: specify path to license file * darkhttpd: extract license file from darkhttpd.c * w3m: ensure host libraries are not picked up * w3m: extract LICENSE file from dock/README * liblua{,52}: extract license files from doc/readme.html * termux_step_install_license: look for License.txt as well * dart: specify path to LICENSE file * nim: specify license file * runit: specify license file * termux_step_install_license: look for LICENSE.TXT as well * ossp-uuid: extract LICENSE from README * pigz: extract LICENSE from pigz.c * ttyrec: extract LICENSE from ttyrec.c %ci:no-build * bmon: specify license files Most of the source files are licensed under MIT, it is not clear (to me) which parts that are licensed under BSD 2-Clause. %ci:no-build * wordgrinder: specify license files * fdupes: add LICENSE * autossh: add LICENSE patch * cmake: specify LICENSE file * dos2unix: specify LICENSE file * gnuplot: specify LICENSE file * termux_step_install_license: look for variants of "copyright" also * picolisp: specify LICENSE file * lua-lpeg: extract license file * tidy: specify license file * gflags: specify LICENSE file * timewarrior: fix src url It seems to have been changed. * postgresql: specify license file * ttyrec: fix license patch header * fossil: specify license file * fmt: specify license file * i2pd: specify license file * leptonica: specify license file * imgflo: add license file patch * ired: add license file from ired github repo * libzen: specify license file * libmediainfo: specify license file * mediainfo: specify license file * tty-clock: add license patch * samefile: add license patch * quickjs: add license patch * docbook-xml: add LICENSE patch * docbook-xsl: specify LICENSE files * gnuplot: configure with --without-latex * timewarrior: add libshared to SRCURL as well The non-release archives does not contain gitsubmodules so we need to download it manually. * restic: switch back to using 0.9.6 archive * dart: revert revision bump dart's SDK does not fully support python3 yet, and trying to solve that is not entirely trivial. We save the dart bump (and upgrade to 2.8.4) for another day. %ci:no-build
2020-07-07 18:45:45 +02:00
TERMUX_PKG_REVISION=3
TERMUX_PKG_DEPENDS="libxml2-utils"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_SKIP_SRC_EXTRACT=true
termux_step_get_source() {
termux_download "https://docbook.org/xml/4.1.2/docbkx412.zip" \
2019-08-16 01:27:19 +02:00
$TERMUX_PKG_CACHEDIR/docbkx412.zip \
30f0644064e0ea71751438251940b1431f46acada814a062870f486c772e7772
termux_download "https://docbook.org/xml/4.2/docbook-xml-4.2.zip" \
2019-08-16 01:27:19 +02:00
$TERMUX_PKG_CACHEDIR/docbook-xml-4.2.zip \
acc4601e4f97a196076b7e64b368d9248b07c7abf26b34a02cca40eeebe60fa2
termux_download "https://docbook.org/xml/4.3/docbook-xml-4.3.zip" \
2019-08-16 01:27:19 +02:00
$TERMUX_PKG_CACHEDIR/docbook-xml-4.3.zip \
23068a94ea6fd484b004c5a73ec36a66aa47ea8f0d6b62cc1695931f5c143464
termux_download "https://docbook.org/xml/4.4/docbook-xml-4.4.zip" \
2019-08-16 01:27:19 +02:00
$TERMUX_PKG_CACHEDIR/docbook-xml-4.4.zip \
02f159eb88c4254d95e831c51c144b1863b216d909b5ff45743a1ce6f5273090
termux_download "https://docbook.org/xml/4.5/docbook-xml-4.5.zip" \
2019-08-16 01:27:19 +02:00
$TERMUX_PKG_CACHEDIR/docbook-xml-4.5.zip \
4e4e037a2b83c98c6c94818390d4bdd3f6e10f6ec62dd79188594e26190dc7b4
mkdir -p $TERMUX_PKG_SRCDIR
}
termux_step_post_get_source() {
cd $TERMUX_PKG_SRCDIR
2019-08-16 01:27:19 +02:00
unzip -d docbook-xml-4.1.2 $TERMUX_PKG_CACHEDIR/docbkx412.zip
local ver
for ver in 4.{2..5}; do
unzip -d docbook-xml-${ver} $TERMUX_PKG_CACHEDIR/docbook-xml-${ver}.zip
done
}
termux_step_make_install() {
mkdir -p $TERMUX_PREFIX/etc/xml
xmlcatalog --noout --create "$TERMUX_PREFIX/etc/xml/docbook-xml"
local ver
for ver in 4.1.2 4.{2..5}; do
pushd docbook-xml-$ver
mkdir -p "$TERMUX_PREFIX/share/xml/docbook/xml-dtd-$ver"
cp -dr docbook.cat *.dtd ent/ *.mod \
"$TERMUX_PREFIX/share/xml/docbook/xml-dtd-$ver"
popd
xml=
case $ver in
4.1.2) xml=' XML' ;;&
*)
xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook XML V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/docbookx.dtd" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//DTD DocBook$xml CALS Table Model V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/calstblx.dtd" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/soextblx.dtd" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook$xml Information Pool V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/dbpoolx.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook$xml Document Hierarchy V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/dbhierx.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook$xml Additional General Entities V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/dbgenent.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook$xml Notations V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/dbnotnx.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "public" \
"-//OASIS//ENTITIES DocBook$xml Character Entities V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/dbcentx.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
;;&
4.[45])
xmlcatalog --noout --add "public" \
"-//OASIS//ELEMENTS DocBook XML HTML Tables V$ver//EN" \
"http://www.oasis-open.org/docbook/xml/$ver/htmltblx.mod" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
;;&
*)
xmlcatalog --noout --add "rewriteSystem" \
"http://www.oasis-open.org/docbook/xml/$ver" \
"$TERMUX_PREFIX/share/xml/docbook/xml-dtd-$ver" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
xmlcatalog --noout --add "rewriteURI" \
"http://www.oasis-open.org/docbook/xml/$ver" \
"$TERMUX_PREFIX/share/xml/docbook/xml-dtd-$ver" \
"$TERMUX_PREFIX/etc/xml/docbook-xml"
;;&
esac
done
}
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
if [ "\$1" = "configure" ]; then
if [ ! -e "$TERMUX_PREFIX/etc/xml/catalog" ]; then
xmlcatalog --noout --create "$TERMUX_PREFIX/etc/xml/catalog"
else
xmlcatalog --noout --del "file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
fi
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//ENTITIES DocBook XML" \
"file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
xmlcatalog --noout --add "delegatePublic" \
"-//OASIS//DTD DocBook XML" \
"file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
xmlcatalog --noout --add "delegateSystem" \
"http://www.oasis-open.org/docbook/" \
"file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
xmlcatalog --noout --add "delegateURI" \
"http://www.oasis-open.org/docbook/" \
"file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
fi
EOF
cat <<- EOF > ./prerm
#!$TERMUX_PREFIX/bin/sh
if [ "\$1" = "remove" ]; then
xmlcatalog --noout --del "file://$TERMUX_PREFIX/etc/xml/docbook-xml" \
$TERMUX_PREFIX/etc/xml/catalog
fi
EOF
}