File waf.spec of Package waf
#
# spec file for package waf
#
# 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/
#
Name: waf
Version: 1.8.14
Release: 0
Summary: A Python-based build system
License: BSD-3-Clause
Group: Development/Tools/Building
Url: https://waf.io
Source0: https://waf.io/waf-%{version}.tar.bz2
Source1: https://waf.io/waf-%{version}.tar.bz2.asc
Source2: %{name}.keyring
Patch0: waf-1.6.2-libdir.patch
BuildRequires: fdupes
BuildRequires: python-devel
Requires: python
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Waf is a Python-based framework for configuring, compiling and
installing applications. It is a replacement for other tools such as
Autotools, Scons, CMake or Ant.
%prep
%setup -q
%patch0
# remove BOM, causes trouble later
sed -i -e '1s/^\xEF\xBB\xBF//' waflib/extras/dpapi.py
%build
extras=
for f in waflib/extras/*.py ; do
f=$(basename "$f" .py);
if [ "$f" != "__init__" ]; then
extras="${extras:+$extras,}$f" ;
fi
done
./waf-light --make-waf --strip --tools="$extras"
%install
# use waf so it unpacks itself
mkdir _temp ; pushd _temp
cp -av ../waf .
python ./waf >/dev/null 2>&1
pushd .waf-%{version}-*
find . -name '*.py' -printf '%%P\0' |
xargs -0 -I{} install -m 0644 -p -D {} %{buildroot}%{_datadir}/waf/{}
popd
popd
# install the frontend
install -m 0755 -p -D waf-light %{buildroot}%{_bindir}/waf-%{python_version}
ln -s waf-%{python_version} %{buildroot}%{_bindir}/waf
# remove shebangs from and fix EOL for all scripts in wafadmin
find %{buildroot}%{_datadir}/ -name '*.py' \
-exec sed -i -e '1{/^#!/d}' -e 's|\r$||g' {} \;
# fix waf script shebang line
sed -i "1c#!%{_bindir}/python2" %{buildroot}%{_bindir}/waf-%{python_version}
# remove x-bits from everything going to doc
find demos utils -type f -exec chmod 0644 {} \;
# remove duplicates
%fdupes -s %{buildroot}
%files
%defattr(-,root,root,-)
%doc README TODO ChangeLog demos
%{_bindir}/waf
%{_bindir}/waf-%{python_version}
%{_datadir}/waf
%changelog