Windows: Update the build script and README-Windows.txt.

The 32-bit build is now for i686 or newer because the
prebuilt MinGW-w64 toolchains include i686 code in the
executables even if one uses -march=i486.

The build script builds 32-bit SSE2 enabled version too.
Run-time detection of SSE2 support would be nice (on any OS)
but it's not implemented in XZ Utils yet.
This commit is contained in:
Lasse Collin 2014-12-20 20:41:48 +02:00
parent 4a1f6133ee
commit 0152f72bf6
2 changed files with 30 additions and 23 deletions

View File

@ -21,14 +21,18 @@ Package contents
---------------- ----------------
All executables and libraries in this package require msvcrt.dll. All executables and libraries in this package require msvcrt.dll.
It's included in all recent Windows versions. On Windows 95 it It's included in all recent Windows versions. (On Windows 95 it
might be missing, but once you get it somewhere, XZ Utils should might be missing, but once you get it somewhere, the i686 binaries
run even on Windows 95. should run even on Windows 95 if the processor is new enough.)
There are two different versions of the executable and library files. There is a SSE2 optimization in the compression code but this
There is one directory for each type of binaries: version of XZ Utils doesn't include run-time processor detection.
This is why there is a separate i686-SSE2 version.
bin_i486 32-bit x86 (i486 and up), Windows 95 and later There is one directory for each type of executable and library files:
bin_i686 32-bit x86 (i686 and newer), Windows 95 and later
bin_i686-sse2 32-bit x86 (i686 with SSE2), Windows 98 and later
bin_x86-64 64-bit x86-64, Windows Vista and later bin_x86-64 64-bit x86-64, Windows Vista and later
Each of the above directories have the following files: Each of the above directories have the following files:
@ -90,15 +94,13 @@ Microsoft Visual C++
lib /def:liblzma.def /out:liblzma.lib /machine:x64 lib /def:liblzma.def /out:liblzma.lib /machine:x64
Linking against static liblzma might work too, but usually you If you need to link statically against liblzma, you should build
should use liblzma.dll if possible. (Or, if having a decompressor liblzma with MSVC 2013 update 2 or later. Alternatively, if having
is enough, consider using XZ Embedded or LZMA SDK which can be a decompressor is enough, consider using XZ Embedded or LZMA SDK.
compiled with MSVC.)
To try linking against static liblzma, rename liblzma.a to e.g. When you plan to link against static liblzma, you need to tell
liblzma_static.lib and tell MSVC to link against it. You also need lzma.h to not use __declspec(dllimport) by defining the macro
to tell lzma.h to not use __declspec(dllimport) by defining the LZMA_API_STATIC. You can do it either in the C/C++ code
macro LZMA_API_STATIC. You can do it either in the C/C++ code
#define LZMA_API_STATIC #define LZMA_API_STATIC
#include <lzma.h> #include <lzma.h>

View File

@ -75,6 +75,8 @@ buildit()
# threading. So I don't include a size-optimized liblzma for now. # threading. So I don't include a size-optimized liblzma for now.
./configure \ ./configure \
--prefix= \ --prefix= \
--enable-silent-rules \
--disable-dependency-tracking \
--disable-nls \ --disable-nls \
--disable-scripts \ --disable-scripts \
--disable-threads \ --disable-threads \
@ -89,9 +91,12 @@ buildit()
make distclean make distclean
# Build the normal speed-optimized binaries. # Build the normal speed-optimized binaries. The type of threading
# (win95 vs. vista) will be autodetect from the target architecture.
./configure \ ./configure \
--prefix= \ --prefix= \
--enable-silent-rules \
--disable-dependency-tracking \
--disable-nls \ --disable-nls \
--disable-scripts \ --disable-scripts \
--build="$BUILD" \ --build="$BUILD" \
@ -125,19 +130,19 @@ txtcp()
done done
} }
# FIXME: Make sure that we don't get i686 or i586 code from the runtime.
# Or if we do, update the strings here to match the generated code.
# i686 has cmov which can help like maybe 1 % in performance but things
# like SSE don't help, so i486 isn't horrible for performance.
#
# FIXME: Using i486 in the configure triplet may be wrong.
if [ -d "$MINGW_W32_DIR" ]; then if [ -d "$MINGW_W32_DIR" ]; then
# 32-bit x86, Win95 or later, using MinGW-w32 # 32-bit x86, Win95 or later, using MinGW-w32
PATH=$MINGW_W32_DIR/bin:$MINGW_W32_DIR/i686-w64-mingw32/bin:$PATH \ PATH=$MINGW_W32_DIR/bin:$MINGW_W32_DIR/i686-w64-mingw32/bin:$PATH \
buildit \ buildit \
pkg/bin_i486 \ pkg/bin_i486 \
i486-w64-mingw32 \ i686-w64-mingw32 \
'-march=i486 -mtune=generic' '-march=i686 -mtune=generic'
# 32-bit x86 with SSE2, Win98 or later, using MinGW-w32
PATH=$MINGW_W32_DIR/bin:$MINGW_W32_DIR/i686-w64-mingw32/bin:$PATH \
buildit \
pkg/bin_i686-sse2 \
i686-w64-mingw32 \
'-march=i686 -msse2 -mfpmath=sse -mtune=generic'
elif [ -d "$MINGW_DIR" ]; then elif [ -d "$MINGW_DIR" ]; then
# 32-bit x86, Win95 or later, using MinGW # 32-bit x86, Win95 or later, using MinGW
PATH=$MINGW_DIR/bin:$PATH \ PATH=$MINGW_DIR/bin:$PATH \