Skip to content

Instantly share code, notes, and snippets.

@azenla
Created June 17, 2016 20:21
Show Gist options
  • Save azenla/1c85b7c54373f1133999493a8c0d11d0 to your computer and use it in GitHub Desktop.
Save azenla/1c85b7c54373f1133999493a8c0d11d0 to your computer and use it in GitHub Desktop.
EAPI=5
DESCRIPTION="Dart SDK"
HOMEPAGE="https://www.dartlang.org/"
SRC_URI=""
inherit git-r3 eutils autotools
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="
dev-lang/python:2.7
>=sys-devel/gcc-4.6.0
dev-vcs/git
"
RDEPEND="${DEPEND}"
URI_DEPOT_TOOLS="https://chromium.googlesource.com/chromium/tools/depot_tools.git"
URI_DART_GCONFIG="https://github.com/dart-lang/sdk.git"
src_unpack() {
einfo "Fetching depot_tools"
git clone ${URI_DEPOT_TOOLS} depot_tools
export PATH="${PWD}/depot_tools:${PATH}"
einfo "Fetching Dart Code"
mkdir -p source
cd source
gclient config ${URI_DART_GCONFIG}
gclient sync -n || die
gclient runhooks || die
cd ..
mv source ${P}
cd "${S}"
}
src_prepare() {
einfo "Build Dart SDK"
}
src_compile() {
local option_params
option_params=" -m release"
if use amd64; then
option_params="${option_params} -a x64"
elif use x86; then
option_params="${option_params} -a ia32"
else
eerror "Currently this ebuild does not support any other architecture except x86/amd64."
die
fi
option_params="${option_params} --os=host create_sdk"
cd sdk
unset CCFLAGS CFLAGS CXXFLAGS
./tools/build.py ${option_params} || die
}
src_install() {
elog "Packaging Dart SDK"
dodir /opt/dart
cp -R ${S}/sdk/out/Release*/dart-sdk/* ${D}/opt/dart/ || "Install failed!"
}
pkg_postinst() {
einfo "Dart is installed at /opt/dart. Due to special folder structure,"
einfo "You may need to add /opt/dart to your PATH manually."
ewarn "Be aware this ebuild is LIVE ebuild."
ewarn "Do not report build errors except the errors with ebuild"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment