| 1 | # Boost.Iostreams Library Build Jamfile |
|---|
| 2 | |
|---|
| 3 | # (C) Copyright Jonathan Turkanis 2004 |
|---|
| 4 | # Distributed under the Boost Software License, Version 1.0. (See accompanying |
|---|
| 5 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
|---|
| 6 | |
|---|
| 7 | # See http://www.boost.org/libs/iostreams for documentation. |
|---|
| 8 | |
|---|
| 9 | project /boost/iostreams : source-location ../src ; |
|---|
| 10 | |
|---|
| 11 | # The biggest trick in this Jamfile is to link to zlib and bzip2 when |
|---|
| 12 | # needed. To configure that, a number of variables are used, which must |
|---|
| 13 | # be set by user with 'path-constant' either in Boost's root Jamfile, or |
|---|
| 14 | # in user-config.jam. |
|---|
| 15 | |
|---|
| 16 | # For each library with either link to existing binary, or build |
|---|
| 17 | # a library from the sources. |
|---|
| 18 | |
|---|
| 19 | import modules ; |
|---|
| 20 | import os ; |
|---|
| 21 | local debug = [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] ; |
|---|
| 22 | |
|---|
| 23 | for local v in NO_COMPRESSION |
|---|
| 24 | NO_ZLIB ZLIB_SOURCE ZLIB_INCLUDE ZLIB_BINARY ZLIB_LIBPATH |
|---|
| 25 | NO_BZIP2 BZIP2_SOURCE BZIP2_INCLUDE BZIP2_BINARY BZIP2_LIBPATH |
|---|
| 26 | { |
|---|
| 27 | $(v) = [ modules.peek : $(v) ] ; |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | # Given a name of library, either 'zlib', or 'bzip2', creates the necessary |
|---|
| 32 | # main target and returns it. If compression is disabled, returns nothing. |
|---|
| 33 | # The 'sources' argument is the list of sources names for the library, |
|---|
| 34 | # which will be used if building the library. |
|---|
| 35 | rule create-library ( library-name : windows-name unix-name : sources + : requirements * ) |
|---|
| 36 | { |
|---|
| 37 | local LIB = $(library-name:U) ; |
|---|
| 38 | if ! $(library-name) in zlib bzip2 |
|---|
| 39 | { |
|---|
| 40 | EXIT "Wrong library name passed to 'create-library' in libs/iostream/build/Jamfile.v2" ; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | if [ os.name ] = NT && ! $($(LIB)_SOURCE) && ! $($(LIB)_INCLUDE) |
|---|
| 44 | { |
|---|
| 45 | if $(debug) |
|---|
| 46 | { |
|---|
| 47 | ECHO "notice: iostreams: not using $(library-name) compression " ; |
|---|
| 48 | } |
|---|
| 49 | NO_$(LIB) = 1 ; |
|---|
| 50 | |
|---|
| 51 | # This is necessary to that test Jamfiles don't run compression |
|---|
| 52 | # tests when not needed. Dirty, but I don't have time to |
|---|
| 53 | # write full-blow project module for zlib and bzip2. |
|---|
| 54 | modules.poke : NO_$(LIB) : 1 ; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | if $(NO_COMPRESSION) || $(NO_$(LIB)) |
|---|
| 58 | { |
|---|
| 59 | if $(debug) |
|---|
| 60 | { |
|---|
| 61 | ECHO "notice: iostreams: not using $(library-name) compression " ; |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | else |
|---|
| 65 | { |
|---|
| 66 | if ! $($(LIB)_INCLUDE) |
|---|
| 67 | { |
|---|
| 68 | $(LIB)_INCLUDE = $($(LIB)_SOURCE) ; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | # Should we use prebuilt library or build it ourselves? |
|---|
| 72 | if $($(LIB)_SOURCE) |
|---|
| 73 | { |
|---|
| 74 | return [ lib boost_$(library-name) |
|---|
| 75 | : $($(LIB)_SOURCE)/$(sources).c |
|---|
| 76 | : <include>$($(LIB)_INCLUDE) |
|---|
| 77 | <location-prefix>$(LIB:L) |
|---|
| 78 | $(requirements) |
|---|
| 79 | : |
|---|
| 80 | : <include>$($(LIB)_INCLUDE) |
|---|
| 81 | ] ; |
|---|
| 82 | } |
|---|
| 83 | else |
|---|
| 84 | { |
|---|
| 85 | if $(debug) |
|---|
| 86 | { |
|---|
| 87 | ECHO "notice: iostreams: using prebuilt $(library-name)" ; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | # Should use prebuilt library. |
|---|
| 91 | if ! $($(LIB)_BINARY) |
|---|
| 92 | { |
|---|
| 93 | # No explicit name specified, guess it. |
|---|
| 94 | if [ os.name ] = NT |
|---|
| 95 | { |
|---|
| 96 | $(LIB)_BINARY = $(windows-name) ; |
|---|
| 97 | lib boost_$(library-name) : : <name>$(windows-name) ; |
|---|
| 98 | } |
|---|
| 99 | else |
|---|
| 100 | { |
|---|
| 101 | $(LIB)_BINARY = $(unix-name) ; |
|---|
| 102 | } |
|---|
| 103 | } |
|---|
| 104 | return [ lib boost_$(library-name) |
|---|
| 105 | : |
|---|
| 106 | : <name>$($(LIB)_BINARY) |
|---|
| 107 | <search>$($(LIB)_LIBPATH) |
|---|
| 108 | : |
|---|
| 109 | : <include>$($(LIB)_INCLUDE) |
|---|
| 110 | ] ; |
|---|
| 111 | |
|---|
| 112 | } |
|---|
| 113 | } |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | local sources = file_descriptor.cpp mapped_file.cpp ; |
|---|
| 118 | local z = [ create-library zlib : zll z : adler32 compress |
|---|
| 119 | crc32 deflate gzio infback inffast inflate inftrees trees uncompr zutil : |
|---|
| 120 | <link>shared:<define>ZLIB_DLL ] ; |
|---|
| 121 | |
|---|
| 122 | if $(z) |
|---|
| 123 | { |
|---|
| 124 | sources += boost_zlib zlib.cpp ; |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | local bz2 = [ create-library bzip2 : libbz2 bz2 : |
|---|
| 128 | blocksort bzlib compress crctable decompress huffman |
|---|
| 129 | mk251 randtable : |
|---|
| 130 | <link>shared:<def-file>$(BZIP2_SOURCE)/libbz2.def ] ; |
|---|
| 131 | |
|---|
| 132 | if $(bz2) |
|---|
| 133 | { |
|---|
| 134 | sources += boost_bzip2 bzip2.cpp ; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | lib boost_iostreams : $(sources) : <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1 ; |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|