%define major 1
%define minor 45
%define teeny 0
%define tarname boost
%define lnkver %{major}_%{minor}
%define pkgver %{major}_%{minor}_%{teeny}

Summary: Portable C++ source libraries
Summary(ja): ポータブルな C++ ソースライブラリ
Name: libboost
Version: %{major}.%{minor}.%{teeny}
Release: 2%{?_dist_release}
Source0: http://downloads.sourceforge.net/%{tarname}/%{tarname}_%{pkgver}.tar.bz2
Source1: user-config.jam
Patch0: https://svn.boost.org/trac/boost/attachment/ticket/4688/boost_filesystem.patch
License: distributable
Group: System Environment/Libraries
URL: http://www.boost.org/

BuildRequires: python-devel apache2-devel bzip2-devel zlib-devel libicu-devel
BuildRequires: libaio-devel lam
BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

Obsoletes: %{name}-date-time-devel %{name}-filesystem-devel %{name}-graph-devel
Obsoletes: %{name}-iostreams-devel %{name}-program-options-devel
Obsoletes: %{name}-python-devel %{name}-regex-devel
Obsoletes: %{name}-serialization-devel %{name}-signals-devel %{name}-test-devel
Obsoletes: %{name}-thread-devel %{name}-wave-devel

%description
Boost provides free peer-reviewed portable C++ source libraries.  The emphasis
is on libraries which work well with the C++ Standard Library.  The libraries
are intended to be widely useful, and are in regular use by thousands of
programmers across a broad spectrum of applications.

A further goal is to establish "existing practice" and provide reference
implementations so that Boost libraries are suitable for eventual
standardization. Ten Boost libraries will be included in the C++ Standards
Committee's upcoming C++ Standard Library Technical Report as a step toward
becoming part of a future C++ Standard.

%description -l ja
Boost は公開レビューされたフリーのC++ライブラリ群です。 C++ の標準ライブラリに
準拠することに重点を置いて開発されています。使いやすく、広い分野のアプリ
ケーションにおいて日常的に多くの開発者に用いられることを目指しています。

さらなる目標は、最終的な標準化に適合した「存在する実例」としてリファレンス実装
を提供することです。10 の Boost ライブラリが、将来の C++ 標準になるための一歩
として、C++ 標準化委員会が策定中の C++ 標準ライブラリテクニカルレポートに
含まれる予定です。

%package devel
Summary: Header files and libraries for developing apps which will use %{name}
Summary(ja): %{name}の開発に必要なヘッダファイル及びライブラリ
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The %{name}-devel package contains the header files and libraries needed
to develop programs that use the Boost library.

%description devel -l ja
%{name}-devel パッケージは Boost ライブラリを使うプログラムの開発に必要な
ヘッダファイルやライブラリを含んでいます。

%package doc
Summary: Documents of %{name}
Summary(ja): %{name}のドキュメント
Group: Applications/Documentation
Requires: %{name} = %{version}-%{release}

%description doc
The %{name}-doc package contains the documents about the boost library.

%description doc -l ja
%{name}-doc パッケージは Boost ライブラリについてのドキュメントを含んでいます。

%package date-time
Summary: Set of data-time libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description date-time
Set of data-time libralies in %{name}

%package filesystem
Summary: Set of filesystem operation libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description filesystem
Set of filesystem operation libralies in %{name}

%package graph
Summary: Set of Graphviz libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description graph
Set of Graphviz libralies in %{name}

%package iostreams
Summary: Set of streams and i/o filters libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description iostreams
Set of streams and i/o filters libralies in %{name}

%package math
Summary: Set of math libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description math
Set of math libralies in %{name}

%package program-options
Summary: Set of program options libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description program-options
Set of program options libralies in %{name}

%package python
Summary: Set of Python libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description python
Set of Python libralies in %{name}

%package random
Summary: Set of random number generation libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description random
Set of random number generation libralies in %{name}

%package regex
Summary: Set of regular expression libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description regex
Set of regular expression libralies in %{name}

%package serialization
Summary: Set of serialization libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description serialization
Set of serialization libralies in %{name}

%package signals
Summary: Set of signals and slots libralies in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description signals
Set of signals and slots libralies in %{name}

%package system
Summary: Operating system support
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description system
Operating system support, including the diagnostics support
that will be part of the C++0x standard library

%package test
Summary: Set of libraries for writing and executing tests in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description test
Set of libraries for writing and executing tests in %{name}

%package thread
Summary: Set of multi-thread libraries in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description thread
Set of multi-thread libraries in %{name}

%package wave
Summary: Set of wave libraries in %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description wave
Set of wave libraries in %{name}

%prep
%setup -q -n %{tarname}_%{pkgver}
cp %SOURCE1 user-config.jam

%patch0 -p1 -b .filesystem

%build
## ./configure --prefix=/usr --libdir=%{_libdir} --with-icu
## make EXPAT_INCLUDE=/usr/include EXPAT_LIBPATH=/usr/lib
./bootstrap.sh \
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--includedir=%{_includedir} \
	--with-icu=%{_prefix} \
	--with-python-version=%{pyver}

./bjam -sICU_LINK="-L%{_libdir} -licui18n" --user-config=./user-config.jam link=shared

%install
rm -rf $RPM_BUILD_ROOT
## ./tools/jam/src/bin.linux*/bjam -sICU_PATH=/usr -sEXPAT_INCLUDE=/usr/include -sEXPAT_LIBPATH=/usr/lib --user-config=user-config.jam --prefix=${RPM_BUILD_ROOT}/usr --libdir=${RPM_BUILD_ROOT}%{_libdir} install

./bjam \
	--prefix=${RPM_BUILD_ROOT}%{_prefix} \
	--libdir=${RPM_BUILD_ROOT}%{_libdir} \
	--user-config=./user-config.jam \
	link=shared \
	install

ln -s ./%{tarname} ${RPM_BUILD_ROOT}/%{_includedir}/%{tarname}-%{lnkver}

# remove unuse files
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/%{name}_*.a

# unnead for libboost-1.42
## pushd $RPM_BUILD_ROOT/%{_libdir}
## for i in libboost_*-mt.so
## do
##   ln -sf $i $(echo $i | cut -f1 -d-).so
## done
## popd

## %post devel
## if [ $1 = 2 ]; then
##    rm -rf %{_includedir}/%{tarname}
## fi
## ln -s %{_includedir}/%{tarname}-%{lnkver}/%{tarname} %{_includedir}/%{tarname}
## 
## %postun devel
## if [ $1 = 0 ]; then
##    rm -rf %{_includedir}/%{tarname}
## fi

%post date-time -p /sbin/ldconfig
%post filesystem -p /sbin/ldconfig
%post graph -p /sbin/ldconfig
%post iostreams -p /sbin/ldconfig
%post math -p /sbin/ldconfig
%post program-options -p /sbin/ldconfig
%post python -p /sbin/ldconfig
%post regex -p /sbin/ldconfig
%post serialization -p /sbin/ldconfig
%post signals -p /sbin/ldconfig
%post system -p /sbin/ldconfig
%post test -p /sbin/ldconfig
%post thread -p /sbin/ldconfig
%post wave -p /sbin/ldconfig

%postun date-time -p /sbin/ldconfig
%postun filesystem -p /sbin/ldconfig
%postun graph -p /sbin/ldconfig
%postun iostreams -p /sbin/ldconfig
%postun math -p /sbin/ldconfig
%postun program-options -p /sbin/ldconfig
%postun python -p /sbin/ldconfig
%postun regex -p /sbin/ldconfig
%postun serialization -p /sbin/ldconfig
%postun signals -p /sbin/ldconfig
%postun system -p /sbin/ldconfig
%postun test -p /sbin/ldconfig
%postun thread -p /sbin/ldconfig
%postun wave -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc LICENSE_1_0.txt

%files devel
%defattr(-,root,root)
%{_includedir}/boost/
%{_includedir}/boost-%{lnkver}/

%files doc
%doc index.htm index.html boost.css boost.png rst.css doc libs more

%files date-time
%{_libdir}/%{name}_date_time*.so*

%files filesystem
%{_libdir}/%{name}_filesystem*.so*

%files graph
%{_libdir}/%{name}_graph*.so*
%{_libdir}/%{name}_mpi*.so*
%{_libdir}/mpi*.so*

%files iostreams
%{_libdir}/%{name}_iostreams*.so*

%files math
%{_libdir}/%{name}_math_*.so*

%files program-options
%{_libdir}/%{name}_program_options*.so*

%files python
%{_libdir}/%{name}_python*.so*

%files random
%{_libdir}/%{name}_random*.so*

%files regex
%{_libdir}/%{name}_regex*.so*

%files serialization
%{_libdir}/%{name}_serialization*.so*
%{_libdir}/%{name}_wserialization*.so*

%files signals
%{_libdir}/%{name}_signals*.so*

%files system
%{_libdir}/%{name}_system*.so*

%files test
%{_libdir}/%{name}_prg_exec_monitor*.so*
%{_libdir}/%{name}_unit_test_framework*.so*

%files thread
%{_libdir}/%{name}_thread*.so*

%files wave
%{_libdir}/%{name}_wave*.so*

%changelog
* Sun Feb 20 2011 Munehiro Yamamoto <munepi@vinelinux.org> 1.45.0-2
- fixed crashing throwing exception
  "std::runtime_error: locale::facet::_S_create_c_locale name not valid" 
  on some systems (FreeBSD and some linuxes) when current locale 
  (LANG,LC_ALL) is not "C"

* Tue Jan 18 2011 Shu KONNO <owa@bg.wakwak.com> 1.45.0-1
- updated to boost_1_45_0
- added random sub-package

* Wed Apr 14 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.42.0-4
- rebuilt again on ppc

* Sat Apr 10 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.42.0-3
- rebuilt with libicu-4.4

* Mon Feb 08 2010 Shu KONNO <owa@bg.wakwak.com> 1.42.0-2
- added "-licui18n" to bjam
- added BR: lam

* Sun Feb 07 2010 Shu KONNO <owa@bg.wakwak.com> 1.42.0-1
- updated to boost_1_42_0
- rebuilt with new toolchain and python-2.6
- added user-config.jam to make libboost_mpi
- added BR: libaio-devel
- added %%{post,postun} -p /sbin/ldconfig
- dropt no use parameter EXPAT_INCLUDE and EXPAT_LIBPATH
- dropt %{_libdir}/%{name}_test_exec_monitor-*.a in %%files %{name}-test
- dropt %%{post,postun} devel section

* Sun Mar 22 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.36.0-2vl5
- rebuilt with libicu-4.0.1
- changed Group to System Environment/Libraries (except devel package)

* Sat Aug 16 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.36.0-1vl5
- new upstream release
- add -math subpackage

* Fri Aug 15 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.35.0-2vl5
- build with python-2.5
- add libboost_XXXX.so symlinks

* Thu May 8 2008 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.35.0-1vl5
- upstream release
- applied new versioning policy
- add EXPAT_INCLUDE and EXPAT_LIBPATH to enable GraphML support
- add new package libboost-system
- Obsolete: *-devel packages

* Sat Sep  8 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.34.1-0vl3
- rebuilt with libicu-3.6
- changed doc Group to Applications/Documentation

* Sat Aug 18 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.34.1-0vl2
- upstream release

* Thu Jun 14 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.34.0-0vl3
- add --libdir=%%{_libdir} to cope with x86_64 environment

* Sun Jun 10 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.34.0-0vl2
- upstream release
- use Easy Build and Install process with ./configure
- add BuildRequires: libicu-devel
- remove %%{_libdir}/libboost_test_exec_monitor-*.so* from %%files -n libboost-test
- add new packages: libboost-graph, libboost-graph-devel, libboost-wave
- add files to doc package

* Sun May 13 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.33.1-0vl2
- rebuilt with new toolchain

* Sat Feb 4 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.33.1-0vl1
- upstream release

* Mon Dec 12 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.33.0-0vl3
- fixed typo in Groups:
- devel packages also moved to Development/Libraries group

* Mon Sep 19 2005 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.33.0-0vl2
- spec modified to avoid errors on non-ix86 archtecture
  (previously the path linuxx86 was explicitly used)

* Sun Sep 11 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.33.0-0vl1
- initial release for Vine Linux

* Sat Sep 10 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.33.0-0vl0.3
- link /usr/include/boost_%{lnkver}/boost to /usr/include/boost

* Sat Sep 10 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.33.0-0vl0.2
- change package name from boost to libboost
- separated into sub-packages

* Fri Jun 17 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.33.0-0vl0.1
- upstream release
- add BuildRequires: bzip2-devel zlib-devel

* Fri Jun 17 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.7
- added so.* file

* Mon Apr 25 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.6
- moved %post, %postun script to -devel package

* Mon Apr 25 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.5
- moved doc/html to -devel package
- make a symbolic link on %{_includedir}/boost

* Mon Apr 25 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.4
- fixed character code to euc-jp

* Mon Apr 25 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.3
- add %doc files

* Fri Apr 22 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.2
- remove Requires
- split -devel package

* Fri Apr 22 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 1.32.0-0vl0.1
- initial build for Vine Linux