Commit c833295a3948e914fa23042896f19f35ddd8d927
1 parent
85d9e7df
Adjust Windows built to support 32-bit and 64-bit builds
Update the build to support new external-libs layout, and autoconf options to specify windows word size. Split make_windows_releases into multiple scripts.
Showing
13 changed files
with
105 additions
and
32 deletions
autoconf.mk.in
| @@ -20,6 +20,9 @@ CXX=@CXX@ | @@ -20,6 +20,9 @@ CXX=@CXX@ | ||
| 20 | CXXFLAGS=@CXXFLAGS@ | 20 | CXXFLAGS=@CXXFLAGS@ |
| 21 | AR=@AR@ | 21 | AR=@AR@ |
| 22 | RANLIB=@RANLIB@ | 22 | RANLIB=@RANLIB@ |
| 23 | +DLLTOOL=@DLLTOOL@ | ||
| 24 | +STRIP=@STRIP@ | ||
| 25 | +OBJDUMP=@OBJDUMP@ | ||
| 23 | GENDEPS=@GENDEPS@ | 26 | GENDEPS=@GENDEPS@ |
| 24 | LIBTOOL=@LIBTOOL@ | 27 | LIBTOOL=@LIBTOOL@ |
| 25 | DOCBOOKX_DTD=@DOCBOOKX_DTD@ | 28 | DOCBOOKX_DTD=@DOCBOOKX_DTD@ |
| @@ -32,3 +35,4 @@ VALIDATE_DOC=@VALIDATE_DOC@ | @@ -32,3 +35,4 @@ VALIDATE_DOC=@VALIDATE_DOC@ | ||
| 32 | SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@ | 35 | SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@ |
| 33 | BUILDRULES=@BUILDRULES@ | 36 | BUILDRULES=@BUILDRULES@ |
| 34 | HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@ | 37 | HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@ |
| 38 | +WINDOWS_WORDSIZE=@WINDOWS_WORDSIZE@ |
config-mingw deleted
config-mingw32
0 → 100755
config-mingw64
0 → 100644
| 1 | +#!/bin/sh | ||
| 2 | +./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=64 --with-buildrules=mingw \ | ||
| 3 | + CC=x86_64-w64-mingw32-gcc \ | ||
| 4 | + CXX=x86_64-w64-mingw32-g++ \ | ||
| 5 | + LD=x86_64-w64-mingw32-ld \ | ||
| 6 | + AR=x86_64-w64-mingw32-ar \ | ||
| 7 | + RANLIB=x86_64-w64-mingw32-ranlib \ | ||
| 8 | + DLLTOOL=x86_64-w64-mingw32-dlltool \ | ||
| 9 | + STRIP=x86_64-w64-mingw32-strip \ | ||
| 10 | + OBJDUMP=x86_64-w64-mingw32-objdump |
config-msvc
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | -CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --with-buildrules=msvc | 2 | +wordsize=$1 |
| 3 | +if ! test "$wordsize" = "32" -o "$wordsize" = "64"; then | ||
| 4 | + echo "Usage: $0 {32,64}" | ||
| 5 | + exit 2 | ||
| 6 | +fi | ||
| 7 | +objdump= | ||
| 8 | +if test "$wordsize" = "64"; then | ||
| 9 | + objdump=OBJDUMP=x86_64-w64-mingw32-objdump | ||
| 10 | +fi | ||
| 11 | +CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=$wordsize --with-buildrules=msvc $objdump |
configure.ac
| @@ -31,6 +31,21 @@ else | @@ -31,6 +31,21 @@ else | ||
| 31 | AC_MSG_RESULT(yes) | 31 | AC_MSG_RESULT(yes) |
| 32 | fi | 32 | fi |
| 33 | 33 | ||
| 34 | +WINDOWS_WORDSIZE= | ||
| 35 | +AC_SUBST(WINDOWS_WORDSIZE) | ||
| 36 | +AC_ARG_WITH(windows-wordsize, | ||
| 37 | + AS_HELP_STRING([--with-windows-wordsize={32,64}], | ||
| 38 | + [Windows only: whether this is a 32-bit or 64-bit build; required if external-libs are enabled]), | ||
| 39 | + [WINDOWS_WORDSIZE=$withval], | ||
| 40 | + [WINDOWS_WORDSIZE=none]) | ||
| 41 | +if test "$USE_EXTERNAL_LIBS" = "1"; then | ||
| 42 | + AC_MSG_CHECKING(for windows wordsize) | ||
| 43 | + AC_MSG_RESULT($WINDOWS_WORDSIZE) | ||
| 44 | + if ! test "$WINDOWS_WORDSIZE" = "32" -o "$WINDOWS_WORDSIZE" = "64"; then | ||
| 45 | + AC_MSG_ERROR(Windows wordsize of 32 or 64 must be specified if external libs are being used.) | ||
| 46 | + fi | ||
| 47 | +fi | ||
| 48 | + | ||
| 34 | if test "$BUILD_INTERNAL_LIBS" = "0"; then | 49 | if test "$BUILD_INTERNAL_LIBS" = "0"; then |
| 35 | AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1]) | 50 | AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1]) |
| 36 | AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1]) | 51 | AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1]) |
| @@ -378,7 +393,7 @@ if test "$USE_EXTERNAL_LIBS" = "1"; then | @@ -378,7 +393,7 @@ if test "$USE_EXTERNAL_LIBS" = "1"; then | ||
| 378 | # the user can run this and then edit autoconf.mk if they have too | 393 | # the user can run this and then edit autoconf.mk if they have too |
| 379 | # much trouble getting it to work with a different compiler. | 394 | # much trouble getting it to work with a different compiler. |
| 380 | CPPFLAGS="$CPPFLAGS -Iexternal-libs/include" | 395 | CPPFLAGS="$CPPFLAGS -Iexternal-libs/include" |
| 381 | - LDFLAGS="$LDFLAGS -Lexternal-libs/lib-$BUILDRULES" | 396 | + LDFLAGS="$LDFLAGS -Lexternal-libs/lib-$BUILDRULES$WINDOWS_WORDSIZE" |
| 382 | LIBS="$LIBS -lz -lpcre" | 397 | LIBS="$LIBS -lz -lpcre" |
| 383 | fi | 398 | fi |
| 384 | 399 |
copy_dlls
| @@ -7,19 +7,19 @@ use File::Basename; | @@ -7,19 +7,19 @@ use File::Basename; | ||
| 7 | 7 | ||
| 8 | my $whoami = basename($0); | 8 | my $whoami = basename($0); |
| 9 | 9 | ||
| 10 | -usage() unless @ARGV == 2; | ||
| 11 | -my ($file, $destdir) = @ARGV; | 10 | +usage() unless @ARGV == 3; |
| 11 | +my ($file, $destdir, $objdump) = @ARGV; | ||
| 12 | my $filedir = dirname($file); | 12 | my $filedir = dirname($file); |
| 13 | 13 | ||
| 14 | my %dlls = (); | 14 | my %dlls = (); |
| 15 | -open(O, "objdump -p $file|") or die "$whoami: can't run objdump\n"; | 15 | +open(O, "$objdump -p $file|") or die "$whoami: can't run objdump\n"; |
| 16 | while (<O>) | 16 | while (<O>) |
| 17 | { | 17 | { |
| 18 | if (m/^\s+DLL Name:\s+(.+\.dll)/i) | 18 | if (m/^\s+DLL Name:\s+(.+\.dll)/i) |
| 19 | { | 19 | { |
| 20 | my $dll = $1; | 20 | my $dll = $1; |
| 21 | $dll =~ tr/A-Z/a-z/; | 21 | $dll =~ tr/A-Z/a-z/; |
| 22 | - next if $dll =~ m/^(kernel32|msvcrt)\.dll$/; | 22 | + next if $dll =~ m/^(kernel32|user32|msvcrt)\.dll$/; |
| 23 | $dlls{$dll} = 1; | 23 | $dlls{$dll} = 1; |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
make/installwin.mk
| @@ -10,7 +10,7 @@ installwin: all | @@ -10,7 +10,7 @@ installwin: all | ||
| 10 | mkdir $(DEST)/doc | 10 | mkdir $(DEST)/doc |
| 11 | cp libqpdf/$(OUTPUT_DIR)/$(STATIC_LIB_NAME) $(DEST)/lib | 11 | cp libqpdf/$(OUTPUT_DIR)/$(STATIC_LIB_NAME) $(DEST)/lib |
| 12 | cp libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin | 12 | cp libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin |
| 13 | - perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin | 13 | + perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin $(OBJDUMP) |
| 14 | cp qpdf/$(OUTPUT_DIR)/qpdf.exe $(DEST)/bin | 14 | cp qpdf/$(OUTPUT_DIR)/qpdf.exe $(DEST)/bin |
| 15 | cp zlib-flate/$(OUTPUT_DIR)/zlib-flate.exe $(DEST)/bin | 15 | cp zlib-flate/$(OUTPUT_DIR)/zlib-flate.exe $(DEST)/bin |
| 16 | cp qpdf/fix-qdf $(DEST)/bin | 16 | cp qpdf/fix-qdf $(DEST)/bin |
make/mingw.mk
| @@ -62,7 +62,7 @@ endef | @@ -62,7 +62,7 @@ endef | ||
| 62 | # 1 2 3 4 5 6 7 | 62 | # 1 2 3 4 5 6 7 |
| 63 | # Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age) | 63 | # Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age) |
| 64 | define makelib | 64 | define makelib |
| 65 | - dlltool -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/,'`$(shell expr $(5) - $(7)).dll) $(1); \ | 65 | + $(DLLTOOL) -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/,'`$(shell expr $(5) - $(7)).dll) $(1); \ |
| 66 | $(CXX) -shared -o `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(shell expr $(5) - $(7)).dll \ | 66 | $(CXX) -shared -o `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(shell expr $(5) - $(7)).dll \ |
| 67 | $(1) $(3) $(4) | 67 | $(1) $(3) $(4) |
| 68 | endef | 68 | endef |
| @@ -75,9 +75,9 @@ endef | @@ -75,9 +75,9 @@ endef | ||
| 75 | 75 | ||
| 76 | # Install target | 76 | # Install target |
| 77 | 77 | ||
| 78 | -INSTALL_DIR = install-mingw | 78 | +INSTALL_DIR = install-mingw$(WINDOWS_WORDSIZE) |
| 79 | STATIC_LIB_NAME = libqpdf.a | 79 | STATIC_LIB_NAME = libqpdf.a |
| 80 | include make/installwin.mk | 80 | include make/installwin.mk |
| 81 | install: installwin | 81 | install: installwin |
| 82 | - strip $(DEST)/bin/*.exe | ||
| 83 | - strip $(DEST)/bin/*.dll | 82 | + $(STRIP) $(DEST)/bin/*.exe |
| 83 | + $(STRIP) $(DEST)/bin/*.dll |
make/msvc.mk
| @@ -101,7 +101,7 @@ endef | @@ -101,7 +101,7 @@ endef | ||
| 101 | 101 | ||
| 102 | # Install target | 102 | # Install target |
| 103 | 103 | ||
| 104 | -INSTALL_DIR = install-msvc | 104 | +INSTALL_DIR = install-msvc$(WINDOWS_WORDSIZE) |
| 105 | STATIC_LIB_NAME = qpdf.lib | 105 | STATIC_LIB_NAME = qpdf.lib |
| 106 | include make/installwin.mk | 106 | include make/installwin.mk |
| 107 | install: installwin | 107 | install: installwin |
make_windows_releases
| @@ -9,29 +9,19 @@ set -x | @@ -9,29 +9,19 @@ set -x | ||
| 9 | cwd=`pwd` | 9 | cwd=`pwd` |
| 10 | PATH=$cwd/libqpdf/build:$PATH | 10 | PATH=$cwd/libqpdf/build:$PATH |
| 11 | 11 | ||
| 12 | -rm -rf install-mingw install-msvc | 12 | +rm -rf install-mingw* install-msvc* |
| 13 | 13 | ||
| 14 | -./config-mingw | 14 | +./config-mingw64 |
| 15 | make check install | 15 | make check install |
| 16 | make distclean | 16 | make distclean |
| 17 | -./config-msvc | 17 | +./config-mingw32 |
| 18 | make check install | 18 | make check install |
| 19 | make distclean | 19 | make distclean |
| 20 | 20 | ||
| 21 | -cd install-mingw | ||
| 22 | -v=`ls -d qpdf-*` | ||
| 23 | -cd .. | ||
| 24 | - | ||
| 25 | -cp -p README-windows-install.txt install-mingw/$v/README.txt | ||
| 26 | -cp -p README-windows-install.txt install-msvc/$v/README.txt | ||
| 27 | - | ||
| 28 | -cd install-mingw | ||
| 29 | -zip -r ../$v-bin-mingw.zip $v | ||
| 30 | -cd ../install-msvc | ||
| 31 | -zip -r ../$v-bin-msvc.zip $v | ||
| 32 | -cd .. | ||
| 33 | - | ||
| 34 | set +x | 21 | set +x |
| 35 | 22 | ||
| 36 | -echo "" | ||
| 37 | -echo "$v-bin-mingw.zip and $v-bin-msvc.zip have been created." | 23 | +echo '' |
| 24 | +echo 'Now run "./make_windows_releases-msvc 64" in a 64-bit MSVC environment' | ||
| 25 | +echo 'and "./make_windows_releases-msvc 32" in a 32-bit MSVC environment.' | ||
| 26 | +echo 'Then run "./make_windows_releases-msvc-finish".' | ||
| 27 | +echo '' |
make_windows_releases-finish
0 → 100755
| 1 | +#!/bin/sh | ||
| 2 | +if [ ! -d external-libs ]; then | ||
| 3 | + echo "Please extract qpdf-external-libs-bin.zip and try again" | ||
| 4 | + exit 2 | ||
| 5 | +fi | ||
| 6 | + | ||
| 7 | +set -e | ||
| 8 | +set -x | ||
| 9 | +cwd=`pwd` | ||
| 10 | +PATH=$cwd/libqpdf/build:$PATH | ||
| 11 | + | ||
| 12 | +cd install-mingw32 | ||
| 13 | +v=`ls -d qpdf-*` | ||
| 14 | +cd .. | ||
| 15 | + | ||
| 16 | +for i in mingw32 mingw64 msvc32 msvc64; do | ||
| 17 | + cp -p README-windows-install.txt install-$i/$v/README.txt | ||
| 18 | + (cd install-$i; zip -r ../$v-bin-$i.zip $v) | ||
| 19 | +done | ||
| 20 | + | ||
| 21 | +set +x | ||
| 22 | + | ||
| 23 | +echo "" | ||
| 24 | +echo "$v-bin-mingw{32,64}.zip and $v-bin-msvc{32,64}.zip have been created." |
make_windows_releases-msvc
0 → 100755
| 1 | +#!/bin/sh | ||
| 2 | +if [ ! -d external-libs ]; then | ||
| 3 | + echo "Please extract qpdf-external-libs-bin.zip and try again" | ||
| 4 | + exit 2 | ||
| 5 | +fi | ||
| 6 | + | ||
| 7 | +w=$1 | ||
| 8 | + | ||
| 9 | +if [ "$w" = "" ]; then | ||
| 10 | + echo "Usage: $0 {32|64}" | ||
| 11 | + exit 2 | ||
| 12 | +fi | ||
| 13 | + | ||
| 14 | +set -e | ||
| 15 | +set -x | ||
| 16 | +cwd=`pwd` | ||
| 17 | +PATH=$cwd/libqpdf/build:$PATH | ||
| 18 | + | ||
| 19 | +./config-msvc $w | ||
| 20 | +make check install | ||
| 21 | +make distclean |