Commit 6b9b943d authored by Federico Mena Quintero's avatar Federico Mena Quintero

Merge branch 'windows_build_improvements'

parents 636c0704 6fdb85cb
Pipeline #66266166 passed with stage
in 7 minutes and 15 seconds
......@@ -49,3 +49,11 @@ builddir
# vscode config directory
.vscode
# Windows build outputs
*.dll
*.exe
*.exp
*.lib
*.obj
*.res
......@@ -3,14 +3,17 @@
The following build systems are available for Bzip2:
* [Meson]: This is our preferred build system for Unix-like systems.
* [CMake]: Build tool for Unix and Windows.
* GNU [Autotools]: Another traditional build system for Unix-like
systems.
* nmake: Unsupported; used only for Windows.
* nmake: Unsupported; used only for Windows and Microsoft Visual
Studio 2013 or later.
Autotools is only supported on Unix-like OSes, nmake is only for Windows,
meson works for both.
[Meson]: https://mesonbuild.com
[CMake]: https://cmake.org
[Autotools]: https://autotools.io/index.html
......@@ -189,13 +192,13 @@ make install
## Using nmake on Windows
At least using MS Visual C++ 6, you can build from the unmodified
sources with [makefile.msc](makefile.msc) by issuing, in a command
shell:
Bzip2 can be built with Microsoft Visual Studio 2013 or later. From a Visual
Studio Tools Command Prompt run:
```
nmake -f makefile.msc
```
(you may need to first run the MSVC-provided script `VCVARS32.BAT`
so as to set up paths to the MSVC tools correctly).
The build will produce `bzip2.exe` and `bzip2recover.exe` files that are dependent
on `bz2-1.dll` and the Microsoft C Runtime library. Dynamic import and static
libraries are also built: `bz2-1.lib` and `bz2-static.lib`.
LIBRARY bz2-1
DESCRIPTION "bz2: library for data compression"
EXPORTS
BZ2_bzCompressInit
BZ2_bzCompress
......
# Makefile for Microsoft Visual C++ 6.0
# Makefile for Microsoft Visual Studio 2013 and later.
# usage: nmake -f makefile.msc
# K.M. Syring (syring@gsf.de)
# Fixed up by JRS for bzip2-0.9.5d release.
CC=cl
CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
RC=rc
OBJS= blocksort.obj \
huffman.obj \
......@@ -14,43 +15,61 @@ OBJS= blocksort.obj \
decompress.obj \
bzlib.obj
all: lib bzip2 test
all: dll lib bzip2 test
bzip2: lib
$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
bzip2: dll bzip2.res bzip2recover.res
$(CC) $(CFLAGS) /Febzip2 bzip2.c bz2-1.lib setargv.obj bzip2.res
$(CC) $(CFLAGS) /Febzip2recover bzip2recover.c bzip2recover.res
dll: $(OBJS) libbz2.def bz2-1.res
link /dll /implib:bz2-1.lib /out:bz2-1.dll /def:libbz2.def $(OBJS) bz2-1.res
lib: $(OBJS)
lib /out:libbz2.lib $(OBJS)
lib /out:bz2-static.lib $(OBJS)
bzip2.res:
$(RC) /fobzip2.res /d BZIP2 version.rc
bzip2recover.res:
$(RC) /fobzip2recover.res /d BZIP2RECOVER version.rc
bz2-1.res:
$(RC) /fobz2-1.res /d BZ21DLL version.rc
test: bzip2
type words1
.\\bzip2 -1 < tests\sample1.ref > sample1.rb2
.\\bzip2 -2 < tests\sample2.ref > sample2.rb2
.\\bzip2 -3 < tests\sample3.ref > sample3.rb2
.\\bzip2 -d < tests\sample1.bz2 > sample1.tst
.\\bzip2 -d < tests\sample2.bz2 > sample2.tst
.\\bzip2 -ds < tests\sample3.bz2 > sample3.tst
type tests\words1
.\\bzip2 -1 < tests\sample1.ref > tests\sample1.rb2
.\\bzip2 -2 < tests\sample2.ref > tests\sample2.rb2
.\\bzip2 -3 < tests\sample3.ref > tests\sample3.rb2
.\\bzip2 -d < tests\sample1.bz2 > tests\sample1.tst
.\\bzip2 -d < tests\sample2.bz2 > tests\sample2.tst
.\\bzip2 -ds < tests\sample3.bz2 > tests\sample3.tst
@echo All six of the fc's should find no differences.
@echo If fc finds an error on sample3.bz2, this could be
@echo because WinZip's 'TAR file smart CR/LF conversion'
@echo is too clever for its own good. Disable this option.
@echo The correct size for sample3.ref is 120,244. If it
@echo is 150,251, WinZip has messed it up.
fc tests\sample1.bz2 sample1.rb2
fc tests\sample2.bz2 sample2.rb2
fc tests\sample3.bz2 sample3.rb2
fc tests\sample1.tst sample1.ref
fc tests\sample2.tst sample2.ref
fc tests\sample3.tst sample3.ref
fc tests\sample1.bz2 tests\sample1.rb2
fc tests\sample2.bz2 tests\sample2.rb2
fc tests\sample3.bz2 tests\sample3.rb2
fc tests\sample1.tst tests\sample1.ref
fc tests\sample2.tst tests\sample2.ref
fc tests\sample3.tst tests\sample3.ref
clean:
del *.obj
del libbz2.lib
del bz2-1.dll
del bz2-1.exp
del bz2-1.lib
del bz2-1.res
del bz2-static.lib
del bzip2.exe
del bzip2.res
del bzip2recover.exe
del bzip2recover.res
del tests\sample1.rb2
del tests\sample2.rb2
del tests\sample3.rb2
......@@ -59,5 +78,5 @@ clean:
del tests\sample3.tst
.c.obj:
$(CC) $(CFLAGS) -c $*.c -o $*.obj
$(CC) $(CFLAGS) -c $*.c /Fe$*.obj
#include <winver.h>
LANGUAGE 0x09,0x01
1 VERSIONINFO
FILEVERSION 1,0,7,0
PRODUCTVERSION 1,0,7,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x00L
FILEOS VOS__WINDOWS32
#if defined(BZ21DLL)
FILETYPE VFT_DLL
#else
FILETYPE VFT_APP
#endif
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
// VALUE "Comments", "\0"
VALUE "CompanyName", "bzip2, https://gitlab.com/federicomenaquintero/bzip2\0"
VALUE "FileDescription", "bzip2\0"
VALUE "FileVersion", "1.0.7\0"
#if defined(BZ21DLL)
VALUE "InternalName", "bz2-1\0"
VALUE "OriginalFilename", "bz2-1.dll\0"
#elif defined(BZIP2)
VALUE "InternalName", "bzip2\0"
VALUE "OriginalFilename", "bzip2.exe\0"
#elif defined(BZIP2RECOVER)
VALUE "InternalName", "bzip2recover\0"
VALUE "OriginalFilename", "bzip2recover.exe\0"
#endif
VALUE "LegalCopyright", "Copyright (C) 1996-2010 Julian Seward <jseward@acm.org>. Copyright (C) 2019 Federico Mena Quintero <federico@gnome.org>. All rights reserved.\0"
// VALUE "LegalTrademarks", "\0"
// VALUE "PrivateBuild", "\0"
VALUE "ProductName", "bzip2\0"
VALUE "ProductVersion", "1.0.7\0"
// VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4b0
END
END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment