PR = "r0"

inherit debian-package allarch
PV = "1.5.56+deb8u1"

SUMMARY = "Debian configuration management system"
DESCRIPTION = "\
 Debconf is a configuration management system for debian packages. Packages\
 use Debconf to ask questions when they are installed.\
"
LICENSE = "BSD-2-Clause"
SECTION = "admin"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=1aa3b78d3182195ba56c01cb7227ead3"

DEBIAN_PATCH_TYPE = "nopatch"

do_configure() {
	:
}

do_compile() {
	:
}

do_install() {
	prefix="${D}" oe_runmake install-utils
	prefix="${D}" oe_runmake install-rest
}

do_install_class-native () {
	prefix="${D}${STAGING_DIR_NATIVE}" oe_runmake install
}

PACKAGES =+ "${PN}-utils"
FILES_${PN}-utils = " \
${bindir}/debconf-get-selections \
${bindir}/debconf-getlang \
${bindir}/debconf-loadtemplate \
${bindir}/debconf-mergetemplate \
"
FILES_${PN} += "${datadir} ${libdir}"

BBCLASSEXTEND = "native"

PR = "r0"

inherit debian-package allarch
PV = "1.5.56+deb8u1"

SUMMARY = "Debian configuration management system"
DESCRIPTION = "\
 Debconf is a configuration management system for debian packages. Packages\
 use Debconf to ask questions when they are installed.\
"
LICENSE = "BSD-2-Clause"
SECTION = "admin"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=1aa3b78d3182195ba56c01cb7227ead3"

DEBIAN_PATCH_TYPE = "nopatch"

inherit perlnative

do_configure() {
	:
}

do_compile() {
	:
}

do_install() {
	prefix="${D}" oe_runmake install-utils
	prefix="${D}" oe_runmake install-rest
}

do_install_class-native () {
	prefix="${D}${STAGING_DIR_NATIVE}" oe_runmake install

	# Use /usr/bin/env nativeperl for the perl script.
	for f in `grep -rIl '#! */usr/bin/perl' ${D}`; do
		sed -i -e 's|/usr/bin/perl.*|/usr/bin/env nativeperl|' $f
	done
}

PACKAGES =+ "${PN}-utils"
FILES_${PN}-utils = " \
${bindir}/debconf-get-selections \
${bindir}/debconf-getlang \
${bindir}/debconf-loadtemplate \
${bindir}/debconf-mergetemplate \
"
FILES_${PN} += "${datadir} ${libdir}"

BBCLASSEXTEND = "native"

Use nativeperl for the perl script
debconf-native: Use nativeperl for the perl script

debconf should not use perl from host system, but nativeperl instead.
Find and replace "/usr/bin/perl" by "/usr/bin/env nativeperl"

Signed-off-by: Trung Do <64081e6b7eb2b24289b8a4e51cef9836ddf28af2@toshiba-tsdv.com>
Signed-off-by: Daichi Fukui <53d95285b006e36c85dc99698165b4ee03ced1eb@toshiba.co.jp>
