Debian Codegraph @

bzip2/install.txt

raw
1 HOW TO ADD BZIP2 SUPPORT TO ZIP
2
3 This document describes how to add bzip2 support to Zip.
4
5 Compiling or linking in the bzip2 library adds an additional bzip2
6 compression method to Zip. This new method can be selected instead
7 of the Zip traditional compression method deflation to compress files
8 and often gives a better compression ratio (perhaps at the cost of
9 greater CPU time). The compression method is specified using the
10 "-Z method" command-line option, where "method" may be either "deflate"
11 (the default), or "bzip2" (if Zip is built with bzip2 support). Zip
12 has been tested with bzip2 library 1.0.5 and earlier.
13
14 Notes
15
16 Compression method bzip2 requires a modern unzip. Before using bzip2
17 compression in Zip, verify that a modern UnZip program with bzip2 support
18 will be used to read the resulting zip archive so that entries compressed
19 with bzip2 (compression method 12) can be read. Older unzips probably
20 won't recognize the compression method and will skip those entries.
21
22 The Zip source kit does not include the bzip2 library or source files, but
23 these can be found at "http://www.bzip.org/" for example. See below for
24 how to add bzip2 to Zip for various operating systems.
25
26 Zip using bzip2 compression is not compatible with the bzip2 application,
27 but instead provides an additional way to compress files before adding
28 them to a Zip archive. It does not replace the bzip2 program itself,
29 which creates bzip2 archives in a different format that are not
30 compatible with zip or unzip.
31
32 The bzip2 code and algorithms are provided under the bzip2 license
33 (provided in the bzip2 source kit) and what is not covered by that license
34 is covered under the Info-ZIP license. Info-ZIP will look at issues
35 involving the use of bzip2 compression in Zip, but any questions about
36 the bzip2 code and algorithms or bzip2 licensing, for example, should be
37 directed to the bzip2 maintainer.
38
39
40 Installation
41
42 To build Zip with bzip2 support, Zip generally needs one bzip2 header
43 file, "bzlib.h", and the object library, typically "libbz2.a", except
44 in cases where the source files are compiled in directly. If you
45 are either compiling the bzip2 library or compiling in the bzip2
46 source files, we recommend defining the C macro BZ_NO_STDIO, which
47 excludes a lot of standalone error code (not used when bzip2 is
48 used as a library and makes the library smaller) and provides hooks
49 that Zip can use to provide better error handling. However, a
50 standard bzip2 object library will work, though any errors that bzip2
51 generates may be more cryptic.
52
53 Building the bzip2 library from the bzip2 source files (recommended):
54
55 Download the latest bzip2 package (from "http://www.bzip.org/", for
56 example).
57
58 Unpack the bzip2 source kit (bzip2-1.0.5.tar.gz was current as of
59 this writing, but the latest should work).
60
61 Read the README file in the bzip2 source kit.
62
63 Compile the bzip2 library for your OS, preferably defining
64 BZ_NO_STDIO. Note: On UNIX systems, this may be done automatically
65 when building Zip, as explained below.
66
67
68 Installation on UNIX (see below for installation on other systems):
69
70 Note: Zip on UNIX uses the "bzlib.h" include file and the compiled
71 "libbz2.a" library to static link to bzip2. Currently we do not
72 support using the shared library (patches welcome).
73
74 The easiest approach may be to drop the two above files in the
75 bzip2 directory of the Zip source tree and build Zip using the
76 "generic" target, that is, using a command like
77 make -f unix/Makefile generic
78 If all goes well, make should confirm that it found the files and
79 will be compiling in bzip2 by setting the BZIP2_SUPPORT flag and
80 then including the libraries while compiling and linking Zip.
81
82 To use bzlib.h and libbz2.a from somewhere else on your system,
83 define the "make" macro IZ_BZIP2 to point to that directory. For
84 example:
85 make -f unix/Makefile generic IZ_BZIP2=/mybz2
86 where /mybz2 might be "/usr/local/src/bzip2/bzip2-1.0.5" on some
87 systems. Only a compiled bzip2 library can be pointed to using
88 IZ_BZIP2 and Zip will not compile bzip2 source in other than the
89 bzip2 directory.
90
91 If IZ_BZIP2 is not defined, Zip will look for the bzip2 files in
92 the "bzip2" directory in the Zip source directory. The bzip2
93 directory is empty in the Zip source distribution (except for
94 this install.txt file) and is provided as a place to put the
95 bzip2 files. To use this directory, either drop bzlib.h and
96 libbz2.a in it to use the compiled library as noted above or drop
97 the contents of the bzip2 source kit in this directory so that
98 bzlib.h is directly in the bzip2 directory and Zip will try to
99 compile it if no compiled library is already there.
100
101
102 Unpacking bzip2 so Zip compiles it:
103
104 To make this work, the bzip2 source kit must be unpacked directly
105 into the Zip "bzip2" directory. For example:
106
107 # Unpack the Zip source kit.
108 gzip -cd zip30.tar-gz | tar xfo -
109 # Move down to the Zip kit's "bzip2" directory, ...
110 cd zip30/bzip2
111 # ... and unpack the bzip2 source kit there.
112 gzip -cd ../../bzip2-1.0.5.tar.gz | tar xfo -
113 # Move the bzip2 source files up to the Zip kit's bzip2 directory.
114 cd bzip2-1.0.5
115 mv * ..
116 # Return to the Zip source kit directory, ready to build.
117 cd ../..
118 # Build Zip.
119 make -f unix/Makefile generic
120
121
122 Using a system bzip2 library:
123
124 If IZ_BZIP2 is not defined and both a compiled library and the bzip2
125 source files are missing from the Zip bzip2 directory, Zip will test
126 to see if bzip2 is globally defined on the system in the default
127 include and library paths and, if found, link in the system bzip2
128 library. This is automatic.
129
130
131 Preventing inclusion of bzip2:
132
133 To build Zip with _no_ bzip2 support on a system where the automatic
134 bzip2 detection scheme will find bzip2, you can specify a bad
135 IZ_BZIP2 directory. For example:
136
137 make -f unix/Makefile generic IZ_BZIP2=no_such_directory
138
139 You can also define NO_BZIP2_SUPPORT to exclude bzip2.
140
141
142 Verifying bzip2 support in Zip:
143
144 When the Zip build is complete, verify that bzip2 support has been
145 enabled by checking the feature list:
146
147 ./zip -v
148
149 If all went well, bzip2 (and its library version) should be listed.
150
151
152 Installation on other systems
153
154 MSDOS:
155
156 Thanks to Robert Riebisch, the DJGPP 2.x Zip port now supports bzip2.
157 To include bzip2, first install bzip2. The new msdos/makebz2.dj2
158 makefile then looks in the standard bzip2 installation directories
159 for the needed files. As he says:
160 It doesn't try to be clever about finding libbz2.a. It just
161 expects bzip2 stuff installed to the default include and library
162 folders, e.g., "C:\DJGPP\include" and "C:\DJGPP\lib" on DOS.
163
164 Given a standard DJGPP 2.x installation, this should create a
165 version of Zip 3.0 with bzip2 support.
166
167 The bzip2 library for DJGPP can be found on any DJGPP mirror in
168 "current/v2apps" (or "beta/v2apps/" for the latest beta). This
169 library has been ported to MSDOS/DJGPP by Juan Manuel Guerrero.
170
171
172 WIN32 (Windows NT/2K/XP/2K3/... and Windows 95/98/ME):
173
174 For Windows there seems to be two approaches, either use bzip2
175 as a dynamic link library or compile the bzip2 source in directly.
176 I have not gotten the static library libbz2.lib to work, but that
177 may be me.
178
179 Using bzip2 as a dynamic link library:
180
181 Building bzip2:
182
183 If you have the needed bzlib.h, libbz2.lib, and libbz2.dll files
184 you can skip building bzip2. If not, open the libbz2.dsp project
185 and build libbz2.dll
186
187 This creates
188 debug/libbz2.lib
189 and
190 libbz2.dll
191
192
193 Building Zip:
194
195 Copy libbz2.lib to the bzip2 directory in the Zip source tree. This
196 is needed to compile Zip with bzip2 support. Also copy the matching
197 bzlib.h from the bzip2 source to the same directory.
198
199 Add libbz2.lib to the link list for whatever you are building. Also
200 define the compiler define BZIP2_SUPPORT.
201
202 Build Zip.
203
204
205 Using Zip with bzip2 as dll:
206
207 Put libbz2.dll in your command path. This is needed to run Zip with
208 bzip2 support.
209
210 Verify that bzip2 is enabled with the command
211
212 zip -v
213
214 You should see bzip2 listed.
215
216 Compiling in bzip2 from the bzip2 source:
217
218 This approach compiles in the bzip2 code directly. No external
219 library is needed.
220
221 Get a copy of the bzip2 source and copy the contents to the bzip2
222 directory in the Zip source tree so that bzlib.h is directly in
223 the bzip2 directory.
224
225 Use the vc6bz2 project to build Zip. This project knows of the
226 added bzip2 files.
227
228 Verify that bzip2 is enabled with the command
229
230 zip -v
231
232
233 Windows DLL (WIN32):
234
235 Nothing yet.
236
237
238 Mac OS X:
239
240 Follow the standard UNIX build procedure. Mac OS X includes bzip2
241 and the UNIX builders should find the bzip2 files in the standard
242 places. Note that the version of bzip2 on your OS may not be
243 current and you can instead specify a different library or compile
244 your own bzip2 library as noted in the Unix procedures above.
245
246
247 OS/2:
248
249 Nothing yet.
250
251
252 VMS (OpenVMS):
253
254 See [.vms]install_vms.txt for how to enable bzip2 support on VMS.
255
256
257 Last updated 26 March 2007, 15 July 2007, 9 April 2008, 27 June 2008
258 S. Schweda, E. Gordon