File android-tools.spec of Package android-tools

#
# spec file for package android-tools
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           android-tools
Version:        4.2.2_r1
Release:        0
Summary:        Android platform tools (adb, fastboot)
License:        Apache-2.0 and BSD-3-Clause
Group:          Hardware/Mobile
Url:            http://developer.android.com/guide/developing/tools/
# git clone https://android.googlesource.com/platform/system/core.git && cd core
# git archive android-%{version} --prefix=core-%{version}/ adb fastboot libzipfile libcutils libmincrypt libsparse mkbootimg include/cutils include/zipfile include/mincrypt | bzip2 > ../core-%{version}.tar.bz2
#
# git clone https://android.googlesource.com/platform/system/extras.git && cd extras
# git archive android-%{version} --prefix=extras/ ext4_utils | bzip2 > ../extras-%{version}.tar.bz2
Source0:        core-%{version}.tar.bz2
Source1:        extras-%{version}.tar.bz2
Source2:        core-Makefile
Source3:        adb-Makefile
Source4:        fastboot-Makefile
Source5:        51-android.rules
Patch0:         android-tools-ppc64-types.patch
Patch1:         fix-overflow-in-adb_client.patch

BuildRequires:  libselinux-devel
BuildRequires:  openssl-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(udev)
Requires:       udev
%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d }

%description
Android Debug Bridge (adb) is a command-line tool used to communicate with and control
Android device over a USB link from a computer. Fastboot is a command line tool used
to directly flash the filesystem in Android devices from a host via USB.

%prep
%setup -q -b 1 -n extras
%patch0 -p1
%setup -q -b 0 -n core-%{version}
cp -p %{SOURCE2} Makefile
cp -p %{SOURCE3} adb/Makefile
cp -p %{SOURCE4} fastboot/Makefile
%patch1 -p1

%build
make %{?_smp_mflags}

%install
install -d -m 0755 %{buildroot}%{_bindir}
install -D -m 0644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/51-android.rules
make install DESTDIR=%{buildroot} BINDIR=%{_bindir}

%post
%{?udev_rules_update:%{udev_rules_update}}

%files
%defattr(-,root,root)
%doc adb/OVERVIEW.TXT adb/SERVICES.TXT adb/NOTICE adb/protocol.txt
%{_bindir}/adb
%{_bindir}/fastboot
%{_udevrulesdir}/51-android.rules

%changelog
openSUSE Build Service is sponsored by