# TODO: - make libXNVCtrl-devel
#       - with --enable-lua-imlib2

%define with_alsa 0
%define with_audacious 0
%define with_imlib 1
%define with_lua 1
%define with_lua_cairo 1
%define with_lua_imlib 1
%define with_moc 1
%define with_mpd 0
%define with_nvidia 0
%define with_rss 1
%define with_smapi 0
%define with_ibm 0
%define with_wlan 0

Name:           conky
Version:        1.8.1
Release:        2%{?_dist_release}
Summary:	A lightweight system monitor for X
Summary(ja):	X 用軽量システムモニタ
Group:          User Interface/X
License:        GPLv3+
URL:            http://conky.sf.net/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Patch0:         conky-1.8.1-delete-curl_types.h.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires:  glib2-devel
BuildRequires:  libxml2-devel
BuildRequires:  libXft-devel
BuildRequires:  libXt-devel
BuildRequires:  libXdamage-devel
BuildRequires:  libXext-devel
%if %{with_alsa}
BuildRequires: alsa-lib-devel
%endif
%if %{with_imlib}
BuildRequires: imlib2-devel
%endif
%if %{with_lua}
BuildRequires: lua-devel
%endif
%if %{with_lua_cairo}
BuildRequires: cairo-devel tolua++-devel
%endif
%if %{with_lua_imlib}
BuildRequires: imlib2-devel tolua++-devel
%endif
%if %{with_audacious}
BuildRequires:  audacious-devel
BuildRequires:  dbus-glib-devel
%endif
%if %{with_nvidia}
BuildRequires: libXNVCtrl-devel
%endif
%if %{with_rss}
BuildRequires: curl-devel
%endif
%if %{with_wlan}
BuildRequires: wireless-tools-devel
%endif

Vendor: Project Vine
Distribution: Vine Linux

%description
A system monitor for X originally based on the torsmo code. but more kickass. 
It just keeps on given'er. Yeah.
#'

%description -l ja
torsmo をベースにした X 用のシステムモニタです。

%prep
%setup -q
%if %{?_dist_release} >= "vl7"
%patch0
%endif

for i in AUTHORS ChangeLog; do
    iconv -f iso8859-1 -t utf8 -o ${i}{_,} && touch -r ${i}{,_} && mv -f ${i}{_,}
done

%build
#sh autogen.sh
%configure \
    --disable-rpath \
    %if !%{with_alsa}
    --disable-alsa \
    %endif
    %if %{with_audacious}
    --enable-audacious=yes \
    %endif
    %if %{with_imlib}
    --enable-imlib2 \
    %endif
    %if !%{with_lua}
    --disable-lua \
    %endif
    %if %{with_lua_cairo}
    --enable-lua-cairo \
    %endif
    %if %{with_lua_imlib}
    --enable-lua-imlib2 \
    %endif
    %if !%{with_moc}
    --disable-moc \
    %endif
    %if !%{with_mpd}
    --disable-mpd \
    %endif
    %if %{with_nvidia}
    --enable-nvidia \
    %endif
    %if %{with_rss}
    --enable-rss \
    %endif
    %if %{with_ibm}
    --enable-ibm \
    %endif
    %if %{with_smapi}
    --enable-smapi \
    %endif
    %if %{with_wlan}
    --enable-wlan \
    %endif
    ;

# don't use rpath
%__sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
%__sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%__make %{?_smp_mflags}


%install
%__rm -rf $RPM_BUILD_ROOT
%__make install DESTDIR=$RPM_BUILD_ROOT

%__rm -f $RPM_BUILD_ROOT%{_sysconfdir}/conky/conky_no_x11.conf
%__rm -f $RPM_BUILD_ROOT%{_libdir}/conky/*.{la,a}

%clean
%__rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING TODO README NEWS extras/* doc/docs.html
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_bindir}/%{name}
%if %{with_lua_cairo} || %{with_lua_imlib}
%{_libdir}/conky
%endif
%{_mandir}/man1/*


%changelog
* Wed Nov 16 2016 Toshiaki Ara <ara_t@384.jp> 1.10.4-1
- new upstream release
- add Vendor and Distribution

* Sun Jun 26 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.8.1-1
- new upstream release

* Sat Mar 27 2010 Munehiro Yamamoto <munepi@vinelinux.org> 1.7.2-1
- new upstream release
- enable lua, lua-cairo
- added BuildRequires: glib2-devel

* Mon Feb 15 2010 Miroslav Lichvar <mlichvar@redhat.com> - 1.7.2-2
- fix building with new audacious (#556317)

* Tue Aug 25 2009 Miroslav Lichvar <mlichvar@redhat.com> - 1.7.2-1
- Update to 1.7.2

* Thu Jul 30 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.7.1.1-1
- new upstream release

* Sat Nov 15 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.6.1-1
- initial build based on Fedora package
 - applied conky-1.6.0-rdtsc.patch, conky-1.6.1-ifaddrs.patch

* Tue Aug 26 2008 Miroslav Lichvar <mlichvar@redhat.com> - 1.6.1-1
- Update to 1.6.1
- Fix buffer overflow when reading interface addresses

* Tue Jul 22 2008 Miroslav Lichvar <mlichvar@redhat.com> - 1.6.0-1
- Update to 1.6.0
- Fix freq_dyn on x86_64

* Tue Apr 01 2008 Miroslav Lichvar <mlichvar@redhat.com> - 1.5.1-1
- Update to 1.5.1

* Sun Mar 23 2008 Miroslav Lichvar <mlichvar@redhat.com> - 1.5.0-1
- Update to 1.5.0
- Convert doc files to UTF-8

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.4.9-2
- Autorebuild for GCC 4.3

* Tue Nov 27 2007 Miroslav Lichvar <mlichvar@redhat.com> - 1.4.9-1
- Update to 1.4.9
- Enable support for Audacious 1.4.0

* Sun Oct 21 2007 Miroslav Lichvar <mlichvar@redhat.com> - 1.4.8-1
- Update to 1.4.8
- Enable mpd, rss and wireless support
- Update license tag

* Wed Apr 18 2007 Michael Rice <errr[AT]errr-online.com> - 1.4.5-4
- Rebuild to match audacious lib in fc6 bug: 236989

* Mon Apr 09 2007 Michael Rice <errr[AT]errr-online.com> - 1.4.5-3
- Rebuild for devel

* Thu Dec 14 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.5-2
- Ship NEWS
- Add patch for license of timed_thread and NEWS

* Tue Dec 12 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.5-1
- version bump
- change group
 
* Wed Dec 06 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.4-3
- rebuild for new audacious lib version

* Thu Nov 30 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.4-2
- Move nano and vim files into docs
- remove unneeded BR's

* Tue Nov 21 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.4-1
- Version bump
- Add vim and nano syntax files to package

* Thu Oct 05 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.3-1
- Version bump
- Remove Install file from docs

* Mon Oct 02 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.2-4
- moved to configure macro from ./configure
- clean up changelog and make more informative entrys
- Fixed sumary in spec file
- remove NEWS file since it was empty
- remove xmms support due to possible security issue
- remove bmp support due to possible security issue
- add missing BR for libXext-devel and remove unneeded libX11-devel  

* Thu Sep 28 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.2-3
- use the GPL as licence since the whole package is GPL

* Thu Sep 28 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.2-2
- remove unneeded deps

* Tue Sep 26 2006 Michael Rice <errr[AT]errr-online.com> - 1.4.2-1
- Initial RPM release
