File drush.spec of Package drush

#
# spec file for package drush
#
# Copyright (c) 2015 SUSE LINUX 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/
#


# For SLE.
BuildRequires:  xz

Requires:       ncurses-utils
Requires:       php5 >= 5.3.3
Requires:       wget
Recommends:     git >= 1.7
# cgi module required for built in drush server
Recommends:     php5-fastcgi
Obsoletes:      drush_make < %{version}
Provides:       drush_make = %{version}

Name:           drush
# The Console_Table file is licensed under BSD.
# The youngj-httpserver includes some MIT licensed code.
Summary:        Command line shell and scripting interface for Drupal
License:        GPL-2.0+
Group:          Productivity/Networking/Web/Servers
Version:        6.7.0+git20151202.7e17b3a
Release:        0
Url:            https://github.com/drush-ops/drush
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Source0:        %{name}-%{version}.tar.xz
Source1:        Console_Table-1.1.3.tar.bz2
Source2:        httpserver-1.0.0.tar.bz2

%description
Drush is a command line shell and scripting interface for Drupal, a veritable
Swiss Army knife designed to make life easier for those of us who spend some of
our working hours hacking away at the command prompt.

See http://drush.ws, the homepage for the drush project.

%prep
%setup -q -a 1 -a 2

%build
find . -name ".gitignore" -exec rm -rf {} \;
mv Console_Table-1.1.3 ./lib
mv httpserver-1.0.0 ./lib

# For some reason all lib/ files have executable bit, remove it.
chmod -R -x+X ./lib

%install
# install drush source
install -d -m 0755 . %{buildroot}%{_datadir}/drush
cp -r * %{buildroot}%{_datadir}/drush

# link to executable in bindir
mkdir -p %{buildroot}%{_bindir}
ln -s %{_datadir}/drush/drush %{buildroot}%{_bindir}/drush

# link to bash complete script
mkdir -p %{buildroot}/etc/bash_completion.d/
ln -s %{_datadir}/drush/drush.complete.sh %{buildroot}/etc/bash_completion.d/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_datadir}/drush
%{_bindir}/drush
/etc/bash_completion.d/drush.complete.sh

%changelog