# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-tex/hangul-ucs-2.60.ebuild,v 1.7 2005/08/24 05:13:41 leonardop Exp $
EAPI=2

inherit texlive-common 

DESCRIPTION="ko.TeX is a collection of LaTeX packages made by Koaunghi Un,
Dohyun Kim and Kangsoo Kim to replace HLaTeX and Hangul-ucs.
See http://project.ktug.or.kr/ko.TeX/ for more information."

S="${WORKDIR}"

HOMEPAGE="http://project.ktug.or.kr/ko.Tex"
SRC_URI="http://ftp.ktug.org/KTUG/ko.TeX/current/kotex-dist-20121201.tar.gz ->
kotex-dist-20121201.tar.gz"

LICENSE="GPL-2"

SLOT="0"
KEYWORDS="~x86 ~ppc ~alpha ~amd64 ~ppc-macos"
IUSE="doc"
src_unpack() {
	unpack ${A}
}


src_install() {
    mkdir bin
    cd ${S}/texmf-dist/source/latex/kotex-util/
    gcc -o ${S}/bin/hmakeindex hmakeindex.c
    gcc -o ${S}/bin/hbibtex hbibtex.c
    cd ${S}/texmf-dist/scripts/kotex-util/perl/
    for file in *.pl
    do
        cp $file ${S}/bin/${file%.pl}
    done
    chmod a+x ${S}/bin/*


	cd ${S}/texmf-dist
	KOTEXDIST="bibtex fonts makeindex scripts source tex"
	if use doc; then
		KOTEXDIST="${KOTEXDIST} doc"
	fi
	for i in ${KOTEXDIST}
	do
		insinto ${TEXMF_DIST_PATH}/${i}
		doins -r ${i}/*
	done
	}

pkg_postinst() {
	echo
	einfo "This is koTex Dist package"
}
