|
| 1 | +# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI="4" |
| 5 | +CROS_WORKON_COMMIT="fabe3f4cc2204755d26ff611a1631fd51c8b0fa6" |
| 6 | +CROS_WORKON_TREE="e5239bf292c078381e7d19833a31752f0f72f5df" |
| 7 | +CROS_WORKON_PROJECT="chromiumos/platform/vpd" |
| 8 | + |
| 9 | +inherit cros-workon systemd |
| 10 | + |
| 11 | +DESCRIPTION="ChromeOS vital product data utilities" |
| 12 | +HOMEPAGE="http://www.chromium.org/" |
| 13 | +SRC_URI="" |
| 14 | + |
| 15 | +LICENSE="BSD-Google" |
| 16 | +SLOT="0" |
| 17 | +KEYWORDS="*" |
| 18 | +IUSE="static systemd" |
| 19 | + |
| 20 | +# util-linux is for libuuid. |
| 21 | +DEPEND="sys-apps/util-linux" |
| 22 | +# shflags for dump_vpd_log. |
| 23 | +# chromeos-activate-date for ActivateDate upstart and script. |
| 24 | +RDEPEND=" |
| 25 | + sys-apps/flashrom |
| 26 | + dev-util/shflags |
| 27 | + virtual/chromeos-activate-date |
| 28 | + !chromeos-base/vpd-info-append |
| 29 | + " |
| 30 | + |
| 31 | +FYDEOS_DEFAULT_LOCALE="en-US" |
| 32 | +FYDEOS_DEFAULT_TIMEZONE="US/Pacific" |
| 33 | +FYDEOS_DEFAULT_REGION="en-US" |
| 34 | +VPD_TEMPLATE="oem_licence.tmp" |
| 35 | + |
| 36 | +src_prepare() { |
| 37 | + default |
| 38 | + epatch ${FILESDIR}/*.patch |
| 39 | + cp ${FILESDIR}/${VPD_TEMPLATE} ${S} |
| 40 | +} |
| 41 | + |
| 42 | +src_configure() { |
| 43 | + cros-workon_src_configure |
| 44 | +} |
| 45 | + |
| 46 | +count_chars() { |
| 47 | + printf $1 | wc -c |
| 48 | +} |
| 49 | + |
| 50 | +src_compile() { |
| 51 | + tc-export CC |
| 52 | + use static && append-ldflags -static |
| 53 | + emake all |
| 54 | + local locale=${FYDEOS_LOCALE:-`echo $FYDEOS_DEFAULT_LOCALE`} |
| 55 | + local timezone=${FYDEOS_TIMEZONE:-`echo $FYDEOS_DEFAULT_TIMEZONE`} |
| 56 | + local region=${FYDEOS_REGION:-`echo $FYDEOS_DEFAULT_REGION`} |
| 57 | + ${FILESDIR}/vpd -i RO_VPD -f ${VPD_TEMPLATE} \ |
| 58 | + -p $(count_chars $locale) -s "initial_locale=${locale}" \ |
| 59 | + -p $(count_chars $timezone) -s "initial_timezone=${timezone}" \ |
| 60 | + -p $(count_chars $region) -s "region=${region}" |
| 61 | +} |
| 62 | + |
| 63 | +src_install() { |
| 64 | + # This target list should be architecture specific |
| 65 | + # (no ACPI stuff on ARM for instance) |
| 66 | + dosbin vpd vpd_s |
| 67 | + dosbin util/check_rw_vpd util/dump_vpd_log util/update_rw_vpd |
| 68 | + dosbin util/vpd_get_value |
| 69 | + |
| 70 | + # install the init script |
| 71 | + if use systemd; then |
| 72 | + systemd_dounit init/vpd-log.service |
| 73 | + systemd_enable_service boot-services.target vpd-log.service |
| 74 | + else |
| 75 | + insinto /etc/init |
| 76 | + doins init/check-rw-vpd.conf |
| 77 | + doins init/vpd-log.conf |
| 78 | + doins ${FILESDIR}/check_serial_number.conf |
| 79 | + fi |
| 80 | + insinto /usr/share/oem |
| 81 | + newins ${VPD_TEMPLATE} .oem_licence |
| 82 | + insinto /usr/share/cros/init |
| 83 | + doins ${FILESDIR}/check_serial_number.sh |
| 84 | +} |
| 85 | + |
| 86 | +src_test() { |
| 87 | + if ! use x86 && ! use amd64; then |
| 88 | + ewarn "Skipping unittests for non-x86 arches" |
| 89 | + return |
| 90 | + fi |
| 91 | + emake test |
| 92 | +} |
0 commit comments