File android-tools.spec of Package android-tools

# spec file for package android-tools
# Copyright © 2012–2016
# 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.

Name:           android-tools
Version:        8.0.0_r36
Release:        0
Summary:        Android platform tools (adb, fastboot)
License:        Apache-2.0 and BSD-3-Clause
Group:          Hardware/Mobile
Source0:        core-%{version}.tar
Source1:        extras-%{version}.tar
Source2:        boringssl-%{version}.tar
Source3:        mdnsresponder-%{version}.tar
# patches are from fedora too
# in generate_build.rb, LDFLAGS have to be AFTER object files!
Source4:        generate_build.rb
Source5:        51-android.rules
Patch1:         0001-Add-string-h.patch
Patch2:         0002-libusb-modifications.patch
Patch3:         0003-atomic-fix.patch
%if 0%{?suse_version} < 1500
# android-tools requires C++14 support.
BuildRequires:  gcc7-c++
BuildRequires:  gcc-c++
BuildRequires:  googletest-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libselinux-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  ruby
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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

%setup -q -b 1 -n extras-%{version}
%setup -q -b 2 -n boringssl-%{version}
%setup -q -b 3 -n mdnsresponder-%{version}
%setup -q -b 0 -n core-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
for dir in extras boringssl mdnsresponder; do
    mv ../$dir-%{version} ../$dir

test -x "$(type -p gcc)"   && CC="$_"
test -x "$(type -p g++)"   && CXX="$_"
test -x "$(type -p gcc-6)" && CC="$_"
test -x "$(type -p g++-6)" && CXX="$_"
test -x "$(type -p gcc-7)" && CC="$_"
test -x "$(type -p g++-7)" && CXX="$_"
test -x "$(type -p gcc-8)" && CC="$_"
test -x "$(type -p g++-8)" && CXX="$_"
ruby %{SOURCE4} | tee
PKGVER=%{version} CC="${CC}" CXX="${CXX}" CXXFLAGS="%{optflags}" CFLAGS="%{optflags}" sh -xe

install -Dm0755 -t %{buildroot}%{_bindir} adb/adb
install -Dm0755 -t %{buildroot}%{_bindir} fastboot/fastboot
install -Dm0755 -t %{buildroot}%{_bindir} libsparse/img2simg
install -Dm0755 -t %{buildroot}%{_bindir} libsparse/simg2img
install -Dm0644 -t %{buildroot}%{_udevrulesdir} %{SOURCE5}

%doc adb/OVERVIEW.TXT adb/SERVICES.TXT adb/NOTICE adb/protocol.txt

openSUSE Build Service is sponsored by