# -*- coding: utf-8-unix -*-
%define wbarconfversion 0.5
%define wbar_utilversion 1.0

%define ttfontdir /usr/share/fonts/TrueType-vlgothic
%define vlgothic TrueType-vlgothic

Version:        1.3.3
Release:        7%{?_dist_release}

Name:           wbar
Summary:        Quick Launch Bar such as a Dock of Max OS X
Summary(ja):    Mac OS X の Dock のようなクイックランチャーバー
Source:         http://www.tecapli.com.ar/warlock/%{name}-%{version}.tbz2
Source2:        http://kapsi.fi/ighea/wbarconf/%{name}conf-%{wbarconfversion}.tar.gz

Patch1:         wbar-makefile.patch
Patch2:         wbar-kde-above-desk.patch

## vine
Source1:        wbar.desktop
Source3:        http://home.arcor.de/max.federle/wbarutil/downloads/%{name}_util-%{wbar_utilversion}.tar.bz2
Source4:        wbar_util-bytecompile.py
# scripts
Source12:       wbar_session
Source13:       wbar_gen
Source14:       wbar_readme
# icons
Source20:       mlterm.png
Source21:       urxvt.png
Source22:       rox-filer.png
Source23:       wbar_util-2.png
Source24:       vine-wbar.png
Source25:       readme.png
Source26:       default.png
Source27:       grape.png
Source28:       xterm.png
Source29:       unicode-term.png
Source30:       mailer.png
# conf-file template
Source40:       dot.wbar.jp
# documents
Source41:       vine_readme_wbar.html
Source42:       vine_readme_wbar.txt

#Patch10:               wbar-default-setting.patch
Patch11:        wbar_util-1.0-vine.patch
#Patch12:       wbar-dot-bar-default.patch
Patch13:        wbar-dot-bar-default2.patch
Patch14:        wbar-session.patch
Patch15:	wbar-1.3.3_gcc43_fixes.patch

## ja_po
Source11:       wbar_util-1.0-ja.po

URL:            http://freshmeat.net/projects/wbar/
Group:          User Interface/Desktops
License:        GPLv2
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  imlib2-devel
BuildRequires:  XOrg-devel
BuildRequires:  freetype2-devel
BuildRequires:  zlib-devel
BuildRequires:  gcc-c++
BuildRequires:  libstdc++34-devel 
BuildRequires:  make 
BuildRequires:  glibc-devel
BuildRequires:  desktop-file-utils
Requires:       imlib2-loader
%if %{?_dist_release} == "vl5"
Requires:       pyxdg zenity
%endif

## vine
Requires:       %{vlgothic}

## ja_po
BuildRequires:  gettext

%description
wbar is a quick launch bar. Its fast, light and cool eye-candy.

Its hacked in c++ trying to keep code as readable as possible with out
sacrificing speed. It works directly on top of X to avoid going throug a lot
of layers.

Initially developed for Fluxbox, then tested on WindowMaker, Xfce, Gnome, etc.

Since version 1.0 can run on top of desktops such as xfdesktop or nautilus
with the -above-desk switch.

This package contained in some wbar configuration utilityies: 
- wbarconf
- wbar_util

%description -l ja
wbar は（Dock でありませんが Dock 風な）クイックランチャーバーです．
速くて，軽くて，見た目にもクールです．

wbar は可能な限り可読性のあるコードの保守を試みて C++ でハックされています．
with out sacrificing speed. 
たくさんのレイヤーを通していくのを避けるために X 上で直接的に動作します．

当初は Fluxbox に対して開発されていましたが、それから
WindowMaker, Xfce, Gnome 上で試みていました。

バージョン 1.0 以降、-above-desk オプションを付けることで 
Xfdesktop あるいは Nautilus のようなデスクトップの最前面で起動できます。

このパッケージには、いくつかの wbar 環境設定ユーティリティーを同梱しています：
- wbarconf
- wbar_util


%prep
%setup -q -a 3
%patch1
%patch2

## vine
#% patch10
%patch11 -p1
#%patch12 -p1
%patch13 -p1

## tools
%__install -m0755 %{SOURCE12} %{SOURCE13} %{SOURCE14} wbar_util/usr/local/bin/
## icons
%__install -m0644 %{SOURCE20} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24} \
    %{SOURCE25} %{SOURCE26} %{SOURCE27} %{SOURCE28} %{SOURCE29} %{SOURCE30} \
    iconpack/wbar.osx/

%patch14 -p1
%patch15 -p1

## ja_po
%__install -d -m0755 wbar_util/opt/wbar_util/locale/ja/LC_MESSAGES
%__install %{SOURCE11} wbar_util/opt/wbar_util/locale/ja/LC_MESSAGES/main.po
pushd wbar_util/opt/wbar_util/locale/ja/LC_MESSAGES/
msgfmt -o main.mo main.po
popd

%build
%__make \
    CXXFLAGS="`imlib2-config --cflags` %{optflags}" \
    LDFLAGS="`imlib2-config --libs`" \
    PREFIX="%{_datadir}/wbar"


%install
%{__rm} -rf $RPM_BUILD_ROOT
#% makeinstall DESTDIR=%{buildroot} PREFIX=%{_datadir}/wbar
%{__make} DESTDIR=$RPM_BUILD_ROOT install

## make sybolic link to ttf font for subtitle
#%if %{?_dist_release} == "vl5"
#ln -sf %{ttfontdir}/TrueType-vlgothic/VL-PGothic-Regular.ttf \
ln -sf %{ttfontdir}/VL-PGothic-Regular.ttf \
    ${RPM_BUILD_ROOT}%{_datadir}/wbar/iconpack/wbar.osx/font.ttf;
#%endif
#%if %{?_dist_release} == "vl4"
#ln -sf %{ttfontdir}/VL-PGothic-Regular.ttf \
#    ${RPM_BUILD_ROOT}%{_datadir}/mplayer/subfont.ttf;
#%endif


## install Gnome menu
desktop-file-install \
    --vendor vine \
    --dir $RPM_BUILD_ROOT%{_datadir}/applications \
    %{SOURCE1}


## install wbarconf
pushd $RPM_BUILD_ROOT%{_datadir}
tar zxf %{SOURCE2}
popd
pushd $RPM_BUILD_ROOT%{_bindir}
ln -sf %{_datadir}/wbarconf/wbarconf.py wbarconf
popd


## install wbar_util
pushd wbar_util
%__python %{SOURCE4}
%__rm -f ./usr/share/wbar_util/wbar.desktop
yes | DESTDIR=$RPM_BUILD_ROOT ./install.sh
desktop-file-install \
    --vendor "vine" \
    --dir $RPM_BUILD_ROOT%{_datadir}/applications \
    $(pwd)/usr/share/applications/wbar_util.desktop
popd

## install Japanese template
%__install -m0644 %{SOURCE40} $RPM_BUILD_ROOT%{_datadir}/wbar/

## install Vine documents
%__install -m0644 %{SOURCE41} %{SOURCE42} \
    $RPM_BUILD_ROOT%{_datadir}/wbar/



%clean
%__rm -rf "%{buildroot}"


%post
%{_bindir}/update-desktop-database -q %{_datadir}/applications || :


%postun
%{_bindir}/update-desktop-database -q %{_datadir}/applications


%files
%defattr(-,root,root)
%doc gpl.txt AUTHORS COPYING NEWS README
%{_bindir}/wbar*
%dir %{_datadir}/wbar
%config(noreplace) %{_datadir}/wbar/dot.wbar
%{_datadir}/wbar/dot.wbar.jp
%{_datadir}/wbar/vine_readme_wbar.*
%dir %{_datadir}/wbar/iconpack
%{_datadir}/wbar/iconpack/*.ttf
%dir %{_datadir}/wbar/iconpack/wbar.*
%{_datadir}/wbar/iconpack/*/*
%{_datadir}/applications/*.desktop
%{_datadir}/wbarconf
%{_datadir}/wbar_util

%changelog
* Sat Jun 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.3.3-7
- rebuild with current VineSeed environment
- add Patch15 (wbar-1.3.3_gcc43_fixes.patch)
- add BuildRequires: desktop-file-utils
- fix Source40 and Patch14

* Mon May 18 2009 KATO Masashi <mkato@par.odn.ne.jp> 1.3.3-6
- added Requires for pyxdg (for main.py) and zenity (for warning messages)
- updated wbar.desktop:
  - changed Icon=/usr/share/wbar/iconpack/wbar.osx/vine-wbar.png
- added dot.wbar.jp
  - for Japanese title support
- update wbar-dot-bar-default.patch:
  - corrected a command name (soffice -> oofice)
  - added some items (xterm,synaptic...etc.)
- added wbar_gen (for Vine Linux):
  - for extracting only executable items from dot.wbar
- applied wbar-session-vine.patch (for wbar_session)
  - generating initial user config file ('$HOME/.wbar'; by wbar_gen)
  - overwritable options
  - verification of icon-path
  - supported help message
  - setting '-above-desk' option automatically. (detecting DE or WM)

* Sun Mar 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.3-5
- applied wbar-dot-bar-default.patch

* Tue Feb 24 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.3-4
- added %%description -l ja

* Tue Feb 17 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.3-3
- added wbar_util-1.0-ja.po
- added wbar_session (for Vine Linux)
- updated wbar.desktop: 
  - changed Exec=wbar_session
- updated wbar_util-1.0-vine.patch: 
  - for restarting wbar

* Sun Feb 15 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.3-2
- changed to Group: User Interface/Desktops
- added comment[ja] in wbar.desktop
- added wbar_util v1.0
- applied wbar_util-1.0-vine.patch

* Sat Apr 11 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.3-1
- initial build

* Tue Oct 23 2007 Pascal Bleser <guru@unixtech.be> 1.3.3-0.pm.2
- added Requires for imlib2-loaders (for PNG support)

* Fri Sep 28 2007 Pascal Bleser <guru@unixtech.be> 1.3.3-0.pm.1
- new upstream version

* Sun Sep 16 2007 Pascal Bleser <guru@unixtech.be> 1.3.2-0.pm.1
- new package
