Ticket #1967: Jamfile.v2

File Jamfile.v2, 4.5 KB (added by brian.pratt@…, 14 years ago)

hacked iostreams Jamfile.v2 that allows zlib use in VC8 and MinGW

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