From bc9c5908b693593a53517ed7b3bf71df377c32c6 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: May 02 2012 19:49:40 +0000 Subject: Add support for building boost-python against Python 3 This doesn't touch boost-openmpi-python and boost-mpich2-python, as those are broken anyway at the moment. --- diff --git a/boost-1.48.0-python3.patch b/boost-1.48.0-python3.patch new file mode 100644 index 0000000..249906a --- /dev/null +++ b/boost-1.48.0-python3.patch @@ -0,0 +1,15 @@ +diff -up boost_1_48_0/libs/python/src/CMakeLists.txt\~ boost_1_48_0/libs/python/src/CMakeLists.txt +--- boost_1_48_0/libs/python/src/CMakeLists.txt~ 2012-05-02 20:29:17.095570094 +0200 ++++ boost_1_48_0/libs/python/src/CMakeLists.txt 2012-05-02 20:29:27.645898988 +0200 +@@ -29,7 +29,8 @@ endif (PYTHON_DEBUG_LIBRARIES AND BUILD_ + # Always build the non-debug variants of the boost_python library + set(BUILD_PYTHON_NODEBUG ON) + +-boost_add_library(python ++colormsg (GREEN "+-- BOOST_PYTHON_SUFFIX=${BOOST_PYTHON_SUFFIX}") ++boost_add_library(python${BOOST_PYTHON_SUFFIX} + numeric.cpp + list.cpp + long.cpp + +Diff finished. Wed May 2 20:29:38 2012 diff --git a/boost.spec b/boost.spec index 9823a8e..42445ab 100644 --- a/boost.spec +++ b/boost.spec @@ -18,6 +18,10 @@ %bcond_without openmpi %endif +# Configuration of Python 3 +%bcond_without python3 +%define python3_version 3.2mu + Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.48.0 @@ -68,12 +72,18 @@ Requires: boost-test = %{version}-%{release} Requires: boost-thread = %{version}-%{release} Requires: boost-timer = %{version}-%{release} Requires: boost-wave = %{version}-%{release} +%if %{with python3} +Requires: boost-python3 = %{version}-%{release} +%endif BuildRequires: cmake BuildRequires: libstdc++-devel%{?_isa} BuildRequires: bzip2-devel%{?_isa} BuildRequires: zlib-devel%{?_isa} BuildRequires: python-devel%{?_isa} +%if %{with python3} +BuildRequires: python3-devel%{?_isa} +%endif BuildRequires: libicu-devel%{?_isa} BuildRequires: chrpath @@ -131,6 +141,9 @@ Patch11: boost-1.48.0-long-double.patch # https://bugzilla.redhat.com/show_bug.cgi?id=784654 Patch12: boost-1.48.0-polygon.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=807780 +Patch13: boost-1.48.0-python3.patch + %bcond_with tests %bcond_with docs_generated @@ -229,6 +242,22 @@ functions and objects to Python, and vice versa, using no special tools -- just your C++ compiler. This package contains run-time support for Boost Python Library. +%if %{with python3} + +%package python3 +Summary: Run-Time component of boost python library for Python 3 +Group: System Environment/Libraries + +%description python3 + +The Boost Python Library is a framework for interfacing Python and +C++. It allows you to quickly and seamlessly expose C++ classes +functions and objects to Python, and vice versa, using no special +tools -- just your C++ compiler. This package contains run-time +support for Boost Python Library compiled for Python 3. + +%endif + %package random Summary: Run-Time component of boost random library Group: System Environment/Libraries @@ -502,6 +531,7 @@ sed 's/_FEDORA_SONAME/%{sonamever}/' %{PATCH1} | %{__patch} -p0 --fuzz=0 %patch10 -p1 %patch11 -p1 %patch12 -p3 +%patch13 -p1 %build # Support for building tests. @@ -521,6 +551,24 @@ sed 's/_FEDORA_SONAME/%{sonamever}/' %{PATCH1} | %{__patch} -p0 --fuzz=0 make VERBOSE=1 %{?_smp_mflags} ) +%if %{with python3} + +# Build boost-python for Python 3 +( echo ============================= build Python 3 ================== + mkdir serial-python3 + cd serial-python3 + %cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo %{boost_testflags} \ + -DENABLE_SINGLE_THREADED=YES -DINSTALL_VERSIONED=OFF \ + -DBUILD_PROJECTS="python" -DWITH_MPI=OFF \ + -DPython_ADDITIONAL_VERSIONS=%{python3_version} \ + -DPYTHON_EXECUTABLE=python%{python3_version} \ + -DBOOST_PYTHON_SUFFIX=3 \ + .. + make VERBOSE=1 %{?_smp_mflags} +) + +%endif + # Build MPI parts of Boost with OpenMPI support %if %{with openmpi} %{_openmpi_load} @@ -639,6 +687,9 @@ find $RPM_BUILD_ROOT/$MPI_LIB -name '*.cmake' -exec rm -f {} \; export PATH=/bin${PATH:+:}$PATH %endif +echo ============================= install Python 3 ================== +DESTDIR=$RPM_BUILD_ROOT make -C serial-python3 VERBOSE=1 install + echo ============================= install serial ================== DESTDIR=$RPM_BUILD_ROOT make -C serial VERBOSE=1 install # Kill any debug library versions that may show up un-invited. @@ -875,7 +926,15 @@ rm -rf $RPM_BUILD_ROOT %files python %defattr(-, root, root, -) %doc LICENSE_1_0.txt -%{_libdir}/libboost_python*.so.%{sonamever} +%{_libdir}/libboost_python.so.%{sonamever} +%{_libdir}/libboost_python-mt.so.%{sonamever} + +%if %{with python3} +%files python3 +%defattr(-, root, root, -) +%doc LICENSE_1_0.txt +%{_libdir}/libboost_python3*.so.%{sonamever} +%endif %files random %defattr(-, root, root, -)