# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-lang/dmd-bin/dmd-bin-2.008-r1.ebuild,v 1.5 2009/08/23 01:57:40 williamh Exp $ EAPI="3" inherit eutils MY_P=${P/-bin/} MY_P=${MY_P/-/.} DESCRIPTION="Digital Mars D Compiler" HOMEPAGE="http://www.digitalmars.com/d/" SRC_URI="http://ftp.digitalmars.com/${MY_P}.zip" IUSE="multilib" LICENSE="DMD" RESTRICT="mirror strip" SLOT="0" KEYWORDS="~amd64 ~x86" LOC="/opt/dmd" S="${WORKDIR}" DEPEND="sys-apps/findutils app-arch/unzip amd64? ( sys-devel/gcc[multilib] )" RDEPEND="amd64? ( sys-devel/gcc[multilib] )" src_unpack() { unpack ${A} # Cleanup line endings cd "${S}/dmd2" edos2unix `find . -name '*.c' -type f` edos2unix `find . -name '*.d' -type f` edos2unix `find . -name '*.ddoc' -type f` edos2unix `find . -name '*.h' -type f` edos2unix `find . -name '*.mak' -type f` edos2unix `find . -name '*.txt' -type f` edos2unix `find samples -name '*.html' -type f` edos2unix src/dmd/linux.mak src/phobos/linux.mak src/phobos/etc/c/zlib/linux.mak # Fix permissions and clean up fperms guo=r,u+w `find . -type f` fperms guo=rx,u+w `find . -type d` fperms guo=rx,u+w linux/bin/dmd linux/bin/dumpobj linux/bin/obj2asm linux/bin/rdmd epatch "${FILESDIR}/${P}.patch" epatch "${FILESDIR}/${P}-64bit.patch" } src_compile() { # druntime need to be build for 64bit cd "${S}/dmd2/src/druntime" rm -rf lib mkdir -p lib32 lib64 sed -i -e "s:DMD=.*:DMD=${S}/dmd2/linux/bin/dmd:" posix.mak if use x86 || use amd64 && use multilib; then make -f posix.mak MODEL=32 || die "Failed to build druntime 32bit" fi if use amd64; then make -f posix.mak MODEL=64 || die "Failed to build druntime 64bit" fi # Don't use teh bundled library since on gentoo we do teh compile cd "${S}/dmd2/src/phobos" sed -i -e "s:DMD=.*:DMD=${S}/dmd2/linux/bin/dmd:" linux.mak etc/c/zlib/linux.mak # Can't use emake, customized build system if use x86 || use amd64 && use multilib; then make -f linux.mak MODEL=32 || die "Failed to build phobos2 32bit" cp generated/posix/release32/libphobos2.a "${S}/dmd2/linux/lib32/" || die fi if use amd64; then make -f linux.mak MODEL=64 || die "Failed to build phobos2 64bit" cp generated/posix/release64/libphobos2.a "${S}/dmd2/linux/lib64/" || die fi # Clean up make -f linux.mak clean } src_install() { cd "${S}/dmd2" sed -i.orig -e 's|%@P%/../../src/|/opt/dmd/src/|g;s|%@P%/../lib|/opt/dmd/lib|g' "linux/bin/dmd.conf" insinto /etc doins linux/bin/dmd.conf # Man pages doman man/man1/dmd.1 doman man/man1/dmd.conf.5 doman man/man1/dumpobj.1 doman man/man1/obj2asm.1 doman man/man1/rdmd.1 # Documentation dohtml -r html/d/* # Install exeinto /opt/dmd/bin doexe linux/bin/dmd doexe linux/bin/dumpobj doexe linux/bin/obj2asm doexe linux/bin/rdmd if use x86 || use amd64 && use multilib; then insinto /opt/dmd/lib32 doins linux/lib32/libphobos2.a fi if use amd64; then insinto /opt/dmd/lib64 doins linux/lib64/libphobos2.a fi insinto /opt/dmd/samples doins samples/d/* # Phobos and DMD source mv src "${D}/opt/dmd/" # Set PATH doenvd "${FILESDIR}/25dmd" } pkg_postinst () { ewarn "You may need to run: " ewarn "env-update && source /etc/profile " ewarn "to be able to use the compiler immediately. " einfo " " einfo "The bundled samples and sources may be found in " einfo "/opt/dmd/samples and /opt/dmd/src respectively. " einfo " " }