File mingw32-boost.spec of Package mingw32-boost

#
# spec file for package mingw32-boost
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define ver 1.88.0
%define file_version 1_88_0
%define docs_version 1.56.0
%define short_version 1_56
%define native_name boost
#!BuildIgnore: post-build-checks
%define _mingw32_docdir %{_mingw32_datadir}/doc/%{native_name}-%{version}
%global build_properties variant=release threading=single,multi threadapi=win32 \\\
	link=shared,static runtime-link=shared debug-symbols=on \\\
	target-os=windows toolset=gcc-mingw address-model=32 binary-format=pe abi=ms \\\
	boost.stacktrace.basic=on boost.stacktrace.from_exception=off
%global build_flags -d2 --layout=tagged --user-config=user-config.jam \\\
	%build_properties --without-mpi --without-python
Name:           mingw32-%{native_name}
Version:        %{ver}
Release:        0
Summary:        Boost C++ Libraries
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://www.boost.org
Source0:        https://archives.boost.io/release/1.88.0/source/%{native_name}_%file_version.tar.gz
Source3:        http://downloads.sourceforge.net/project/boost/boost-docs/%{docs_version}/%{native_name}_%{short_version}_pdf.tar.bz2
Source4:        existing_extra_docs
Patch1:         boost-thread.patch
Patch8:         boost-no_segfault_in_Regex_filter.patch
Patch50:        boost-use_std_xml_catalog.patch

BuildRequires:  dos2unix
BuildRequires:  gcc-c++
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-libbz2-devel
BuildRequires:  mingw32-libexpat-devel
BuildRequires:  mingw32-libicu-devel
BuildRequires:  mingw32-xz-devel
BuildRequires:  mingw32-zlib-devel
BuildRequires:  mingw32-zstd-devel
BuildRequires:  procps
%_mingw32_package_header_debug
BuildArch:      noarch

%description
Boost provides free peer-reviewed portable C++ source libraries. The
emphasis is on libraries that 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.

Although Boost was begun by members of the C++ Standards Committee
Library Working Group, membership has expanded to include nearly two
thousand members of the C++ community at large.

This package is mainly needed for updating from a prior version, the
dynamic libraries are found in their respective package. For development
using Boost, you also need the boost-devel package. For documentation,
see the boost-doc package.

%package        devel
Summary:        Development package for Boost C++
Group:          Development/Libraries/C and C++

%description devel
This package contains all that is needed to develop/compile
applications that use the Boost C++ libraries. For documentation see
the documentation packages (html, man or pdf).

%package        doc-html
Summary:        HTML documentation for the Boost C++ Libraries
Group:          Development/Libraries/C and C++

%description    doc-html
This package contains the documentation of the boost dynamic libraries
in HTML format.

%package        doc-pdf
Summary:        PDF documentation for the Boost C++ Libraries
Group:          Development/Libraries/C and C++

%description    doc-pdf
This package contains the documentation of the boost dynamic libraries
in PDF format.

%package        -n mingw32-libboost_atomic
Summary:        Run-Time component of boost atomic library
Group:          System/Libraries

%description -n mingw32-libboost_atomic
Run-Time support for Boost.Atomic, a library that provides atomic data types
and operations on these data types, as well as memory ordering constraints
required for coordinating multiple threads through atomic variables.

%package        -n mingw32-libboost_charconv
Summary:        Run-Time component of boost charconv library
Group:          System/Libraries

%description -n mingw32-libboost_charconv
Run-Time support for Boost.Charconv, a library that provides conversion of
numeric values to/fom string.

%package        -n mingw32-libboost_container
Summary:        Boost.Container runtime library
Group:          System/Libraries

%description -n mingw32-libboost_container
This package contains the Boost.Container runtime library.

%package        -n mingw32-libboost_context
Summary:        Run-Time component of boost context switching library
Group:          System/Libraries

%description -n mingw32-libboost_context
Run-Time support for Boost.Context, a foundational library that
provides a sort of cooperative multitasking on a single thread.

%package        -n mingw32-libboost_contract
Summary:        Run-Time component of boost contract library
Group:          System/Libraries

%description -n mingw32-libboost_contract
Run-Time support for Boost.Contract that provides tupport for contract programming.

%package        -n mingw32-libboost_coroutine
Summary:        Boost::Coroutine runtime library
Group:          System/Libraries

%description -n mingw32-libboost_coroutine
This package contains the Boost Coroutine runtime library.

%package        -n mingw32-libboost_date_time
Summary:        Boost::Date.Time Runtime libraries
Group:          System/Libraries

%description    -n mingw32-libboost_date_time
This package contains the Boost Date.Time runtime libraries.

%package        -n mingw32-libboost_fiber
Summary:        Run-Time component of boost fiber library
Group:          System/Libraries

%description    -n mingw32-libboost_fiber
This package contains the Boost.Fiber userland thread library

%package        -n mingw32-libboost_filesystem
Summary:        Boost::Filesystem Runtime Libraries
Group:          System/Localization

%description    -n mingw32-libboost_filesystem
This package contains the Boost::Filesystem libraries.

%package        -n mingw32-libboost_graph
Summary:        Boost::Graph Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_graph
This package contains the Boost::Graph Runtime libraries.

%package        -n mingw32-libboost_iostreams
Summary:        Boost::IOStreams Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_iostreams
This package contains the Boost::IOStreams Runtime libraries.

%package        -n mingw32-libboost_json
Summary:        Boost JSON Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_json
This package contains the Boost.JSON Runtime libraries.

%package        -n mingw32-libboost_log
Summary:        Run-Time component of boost logging library
Group:          System/Libraries

%description    -n mingw32-libboost_log
Boost.Log library aims to make logging significantly easier for the
application developer. It provides a wide range of out-of-the-box
tools along with public interfaces for extending the library.

%package        -n mingw32-libboost_math
Summary:        Boost::Math Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_math
This package contains the Boost::Math Runtime libraries.

%package        -n mingw32-libboost_nowide
Summary:        Run-Time component of boost nowide library
Group:          System/Libraries

%description    -n mingw32-libboost_nowide
This package contains the Boost.Nowide library for abstracting wide character APIs.

%package        -n mingw32-libboost_test
Summary:        Boost::Test Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_test
This package contains the Boost::Test runtime libraries.

%package        -n mingw32-libboost_process
Summary:        Run-Time component of boost process library
Group:          System/Libraries

%description    -n mingw32-libboost_process
This package contains the boost.process Runtime libraries.

%package        -n mingw32-libboost_program_options
Summary:        Boost::ProgramOptions Runtime libraries
Group:          System/Libraries

%description    -n mingw32-libboost_program_options
This package contains the Boost::ProgramOptions Runtime libraries.

%if 0
%package        -n mingw32-libboost_python
Summary:        Boost::Python Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_python
This package contains the Boost::Python Runtime libraries.

%endif

%package        -n mingw32-libboost_serialization
Summary:        Boost::Serialization Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_serialization
This package contains the Boost::Serialization Runtime libraries.

%package        -n mingw32-libboost_stacktrace
Summary:        Boost::Stacktrace Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_stacktrace
This package contains the Boost::Stacktrace runtime libraries.

%package        -n mingw32-libboost_system
Summary:        Boost::System Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_system
This package contains the Boost::System runtime libraries.

%package        -n mingw32-libboost_thread
Summary:        Boost::Thread Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_thread
This package contains the Boost::Thread runtime libraries.

%package        -n mingw32-libboost_url
Summary:        Run-Time component of boost URL library
Group:          System/Libraries

%description    -n mingw32-libboost_url
This package contains the Boost.URL runtime libraries.

%package        -n mingw32-libboost_wave
Summary:        Boost::Wave Runtime Libraries
Group:          System/Libraries

%description    -n mingw32-libboost_wave
This package contains the Boost::Wave runtime libraries.

%package        -n mingw32-libboost_regex
Summary:        The Boost::Regex runtime library
Group:          System/Libraries

%description    -n mingw32-libboost_regex
This package contains the Boost::Regex runtime library.

%package        -n mingw32-libboost_random
Summary:        The Boost::Random runtime library
Group:          System/Libraries

%description    -n mingw32-libboost_random
This package contains the Boost:Random runtime library.

%package        -n mingw32-libboost_chrono
Summary:        The Boost::Chrono runtime library
Group:          System/Libraries

%description    -n mingw32-libboost_chrono
This package contains the Boost::Chrono runtime library.

%package        -n mingw32-libboost_locale
Summary:        The Boost::Locale runtime library
Group:          System/Libraries

%description    -n mingw32-libboost_locale
This package contains the Boost::Locale runtime library.

%package        -n mingw32-libboost_timer
Summary:        The Boost::Timer runtime library
Group:          System/Libraries

%description    -n mingw32-libboost_timer
This package contains the Boost::Timer runtime library.

%package        -n mingw32-libboost_type_erasure
Summary:        Boost.TypeErasure runtime library
Group:          System/Libraries

%description -n mingw32-libboost_type_erasure
This package contains Boost::TypeErasure runtime library.

%_mingw32_debug_package

%prep
free
%autosetup -p1 -n %{native_name}_%{file_version} -b 3
#everything in the tarball has the executable flag set ......
find -type f ! \( -name \*.sh -o -name \*.py -o -name \*.pl \) -exec chmod -x {} +

#stupid build machinery copies .orig files
find . -name \*.orig -exec rm {} +

%build
find . -type f -exec chmod u+w {} +

EXPAT_INCLUDE=%{_mingw32_includedir}
EXPAT_LIBPATH=%{_mingw32_libdir}
export EXPAT_INCLUDE EXPAT_LIBPATH

BUILD_FLAGS="--with-toolset=gcc --prefix=%{buildroot}%{_mingw32_prefix}"

./bootstrap.sh $BUILD_FLAGS --without-libraries=python --with-icu=%{_mingw32_prefix}

cat << EOF >user-config.jam
# Boost.Build Configuration
EOF

# Make it use the cross-compiler instead of gcc.
cat << EOF >user-config.jam
using gcc : mingw : %{_mingw32_cxx} -DBOOST_USE_WINDOWS_H=1
        : # options
          <rc>%{_mingw32_windres}
          <archiver>%{_mingw32_ar}
        ;
EOF

./b2 %build_flags \
	--prefix=%{buildroot}%{_mingw32_prefix} \
	--exec-prefix=%{buildroot}%{_mingw32_prefix} \
	--libdir=%{buildroot}%{_mingw32_libdir} \
	--includedir=%{buildroot}%{_mingw32_includedir} \
	stage

%install
EXPAT_INCLUDE=%{_mingw32_includedir}
EXPAT_LIBPATH=%{_mingw32_libdir}
export EXPAT_INCLUDE EXPAT_LIBPATH

./b2 %build_flags  \
	--prefix=%{buildroot}%{_mingw32_prefix} \
	--exec-prefix=%{buildroot}%{_mingw32_prefix} \
	--libdir=%{buildroot}%{_mingw32_libdir} \
	--includedir=%{buildroot}%{_mingw32_includedir} \
	install

for i in $(find %{buildroot}%{_mingw32_libdir} -name \*.a) ; do
	dir=$(dirname $i)
	i=$(basename $i)
	j=$(echo $i | sed -e 's|-x64[.]|.|')
	if ! [ $i = $j ] ; then
		ln -s $i $dir/$j
	fi
done

find %{buildroot}%{_mingw32_libdir}/cmake -name \*.cmake | xargs -t sed -i -e 's|%{buildroot}||g'

mkdir -p %{buildroot}%{_mingw32_bindir}

for i in `find %{buildroot}%{_mingw32_libdir} -name *.dll`; \
do \
	mv $i %{buildroot}%{_mingw32_bindir}; \
done

#install the pdf documentation
install -d %{buildroot}/%{_mingw32_docdir}/pdf
install -p -m 644 ../%{native_name}_%{short_version}_pdf/*.pdf %{buildroot}/%{_mingw32_docdir}/pdf/


#install doc files
find libs/ -name \*.htm\* -o -name \*.css -o -name \*.js | xargs dos2unix
find . -name \*.htm\* -o -name \*.gif -o -name \*.css -o -name \*.jpg -o -name \*.png -o -name \*.ico | \
	tar --files-from=%{SOURCE4} -cf - --files-from=- | tar -C %{buildroot}%{_mingw32_docdir} -xf -
rm -rf %{buildroot}%{_mingw32_docdir}/boost
ln -s ../LICENSE_1_0.txt %{buildroot}%{_mingw32_docdir}/libs
#only for documentation, doesn't need to be executable
find %{buildroot}%{_mingw32_docdir} -name \*.py -exec chmod -x {} +

rm -rf %{buildroot}%{_mingw32_libdir}/libboost_test_exec_monitor*.a

%files -n mingw32-libboost_atomic
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_atomic*.dll

%files -n mingw32-libboost_charconv
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_charconv*.dll

%files -n mingw32-libboost_container
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_container*.dll

%files -n mingw32-libboost_context
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_context*.dll

%files -n mingw32-libboost_contract
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_contract*.dll

%files -n mingw32-libboost_coroutine
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_coroutine*.dll

%files -n mingw32-libboost_date_time
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_date_time*.dll

%files -n mingw32-libboost_fiber
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_fiber*.dll

%files -n mingw32-libboost_filesystem
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_filesystem*.dll

%files -n mingw32-libboost_graph
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_graph*.dll

%files -n mingw32-libboost_iostreams
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_iostreams*.dll

%files -n mingw32-libboost_json
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_json*.dll

%files -n mingw32-libboost_log
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_log*.dll

%files -n mingw32-libboost_math
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_math_*.dll

%files -n mingw32-libboost_nowide
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_nowide*.dll

%files -n mingw32-libboost_test
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_prg_exec_monitor*.dll
%{_mingw32_bindir}/libboost_unit_test_framework*.dll

%files -n mingw32-libboost_process
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_process*.dll

%files -n mingw32-libboost_program_options
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_program_options*.dll

%files -n mingw32-libboost_serialization
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_*serialization*.dll

%files -n mingw32-libboost_stacktrace
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_stacktrace*.dll

%files -n mingw32-libboost_system
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_system*.dll

%files -n mingw32-libboost_thread
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_thread*.dll

%files -n mingw32-libboost_url
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_url*.dll

%files -n mingw32-libboost_wave
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_wave*.dll

%files -n mingw32-libboost_regex
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_regex*.dll

%files -n mingw32-libboost_random
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_random*.dll

%files -n mingw32-libboost_chrono
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_chrono*.dll

%files -n mingw32-libboost_locale
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_locale*.dll

%files -n mingw32-libboost_timer
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_timer*.dll

%files -n mingw32-libboost_type_erasure
%defattr(-, root, root, -)
%{_mingw32_bindir}/libboost_type_erasure*.dll

%files devel
%defattr(-,root,root,-)
%{_mingw32_includedir}/boost
%{_mingw32_libdir}/libboost_*.a
%{_mingw32_libdir}/cmake
%{_mingw32_datadir}/boost_predef

%files doc-html
%defattr(-, root, root, -)
%{_mingw32_docdir}/*
%exclude %{_mingw32_docdir}/pdf

%files doc-pdf
%defattr(-, root, root, -)
%{_mingw32_docdir}/pdf

%changelog
openSUSE Build Service is sponsored by