# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # automatically generated by gs-ctan # please do not edit this file # # TODO: write common base eclass for g-sorcery # # Original Author: Jauhien Piatlicki # Purpose: support installation of latex packages # from overlays generated by gs-ctan # # Bugs to piatlicki@gmail.com # # @ECLASS: gs-ctan.eclass # # @ECLASS-VARIABLE: BASE_SRC_URI # @DESCRIPTION: address of a repository with packages # # @ECLASS-VARIABLE: CATALOGUE # @DESCRIPTION: directory on the server where package lives # # @ECLASS-VARIABLE: SOURCE_TYPE # @DESCRIPTION: type of a package (zip or tar.xz) # # @ECLASS-VARIABLE: DIGEST_SOURCES # @DESCRIPTION: whether manifest for sources exists # # @ECLASS-VARIABLE: REALNAME # @DESCRIPTION: real name of a package in the repository # # @ECLASS-VARIABLE: GSCTAN_STORE_DIR # @DESCRIPTION: store location for downloaded sources GSCTAN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" # # @ECLASS-VARIABLE: GSCTAN_FETCH_CMD # @DESCRIPTION: fetch command GSCTAN_FETCH_CMD="wget" inherit latex-package if [[ ${SOURCE_TYPE} = "zip" ]]; then EXPORT_FUNCTIONS src_{unpack,compile,install} else EXPORT_FUNCTIONS src_{unpack,install} fi SUFFIX="${SOURCE_TYPE}" SOURCEFILE=${REALNAME}.${SUFFIX} gs-ctan_fetch() { addwrite "${GSCTAN_STORE_DIR}" pushd "${GSCTAN_STORE_DIR}" >/dev/null || die "can't chdir to ${GSCTAN_STORE_DIR}" if [[ ! -f "${SOURCEFILE}" ]]; then $GSCTAN_FETCH_CMD ${BASE_SRC_URI}${CATALOGUE}${SOURCEFILE} || die fi popd >/dev/null || die } gs-ctan_src_unpack() { if [[ ${SOURCE_TYPE} = "zip" ]]; then if [[ x${DIGEST_SOURCES} = x ]]; then gs-ctan_fetch fi cp ${GSCTAN_STORE_DIR}/${SOURCEFILE} . || die unzip ${SOURCEFILE} || die mv ${PN} ${P} || die else if [[ x${DIGEST_SOURCES} = x ]]; then gs-ctan_fetch fi mkdir ${S} || die cd ${S} || die tar xvf ${GSCTAN_STORE_DIR}/${SOURCEFILE} || die rm -rf tlpkg || die fi } gs-ctan_src_compile() { cd ${S} || die latex-package_src_compile for d in `ls -d -- */`; do pushd ${d} || die latex-package_src_compile popd || die done } gs-ctan_src_install() { if [[ ${SOURCE_TYPE} = "zip" ]]; then cd ${S} || die latex-package_src_install for d in `ls -d -- */`; do pushd ${d} || die latex-package_src_install popd || die done else insinto ${TEXMF} doins -r * fi }