Created
August 21, 2010 04:32
-
-
Save r0bertz/541776 to your computer and use it in GitHub Desktop.
go language ebuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 1999-2009 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: $ | |
EAPI="2" | |
inherit elisp-common eutils mercurial toolchain-funcs | |
DESCRIPTION="The Go Programming Language" | |
HOMEPAGE="http://golang.org/" | |
SRC_URI="" | |
EHG_REPO_URI="https://go.googlecode.com/hg/" | |
EHG_REVISION="release" | |
LICENSE="BSD" | |
SLOT="0" | |
KEYWORDS="~amd64 ~x86" | |
IUSE="emacs vim-syntax" | |
RESTRICT="test" | |
RDEPEND="sys-devel/gcc" | |
DEPEND="${RDEPEND} | |
emacs? ( virtual/emacs ) | |
sys-devel/bison | |
sys-apps/ed" | |
S="${WORKDIR}/hg" | |
ENVFILE="${WORKDIR}/50${PN}" | |
src_prepare() { | |
GOBIN="${WORKDIR}/bin" | |
mkdir -p "${GOBIN}" || die | |
sed -i \ | |
-e "/^GOBIN=/s:=.*:=${GOBIN}:" \ | |
-e "/MAKEFLAGS=/s:=.*:=${MAKEOPTS}:" \ | |
src/make.bash || die | |
sed -i \ | |
-e "/^CFLAGS=/s:-O2:${CFLAGS}:" \ | |
src/Make.conf || die | |
case ${ARCH} in | |
x86) | |
GOARCH="386" | |
;; | |
*) | |
GOARCH="${ARCH}" | |
;; | |
esac | |
case ${CHOST} in | |
*-darwin*) | |
GOOS="darwin" | |
;; | |
*) | |
GOOS="linux" | |
;; | |
esac | |
# *-nacl*) | |
# GOOS="nacl" | |
# ;; | |
cat > "${ENVFILE}" <<EOF | |
GOROOT="/usr/$(get_libdir)/${PN}" | |
GOARCH="${GOARCH}" | |
GOOS="${GOOS}" | |
EOF | |
. "${ENVFILE}" | |
echo 'GOBIN="/usr/bin"' >> "${ENVFILE}" | |
export GOBIN GOROOT GOARCH GOOS | |
} | |
src_compile() { | |
cd src | |
PATH="${GOBIN}:${PATH}" GOROOT="${S}" CC="$(tc-getCC)" ./make.bash || die | |
if use emacs ; then | |
elisp-compile "${S}"/misc/emacs/*.el || die | |
fi | |
} | |
src_test() { | |
cd src | |
PATH="${GOBIN}:${PATH}" GOROOT="${S}" CC="$(tc-getCC)" ./run.bash || die | |
} | |
src_install() { | |
dobin "${GOBIN}"/* || die | |
insinto "${GOROOT}" | |
doins -r pkg || die | |
insinto "${GOROOT}/src" | |
doins src/Make.* || die | |
insinto "${GOROOT}/src/pkg/runtime" | |
doins src/pkg/runtime/*.h || die | |
if use emacs ; then | |
elisp-install ${PN} "${S}"/misc/emacs/*.el* || die "elisp-install failed" | |
fi | |
if use vim-syntax ; then | |
insinto /usr/share/vim/vimfiles/syntax | |
doins "${S}"/misc/vim/syntax/go.vim || die | |
insinto /usr/share/vim/vimfiles/ftdetect | |
doins "${S}"/misc/vim/ftdetect/gofiletype.vim || die | |
fi | |
doenvd "${ENVFILE}" || die | |
dodoc AUTHORS CONTRIBUTORS README || die | |
dohtml -r doc/* || die | |
} | |
pkg_postinst() { | |
elog "please don't forget to source /etc/profile" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment