public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Modular texlive eclasses up for review
@ 2007-10-08 21:47 Alexis Ballier
  2007-10-08 23:03 ` Alexis Ballier
  0 siblings, 1 reply; 8+ messages in thread
From: Alexis Ballier @ 2007-10-08 21:47 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 966 bytes --]

Hi list, 

attached are two new eclasses I'm planning to commit soon.
I'm sending 'em as some reviewing never hurts, but I hope they're
perfectly fine ;)

texlive-common.eclass : helper eclass for handling the texmf
tree; it contains variable definitions used by texlive ebuilds and
two functions : 
- one to move config files that might be modified by the
user to /etc and symlink them from the original location to not break
texmf stucture; 
- the second function search for a file in the texmf tree in the
current directory (the usual tex distribution's way is to have ls-R
files and use kpsewhich but we must not assume the presence of such
programs/files as we'll be using it for installing texlive...)


texlive-module.eclass : generic installation eclass for all the
different parts of texlive's texmf tree, this is to avoid code
duplication in 80+ ebuilds.


If no objection, I'll commit them in a few days.


Regards, 

Alexis.

[-- Attachment #1.2: texlive-module.eclass --]
[-- Type: application/octet-stream, Size: 2437 bytes --]

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

#
# Original Author: Alexis Ballier <aballier@gentoo.org>
# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will
# only have to inherit this eclass.
# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list
# of packages that it will install.
#

inherit texlive-common

HOMEPAGE="http://www.tug.org/texlive/"

for i in ${TEXLIVE_MODULE_CONTENTS}; do
	SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
done

COMMON_DEPEND=">=app-text/texlive-core-${PV}
	${TEXLIVE_MODULES_DEPS}"

DEPEND="${COMMON_DEPEND}
	app-arch/unzip"

RDEPEND="${COMMON_DEPEND}"

IUSE="doc"

S="${WORKDIR}"

texlive-module_src_compile() {
	# Build format files
	for i in texmf/fmtutil/format*.cnf; do
		if test -f "${i}"; then
			einfo "Building format ${i}"
			TEXMFHOME="${S}/texmf:${S}/texmf-dist"\
				fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
				|| die "failed to build format ${i}"
		fi
	done

	# Generate config files
	for i in "${S}"/texmf/lists/*;
	do
		grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs"
	done

	for j in $(cat "${T}/jobs");
	do
		command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/')
		parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/')
		case ${command} in
			addMap)
				echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
			addMixedMap)
				echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
			addDvipsMap)
				echo "p	+${parameter}" >> "${S}/${PN}-config.ps";;
			addDvipdfmMap)
				echo "f	${parameter}" >> "${S}/${PN}-config";;
		esac
	done
}

texlive-module_src_install() {
	insinto /usr/share
	test -d texmf && doins -r texmf
	test -d texmf-dist && doins -r texmf-dist
	test -d texmf-var && doins -r texmf-var
	use doc && test -d texmf-doc && doins -r texmf-doc

	insinto /etc/texmf/updmap.d
	test -f "${S}/${PN}.cfg" && doins "${S}/${PN}.cfg"
	insinto /etc/texmf/dvips/config
	test -f "${S}/${PN}-config.ps" && doins "${S}/${PN}-config.ps"
	insinto /etc/texmf/dvipdfm/config
	test -f "${S}/${PN}-config" && doins "${S}/${PN}-config"

	texlive-common_handle_config_files
}

texlive-module_pkg_postinst() {
	if [ "$ROOT" = "/" ] ; then
		/usr/sbin/texmf-update
	fi
}

texlive-module_pkg_postrm() {
	if [ "$ROOT" = "/" ] ; then
		/usr/sbin/texmf-update
	fi
}

EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

[-- Attachment #1.3: texlive-common.eclass --]
[-- Type: application/octet-stream, Size: 1452 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

#
# Original Author: Alexis Ballier <aballier@gentoo.org>
# Purpose: Provide various functions used by both texlive-core and texlive
# modules.
# Note that this eclass *must* not assume the presence of any standard tex tool
#


TEXMF_PATH=/usr/share/texmf
TEXMF_DIST_PATH=/usr/share/texmf-dist
TEXMF_VAR_PATH=/usr/share/texmf-var

# Has to be called in src_install after having installed the files in ${D}
# This function will move the relevant files to /etc/texmf and symling them
# from their original location. This is to allow easy update of texlive's
# configuration

texlive-common_handle_config_files() {
	# Handle config files properly
	cd "${D}${TEXMF_PATH}"
	for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
		if [ "${f/config/}" != "${f}" ] ; then
			continue
		fi
		dodir /etc/texmf/$(dirname ${f}).d
		mv "${D}/${TEXMF_PATH}/${f}" "${D}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed."
		dosym /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f}
	done
}


# Return if a file is present in the texmf tree
# Call it from the directory containing texmf and texmf-dist

texlive-common_is_file_present_in_texmf() {
	local mark="${T}/$1.found"
	find texmf -name $1 -exec touch "${mark}" \;
	find texmf-dist -name $1 -exec touch "${mark}" \;
	return $(test -f "${mark}")
}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-10-10 10:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 21:47 [gentoo-dev] Modular texlive eclasses up for review Alexis Ballier
2007-10-08 23:03 ` Alexis Ballier
2007-10-09  0:08   ` Jeroen Roovers
2007-10-09  7:13   ` Roy Marples
2007-10-09 11:17     ` Alexis Ballier
2007-10-09 12:00       ` Roy Marples
2007-10-09 12:49         ` Francesco Riosa
2007-10-10  9:58           ` Alexis Ballier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox