update_engine: convert to autotools and make

scons has been replaced by a standard autotools build system. Beyond
that a few things are different:

 - remove GCC 4.8 workaround, the build system handles this now.
 - instead of trying to make executing code in a cross-compiled $SYSROOT
   work just avoid running the test suite for board builds. The tests
   can still run for the native SDK build.
 - `make install` now handles at least part of the install process.
This commit is contained in:
Michael Marineau 2015-04-06 17:41:13 -07:00
parent a95ebfaef7
commit e78e4aabb6
2 changed files with 17 additions and 40 deletions

View File

@ -1,18 +1,21 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI="4" EAPI=5
CROS_WORKON_PROJECT="coreos/update_engine" CROS_WORKON_PROJECT="coreos/update_engine"
CROS_WORKON_REPO="git://github.com" CROS_WORKON_REPO="git://github.com"
AUTOTOOLS_AUTORECONF=1
# TODO: this can be disabled once -I.. is no longer used
AUTOTOOLS_IN_SOURCE_BUILD=1
if [[ "${PV}" == 9999 ]]; then if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm ~arm64 ~x86" KEYWORDS="~amd64 ~arm ~arm64 ~x86"
else else
CROS_WORKON_COMMIT="e2d68d8eb56450982e53bc0703c11f41b653dcd5" CROS_WORKON_COMMIT="e2cf3c5c3074b987767132de07a1533f2af6597b"
KEYWORDS="amd64 arm arm64 x86" KEYWORDS="amd64 arm arm64 x86"
fi fi
inherit flag-o-matic toolchain-funcs cros-debug cros-workon scons-utils systemd inherit autotools-utils flag-o-matic toolchain-funcs cros-workon systemd
DESCRIPTION="CoreOS OS Update Engine" DESCRIPTION="CoreOS OS Update Engine"
HOMEPAGE="https://github.com/coreos/update_engine" HOMEPAGE="https://github.com/coreos/update_engine"
@ -20,7 +23,7 @@ SRC_URI=""
LICENSE="BSD" LICENSE="BSD"
SLOT="0" SLOT="0"
IUSE="cros_host -delta_generator symlink-usr" IUSE="cros-debug cros_host -delta_generator symlink-usr"
LIBCHROME_VERS="180609" LIBCHROME_VERS="180609"
@ -39,10 +42,9 @@ RDEPEND="!coreos-base/coreos-installer
sys-fs/e2fsprogs" sys-fs/e2fsprogs"
DEPEND="dev-cpp/gmock DEPEND="dev-cpp/gmock
dev-cpp/gtest dev-cpp/gtest
cros_host? ( dev-util/scons )
${RDEPEND}" ${RDEPEND}"
src_compile() { src_configure() {
# Disable PIE when building for the SDK, this works around a bug that # Disable PIE when building for the SDK, this works around a bug that
# breaks using delta_generator from the update.zip bundle. # breaks using delta_generator from the update.zip bundle.
# https://code.google.com/p/chromium/issues/detail?id=394508 # https://code.google.com/p/chromium/issues/detail?id=394508
@ -52,56 +54,31 @@ src_compile() {
append-ldflags -nopie append-ldflags -nopie
fi fi
# Fix builds with GCC 4.8 local myeconfargs=(
if [[ $(gcc-major-version) -ge 4 && $(gcc-minor-version) -ge 8 ]]; then $(use_enable cros-debug debug)
append-flags -Wno-unused-local-typedefs $(use_enable delta_generator)
fi )
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG autotools-utils_src_configure
cros-debug-add-NDEBUG
export CCFLAGS="$CFLAGS"
export BASE_VER=${LIBCHROME_VERS}
escons
} }
src_test() { src_test() {
UNITTESTS_BINARY=update_engine_unittests if use cros_host; then
TARGETS="${UNITTESTS_BINARY} test_http_server delta_generator" autotools-utils_src_test
escons ${TARGETS}
if ! use x86 && ! use amd64 ; then
einfo "Skipping tests on non-x86 platform..."
else else
# We need to set PATH so that the `openssl` in the target ewarn "Skipping tests on cross-compiled target platform..."
# sysroot gets executed instead of the host one (which is
# compiled differently). http://crosbug.com/27683
PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='-*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (unprivileged) succeeded" \
|| die "./${UNITTESTS_BINARY} (unprivileged) failed, retval=$?"
sudo LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (root) succeeded" \
|| die "./${UNITTESTS_BINARY} (root) failed, retval=$?"
fi fi
} }
src_install() { src_install() {
dosbin update_engine autotools-utils_src_install
dosbin systemd/update_engine_stub
dobin update_engine_client
dosbin coreos-postinst
dosbin coreos-setgoodroot
if use symlink-usr; then if use symlink-usr; then
dosym sbin/coreos-postinst /usr/postinst dosym sbin/coreos-postinst /usr/postinst
else else
dosym usr/sbin/coreos-postinst /postinst dosym usr/sbin/coreos-postinst /postinst
fi fi
use delta_generator && dobin delta_generator
systemd_dounit systemd/update-engine.service systemd_dounit systemd/update-engine.service
systemd_dounit systemd/update-engine-stub.service systemd_dounit systemd/update-engine-stub.service
systemd_dounit systemd/update-engine-stub.timer systemd_dounit systemd/update-engine-stub.timer