Skip to content

Instantly share code, notes, and snippets.

@jmroot
Created November 6, 2023 20:37
Show Gist options
  • Select an option

  • Save jmroot/a919ee34a6833b7d1a3cfcc37a1bff8d to your computer and use it in GitHub Desktop.

Select an option

Save jmroot/a919ee34a6833b7d1a3cfcc37a1bff8d to your computer and use it in GitHub Desktop.
android-platform-tools with subports for older CPUs
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
name android-platform-tools
version 34.0.5
categories java devel
installs_libs no
maintainers {judaew @judaew} openmaintainer
homepage https://developer.android.com/studio/
description Platform-Tools for Google Android SDK (adb and fastboot)
long_description {*}${description}
# different files are covered with different licenses. See
# platform-tools/NOTICE.txt for details
license BSD MIT NCSA Apache-2 GPL-2 LGPL-2.1
master_sites https://dl.google.com/android/repository
distname platform-tools_r${version}-darwin
use_zip yes
checksums rmd160 5c3e0f5cf838a317b79e985b6c023e000be64ee2 \
sha256 b2c9757744a9d01fcc616b893ac6236233caf1bdf2ef384d73371ab68bfc4a43 \
size 11194858
use_configure no
worksrcdir platform-tools
# detect which version to depend on based on HW capabilities
switch ${configure.build_arch} {
arm64 {
depends_run port:android-platform-tools-latest
}
x86_64 {
if {![catch {sysctl hw.optional.sse4_1} sse4] && $sse4 == 1} {
depends_run port:android-platform-tools-latest
} else {
depends_run port:android-platform-tools-31
}
}
i386 {
depends_run port:android-platform-tools-23
}
}
# define versioned subports
subport android-platform-tools-latest {
supported_archs x86_64 arm64
}
subport android-platform-tools-31 {
version 31.0.3
set ver_hash e8b2b4cbe47c728c1e54c5f524440b52d4e1a33c
distname ${ver_hash}.platform-tools_r${version}-darwin
checksums rmd160 26a2d4602ddd7537798bacd3adf6d5c376dc3e77 \
sha256 773c08cfa31cec1bb4568ce5b374366e6310a5ffc21875024604a0f65bc831b1 \
size 13227985
supported_archs i386 x86_64
notes-append "The current version of ${name} requires SSE4.1, which is not supported by your CPU. The last version compatible with your CPU (${version}) has been installed instead."
}
subport android-platform-tools-23 {
version 23.0.1
distname platform-tools_r${version}-macosx
checksums rmd160 7d0d3fbfdf2bbb8e1d6430373da88c2e77b9c6de \
sha256 d2439f5de236c3831c048b678653c5955487351be8e196c65923b4eca5c47692 \
size 2489850
supported_archs i386
notes-append "The current version of ${name} requires a 64-bit CPU. The last version compatible with your CPU (${version}) has been installed instead."
}
build {}
if {$subport ne $name} {
destroot {
set sdk_dir ${prefix}/share/java/android-sdk-macosx
xinstall -d ${destroot}${sdk_dir}
file copy ${worksrcpath} ${destroot}${sdk_dir}/platform-tools
foreach bin {adb fastboot} {
ln -s ${sdk_dir}/platform-tools/${bin} ${destroot}${prefix}/bin/${bin}
}
}
} else {
supported_archs noarch
platforms any
distfiles
destroot {
xinstall -d ${prefix}/share/doc/${name}
system "echo $name is a stub port > ${prefix}/share/doc/${name}/ReadMe.txt"
}
}
livecheck.url https://developer.android.com/studio/releases/platform-tools.html
livecheck.regex <h4 id=".+">(\[0-9\.\]+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment