1SUMMARY = "GNU Troff software"
2DESCRIPTION = "The groff (GNU troff) software is a typesetting package which reads plain text mixed with \
3formatting commands and produces formatted output."
4SECTION = "base"
5HOMEPAGE = "http://www.gnu.org/software/groff/"
6LICENSE = "GPL-3.0-only"
7
8LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
9
10SRC_URI = "${GNU_MIRROR}/groff/groff-${PV}.tar.gz \
11           file://groff-not-search-fonts-on-build-host.patch \
12           file://0001-Make-manpages-mulitlib-identical.patch \
13           "
14
15SRC_URI[sha256sum] = "6b9757f592b7518b4902eb6af7e54570bdccba37a871fddb2d30ae3863511c13"
16
17DEPENDS = "bison-native groff-native"
18RDEPENDS:${PN} += "perl sed"
19
20inherit autotools-brokensep texinfo multilib_script pkgconfig
21
22MULTILIB_SCRIPTS = "${PN}:${bindir}/gpinyin ${PN}:${bindir}/grog"
23
24EXTRA_OECONF = "--without-x --with-urw-fonts-dir=/completely/bogus/dir/"
25EXTRA_OEMAKE:class-target = "GROFFBIN=groff GROFF_BIN_PATH=${STAGING_BINDIR_NATIVE}"
26
27CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl' ac_cv_path_BASH_PROG='no' PAGE=A4"
28
29# Delete these generated files since we depend on bison-native
30# and regenerate them. Do it deterministically (always).
31do_configure:prepend() {
32	rm -f ${S}/src/preproc/eqn/eqn.cpp
33	rm -f ${S}/src/preproc/eqn/eqn.hpp
34}
35
36do_install:append() {
37	# Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
38	# for target as /usr/bin/perl, so fix it to /usr/bin/perl.
39	for i in afmtodit mmroff gropdf pdfmom grog; do
40		if [ -f ${D}${bindir}/$i ]; then
41			sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/$i
42		fi
43	done
44	if [ -e ${D}${libdir}/charset.alias ]; then
45		rm -rf ${D}${libdir}/charset.alias
46	fi
47
48	# awk is located at /usr/bin/, not /bin/
49	SPECIAL_AWK=`find ${D} -name special.awk`
50	if [ -f ${SPECIAL_AWK} ]; then
51		sed -i -e 's:#!.*awk:#! ${USRBINPATH}/awk:' ${SPECIAL_AWK}
52	fi
53
54	# not ship /usr/bin/glilypond and its releated files in embedded target system
55	rm -rf ${D}${bindir}/glilypond
56	rm -rf ${D}${libdir}/groff/glilypond
57	rm -rf ${D}${mandir}/man1/glilypond*
58
59	# not ship /usr/bin/grap2graph and its releated man files
60	rm -rf ${D}${bindir}/grap2graph
61	rm -rf ${D}${mandir}/man1/grap2graph*
62
63        # strip hosttool path out of generated files
64        sed -i -e 's:${HOSTTOOLS_DIR}/::g' ${D}${docdir}/${BP}/examples/hdtbl/*.roff
65}
66
67do_install:append:class-native() {
68	create_cmdline_wrapper ${D}/${bindir}/groff \
69		-F${STAGING_DIR_NATIVE}${datadir_native}/groff/${PV}/font \
70		-M${STAGING_DIR_NATIVE}${datadir_native}/groff/${PV}/tmac
71}
72
73FILES:${PN} += "${libdir}/${BPN}/site-tmac \
74                ${libdir}/${BPN}/groffer/"
75
76BBCLASSEXTEND = "native"
77