Boost logo

Boost :

From: Patrick Hartling (patrick_at_[hidden])
Date: 2006-08-09 15:48:54


Several weeks ago, I posted an RPM spec file for Boost that I was hoping to
see used as the "upstream" spec file for Boost installations on RPM-based
Linux distributions. If nothing else, having it serve as a model to Linux
distributors would be great, too. I have attached an updated version of that
spec file that I feel is an improvement to the earlier version.

The philosophy behind this new spec file is to be as true as possible to
what I understand to be a "normal" Boost installation. I realize that users
are afforded many ways to customize their Boost installation through
different build-time options. Without doing any build customization,
however, a Boost installation has single- and multi-threaded variants of
libraries, both static and dynamic, that are named based on the toolset used
for building and the Boost version number. Furthermore, the headers are
installed in a versioned subdirectory. All of this allows parallel
installations of different Boost build variants, and I see that as an
extremely powerful capability. The attached RPM spec file leverages that in
a way that I see as being very valuable.

Relative to the Boost RPM distributed for use on Red Hat distributions of
Linux (I do not have experience with pre-packaged versions of Boost from
other Linux distribution vendors, so I cannot comment on how they do
things), this RPM spec file has the following benefits:

   * Allows parallel installations of multiple Boost releases (both the
     run-time RPM and the developer RPM)
   * Installs single- and multi-threaded builds of libraries

The spec file that Red Hat uses for building Boost RPMs removes the toolset
name and the version information from the base name of the library, and it
only installs the single-threaded build of each library. For reasons that
are not yet clear to me, an additional symlink is created for each Boost
shared library named libboost_<libname>.so.2 that points to
libboost_<libname>.so.1.33.1. This prevents multiple parallel run-time
installations. Multiple developer installations are prevented by the removal
of the version information from the base library name and by the fact that
the headers are placed in /usr/include/boost instead of in
/usr/include/boost-1_33_1/boost.

Since there are likely to be many users who are expecting Boost to be
installed using the Red Hat RPM, I have added some compatibility bits in the
form of two extra RPMs called boost-symlinks and boost-devel-symlinks. The
first installs symlinks for the Boost libraries named using Red Hat's
stripped down convention (with the version number after the .so part of the
name). The second RPM installs unversioned symbolic links to the fully
qualified library names and to the Boost header directory. The idea here is
that users could have multiple Boost developer installations in parallel,
and if they so desired, they could install this extra RPM with unversioned
names to point to whichever Boost installation should be the "default"
version. Since the symlinks are unversioned, parallel installations of
multiple versions of these RPMs is not possible. Nevertheless, the two
together provide a means to make a Boost RPM installation that is compatible
with what Red Hat has been distributing for quite a while now.

Comments?

 -Patrick

-- 
Patrick L. Hartling                    | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2oum9          | http://www.infiscape.com/

%define version 1.33.1
%define underscore_version %(echo %{version} | sed -e 's/\\./_/g')
%define last_version 1.33.0
%define tarball_name boost_%{underscore_version}
%define release 2

%define python_arch %(python -c 'import os; print os.uname()[4]')

%if %{python_arch} == %{_arch}
%define build_python 1
%else
%define build_python 0
%endif

Name: boost
Summary: The Boost C++ Libraries
Version: %{version}
Release: %{release}
License: Boost Software License
URL: http://www.boost.org/
Group: System Environment/Libraries
Source: %{tarball_name}.tar.bz2
BuildRoot: %{_tmppath}/boost-%{version}-root
Prereq: /sbin/ldconfig
%if %{build_python}
BuildRequires: libstdc++-devel python
%else
BuildRequires: libstdc++-devel
%endif
Obsoletes: boost <= %{last_version}
Obsoletes: boost-devel <= %{last_version}
Obsoletes: boost-doc <= %{last_version}
%if %{build_python}
Obsoletes: boost-python <= %{last_version}
%endif

%description
Boost provides free peer-reviewed portable C++ source libraries. The
emphasis is on libraries which work well with the C++ Standard
Library. One goal is to establish "existing practice" and provide
reference implementations so that the Boost libraries are suitable for
eventual standardization. (Some of the libraries have already been
proposed for inclusion in the C++ Standards Committee's upcoming C++
Standard Library Technical Report.)

%package devel
Summary: The Boost C++ Headers
Group: System Environment/Libraries
Requires: boost = %{version}-%{release}
%if %{build_python}
Obsoletes: boost-python-devel <= %{last_version}
Provides: boost-python-devel = %{version}-%{release}
%endif

%description devel
Headers and libraries for developing software that uses Boost C++.

%package symlinks
Summary: Compatibility Links to the Boost C++ %{version} Libraries
Group: System Environment/Libraries
Requires: boost = %{version}-%{release}

%description symlinks
Symllinks to the Boost %{version} libraries for compatibility with Boost
RPMs distributed by Red Hat.

%package devel-symlinks
Summary: Unversioned Links to the Boost C++ %{version} Headers
Group: System Environment/Libraries
Requires: boost = %{version}-%{release}
Requires: boost-devel = %{version}-%{release}

%description devel-symlinks
Unversioned symllinks to the Boost %{version} headers and libraries for
compatibility with Boost RPMs distributed by Red Hat.

%package doc
Summary: The Boost C++ HTML docs
Group: System Environment/Libraries
Requires: boost = %{version}-%{release}
%if %{build_python}
Provides: boost-python-docs = %{version}-%{release}
%endif

%description doc
HTML documentation files for Boost C++ libraries

%prep
rm -rf $RPM_BUILD_ROOT

%setup -n %{tarball_name} -q

%ifarch i386 i486 i586 i686
%define arch_args <cflags>-m32 <cxxflags>-m32 <linkflags>-m32 <linkflags>-L/usr/lib
%else
%ifarch x86_64
%define arch_args <cflags>-m64 <cxxflags>-m64 <linkflags>-m64 <linkflags>-L/usr/lib64
%endif
%endif

%build
if icu-config --ldflags ; then export ICU_PATH=/usr ICU_LINK=\"$(icu-config --ldflags | sed 's/-lpthread//g')\"; fi
without_libs=''
%if %{build_python} == 0
without_libs="$without_libs --without-python"
%endif
# This is a hack. A better way needs to be devised for determining when
# the local architecture does not match the target architecture.
%if %{python_arch} != %{_arch}
without_libs="$without_libs --without-iostreams"
%endif
#build bjam
(cd tools/build/jam_src && ./build.sh)
#build boost with bjam
BJAM=`find tools/build/jam_src/ -name bjam -a -type f`
PYTHON_VERSION=`python -V 2>&1 |sed 's,.* \([0-9]\.[0-9]\)\(\.[0-9]\)\?.*,\1,'`
PYTHON_FLAGS="-sPYTHON_ROOT=/usr -sPYTHON_VERSION=$PYTHON_VERSION"
$BJAM $PYTHON_FLAGS "-sTOOLS=gcc" "-sBUILD=release <threading>single/multi %{arch_args}" "--prefix=$RPM_BUILD_ROOT%{_prefix}" "--libdir=$RPM_BUILD_ROOT%{_libdir}" $without_libs install

%install
curdir=`pwd`
cd $RPM_BUILD_ROOT%{_includedir}
ln -s boost-%{underscore_version}/boost ./boost

# Replace unversioned static and shared libraries with symlinks to the
# versioned copy. The symlinks will be packaged separately for people who want
# to use an unversioned Boost developer environment. This also prevents
# ldconfig from complaining about duplicate shared libraries.
# Create symlinks to the fully qualified library without the toolset name for
# compatibility with other Boost RPMs.
cd $RPM_BUILD_ROOT%{_libdir}
for f in libboost_*-%{underscore_version}.so ; do
   unversioned_name=`echo $f | sed -e 's/-%{underscore_version}//'`
   no_info_name=`echo $unversioned_name | sed -e 's/-gcc//'`
   rm -f $unversioned_name
   ln -s $f.%{version} $unversioned_name
   ln -s $f.%{version} $no_info_name
   ln -s $f.%{version} $no_info_name.%{version}
   ln -s $f.%{version} $no_info_name.2
done
for f in libboost_*-%{underscore_version}.a ; do
   unversioned_name=`echo $f | sed -e 's/-%{underscore_version}//'`
   no_info_name=`echo $unversioned_name | sed -e 's/-gcc//'`
   rm -f $unversioned_name
   ln -s $f $unversioned_name
   ln -s $f $no_info_name
done
cd $curdir

#install doc files
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
#cp -a doc/html $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version}
find . -name '*.html' -o -name '*.css' -o -name '*.htm' | cpio -p --make-directories $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version}
find $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version} -type d | xargs chmod 755
find $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version} -type f | xargs chmod 644

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%defattr(-, root, root)
%{_libdir}/*-%{underscore_version}.so.%{version}

%files symlinks
%defattr(-, root, root)
%{_libdir}/*[a-z].so.%{version}
%{_libdir}/*[a-z].so.2

%files devel
%defattr(-, root, root)
%{_includedir}/boost-%{underscore_version}
%{_libdir}/*-%{underscore_version}.a
%{_libdir}/*-%{underscore_version}.so

%files devel-symlinks
%defattr(-, root, root)
%{_includedir}/boost
%{_libdir}/*[a-z].a
%{_libdir}/*[a-z].so

%files doc
%defattr(-, root, root)
%{_docdir}/boost-%{version}

%changelog
* Wed Aug 9 2006 Patrick Hartling <patrick_at_[hidden]> 1.33.1-2
- Put headers in versioned subdirectory
- Simplify build/installation process
- Fixed complaints from ldconfig about duplicate shared libraries
- Use symbolic links for unversioned header directory and library files
  for compability with Red Hat RPMs (see the new packages symlinks and
  devel-symlinks)

* Fri Apr 14 2006 Patrick Hartling <patrick_at_[hidden]> 1.33.1-1
- Update to 1.33.1
- Install single- and multi-threaded libraries
- Install fully versioned libraries
- Allow 32-bit build to be made on 64-bit architecture (currently without
  Boost.Python or Boost.iostreams)

* Mon Nov 29 2004 Benjamin Kosnik <bkoz_at_[hidden]> 1.32.0-1
- Update to 1.32.0
- (#122817: libboost_*.so symlinks missing)

* Wed Sep 22 2004 Than Ngo <than_at_[hidden]> 1.31.0-9
- cleanup specfile
- fix multiarch problem

* Tue Jun 15 2004 Elliot Lee <sopwith_at_[hidden]>
- rebuilt

* Wed May 05 2004 Warren Togami <wtogami_at_[hidden]> 1.31.0-7
- missing Obsoletes boost-python

* Mon May 03 2004 Benjamin Kosnik <bkoz_at_[hidden]>
- (#121630: gcc34 patch needed)

* Wed Apr 21 2004 Warren Togami <wtogami_at_[hidden]>
- #121415 FC2 BLOCKER: Obsoletes boost-python-devel, boost-doc
- other cleanups

* Tue Mar 30 2004 Benjamin Kosnik <bkoz_at_[hidden]>
- Remove bjam dependency. (via Graydon).
- Fix installed library names.
- Fix SONAMEs in shared libraries.
- Fix installed header location.
- Fix installed permissions.

* Fri Feb 13 2004 Elliot Lee <sopwith_at_[hidden]>
- rebuilt

* Mon Feb 09 2004 Benjamin Kosnik <bkoz_at_[hidden]> 1.31.0-2
- Update to boost-1.31.0

* Thu Jan 22 2004 Benjamin Kosnik <bkoz_at_[hidden]> 1.31.0-1
- Update to boost-1.31.0.rc2
- (#109307: Compile Failure with boost libraries)
- (#104831: Compile errors in apps using Boost.Python...)
- Unify into boost, boost-devel rpms.
- Simplify installation using bjam and prefix install.

* Tue Sep 09 2003 Nalin Dahyabhai <nalin_at_[hidden]> 1.30.2-2
- require boost-devel instead of devel in subpackages which require boost-devel
- remove stray Prefix: tag

* Mon Sep 08 2003 Benjamin Kosnik <bkoz_at_[hidden]> 1.30.2-1
- change license to Freely distributable
- verify installation of libboost_thread
- more boost-devel removals
- deal with lack of _REENTRANT on ia64/s390
- (#99458) rpm -e fixed via explict dir additions
- (#103293) update to 1.30.2

* Wed Jun 04 2003 Elliot Lee <sopwith_at_[hidden]>
- rebuilt

* Tue May 13 2003 Florian La Roche <Florian.LaRoche_at_[hidden]>
- remove packager, change to new Group:

* Tue May 06 2003 Tim Powers <timp_at_[hidden]> 1.30.0-3
- add deffattr's so we don't have unknown users owning files




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk