File android-platform-tools.spec of Package android-tools

# spec file for package android-platform-tools
# Copyright (c) 2021 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           android-platform-tools
Version:        31.0.2
Release:        0
Summary:        Android platform tools
License:        Apache-2.0 AND MIT
Group:          Hardware/Mobile
Source1:        vendor.tar.gz
# PATCH-FIX-OPENSUSE fix-pie-build.patch boo#1185883 -- Build with -fPIE/-pie
Patch0:         fix-pie-build.patch
# PATCH-FIX-OPENSUSE fix-install-completion.patch boo#1185883 -- Simplify completion
Patch1:         fix-install-completion.patch
# PATCH-FEATURE-OPENSUSE fix-add-e2fsprogs-contrib.patch boo#1185883 -- Some more e2fsprogs tools
Patch2:         fix-add-e2fsprogs-contrib.patch
# PATCH-FEATURE-OPENSUSE fix-install-python-tools.patch boo#1185883 -- Some python3 tools
Patch3:         fix-install-python-tools.patch
BuildRequires:  cmake >= 3.1
BuildRequires:  go
BuildRequires:  gtest
BuildRequires:  help2man
BuildRequires:  ninja
BuildRequires:  pcre2-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libbrotlicommon)
BuildRequires:  pkgconfig(liblz4)
BuildRequires:  pkgconfig(libunwind-generic)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(protobuf)
Requires:       android-udev-rules
%if 0%{?suse_version} <= 1500
BuildRequires:  gcc10
BuildRequires:  gcc10-c++
BuildRequires:  gcc >= 10
BuildRequires:  gcc-c++ >= 10
Provides:       android-tools = %{version}
Obsoletes:      android-tools < %{version}

Android SDK Platform-Tools is a component for the Android SDK.
It includes tools that interface with the Android platform.

%package python3
Summary:        Python3 Android platform tools
Group:          Hardware/Mobile
BuildRequires:  python3-protobuf
Requires:       %{name} = %{version}
Requires:       python3
Requires:       python3-protobuf
Supplements:    (%{name} and python3)
BuildArch:      noarch
Provides:       android-tools-python3 = %{version}
Obsoletes:      android-tools-python3 < %{version}

%description python3
Additional Android platform tools that require python3.

%package bash-completion
Summary:        Bash completion for android-platform-tools
Group:          Hardware/Mobile
BuildRequires:  bash-completion
Requires:       bash-completion
Supplements:    (%{name} and bash)
BuildArch:      noarch
Provides:       android-tools-bash-completion = %{version}
Obsoletes:      android-tools-bash-completion < %{version}

%description bash-completion
Bash command line completion support for android-platform-tools.

%autosetup -p1
tar xf %{SOURCE1} -C vendor/boringssl

%define __builder ninja
%if 0%{?suse_version} <= 1500
export CC=gcc-10
export CXX=g++-10
export CFLAGS="%{optflags} -fPIE -Wno-return-type"
export LDFLAGS="-pie"
export GOFLAGS="-mod=vendor -buildmode=pie -trimpath"


install -d -m 0755 %{buildroot}%{_mandir}/man1
for f in adb fastboot
    help2man -N %{buildroot}%{_bindir}/${f} | sed -e 's|\(/home/.*\)\(/usr/.*\)|\2|g' \
	> %{buildroot}%{_mandir}/man1/${f}.1
for f in aftltool avbtool mkbootimg
    help2man -N %{buildroot}%{_bindir}/${f} --version-string="%{version}" \
	> %{buildroot}%{_mandir}/man1/${f}.1
rm -r %{buildroot}%{_bindir}/__pycache__

%license LICENSE

%files python3

%files bash-completion

openSUSE Build Service is sponsored by