%define FBversion 1.3.5
%define pversion 1.3.0
%define patchversion 1.1.0.1

%define fbumenu_version 0.5.5
%define vinefiles_version 11.4

Summary:        Fluxbox is a windowmanager that is based on Blackbox.
summary(ja):    Fluxbox は Blackbox から派生したウインドウマネージャです。
Name:           fluxbox
Version:        %{FBversion}
Release:        2%{?_dist_release}
Group:          User Interface/Desktops
License:        MIT
URL:            http://fluxbox.org/
Vendor:         Project Vine
Distribution:   Vine Linux
Source0:        http://sourceforge.net/projects/fluxbox/files/fluxbox/%{version}/fluxbox-%{version}.tar.bz2
# styles & scripts 
Source1:        %{name}-vinefiles-%{vinefiles_version}.tar.bz2
Source2:        styles2-2.tar.bz2
Source3:        fb_libexec.tar.bz2
Source4:        fb_extend_menu

### data/init.in
Patch0:         fluxbox-init_in.patch
### nls/Translation.m
Patch3:         fluxbox-%{pversion}.nls-ja.patch
### util/startfluxbox.in
Patch4:         fluxbox-%{pversion}-2.startfb.patch
### util/sfluxbox-generate_menu
Patch93:        fluxbox-1.3.5.menugen.patch
### util/fbsetbg
Patch10:        fbsetbg_setter_priority.patch
### nls/ja_JP/Makefile.in
Patch40:        fluxbox-%{patchversion}.nls-ja-make.patch
### util/fluxbox-update_configs.cc
Patch41:        fluxbox-%{pversion}.update_cfg.patch
### data/windowmenu
Patch50:        fluxbox.windowmenu-1.patch
### data/keys
Patch51:        fluxbox.keys-1.patch

BuildRoot:      %{_tmppath}/%{name}-buildroot
BuildRequires:  libX11-devel libXext-devel 
BuildRequires:  bzip2 imlib2-devel zlib-devel freetype2-devel
BuildRequires:  libXpm-devel nkf libXft-devel
BuildRequires:  libICE-devel libSM-devel libXinerama-devel
BuildRequires:  libXrandr-devel libXrender-devel
BuildRequires:  fontconfig-devel libtool
Requires:       imlib2 imlib2-loader ImageMagick nkf task-xorg-x11
Requires:       zenity bash feh

%description

Fluxbox is yet another windowmanager for X.
It's based on the Blackbox 0.61.1 code. 
Fluxbox looks like blackbox and handles styles, colors, window 
placement and similar thing exactly like blackbox 
    (100% theme/style compability).
So what's the difference between fluxbox and blackbox then?
The answer is: LOTS!
Here is a list of features that fluxbox already has, or is in the works...

%description -l ja

fluxbox は X Window System 用の、一味違ったウィンドウマネージャです。
それは blackbox-0.61.1 のプログラムコードをベースに開発されています。
fluxbox は blackbox によく似ていて、スタイル、カラーリング、ウィンドウ
の配置などを blackbox 同様に処理します。(スタイル(テーマ)は 100% 互換)
では、fluxbox と blackbox の違いは？  ...  その答えは「いっぱい」!

fluxbox に何が出来るか、今後何を計画しているのか？
詳しくは http://fluxbox.sourceforge.net/ をご覧下さい。

%prep
%__rm -rf %{buildroot}
%setup -q -a 1 -a 2 -a 3

## init
%patch0 -p1
## nls
%patch3 -p1
## startfluxbox
%patch4 -p1
## fluxbox-generete_menu
%patch93 -p1
## fbsetbg_setter_priority
%patch10 -p1
## nls Makefile.in
%patch40 -p1
## fluxbox-update_configs.cc
%patch41 -p1
## windowmenu
%patch50 -p1
## keys
%patch51 -p1

%build

CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
    CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
    FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
    ./configure --enable-nls \
    --prefix=%{_prefix} \
    --exec-prefix=%{_exec_prefix} \
    --bindir=%{_bindir} \
    --sbindir=%{_sbindir} \
    --sysconfdir=%{_sysconfdir} \
    --datadir=%{_datadir} \
    --includedir=%{_includedir} \
    --libdir=%{_libdir} \
    --libexecdir=%{_libexecdir} \
    --localstatedir=%{_localstatedir} \
    --sharedstatedir=%{_sharedstatedir} \
    --mandir=%{_mandir} \
    --infodir=%{_infodir}

%__make

%install
%__rm -rf  %{buildroot}
# fluxbox installation
make "DESTDIR=%{buildroot}" install

# styles
%__rm data/styles/Makefile*
%__cp -a data/styles                %{buildroot}%{_datadir}/%{name}/
%__cp -a data/styles2               %{buildroot}%{_datadir}/%{name}/
# wallpapers
%__cp -a data/backgrounds           %{buildroot}%{_datadir}/%{name}/
# HTML images
%__cp -a data/images                %{buildroot}%{_datadir}/%{name}/
# UserMenu samples
%__cp -a data/UserMenu              %{buildroot}%{_datadir}/%{name}/
# HTML docs
%__cp data/*.html                   %{buildroot}%{_datadir}/%{name}/
# scripts
%__cp data/fb_welcome               %{buildroot}%{_datadir}/%{name}/
%__cp data/cng_fbtips               %{buildroot}%{_datadir}/%{name}/
%__cp data/change-rootcmd           %{buildroot}%{_datadir}/%{name}/
%__cp data/change-init_rootcmd      %{buildroot}%{_datadir}/%{name}/
%__cp data/applyoldstyle            %{buildroot}%{_datadir}/%{name}/
%__cp data/mk-rootcmds              %{buildroot}%{_bindir}/
%__cp data/fbumenu_gen-%{fbumenu_version} %{buildroot}%{_bindir}/fbumenu_gen
# changelog
%__cp ChangeLog                     %{buildroot}%{_datadir}/%{name}/

# xsession desktop entry
%__mkdir_p %{buildroot}%{_datadir}/xsessions/
#%__cp data/fluxbox.desktop %{buildroot}%{_datadir}/xsessions/
%__install -m 644 data/fluxbox.desktop %{buildroot}%{_datadir}/xsessions/
# logout, reboot, shutdown commands
%__mkdir_p %{buildroot}%{_libexecdir}/%{name}
%__install -m 755 fb_libexec/* %{buildroot}%{_libexecdir}/%{name}/
# extend menu
%__mkdir_p %{buildroot}%{_datadir}/%{name}/
%__install -m 755 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/

if [ -z "$DEBUG" ]; then
    strip   %{buildroot}%{_bindir}/fluxbox \
        %{buildroot}%{_bindir}/fbsetroot \
        %{buildroot}%{_bindir}/fbrun
fi

bzip2 %{buildroot}%{_mandir}/man1/*.1

%post

# New menu-system
%__rm %{_datadir}/fluxbox/menu*
%{_bindir}/fluxbox-generate_menu \
    -in -B \
    -p %{_prefix} \
    -o %{_datadir}/fluxbox/menu 2> /dev/null

%clean

%__rm -rf %{buildroot}

%files
%defattr(-,root,root,755)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
%{_bindir}/*
%{_datadir}/*
%{_libexecdir}/*


%changelog
* Fri Dec 27 2013 TANAKA hiroaki <mosaicist@jcom.home.ne.jp> 1.3.5-2
- rebuild with gcc-4.8

* Wed Jun 12 2013 TANAKA hiroaki mosaicist@jcom.home.ne.jp > 1.3.5-1
- new upstream release
- update fluxbox-%version.menugen.patch

* Mon Feb 13 2012 KATO Masashi <mkato@par.odn.ne.jp> 1.3.2-3
- replaced wallpaper setter "xsri" with "feh"
- update documents(fluxtips.html)

* Mon Nov 14 2011 KATO Masashi <mkato@par.odn.ne.jp> 1.3.2-2
- rewrited spec file
  (reformat %changelog)

* Mon Nov 14 2011 KATO Masashi <mkato@par.odn.ne.jp> 1.3.2-1
- new upstream release.

* Sat Mar 26 2011 KATO Masashi <mkato@par.odn.ne.jp> 1.3.1-2
- added wide wall paper
- update documents(flux_news.html)

* Mon Mar  7 2011 KATO Masashi <mkato@par.odn.ne.jp> 1.3.1-1
- new upstream release.

* Tue Mar  1 2011 KATO Masashi <mkato@par.odn.ne.jp> 1.3.0-1
- new upstream release.
- updated patchs.
- added keys & windowmenu patch.
- update documents(flux_news.html,styles.html)

* Tue Oct  5 2010 KATO Masashi <mkato@par.odn.ne.jp> 1.1.1-5
- added BR: libICE-devel libSM-devel libXinerama-devel
            libXrandr-devel libXrender-devel fontconfig-devel libtool
- added Requires: task-xorg-x11 bash 
- dropped Requires: xinitrc libXpm

* Mon Oct  4 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.1.1-4
- add BR: libXft-devel (1.1.1-3.ppc was built w/o libXft-devel)

* Wed May 26 2010 KATO Masashi <mkato@par.odn.ne.jp> 1.1.1-3
- update & added Vine documents. (apps.html, config_files.html)
- Combined some of patches. 
- update fbumenu_gen script(usermenu generator).
- added menu commands. (logout, reboot, shutdown)
- added extend application menu script. (%{SOURCE4})

* Tue Mar 16 2010 KATO Masashi <mkato@par.odn.ne.jp> 1.1.1-2
- updated wallpapers.
- moved desktop-entry to %{_datadir}/xsessions/ .

* Fri Sep 19 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.1.1-1
- new upstream release.
- removed upstream patchs.
- rewrote Vine documents.

* Sat Sep 14 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.1.0.1-3
- Applied upstream patchs.

* Fri Sep 12 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.1.0.1-2
- updated mk-rootcmds
- updated vine documents. (keys.html, flux_news.html)

* Thu Sep 11 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.1.0.1-1
- new upstream release
- removed fluxbox-%{FBversion}.nls-hh.patch
- rewrote documents. (keys.html, flux_news.html)
- added new default keys file

* Sun Aug 24 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-6
- fixed locale problem
-     rewrote scripts for eucJP and UTF-8
- revived fluxbox-%{FBversion}.Xclients.patch. (for startx)

* Sun Jun 22 2008 KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-5
- add new style. (tux)

* Mon Jun 16 2008  KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-3
- corrected line gap of nls-header
-   (fluxbox-1.0.0.nls-hh.patch) 

* Tue May 27 2008  KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-2
- adjust startup sequence
-   (rewrite desktop entry file for dm sessions)
-   (remove fluxbox-%{FBversion}.Xclients.patch)

* Sun May 25 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.0-1
- applied new versioning policy
- rebuilt with xorg-x11 7.3
- spec in UTF-8

* Tue Dec  4 2007 KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-0vl3, 4
- retouch patchs for ja_JP.UTF-8 locale
-     : for root menu & help message
- rewrite vine documents

* Mon Oct 15 2007 KATO Masashi <mkato@par.odn.ne.jp> 1.0.0-0vl1, 2
- new upstream 'stable' release
- add new documents(styles tips, keys tips).
- add new styles
- update patch files, vine documents, vine scripts

* Wed Apr 11 2007 KATO Masashi <mkato@par.odn.ne.jp> 1.0-0vl0.rc3.1, 2
- new upstream release
- add rewrited system styles
- update patch files
- update vine documents

* Sun Dec 24 2006 KATO Masashi <mkato@par.odn.ne.jp> 1.0-0vl0.rc2.3, 4
- add BuildRequires: zlib-devel freetype2-devel
- add Requires: xsri
- Change wpsetter''s priority (fbsetbg_setter_priority.patch)

* Thu Jul 20 2006 KATO Masashi <mkato@par.odn.ne.jp> 1.0-0vl0.rc2.1, 2
- new upstream release
- update patch files
- update vine documents

* Thu Jul  6 2006 KATO Masashi <mkato@par.odn.ne.jp> 1.0-0vl0.rc0.1, 2
- new upstream release
- update patch files
- added 'additional applications' extension to fluxbox-generate_menu

* Tue Apr  8 2006 KATO Masashi <mkato@par.odn.ne.jp> 0.9.15.1-0vl1, 2
- new upstream release
- add 'init file rewrite' script for back-compatible
- rewrite documents

* Wed Mar 29 2006 KATO Masashi <mkato@par.odn.ne.jp> 0.9.15-0vl1, 2
- new upstream release
- update *tips*
- update patch files
- add & update script files
- update & retouch style files (VineStyle*, BlueStar*)
- retouch menu structure (Vine tools)
- add script for back compatible to background-style

* Sun Mar 19 2006 KATO Masashi <mkato@par.odn.ne.jp> 0.9.14-0vl1.1, 2.2
- update *_tips.html
    (retouch link errors)
- retouch ja_JP/Translation.m 
- update menugen patch
- update style file (VineStyle, BlueStar)
- add index.html, scripts for 'wellcome'

* Tue Oct 25 2005 KATO Masashi <mkato@par.odn.ne.jp> 0.9.14-0vl1, 2
- new upstream release
- update vine patch
  (retouch init file for new spec.)
- update vinefiles
  (update fbumenu_gen(usermenu generator))
    (update 2 style files for new spec.)
    (update fluxtips.txt)
- update fluxbox_menu_tips.html

* Sun Jun  5 2005 KATO Masashi <mkato@par.odn.ne.jp> 0.9.13-0vl3, 4
- update vine patch 
  (add some menu items to fluxbox-generate_menu)
    (retouch menu structure)
      (rewrite 'about menu')
- update vinefiles
    (add usermenu generator to x-utilus)
- update fluxbox_menu_tips.html

* Fri May 27 2005 KATO Masashi <mkato@par.odn.ne.jp> 0.9.13-0vl1
- new upstream release
- update vine patch 
        (add some menu items to fluxbox-generate_menu)
                (extend 'about toolbar')
- update nls-ja patch
- update fluxtips.txt
    (rewrite, add '0.9.13 news')

* Sun Feb  6 2005 KATO Masashi <mkato@par.odn.ne.jp> 0.9.12-0vl1
- new upstream release
- update vine patch 
  (add some menu items to fluxbox-generate_menu)
    (include blackbox styles)
      (extend 'my_mail')
      (extend 'about menu')
- add nls-ja patch

* Sun Dec 12 2004 KATO Masashi <mkato@par.odn.ne.jp> 0.9.11-0vl1
- new upstream release
- update vine patch 
  (generate japanese menu)
    (add some menu items to fluxbox-generate_menu)
    (retouch menu structure)
    (fix menu backup problem)

* Wed Nov 24 2004 IWAI, Masaharu <iwai@alib.jp> 0.9.10-0vl1
- new upstream release
- update vine patch ( merged vine patches )
- add font_locale patch ( Patch100 )
- fix typo: s/buidroot/buildroot/g

* Sun Jun 20 2004 KATO Masashi <mkato@par.odn.ne.jp> 0.9.9-0vl2
- rewrite 2 styles (VineStyleII, BlueStarII)
- rewrite fluxtips.txt(for 0.9.x)
- modifying menu-generator
    (fix problems of 'can't generates some menus'')
    (add some menu items)
    (Japanese help messages)
- modifying 'init' file(default style, menu-alpha)
- append sample of 'keys' file

* Sun May  2 2004 IWAI, Masaharu <iwai@alib.jp> 0.9.9-0vl1
- new upstream release

* Sun Mar 14 2004 IWAI, Masaharu <iwai@alib.jp> 0.9.8-0vl2
- using rpm macros
- fix nonexistent directory for styles in postscript
- add BuildRequires: bzip2
- drop Prefix tag

* Sat Mar  6 2004 IWAI, Masaharu <iwai@alib.jp> 0.9.8-0vl1
- new upstream release
- update vine patch (Patch101)

* Mon Aug 11 2003 IWAI, Masaharu <iwai@alib.jp> 0.1.14-1_0vl2
- build for VineSeed
- fix Group tag for VineLinux:
  Graphical desktop/Other -> User Interface/Desktops
- add /usr/share/%%{name} directory in %%files section

* Sat May 31 2003 KATO Masashi <mkato@par.odn.ne.jp> 0.1.14-1_0vl1
- fluxbox for Vine Linux. Japanese menu enabled at default.
  (initial package for Vine Linux)
- modified menu-generator patch (x-terminals)
- modified init.in patch (date,workspace name,default style)
- added 2 styles (VineStyle, BlueStar)
