Skip to content

Instantly share code, notes, and snippets.

@matsuu
Created May 11, 2010 14:22
Show Gist options
  • Save matsuu/397366 to your computer and use it in GitHub Desktop.
Save matsuu/397366 to your computer and use it in GitHub Desktop.
ebuild for ibus-mozc
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
PYTHON_DEPEND="2"
inherit multilib python subversion toolchain-funcs
DESCRIPTION="The Mozc engine for IBus Framework"
HOMEPAGE="http://code.google.com/p/mozc/"
# subversion eclass fetches gclient, which will then fetch mozc itself
ESVN_REPO_URI="http://src.chromium.org/svn/trunk/tools/depot_tools"
EGCLIENT_REPO_URI="http://mozc.googlecode.com/svn/trunk/src"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
RDEPEND=">=app-i18n/ibus-1.2
dev-libs/glib:2
dev-libs/protobuf
net-misc/curl
sys-libs/zlib
x11-libs/qt-gui:4"
DEPEND="${RDEPEND}
dev-util/gtest"
BUILDTYPE="${BUILDTYPE:-Release}"
pkg_setup() {
python_set_active_version 2
}
src_unpack() {
subversion_src_unpack
mv "${S}" "${WORKDIR}"/depot_tools
# Most subversion checks and configurations were already run
EGCLIENT="${WORKDIR}"/depot_tools/gclient
cd "${ESVN_STORE_DIR}" || die "gclient: can't chdir to ${ESVN_STORE_DIR}"
if [[ ! -d ${PN} ]]; then
mkdir -p "${PN}" || die "gclient: can't mkdir ${PN}."
fi
cd "${PN}" || die "gclient: can't chdir to ${PN}"
if [[ ! -f .gclient ]]; then
einfo "gclient config -->"
${EGCLIENT} config ${EGCLIENT_REPO_URI} || die "gclient: error creating config"
fi
einfo "gclient sync start -->"
einfo " repository: ${EGCLIENT_REPO_URI}"
${EGCLIENT} sync || die "gclient: can't fetch to ${PN} from ${EGCLIENT_REPO_URI}."
einfo " working copy: ${ESVN_STORE_DIR}/${PN}"
mkdir -p "${S}"
rsync -rlpgo --exclude=".svn/" src/ "${S}" || die "gclient: can't export to ${S}."
}
src_prepare() {
sed -i -e "s:/usr/lib/mozc:/usr/$(get_libdir)/mozc:" base/util.cc || die
}
src_configure() {
export HOME="${S}"
export BUILD_COMMAND="emake"
"$(PYTHON)" build_mozc.py gyp || die "gyp failed"
}
src_compile() {
CFLAGS="" CXXFLAGS="" "$(PYTHON)" build_mozc.py build_tools -c "${BUILDTYPE}" || die
export CXX="$(tc-getCXX)"
export CC="$(tc-getCC)"
export AR="$(tc-getAR)"
export AS="$(tc-getAS)"
export RANLIB="$(tc-getRANLIB)"
export LD="$(tc-getLD)"
"$(PYTHON)" build_mozc.py build -c "${BUILDTYPE}" \
unix/ibus/ibus.gyp:ibus_mozc \
server/server.gyp:mozc_server \
gui/gui.gyp:mozc_tool || die
}
src_install() {
exeinto /usr/libexec || die
newexe "out/${BUILDTYPE}/ibus_mozc" ibus-engine-mozc || die
exeinto "/usr/$(get_libdir)/mozc" || die
doexe "out/${BUILDTYPE}/mozc_server" "out/${BUILDTYPE}/mozc_tool" || die
insinto /usr/share/ibus/component || die
doins unix/ibus/mozc.xml || die
}
Copy link

ghost commented May 23, 2010

Thanks! Will you add this to the portage tree eventually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment