File quirc.spec of Package quirc
# vim: set sw=4 ts=4 et nu:
# Copyright (c) 2012 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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/
%define _default_patch_fuzz 2
Name: quirc
Version: 0.9.2
Release: 0
Summary: Lightweight IRC Client for the Console
Source: https://github.com/downloads/ec429/quIRC/quirc_%{version}.tar.gz
Source1: quirc.desktop
Patch1: quirc-add_missing_lncurses.patch
URL: http://github.com/ec429/quIRC
Group: Productivity/Networking/IRC
License: GNU General Public License version 3 (GPL v3)
BuildRoot: %{_tmppath}/build-%{name}-%{version}
BuildRequires: ncurses-devel
BuildRequires: gcc make glibc-devel
BuildRequires: update-desktop-files
%description
quIRC is a simple terminal-based IRC (Internet Relay Chat) client.
%prep
%setup -q -n "quirc_%{version}"
%patch1
# there's no make clean
%__rm -f *.o quirc
# wrong EOL
%__sed -i 's/\r$//' COPYING
# missing EOL at end of file (and I'm too lazy to write a patch):
echo >> config_help.c
%if 0%{?suse_version} > 0 && 0%{?suse_version} < 1000
%__sed -i 's/-Wextra//g' Makefile
%__sed -i 's/-Werror//g' Makefile
%endif
%build
VERSION_MAJ=$(echo "%{version}" | cut -f1 -d.)
VERSION_MIN=$(echo "%{version}" | cut -f2 -d.)
VERSION_REV=$(echo "%{version}" | cut -f3 -d.)
VERSION_TXT="%{version}"
CC_VERSION=$(%__cc -v 2>&1 | tail -n 1)
cat<<EOF >version.h2
#pragma once
#define VERSION_MAJ $VERSION_MAJ
#define VERSION_MIN $VERSION_MIN
#define VERSION_REV $VERSION_REV
#define VERSION_TXT "$VERSION_TXT"
#define CC_VERSION "$CC_VERSION"
#define VERSION "%{version}"
EOF
OPTFLAGS="%{optflags}"
%if 0%{?suse_version} < 1100
OPTFLAGS="$OPTFLAGS -fno-strict-aliasing"
%endif
%__make %{?_smp_flags} \
CC="%__cc" \
OPTFLAGS="$OPTFLAGS" \
PREFIX="%{_prefix}" \
VERSION="%{version}"
%install
%__install -D -m0755 quirc "%{buildroot}%{_bindir}/quirc"
%__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
%suse_update_desktop_file -r "%{name}" Network IRCClient
%clean
%{?buildroot:%__rm -rf "%{buildroot}"}
%files
%defattr(-,root,root)
%doc README COPYING
%{_bindir}/quirc
%{_datadir}/applications/quirc.desktop
%changelog