Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/android-tools/files/, dev-util/android-tools/
Date: Fri, 26 Jan 2018 22:40:24
Message-Id: 1517006411.4ae818f00f38343a8dca9787c3ee7337b3654546.vapier@gentoo
1 commit: 4ae818f00f38343a8dca9787c3ee7337b3654546
2 Author: Mike Frysinger <vapier <AT> chromium <DOT> org>
3 AuthorDate: Tue Jan 2 10:14:35 2018 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 26 22:40:11 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ae818f0
7
8 dev-util/android-tools: version bump to 8.1.0_p1 #632382
9
10 Closes: https://bugs.gentoo.org/632382
11
12 dev-util/android-tools/Manifest | 7 ++
13 .../android-tools/android-tools-8.1.0_p1.ebuild | 124 ++++++++++++++++++++
14 .../files/android-tools-8.1.0_p1-build.patch | 30 +++++
15 dev-util/android-tools/files/make-tarballs.sh | 128 +++++++++++++++++++++
16 4 files changed, 289 insertions(+)
17
18 diff --git a/dev-util/android-tools/Manifest b/dev-util/android-tools/Manifest
19 index 05c7de00a27..15a69b3f57d 100644
20 --- a/dev-util/android-tools/Manifest
21 +++ b/dev-util/android-tools/Manifest
22 @@ -8,3 +8,10 @@ DIST android-tools-6.0.1_r79-core.tar.gz 1186562 BLAKE2B 473454d340e65f98201508c
23 DIST android-tools-6.0.1_r79-extras.tar.gz 648657 BLAKE2B 4582ddd57b729492e08987e17304c62778504ffc316ab26df8c83fff1aed33226106474131d5ad0e3e302b577c83a2b78d0be04fef9711e39861a223580ab1b9 SHA512 e10694737c518f591eff4e808bb826c83bf45dc44c5c1ee8a4082a6e0653350ffe2986e299348cb4a1219203192d01546a05e9354ce05e29897f856c147de8c3
24 DIST android-tools-6.0.1_r79-f2fs-tools.tar.gz 70255 BLAKE2B ab9ce3efd33c28a1a0a9cb8a5415057498dd493e059183cc9d3fcc9de1b5ca4d7488c75695c94700fc6a4e5503beb8647576c7096fa50229f98485d2983ce152 SHA512 0871f99f78006028889b42668ec627b6515bb812ad3ec4a489f62187a79f64d2a74f66556698a5f05fc99932f75fefd8810dedceeab744b212beb764e97b82c8
25 DIST android-tools-6.0.1_r79-libselinux.tar.gz 50814 BLAKE2B f09f26c801be83bc97f4b18606f513ce0fae791126a30c90067e3b2066c991fa1390ab2d0fac2475f755f3245179718204d5014f47ece46801dc0f80caf9758b SHA512 686557271271c4d59fb968c5aa76b433955009733f3151c4c86faa996ce846088d6632b0969b23699822b7a6f09eae60abedba6abb0edc9d444159bbdb5c6f91
26 +DIST android-tools-8.1.0_r1-arch.tar.gz 6250 BLAKE2B 65447517a33438c8531a9d707c6107703eaccb558e505e51a88ef51e70f83488620f76eb0240dc0899211cf120e9e1ffbea041086f1d8133f30b56358aba76d6 SHA512 5746e0b2f6aae37ebe60b7b1e939699a11de2f44286497f77d700c3896e02559d55002f036ecdc1c412844bfce4ab245b9086193dc982e6be74bcaea61010c5c
27 +DIST android-tools-8.1.0_r1-core.tar.gz 5227179 BLAKE2B afb280d67fe1b926e1f1ad68409584ad0209eb48921542e2bd490448c888cdf4bf6fb4c6f9552d580c7a396e79c2c85019e79a9a6c9881ea962c2f1064c33d82 SHA512 2c8e67232ca6348a4fd4b5d7077715491d2168c46fc8e336635a961bbbed156ef480718ee58393501196e9315c6c1bda807f8966944e3bc209dd5a0f7088642e
28 +DIST android-tools-8.1.0_r1-extras.tar.xz 275952 BLAKE2B 0fd3c536fee6ffbe2cdd4321604d32dc3a2b48a1b3edcb9121e83ceea760e491b47b301c3d8126565efd6b11adabd4f89c79bbe8731585660ce395af9e643fe7 SHA512 bfe3af89eadf38ce6805637e41f3fb15feb85455902f6a43e52a2f95dd1595cc896a9f46ccc82ab8db433f56a05f2f4c0ba85b77f40b03d5d69c8fec4082a2da
29 +DIST android-tools-8.1.0_r1-f2fs-tools.tar.xz 93924 BLAKE2B b8b6c7ba4c3f5309bfcfc91bd57d018d7af66f8dd25590207fd545f0dba02961826bf9963a56c7994feea5db8f9caedfe4fe62870420d9544283f87ec337cfb8 SHA512 de726be0691c58a5093098bd30cfc06c4312c44bec040cbecd594694cb7b38742dafd1f00b08c18f1b70abf56571738eb3e85e612f082e09e51a98980444e069
30 +DIST android-tools-8.1.0_r1-selinux.tar.xz 3188060 BLAKE2B 8c513d858e8dcaed705975ad61f362d7b1c2252685a63a1ad6035f36b0b402f1857ac5d2635d35ffa10f05b4a2605f30f27dcc5e9d91930eb0656f3ce2da036d SHA512 8799f10b4dba840ecea8f6abb8166c2e137eb3f0d9c5cfb132c661cf17800f2eeaafb1b4ec9e8974fc3324fae99e3654e52397c987faf1d48ab6148152d84f11
31 +DIST android-tools-8.1.0_r1.ninja.xz 2740 BLAKE2B 34473e33970cefdaf82bbe4524665fd50e6617cf867757ca07cdccc2e7356f43ef4bb455080ef4bac516ddba3c4e4120f0b27306e84725f8d5738a81800e3a53 SHA512 707e0e1c53832a42384e93d363f80007b76f18166b9f3f7d516431410b05319b1acc804daa1fddc218e11feb48de48683efb5203f4fa6d80646dcb1a2953139f
32 +DIST boringssl-14308731e5446a73ac2258688a9688b524483cb6.tar.gz 13030361 BLAKE2B 6982416b6e193e7faccd41fff3bd35f80b11d7495251d876e6b081bd94a887ec3c6bf5b7852d9595594fc2bdc57353f268272ef01fb79f7c93b52d46cbda69ac SHA512 171b524b0452a48853b2c8010ff5e14d5d720e69eeaf1d3b79f675838f3afa94aee9de2f47b37303feb2d92cbf77639efe585786625b7b37b8cc2ba727c37fdc
33
34 diff --git a/dev-util/android-tools/android-tools-8.1.0_p1.ebuild b/dev-util/android-tools/android-tools-8.1.0_p1.ebuild
35 new file mode 100644
36 index 00000000000..a1e81887fcd
37 --- /dev/null
38 +++ b/dev-util/android-tools/android-tools-8.1.0_p1.ebuild
39 @@ -0,0 +1,124 @@
40 +# Copyright 1999-2018 Gentoo Foundation
41 +# Distributed under the terms of the GNU General Public License v2
42 +
43 +EAPI="6"
44 +
45 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
46 +CMAKE_MAKEFILE_GENERATOR="ninja"
47 +
48 +inherit flag-o-matic bash-completion-r1 ninja-utils toolchain-funcs cmake-utils python-r1 python-utils-r1
49 +
50 +MY_PV="${PV/_p/_r}"
51 +MY_P=${PN}-${MY_PV}
52 +
53 +DESCRIPTION="Android platform tools (adb, fastboot, and mkbootimg)"
54 +HOMEPAGE="https://android.googlesource.com/platform/system/core.git/"
55 +# See helper scripts in files/ for creating these tarballs and getting this hash.
56 +BORINGSSL_SHA1="14308731e5446a73ac2258688a9688b524483cb6"
57 +# The ninja file was created by running the ruby script from archlinux by hand and fixing the build vars.
58 +# No point in depending on something large/uncommon like ruby just to generate a ninja file.
59 +SRC_URI="https://git.archlinux.org/svntogit/community.git/snapshot/community-2b7f9774cc468205fec145e64e9103aee8e5c6f9.tar.gz -> ${MY_P}-arch.tar.gz
60 + https://github.com/android/platform_system_core/archive/android-${MY_PV}.tar.gz -> ${MY_P}-core.tar.gz
61 + https://github.com/google/boringssl/archive/${BORINGSSL_SHA1}.tar.gz -> boringssl-${BORINGSSL_SHA1}.tar.gz
62 + mirror://gentoo/${MY_P}-extras.tar.xz https://dev.gentoo.org/~vapier/dist/${MY_P}-extras.tar.xz
63 + mirror://gentoo/${MY_P}-selinux.tar.xz https://dev.gentoo.org/~vapier/dist/${MY_P}-selinux.tar.xz
64 + mirror://gentoo/${MY_P}-f2fs-tools.tar.xz https://dev.gentoo.org/~vapier/dist/${MY_P}-f2fs-tools.tar.xz
65 + mirror://gentoo/${MY_P}.ninja.xz https://dev.gentoo.org/~vapier/dist/${MY_P}.ninja.xz"
66 +
67 +# The entire source code is Apache-2.0, except for fastboot which is BSD-2.
68 +LICENSE="Apache-2.0 BSD-2"
69 +SLOT="0"
70 +KEYWORDS="~amd64 ~arm ~x86 ~arm-linux ~x86-linux"
71 +IUSE="python"
72 +
73 +DEPEND="sys-libs/zlib:=
74 + dev-libs/libpcre2:=
75 + virtual/libusb:1="
76 +RDEPEND="${DEPEND}
77 + python? ( ${PYTHON_DEPS} )"
78 +DEPEND+="
79 + dev-lang/go"
80 +
81 +S=${WORKDIR}
82 +CMAKE_USE_DIR="${S}/boringssl"
83 +
84 +unpack_into() {
85 + local archive="$1"
86 + local dir="$2"
87 +
88 + mkdir -p "${dir}"
89 + pushd "${dir}" >/dev/null || die
90 + unpack "${archive}"
91 + if [[ ${dir} != ./* ]] ; then
92 + mv */* ./ || die
93 + fi
94 + popd >/dev/null
95 +}
96 +
97 +src_unpack() {
98 + unpack_into "${MY_P}-arch.tar.gz" arch
99 + unpack_into "${MY_P}-core.tar.gz" core
100 + unpack_into "${MY_P}-extras.tar.xz" extras
101 + unpack_into "${MY_P}-f2fs-tools.tar.xz" ./f2fs-tools
102 + unpack_into "${MY_P}-selinux.tar.xz" ./selinux
103 + unpack_into boringssl-${BORINGSSL_SHA1}.tar.gz boringssl
104 +
105 + unpack "${MY_P}.ninja.xz"
106 + mv "${MY_P}.ninja" "build.ninja" || die
107 +
108 + # Avoid depending on gtest just for its prod headers when boringssl bundles it.
109 + ln -s ../../boringssl/third_party/googletest/include/gtest core/include/ || die
110 +}
111 +
112 +src_prepare() {
113 + cd "${S}"/core
114 + eapply "${WORKDIR}"/arch/trunk/fix_build_core.patch
115 + eapply "${FILESDIR}"/${P}-build.patch
116 + sed -i '1i#include <sys/sysmacros.h>' adb/client/usb_linux.cpp || die #616508
117 +
118 + cd "${S}"/selinux
119 + eapply "${WORKDIR}"/arch/trunk/fix_build_selinux.patch
120 +
121 + cd "${S}"/extras
122 + sed -e 's|^#include <sys/cdefs.h>$|/*\0*/|' \
123 + -e 's|^__BEGIN_DECLS$|#ifdef __cplusplus\nextern "C" {\n#endif|' \
124 + -e 's|^__END_DECLS$|#ifdef __cplusplus\n}\n#endif|' \
125 + -i ext4_utils/sha1.{c,h} || die #580686
126 +
127 + cd "${S}"
128 + default
129 +
130 + # The pregenerated ninja file expects the build/ dir.
131 + BUILD_DIR="${CMAKE_USE_DIR}/build"
132 + cmake-utils_src_prepare
133 +}
134 +
135 +src_configure() {
136 + append-lfs-flags
137 +
138 + cmake-utils_src_configure
139 +
140 + sed -i \
141 + -e "s:@CC@:$(tc-getCC):g" \
142 + -e "s:@CXX@:$(tc-getCXX):g" \
143 + -e "s:@CFLAGS@:${CFLAGS}:g" \
144 + -e "s:@CPPFLAGS@:${CPPFLAGS}:g" \
145 + -e "s:@CXXFLAGS@:${CXXFLAGS}:g" \
146 + -e "s:@LDFLAGS@:${LDFLAGS}:g" \
147 + -e "s:@PV@:${PV}:g" \
148 + build.ninja || die
149 +}
150 +
151 +src_compile() {
152 + # We only need a few libs from boringssl.
153 + cmake-utils_src_compile libcrypto.a libssl.a
154 +
155 + eninja
156 +}
157 +
158 +src_install() {
159 + dobin adb fastboot
160 + dodoc core/adb/*.{txt,TXT} core/fastboot/README.md
161 + use python && python_foreach_impl python_doexe core/mkbootimg/mkbootimg
162 + newbashcomp arch/trunk/bash_completion.fastboot fastboot
163 +}
164
165 diff --git a/dev-util/android-tools/files/android-tools-8.1.0_p1-build.patch b/dev-util/android-tools/files/android-tools-8.1.0_p1-build.patch
166 new file mode 100644
167 index 00000000000..f3d664ef70a
168 --- /dev/null
169 +++ b/dev-util/android-tools/files/android-tools-8.1.0_p1-build.patch
170 @@ -0,0 +1,30 @@
171 +--- a/adb/sysdeps.h
172 ++++ b/adb/sysdeps.h
173 +@@ -66,6 +66,11 @@
174 + #endif
175 + #endif
176 +
177 ++#ifndef __clang__
178 ++#define _Nonnull
179 ++#define _Nullable
180 ++#endif
181 ++
182 + #ifdef _WIN32
183 +
184 + // Clang-only nullability specifiers
185 +--- a/libcutils/include/cutils/trace.h
186 ++++ b/libcutils/include/cutils/trace.h
187 +@@ -18,7 +18,13 @@
188 + #define _LIBS_CUTILS_TRACE_H
189 +
190 + #include <inttypes.h>
191 ++// https://gcc.gnu.org/PR60932
192 ++#ifdef __cplusplus
193 ++#include <atomic>
194 ++using namespace std;
195 ++#else
196 + #include <stdatomic.h>
197 ++#endif
198 + #include <stdbool.h>
199 + #include <stdint.h>
200 + #include <stdio.h>
201
202 diff --git a/dev-util/android-tools/files/make-tarballs.sh b/dev-util/android-tools/files/make-tarballs.sh
203 new file mode 100755
204 index 00000000000..5a0a775c129
205 --- /dev/null
206 +++ b/dev-util/android-tools/files/make-tarballs.sh
207 @@ -0,0 +1,128 @@
208 +#!/bin/bash
209 +# Copyright 1999-2018 Gentoo Foundation
210 +# Distributed under the terms of the GNU General Public License v2
211 +
212 +# Create the various tarballs we need. GoB does not provide stable archives (unlike github),
213 +# and some repos are uselessly fat, so we have to create things by hand. Fun times.
214 +
215 +set -e
216 +
217 +die() {
218 + echo "error: $*" >&2
219 + exit 1
220 +}
221 +
222 +fetch_boringssl() {
223 + local ver=$1 tag=$2
224 + local content hash
225 +
226 + echo "checking boringssl in ${tag}"
227 + content=$(wget -nv "https://android.googlesource.com/platform/external/boringssl/+/${tag}/BORINGSSL_REVISION?format=TEXT" -O -)
228 + hash=$(echo "${content}" | base64 -d)
229 + echo "using boringssl ${hash}"
230 +
231 + local tar="${DISTDIR}/boringssl-${hash}.tar.gz"
232 + if [[ ! -e ${tar} ]] ; then
233 + # We use github as it provides stable tarballs. GoB does not (includes timestamps).
234 + # https://boringssl.googlesource.com/boringssl/+archive/${hash}.tar.gz
235 + wget -c "https://github.com/google/boringssl/archive/${hash}.tar.gz" -O "${tar}"
236 + fi
237 +
238 + du -h "${tar}"
239 +}
240 +
241 +# The extras repo has ballooned to ~200MB, so we have to strip the large useless
242 +# files and random binaries.
243 +fetch_extras() {
244 + local ver=$1 tag=$2
245 + local tar="${DISTDIR}/android-tools-${ver}-extras.tar.xz"
246 +
247 + if [[ ! -e ${tar} ]] ; then
248 + local prune=(
249 + ioshark
250 + memory_replay
251 + perfprofd
252 + simpleperf
253 + )
254 + local dir="${tag}-extras"
255 + rm -rf "${dir}"
256 + mkdir "${dir}"
257 + cd "${dir}"
258 +
259 + wget "https://android.googlesource.com/platform/system/extras/+archive/${tag}.tar.gz" -O extras.tar.gz
260 + tar xf extras.tar.gz
261 + rm -rf "${prune[@]}" extras.tar.gz
262 +
263 + cd ..
264 + tar cf - "${dir}" | xz -9 > "${dir}.tar.xz"
265 + rm -rf "${dir}"
266 +
267 + mv "${dir}.tar.xz" "${tar}"
268 + fi
269 +
270 + du -h "${tar}"
271 +}
272 +
273 +# Since the GoB archive is unstable, we might as well rewrite it into xz to shrink.
274 +fetch_selinux() {
275 + local ver=$1 tag=$2
276 + local tar="${DISTDIR}/android-tools-${ver}-selinux.tar.xz"
277 +
278 + if [[ ! -e ${tar} ]] ; then
279 + wget "https://android.googlesource.com/platform/external/selinux/+archive/${tag}.tar.gz" -O - | zcat | xz > "${tar}"
280 + fi
281 +
282 + du -h "${tar}"
283 +}
284 +
285 +# Since the GoB archive is unstable, we might as well rewrite it into xz to shrink.
286 +fetch_f2fs() {
287 + local ver=$1 tag=$2
288 + local tar="${DISTDIR}/android-tools-${ver}-f2fs-tools.tar.xz"
289 +
290 + if [[ ! -e ${tar} ]] ; then
291 + wget "https://android.googlesource.com/platform/external/f2fs-tools/+archive/${tag}.tar.gz" -O - | zcat | xz > "${tar}"
292 + fi
293 +
294 + du -h "${tar}"
295 +}
296 +
297 +usage() {
298 + local status=$1
299 +
300 + [[ ${status} -eq 1 ]] && exec 1>&2
301 +
302 + cat <<-EOF
303 + Usage: $0 <android version>
304 +
305 + To find the next available version, consult:
306 + https://git.archlinux.org/svntogit/community.git/log/trunk?h=packages/android-tools
307 +
308 + They have some helper scripts for building the files directly.
309 +
310 + Example:
311 + $0 android-8.1.0_r1
312 + EOF
313 +
314 + exit ${status}
315 +}
316 +
317 +main() {
318 + [[ $# -ne 1 ]] && usage 1
319 + [[ $1 == "-h" || $1 == "--help" ]] && usage 0
320 +
321 + if [[ -z ${DISTDIR} ]] ; then
322 + eval $(portageq -v envvar DISTDIR)
323 + fi
324 + if [[ -z ${DISTDIR} ]] ; then
325 + die "Please set \$DISTDIR first"
326 + fi
327 +
328 + local ver="${1#android-}"
329 + local tag="android-${ver}"
330 + fetch_boringssl "${ver}" "${tag}"
331 + fetch_extras "${ver}" "${tag}"
332 + fetch_selinux "${ver}" "${tag}"
333 + fetch_f2fs "${ver}" "${tag}"
334 +}
335 +main "$@"