# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils flag-o-matic versionator major=$(get_version_component_range 1) minor=$(get_version_component_range 2) rtype=`expr match $(get_version_component_range 3) '\([a-z]*\)'` release=`expr match $(get_version_component_range 3) '[a-z]*\([0-9]*\)'` MY_P="MetaOCaml_${major}${minor}_${rtype}_${release}" DESCRIPTION="A compiled, type-safe, multi-stage programming language" HOMEPAGE="http://www.metaocaml.org/" SRC_URI="http://www.metaocaml.org/dist/old/${MY_P}.tar.gz" LICENSE="QPL-1.0 GPL-2-with-linking-exception" KEYWORDS="~x86" SLOT="0" IUSE="ncurses tcltk threads doc latex" RESTRICT="nostrip" DEPEND="virtual/libc ncurses? ( >=sys-libs/ncurses-5.4-r6 ) tcltk? ( >=dev-lang/tk-8.4.9 ) doc? app-doc/ocaml-docs !dev-lang/ocaml" PROVIDE="dev-lang/ocaml" S=${WORKDIR}/${MY_P} src_compile() { filter-flags "-fstack-protector" replace-flags "-O?" -O2 local myconf use ncurses || myconf="${myconf} -no-curses" use tcltk || myconf="${myconf} -no-tk" use threads && myconf="${myconf} -with-pthread" || myconf="${myconf} -no-pthread" ./configure \ ${myconf} \ -host ${CHOST} \ -prefix /usr \ -bindir /usr/bin \ -libdir /usr/$(get_libdir)/ocaml \ -mandir /usr/share/man || die "./configure failed" sed -i -e "s/\(BYTECCCOMPOPTS=.*\)/\1 ${CFLAGS}/" config/Makefile sed -i -e "s/\(NATIVECCCOMPOPTS=.*\)/\1 ${CFLAGS}/" config/Makefile local makeOptions="-j1" emake ${makeOptions} world || die "emake world failed" emake ${makeOptions} bootstrap # If the first bootstrap fails, we try bootstrapping again # to get to a fixpoint. if [ ${?} != 0 ]; then #not at fix point... emake ${makeOptions} bootstrap || die "Second emake bootstrap failed" fi #make world.opt does not produce metaocaml[c]; do it manually emake ${makeOptions} opt || die "emake opt failed" emake ${makeOptions} opt.opt || die "emake opt.opt failed" } src_install() { make BINDIR=${D}/usr/bin \ LIBDIR=${D}/usr/$(get_libdir)/ocaml \ MANDIR=${D}/usr/share/man \ install || die "make install failed" # removes sandbox dir from ld.conf dosed "s:${D}::g" /usr/$(get_libdir)/ocaml/ld.conf dodoc Changes README Upgrading } pkg_postinst() { use latex && echo "TEXINPUTS=/usr/$(get_libdir)/ocaml/ocamldoc:" > /etc/env.d/99ocamldoc echo einfo "OCaml and thus also MetaOCaml are not binary compatible from version to version." einfo "You (may) need to rebuild all installed packages depending on dev-lan/ocaml." echo einfo "To do so, you can run: " einfo " sh /usr/portage/dev-lang/ocaml/files/ocaml-rebuild.sh [-h | emerge options]" einfo "which will call emerge on all old packages with the given options." echo }