File android-tools.spec of Package android-tools

#
# spec file for package android-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 https://bugs.opensuse.org/
#


Name:           android-tools
Version:        31.0.3
Release:        lp153.13.1
Summary:        Android platform tools
License:        Apache-2.0 AND MIT
Group:          Hardware/Mobile
URL:            https://developer.android.com/studio/releases/platform-tools
Source0:        https://github.com/nmeum/android-tools/releases/download/%{version}/%{name}-%{version}.tar.xz
Source1:        vendor.tar.gz
# PATCH-FIX-OPENSUSE fix-pie-build.patch boo#1185883 munix9@googlemail.com -- Build with -fPIE/-pie
Patch0:         fix-pie-build.patch
# PATCH-FIX-OPENSUSE fix-install-completion.patch boo#1185883 munix9@googlemail.com -- Simplify completion
Patch1:         fix-install-completion.patch
# PATCH-FEATURE-OPENSUSE fix-add-e2fsprogs-contrib.patch boo#1185883 munix9@googlemail.com -- Some more e2fsprogs tools
Patch2:         fix-add-e2fsprogs-contrib.patch
# PATCH-FEATURE-OPENSUSE fix-install-python-tools.patch boo#1185883 munix9@googlemail.com -- 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++
%else
BuildRequires:  gcc >= 10
BuildRequires:  gcc-c++ >= 10
%endif

%description
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
Requires:       %{name} = %{version}
Requires:       python3
Supplements:    (%{name} and python3)
BuildArch:      noarch

%description python3
Additional Android platform tools that require python3.

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

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

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

%build
%define __builder ninja
%if 0%{?suse_version} <= 1500
export CC=gcc-10
export CXX=g++-10
%endif
export CFLAGS="%{optflags} -fPIE -Wno-return-type"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-pie"
export GOFLAGS="-mod=vendor -buildmode=pie -trimpath"
%cmake -DBUILD_SHARED_LIBS:BOOL=OFF
%cmake_build

%install
%cmake_install

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

%files
%license LICENSE
%doc README.md
%{_bindir}/adb
%{_bindir}/append2simg
%{_bindir}/e2fsdroid
%{_bindir}/ext2simg
%{_bindir}/fastboot
%{_bindir}/img2simg
%{_bindir}/mke2fs.android
%{_bindir}/simg2img
%{_mandir}/man1/adb.1%{?ext_man}
%{_mandir}/man1/fastboot.1%{?ext_man}

%files python3
%{_bindir}/avbtool{,.py}
%{_bindir}/mkbootimg
%{_mandir}/man1/avbtool.1%{?ext_man}
%{_mandir}/man1/mkbootimg.1%{?ext_man}

%files bash-completion
%{_datadir}/bash-completion/completions/adb
%{_datadir}/bash-completion/completions/fastboot

%changelog
* Sun Oct 24 2021 munix9@googlemail.com
- Update to version 31.0.3
  * fastboot
  - Support flashing vbmeta_vendor.img for fastboot flashall / update.
  * aftltool removed upstream
* Wed Aug  4 2021 Petr Vorel <pvorel@suse.cz>
- Fix Supplements: supplement against bash-completion, not bash. otherwise
  bash-completion is now pulled in for everybody. Reported by dimstar.
* Tue Jul 20 2021 munix9@googlemail.com
- Update to version 31.0.2 [boo#1185883]
  * adb
  - Support forwarding to vsock on linux.
  - Fix bug in adb track-devices where devices over wireless
    debugging wouldn't immediately receive updates.
  - Implement preliminary support for mDNS device discovery
    without a separately installed mDNS service. This is
    currently disabled by default, and can be enabled by
    setting the environment variable ADB_MDNS_OPENSCREEN to 1
    when starting the adb server.
  * fastboot
  - Don't fail when unable to get boot partition size.
  - Derive device locked state from property instead of parsing
    the kernel command line.
- Switch source to https://github.com/nmeum/android-tools
- Add fix-add-e2fsprogs-contrib.patch
- Add fix-install-completion.patch
- Add fix-install-python-tools.patch
- Add fix-pie-build.patch
- Add vendor.tar.gz ("go_modules" service)
- Remove adb.bash and fastboot.bash (now included in archive)
- Remove fix_build_core.patch
- Remove fix_build_e2fsprogs.patch
- Remove fix-include-limits.patch
- Remove generate_build.rb
- Clean up/rework spec file
* Tue Jun  1 2021 munix9@googlemail.com
- Update to android-security-9.0.0_r68
- Add fix-include-limits.patch
* Mon Apr 26 2021 munix9@googlemail.com
- Fix build for Leap (use pcre2-devel instead of
  pkgconfig(libpcre))
* Thu Apr  8 2021 munix9@googlemail.com
- Update to android-security-9.0.0_r67
- Add man pages (via help2man) and bash completion for
  adb and fastboot
- Clean up spec file
* Tue Mar  2 2021 munix9@googlemail.com
- Update to android-security-9.0.0_r66
* Fri Feb  5 2021 munix9@googlemail.com
- Update to android-security-9.0.0_r65
* Tue Jan  5 2021 munix9@googlemail.com
- Update to android-security-9.0.0_r64
* Tue Dec  8 2020 munix9@googlemail.com
- Update to android-security-9.0.0_r63
* Thu Nov 26 2020 munix9@googlemail.com
- Update to android-security-9.0.0_r62
* Sat Oct 10 2020 munix9@googlemail.com
- Update to android-9.0.0_r61
* Fri Sep 18 2020 munix9@googlemail.com
- Update to android-9.0.0_r60
* Tue Jul 21 2020 munix9@googlemail.com
- Update to android-9.0.0_r58
* Sun Jan 19 2020 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r52
* Fri Nov  8 2019 munix9@googlemail.com
- moved udev-rules into new package 'android-udev-rules'
- some spec clean up
* Fri Oct 25 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r49
* Wed Oct  2 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r48
- added hack: fix for glibc >= 2.30 [by Paolo Panto (munix9)]
* Sun Aug 25 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r47
* Mon Jul 15 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r45
- Add "%%define _lto_cflags %%{nil}" line by Paolo Panto (munix9)
  to specfile.
* Thu Jun 20 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r42
- Put udev rules in _service as well
* Thu May 30 2019 Markus S <kamikazow@opensuse.org>
- Use Python3 for avbtool and mkbootimg.
* Mon May 13 2019 Markus S <kamikazow@opensuse.org>
- Update to android-9.0.0_r39
* Mon Apr 22 2019 Aleksa Sarai <asarai@suse.com>
- Update to android-9.0.0_r30
- Switch to ninja for builds with massive packaging rework.
- Update android-udev-rules.
* Thu Jan  3 2019 olaf@aepfle.de
- Detect path to g++ with C++14 support and pass it as variable
  to generated build.sh
* Mon Dec 24 2018 ecsos@opensuse.org
- Update to android-8.0.0_36
* Wed Apr 18 2018 Markus S <kamikazow@opensuse.org>
- Update to android-8.0.0_17
* Mon Feb 15 2016 dmitry_r@opensuse.org
- Fix systemd-udevd warning [boo#965512]
* Mon Oct 26 2015 dmitry_r@opensuse.org
- Split udev rules to android-tools-udev package. Use rules from
  libmtp-udev by default. [boo#938659]
* Tue Jul 14 2015 dmitry_r@opensuse.org
- Update to version 5.1.1_r8
  * No changelog available
- Drop obsolete fix-overflow-in-adb_client.patch
- Drop obsolete android-tools-ppc64-types.patch
- Fix implicit definition
  * f2fs-tools-implicit-definitions.patch
* Tue Jun 23 2015 crrodriguez@opensuse.org
- 51-android.rules: Use TAG+="uaccess" instead of using
  group/mode access control.
* Fri Sep 19 2014 crrodriguez@opensuse.org
- Use udevrulesdir and call udev_rules_update when appropiate
* Fri May  2 2014 dmitry_r@opensuse.org
- Fix overflow in adb CVE-2014-1909 [bnc#863074]
  * fix-overflow-in-adb_client.patch
* Thu Feb 14 2013 dmitry_r@opensuse.org
- Update to version 4.2.2_r2
  * no changelog available
- Remove provide section from package
* Mon Jan 28 2013 dvaleev@suse.com
- fix wrong types for ppc64 (android-tools-ppc64-types.patch)
* Wed Jan 16 2013 dmitry_r@opensuse.org
- Move udev rules to correct place
* Wed Jan 16 2013 dmitry_r@opensuse.org
- Fix udev rules
* Fri Dec  7 2012 dmitry_r@opensuse.org
- Initial package
- Version 4.2.1_r1
openSUSE Build Service is sponsored by