DESCRIPTION = "GNU roff"
SECTION = "base"
LICENSE = "GPL"
PR = "r2"

SRC_URI = "http://ftp.gnu.org/gnu/groff/groff-${PV}.tar.gz \
          "
SRC_URI[md5sum] = "48fa768dd6fdeb7968041dd5ae8e2b02"
SRC_URI[sha256sum] = "b645878135cb620c6c417c5601bfe96172245af12045540d7344938b4c2cd805"

inherit autotools

PARALLEL_MAKE = ""

do_configure_prepend(){
	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
		sed -i \
		    -e '/^GROFFBIN=/s:=.*:=echo:' \
		    -e '/^TROFFBIN=/s:=.*:=echo:' \
		    -e '/^GROFF_BIN_PATH=/s:=.*:=:' \
		    -e '/^GROFF_BIN_DIR=/s:=.*:=:' \
		    ${S}/contrib/*/Makefile.sub \
		    ${S}/doc/Makefile.in \
		    ${S}/doc/Makefile.sub
	fi
}

BBCLASSEXTEND = "native"

DESCRIPTION = "GNU roff"
SECTION = "base"
LICENSE = "GPL"
PR = "r3"

SRC_URI = "${GNU_MIRROR}/groff/groff-${PV}.tar.gz"

SRC_URI[md5sum] = "48fa768dd6fdeb7968041dd5ae8e2b02"
SRC_URI[sha256sum] = "b645878135cb620c6c417c5601bfe96172245af12045540d7344938b4c2cd805"

DEPENDS = "groff-native"
DEPENDS_virtclass-native = ""

inherit autotools

PARALLEL_MAKE = ""

do_configure_prepend(){
	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
		sed -i \
		    -e '/^GROFFBIN=/s:=.*:=${STAGING_BINDIR_NATIVE}/groff:' \
		    -e '/^TROFFBIN=/s:=.*:=${STAGING_BINDIR_NATIVE}/troff:' \
		    -e '/^GROFF_BIN_PATH=/s:=.*:=${STAGING_BINDIR_NATIVE}:' \
		    -e '/^GROFF_BIN_DIR=/s:=.*:=${STAGING_BINDIR_NATIVE}:' \
		    ${S}/contrib/*/Makefile.sub \
		    ${S}/doc/Makefile.in \
		    ${S}/doc/Makefile.sub
	fi
}

BBCLASSEXTEND = "native"

Fix do_install in certain cases, along with DEPENDS
groff: Fix do_install in certain cases, along with DEPENDS

Sometimes groff fails in the do_install step, complaining that img/pic* does
not exist.  Normally, these files would be created by groff itself during the
build process, but since we are cross-compiling, the old recipe replaces the
invocation of groff and troff with echo commands.  However, echo does not
create the output files, which eventually results in the do_install failure.

This patch makes groff dependent on groff-native, and instead of using echo,
it instructs the build process to use the staged groff binaries.

(Tom Rini: While in here, switch to GNU_MIRROR)

Acked-by: Khem Raj <729d64b6f67515e258459a5f6d20ec88b2caf8df@gmail.com>
Signed-off-by: Mike Westerhof <a17fed27eaa842282862ff7c1b9c8395a26ac320@mwester.net>
Signed-off-by: Tom Rini <4c3d5c8f8c21c27dd329bd585f481113514551fd@mentor.com>
