| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/mercury/mercury-10.04_beta1.ebuild,v 1.6 2010/04/11 00:21:19 keri Exp $
|
| 4 |
|
| 5 |
EAPI=2
|
| 6 |
|
| 7 |
inherit autotools elisp-common eutils flag-o-matic java-pkg-opt-2 multilib
|
| 8 |
|
| 9 |
PATCHSET_VER="0"
|
| 10 |
MY_P=${PN}-compiler-${PV}
|
| 11 |
|
| 12 |
DESCRIPTION="Mercury is a modern general-purpose logic/functional programming language"
|
| 13 |
HOMEPAGE="http://www.cs.mu.oz.au/research/mercury/index.html"
|
| 14 |
SRC_URI="http://www.mercury.csse.unimelb.edu.au/download/files/${MY_P}.tar.gz
|
| 15 |
mirror://gentoo/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz
|
| 16 |
test? ( http://www.mercury.csse.unimelb.edu.au/download/files/mercury-tests-${PV}.tar.gz )"
|
| 17 |
|
| 18 |
LICENSE="GPL-2"
|
| 19 |
SLOT="0"
|
| 20 |
KEYWORDS="~amd64 ~x86"
|
| 21 |
|
| 22 |
IUSE="debug emacs erlang examples java minimal readline test threads"
|
| 23 |
|
| 24 |
DEPEND="!dev-libs/mpatrol
|
| 25 |
!dev-util/mono-debugger
|
| 26 |
readline? ( sys-libs/readline )
|
| 27 |
erlang? ( dev-lang/erlang )
|
| 28 |
java? ( >=virtual/jdk-1.5 )"
|
| 29 |
|
| 30 |
RDEPEND="${DEPEND}
|
| 31 |
emacs? ( virtual/emacs )"
|
| 32 |
|
| 33 |
S="${WORKDIR}"/${MY_P}
|
| 34 |
TESTDIR="${WORKDIR}"/${PN}-tests-${PV}
|
| 35 |
|
| 36 |
SITEFILE=50${PN}-gentoo.el
|
| 37 |
|
| 38 |
src_prepare() {
|
| 39 |
cd "${WORKDIR}"
|
| 40 |
EPATCH_FORCE=yes
|
| 41 |
EPATCH_SUFFIX=patch
|
| 42 |
epatch "${WORKDIR}"/${PV}
|
| 43 |
|
| 44 |
sed -i -e "s/@libdir@/$(get_libdir)/" \
|
| 45 |
"${S}"/scripts/Mmake.vars.in \
|
| 46 |
|| die "sed libdir failed"
|
| 47 |
|
| 48 |
if use test; then
|
| 49 |
epatch "${WORKDIR}"/${PV}-tests
|
| 50 |
fi
|
| 51 |
|
| 52 |
cd "${S}"
|
| 53 |
eautoconf
|
| 54 |
}
|
| 55 |
|
| 56 |
src_configure() {
|
| 57 |
strip-flags
|
| 58 |
|
| 59 |
local myconf
|
| 60 |
myconf="--libdir=/usr/$(get_libdir) \
|
| 61 |
--disable-gcc-back-end \
|
| 62 |
--disable-deep-profiler \
|
| 63 |
--disable-dotnet-grades \
|
| 64 |
$(use_enable erlang erlang-grade) \
|
| 65 |
$(use_enable java java-grade) \
|
| 66 |
$(use_enable debug debug-grades) \
|
| 67 |
$(use_enable threads par-grades) \
|
| 68 |
$(use_enable !minimal most-grades) \
|
| 69 |
$(use_with readline)"
|
| 70 |
|
| 71 |
econf ${myconf}
|
| 72 |
}
|
| 73 |
|
| 74 |
src_compile() {
|
| 75 |
# Generate Mercury .m dependencies. This step will vacuously
|
| 76 |
# succeed if we do not have a bootstrappable instance of mmc
|
| 77 |
# already installed. This step is required as mmc does not wait
|
| 78 |
# for all dependencies to be generated before compiling .m files.
|
| 79 |
emake \
|
| 80 |
PARALLEL=${MAKEOPTS} \
|
| 81 |
bootstrap_depend || die "emake depend failed"
|
| 82 |
|
| 83 |
# Build Mercury using base llds grade
|
| 84 |
emake \
|
| 85 |
PARALLEL=${MAKEOPTS} \
|
| 86 |
EXTRA_MLFLAGS=--no-strip \
|
| 87 |
EXTRA_LDFLAGS="${LDFLAGS}" \
|
| 88 |
EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
|
| 89 |
|| die "emake failed"
|
| 90 |
|
| 91 |
# We can now patch .m Mercury compiler files since we
|
| 92 |
# have just built mercury_compiler.
|
| 93 |
EPATCH_FORCE=yes
|
| 94 |
EPATCH_SUFFIX=patch
|
| 95 |
epatch "${WORKDIR}"/${PV}-mmc
|
| 96 |
|
| 97 |
sed -i -e "s/@libdir@/$(get_libdir)/" \
|
| 98 |
"${S}"/compiler/file_util.m \
|
| 99 |
"${S}"/compiler/make.program_target.m \
|
| 100 |
|| die "sed libdir failed"
|
| 101 |
|
| 102 |
# Rebuild Mercury compiler using the just built mercury_compiler
|
| 103 |
emake \
|
| 104 |
PARALLEL=${MAKEOPTS} \
|
| 105 |
EXTRA_MLFLAGS=--no-strip \
|
| 106 |
EXTRA_LDFLAGS="${LDFLAGS}" \
|
| 107 |
EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
|
| 108 |
MERCURY_COMPILER="${S}"/compiler/mercury_compile \
|
| 109 |
compiler || die "emake compiler failed"
|
| 110 |
|
| 111 |
# The default Mercury grade may not be the same as the grade used to
|
| 112 |
# compile the llds base grade. Since src_test() is run before
|
| 113 |
# src_install() we compile the default grade now
|
| 114 |
emake \
|
| 115 |
PARALLEL=${MAKEOPTS} \
|
| 116 |
EXTRA_MLFLAGS=--no-strip \
|
| 117 |
EXTRA_LDFLAGS="${LDFLAGS}" \
|
| 118 |
EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
|
| 119 |
MERCURY_COMPILER="${S}"/compiler/mercury_compile \
|
| 120 |
default_grade || die "emake default_grade failed"
|
| 121 |
}
|
| 122 |
|
| 123 |
src_test() {
|
| 124 |
TEST_GRADE=`scripts/ml --print-grade`
|
| 125 |
if [ -d "${S}"/install_grade_dir.${TEST_GRADE} ] ; then
|
| 126 |
TWS="${S}"/install_grade_dir.${TEST_GRADE}
|
| 127 |
cp browser/mer_browser.init "${TWS}"/browser/
|
| 128 |
cp mdbcomp/mer_mdbcomp.init "${TWS}"/mdbcomp/
|
| 129 |
cp runtime/mer_rt.init "${TWS}"/runtime/
|
| 130 |
cp ssdb/mer_ssdb.init "${TWS}"/ssdb/
|
| 131 |
else
|
| 132 |
TWS="${S}"
|
| 133 |
fi
|
| 134 |
|
| 135 |
cd "${TESTDIR}"
|
| 136 |
sed -i -e "s:@WORKSPACE@:${TWS}:" WS_FLAGS.ws \
|
| 137 |
|| die "sed WORKSPACE failed"
|
| 138 |
|
| 139 |
# Mercury tests must be run in C locale since Mercury output is
|
| 140 |
# compared to hard-coded warnings/errors
|
| 141 |
LC_ALL="C" \
|
| 142 |
PATH="${TWS}"/scripts:"${TWS}"/util:"${TWS}"/slice:"${PATH}" \
|
| 143 |
TERM="" \
|
| 144 |
WORKSPACE="${TWS}" \
|
| 145 |
MERCURY_COMPILER="${TWS}"/compiler/mercury_compile \
|
| 146 |
MERCURY_CONFIG_DIR="${TWS}" \
|
| 147 |
MMAKE_DIR="${TWS}"/scripts \
|
| 148 |
MERCURY_SUPPRESS_STACK_TRACE=yes \
|
| 149 |
GRADE=${TEST_GRADE} \
|
| 150 |
MERCURY_ALL_LOCAL_C_INCL_DIRS=" -I${TWS}/boehm_gc \
|
| 151 |
-I${TWS}/boehm_gc/include \
|
| 152 |
-I${TWS}/runtime \
|
| 153 |
-I${TWS}/library \
|
| 154 |
-I${TWS}/mdbcomp \
|
| 155 |
-I${TWS}/browser \
|
| 156 |
-I${TWS}/trace" \
|
| 157 |
mmake || die "mmake test failed"
|
| 158 |
}
|
| 159 |
|
| 160 |
src_install() {
|
| 161 |
emake \
|
| 162 |
PARALLEL=${MAKEOPTS} \
|
| 163 |
EXTRA_LDFLAGS="${LDFLAGS}" \
|
| 164 |
EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
|
| 165 |
MERCURY_COMPILER="${S}"/compiler/mercury_compile \
|
| 166 |
INSTALL_PREFIX="${D}"/usr \
|
| 167 |
INSTALL_MAN_DIR="${D}"/usr/share/man \
|
| 168 |
INSTALL_INFO_DIR="${D}"/usr/share/info \
|
| 169 |
INSTALL_HTML_DIR="${D}"/usr/share/doc/${PF}/html \
|
| 170 |
INSTALL_ELISP_DIR="${D}/${SITELISP}"/${PN} \
|
| 171 |
install || die "make install failed"
|
| 172 |
|
| 173 |
if use emacs; then
|
| 174 |
elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
|
| 175 |
|| die "elisp-site-file-install failed"
|
| 176 |
fi
|
| 177 |
|
| 178 |
dodoc \
|
| 179 |
BUGS HISTORY LIMITATIONS NEWS README README.Linux \
|
| 180 |
README.Linux-Alpha README.Linux-m68k README.Linux-PPC \
|
| 181 |
RELEASE_NOTES TODO VERSION WORK_IN_PROGRESS || die
|
| 182 |
|
| 183 |
if use erlang; then
|
| 184 |
dodoc README.Erlang || die
|
| 185 |
fi
|
| 186 |
|
| 187 |
if use java; then
|
| 188 |
dodoc README.Java || die
|
| 189 |
fi
|
| 190 |
|
| 191 |
if use examples; then
|
| 192 |
insinto /usr/share/doc/${PF}/samples
|
| 193 |
doins samples/{*.m,README,Mmakefile} || die
|
| 194 |
doins -r samples/c_interface \
|
| 195 |
samples/diff \
|
| 196 |
samples/muz \
|
| 197 |
samples/rot13 \
|
| 198 |
samples/solutions \
|
| 199 |
samples/solver_types || die
|
| 200 |
|
| 201 |
if use java; then
|
| 202 |
doins -r samples/java_interface || die
|
| 203 |
fi
|
| 204 |
|
| 205 |
rm -rf $(find "${D}"/usr/share/doc/${PF}/samples \
|
| 206 |
-name CVS -o -name .cvsignore)
|
| 207 |
fi
|
| 208 |
}
|
| 209 |
|
| 210 |
pkg_postinst() {
|
| 211 |
use emacs && elisp-site-regen
|
| 212 |
}
|
| 213 |
|
| 214 |
pkg_postrm() {
|
| 215 |
use emacs && elisp-site-regen
|
| 216 |
}
|