import intf_libs  = libboost-assert%lib{boost_assert}
import intf_libs += libboost-config%lib{boost_config}
import intf_libs += libboost-core%lib{boost_core}
import intf_libs += libboost-detail%lib{boost_detail}
import intf_libs += libboost-function%lib{boost_function}
import intf_libs += libboost-integer%lib{boost_integer}
import intf_libs += libboost-iterator%lib{boost_iterator}
import intf_libs += libboost-mpl%lib{boost_mpl}
import intf_libs += libboost-preprocessor%lib{boost_preprocessor}
import intf_libs += libboost-random%lib{boost_random}
import intf_libs += libboost-range%lib{boost_range}
import intf_libs += libboost-smart-ptr%lib{boost_smart_ptr}
import intf_libs += libboost-throw-exception%lib{boost_throw_exception}
import intf_libs += libboost-type-traits%lib{boost_type_traits}
import intf_libs += libboost-utility%lib{boost_utility}
import impl_libs  = libz%lib{z}
import impl_libs += libbzip2%lib{bzip2}
import impl_libs += libboost-numeric-conversion%lib{boost_numeric_conversion}

# BEGIN MANUAL CUSTOMIZATION
#
if $config.libboost_iostreams.regex
  import intf_libs += libboost-regex%lib{boost_regex}
#
# END MANUAL CUSTOMIZATION

intf_libs = $cxx.deduplicate_export_libs($intf_libs)

# Public headers.
#
pub = [dir_path] ../include/boost/

include $pub

pub_hdrs = $($pub/ pub_hdrs)

lib{boost_iostreams}: $pub/{$pub_hdrs}

# BEGIN MANUAL CUSTOMIZATION
#

# Private headers and sources as well as dependencies.
#
# Exclude the source files implementing LZMA and ZSTD compression because they
# require unpackaged libraries. (Note that this does not disable compression
# because the zlib and bzip2 source files are included by `**`.)
#
# Note that the user trying to use the excluded functionality will fail with a
# linker error. We could probably also exclude the related headers
# (boost/iostreams/filter/lzma.hpp, etc) but let's keep it simple for now.
#
lib{boost_iostreams}: {hxx ixx txx}{**}     \
                      cxx{** -lzma -zstd}   \
                      $impl_libs $intf_libs

#
# END MANUAL CUSTOMIZATION

# Build options.
#
out_pfx_inc = [dir_path] $out_root/include/
src_pfx_inc = [dir_path] $src_root/include/
out_pfx_src = [dir_path] $out_root/src/
src_pfx_src = [dir_path] $src_root/src/

cxx.poptions =+ "-I$out_pfx_src" "-I$src_pfx_src" \
                "-I$out_pfx_inc" "-I$src_pfx_inc"

{hbmia obja}{*}: cxx.poptions += -DBOOST_IOSTREAMS_STATIC_LINK
{hbmis objs}{*}: cxx.poptions += -DBOOST_IOSTREAMS_DYN_LINK

# Export options.
#
lib{boost_iostreams}:
{
  cxx.export.poptions = "-I$out_pfx_inc" "-I$src_pfx_inc" \
                         -DBOOST_IOSTREAMS_NO_LIB
  cxx.export.libs = $intf_libs
}

liba{boost_iostreams}: cxx.export.poptions += -DBOOST_IOSTREAMS_STATIC_LINK
libs{boost_iostreams}: cxx.export.poptions += -DBOOST_IOSTREAMS_DYN_LINK

# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version. See the version module
# for details on the version.* variable values.
#
if $version.pre_release
  lib{boost_iostreams}: bin.lib.version = "-$version.project_id"
else
  lib{boost_iostreams}: bin.lib.version = "-$version.major.$version.minor"

# Don't install private headers.
#
{hxx ixx txx}{*}: install = false
