summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
authorJosh MacDonald <josh.macdonald@gmail.com>2015-07-09 21:37:34 -0700
committerJosh MacDonald <josh.macdonald@gmail.com>2015-07-09 21:37:34 -0700
commitab5fac1b46411bdf6151013978a721d52342cc4f (patch)
tree2cf0430f273ef4c6f0671d3baa66878e596ccd72 /xdelta3
parentf56eeca9241a1dc570f77a419a98766e868301d5 (diff)
More work trying to build with mingw; not succeeding
Diffstat (limited to 'xdelta3')
-rwxr-xr-xxdelta3/run_release.sh43
-rw-r--r--xdelta3/xdelta3.h33
2 files changed, 48 insertions, 28 deletions
diff --git a/xdelta3/run_release.sh b/xdelta3/run_release.sh
index 0f86c27..de33020 100755
--- a/xdelta3/run_release.sh
+++ b/xdelta3/run_release.sh
@@ -9,6 +9,13 @@ export LDFLAGS
9 9
10LIBBASE=$HOME/lib 10LIBBASE=$HOME/lib
11 11
12MINGW_CCFLAGS="-DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0 -DXD3_WIN32=1 -DSHELL_TESTS=0"
13MINGW_LDFLAGS="-lmingw32"
14
15# Location where mingw-w64-build script runs.
16MINGW_BASE="/volume/home/jmacd/src/mingwb"
17
18# Windows 32bit
12# Run from the source dir. 19# Run from the source dir.
13SRCDIR=$PWD 20SRCDIR=$PWD
14 21
@@ -25,12 +32,13 @@ function buildit {
25 host=$1 32 host=$1
26 march=$2 33 march=$2
27 offsetbits=$3 34 offsetbits=$3
28 args=$4 35 cargs=$4
36 largs=$5
29 BM="${host}${march}" 37 BM="${host}${march}"
30 D=build/$BM/xoff${offsetbits} 38 D=build/$BM/xoff${offsetbits}
31 CFLAGS="$COMMON ${march} ${args} -I$LIBBASE/$BM/include" 39 CFLAGS="${COMMON} ${march} ${cargs} -I$LIBBASE/$BM/include"
32 CXXFLAGS="$COMMON ${march} ${args} -I$LIBBASE/$BM/include" 40 CXXFLAGS="${COMMON} ${march} ${cargs} -I$LIBBASE/$BM/include"
33 LDFLAGS="$COMMON ${march} ${args} -L$LIBBASE/$BM/lib" 41 LDFLAGS="${largs} -L$LIBBASE/$BM/lib"
34 echo CFLAGS=$CFLAGS 42 echo CFLAGS=$CFLAGS
35 echo CXXFLAGS=$CXXFLAGS 43 echo CXXFLAGS=$CXXFLAGS
36 echo LDFLAGS=$LDFLAGS 44 echo LDFLAGS=$LDFLAGS
@@ -43,26 +51,31 @@ function buildit {
43 --host=${host} \ 51 --host=${host} \
44 --prefix=$PWD \ 52 --prefix=$PWD \
45 --enable-debug-symbols) 53 --enable-debug-symbols)
46 echo "Building $D ..." 54
47 (cd $D && make all) 55 # echo "Building $D ..."
48 echo "Installing $D ..." 56 # (cd $D && make all)
49 (cd $D && make install) 57 # echo "Installing $D ..."
50 echo "Testing $D ..." 58 # (cd $D && make install)
59 # echo "Testing $D ..."
51 60
52 # TODO test if host matches mingw, can't run tests 61 # TODO test if host matches mingw, can't run tests
53 # (cd $D && ./bin/xdelta3regtest) 62 # (cd $D && ./bin/xdelta3regtest)
54 (cd $D && ./bin/xdelta3 test) 63 # (cd $D && ./bin/xdelta3 test)
55} 64}
56 65
57function buildall { 66function buildall {
58 buildit "$1" "$2" 32 "-DXD3_USE_LARGEFILE64=0 $3" 67 buildit "$1" "$2" 32 "-DXD3_USE_LARGEFILE64=0 $3" "$4"
59 buildit "$1" "$2" 64 "-DXD3_USE_LARGEFILE64=1 $3" 68 buildit "$1" "$2" 64 "-DXD3_USE_LARGEFILE64=1 $3" "$4"
60} 69}
61 70
71# Linux / OS X 64bit
62#buildall x86_64-pc-linux-gnu -m64 72#buildall x86_64-pc-linux-gnu -m64
73
74# Linux / OS X 32bit
63#buildall x86_64-pc-linux-gnu -m32 75#buildall x86_64-pc-linux-gnu -m32
64 76
65MINGW_FLAGS="-DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0 -DXD3_WIN32=1 -DSHELL_TESTS=0" 77# Windows 32bit
78buildall i686-w64-mingw32 -mconsole "${MINGW_CFLAGS}" "-L${MINGW_BASE}/mingw-w64-i686/lib ${MINGW_LDFLAGS}"
66 79
67buildall i686-w64-mingw32 -m32 "${MINGW_FLAGS}" 80# Windows 64bit
68buildall x86_64-w64-mingw32 -m64 "${MINGW_FLAGS}" 81#buildall x86_64-w64-mingw32 -mconsole "${MINGW_CFLAGS}" "-L${MINGW_BASE}/mingw-w64-x86_64/lib ${MINGW_LDFLAGS}"
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index 51f3156..6e03c31 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -110,22 +110,26 @@
110 */ 110 */
111#ifndef _WIN32 111#ifndef _WIN32
112#include <stdint.h> 112#include <stdint.h>
113#else 113#else /* WIN32 case */
114#define WIN32_LEAN_AND_MEAN 114#define WIN32_LEAN_AND_MEAN
115
115#ifndef WINVER 116#ifndef WINVER
116#if XD3_USE_LARGEFILE64 117#if XD3_USE_LARGEFILE64
117/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx. 118/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx.
118 * requires Win2000 or newer version of WinNT */ 119 * requires Win2000 or newer version of WinNT */
119#define WINVER 0x0500 120#define WINVER 0x0500
120#define _WIN32_WINNT 0x0500 121#define _WIN32_WINNT 0x0500
121#else 122#else /* xoff_t is 32bit */
122/* 32 bit (DWORD) file offsets: uses GetFileSize and 123/* 32 bit (DWORD) file offsets: uses GetFileSize and
123 * SetFilePointer. compatible with win9x-me and WinNT4 */ 124 * SetFilePointer. compatible with win9x-me and WinNT4 */
124#define WINVER 0x0400 125#define WINVER 0x0400
125#define _WIN32_WINNT 0x0400 126#define _WIN32_WINNT 0x0400
126#endif 127#endif /* if XD3_USE_LARGEFILE64 */
127#endif 128#endif /* ifndef WINVER */
129
128#include <windows.h> 130#include <windows.h>
131
132/* _MSV_VER is defined by Microsoft tools, not by mingw32 */
129#ifdef _MSC_VER 133#ifdef _MSC_VER
130#define inline 134#define inline
131typedef signed int ssize_t; 135typedef signed int ssize_t;
@@ -134,28 +138,34 @@ typedef unsigned char uint8_t;
134typedef unsigned short uint16_t; 138typedef unsigned short uint16_t;
135typedef unsigned long uint32_t; 139typedef unsigned long uint32_t;
136typedef ULONGLONG uint64_t; 140typedef ULONGLONG uint64_t;
137#else 141#else /* _MSC_VER >= 1600 */
138/* For MSVC10 and above */ 142/* For MSVC10 and above */
139#include <stdint.h> 143#include <stdint.h>
140#endif 144#endif /* _MSC_VER < 1600 */
141#else 145#else /* _MSC_VER not defined */
142/* mingw32, lcc and watcom provide a proper header */ 146/* mingw32, lcc and watcom provide a proper header */
143#include <stdint.h> 147#include <stdint.h>
144#endif 148#endif /* _MSC_VER defined */
145#endif 149#endif /* _WIN32 defined */
146 150
147typedef uint32_t usize_t; 151typedef uint32_t usize_t;
148 152
149#if XD3_USE_LARGEFILE64 153#if XD3_USE_LARGEFILE64
154/* xoff_t is a 64-bit type */
150#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */ 155#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */
156
151#ifndef _LARGEFILE_SOURCE 157#ifndef _LARGEFILE_SOURCE
152#define _LARGEFILE_SOURCE 158#define _LARGEFILE_SOURCE
153#endif 159#endif
160
154#ifndef _FILE_OFFSET_BITS 161#ifndef _FILE_OFFSET_BITS
155#define _FILE_OFFSET_BITS 64 162#define _FILE_OFFSET_BITS 64
156#endif 163#endif
157 164
158#if SIZEOF_UNSIGNED_LONG == 8 165#ifdef _WIN32
166typedef uint64_t xoff_t;
167#define Q "I64"
168#elif SIZEOF_UNSIGNED_LONG == 8
159typedef unsigned long xoff_t; 169typedef unsigned long xoff_t;
160#define Q "l" 170#define Q "l"
161#elif SIZEOF_SIZE_T == 8 171#elif SIZEOF_SIZE_T == 8
@@ -164,9 +174,6 @@ typedef size_t xoff_t;
164#elif SIZEOF_UNSIGNED_LONG_LONG == 8 174#elif SIZEOF_UNSIGNED_LONG_LONG == 8
165typedef unsigned long long xoff_t; 175typedef unsigned long long xoff_t;
166#define Q "ll" 176#define Q "ll"
167#else
168typedef uint64_t xoff_t;
169#define Q "I64"
170#endif 177#endif
171 178
172#define SIZEOF_XOFF_T 8 179#define SIZEOF_XOFF_T 8