2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

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.
This commit is contained in:
Jay Berkenbilt 2012-06-21 14:06:54 -04:00
parent 85d9e7dfed
commit c833295a39
12 changed files with 104 additions and 31 deletions

View File

@ -20,6 +20,9 @@ CXX=@CXX@
CXXFLAGS=@CXXFLAGS@
AR=@AR@
RANLIB=@RANLIB@
DLLTOOL=@DLLTOOL@
STRIP=@STRIP@
OBJDUMP=@OBJDUMP@
GENDEPS=@GENDEPS@
LIBTOOL=@LIBTOOL@
DOCBOOKX_DTD=@DOCBOOKX_DTD@
@ -32,3 +35,4 @@ VALIDATE_DOC=@VALIDATE_DOC@
SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@
BUILDRULES=@BUILDRULES@
HAVE_LD_VERSION_SCRIPT=@HAVE_LD_VERSION_SCRIPT@
WINDOWS_WORDSIZE=@WINDOWS_WORDSIZE@

View File

@ -1,2 +1,2 @@
#!/bin/sh
./configure --disable-test-compare-images --enable-external-libs --with-buildrules=mingw
./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=32 --with-buildrules=mingw

10
config-mingw64 Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=64 --with-buildrules=mingw \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
LD=x86_64-w64-mingw32-ld \
AR=x86_64-w64-mingw32-ar \
RANLIB=x86_64-w64-mingw32-ranlib \
DLLTOOL=x86_64-w64-mingw32-dlltool \
STRIP=x86_64-w64-mingw32-strip \
OBJDUMP=x86_64-w64-mingw32-objdump

View File

@ -1,2 +1,11 @@
#!/bin/sh
CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --with-buildrules=msvc
wordsize=$1
if ! test "$wordsize" = "32" -o "$wordsize" = "64"; then
echo "Usage: $0 {32,64}"
exit 2
fi
objdump=
if test "$wordsize" = "64"; then
objdump=OBJDUMP=x86_64-w64-mingw32-objdump
fi
CC=cl CXX="cl -TP -GR" ./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=$wordsize --with-buildrules=msvc $objdump

View File

@ -31,6 +31,21 @@ else
AC_MSG_RESULT(yes)
fi
WINDOWS_WORDSIZE=
AC_SUBST(WINDOWS_WORDSIZE)
AC_ARG_WITH(windows-wordsize,
AS_HELP_STRING([--with-windows-wordsize={32,64}],
[Windows only: whether this is a 32-bit or 64-bit build; required if external-libs are enabled]),
[WINDOWS_WORDSIZE=$withval],
[WINDOWS_WORDSIZE=none])
if test "$USE_EXTERNAL_LIBS" = "1"; then
AC_MSG_CHECKING(for windows wordsize)
AC_MSG_RESULT($WINDOWS_WORDSIZE)
if ! test "$WINDOWS_WORDSIZE" = "32" -o "$WINDOWS_WORDSIZE" = "64"; then
AC_MSG_ERROR(Windows wordsize of 32 or 64 must be specified if external libs are being used.)
fi
fi
if test "$BUILD_INTERNAL_LIBS" = "0"; then
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1])
@ -378,7 +393,7 @@ if test "$USE_EXTERNAL_LIBS" = "1"; then
# the user can run this and then edit autoconf.mk if they have too
# much trouble getting it to work with a different compiler.
CPPFLAGS="$CPPFLAGS -Iexternal-libs/include"
LDFLAGS="$LDFLAGS -Lexternal-libs/lib-$BUILDRULES"
LDFLAGS="$LDFLAGS -Lexternal-libs/lib-$BUILDRULES$WINDOWS_WORDSIZE"
LIBS="$LIBS -lz -lpcre"
fi

View File

@ -7,19 +7,19 @@ use File::Basename;
my $whoami = basename($0);
usage() unless @ARGV == 2;
my ($file, $destdir) = @ARGV;
usage() unless @ARGV == 3;
my ($file, $destdir, $objdump) = @ARGV;
my $filedir = dirname($file);
my %dlls = ();
open(O, "objdump -p $file|") or die "$whoami: can't run objdump\n";
open(O, "$objdump -p $file|") or die "$whoami: can't run objdump\n";
while (<O>)
{
if (m/^\s+DLL Name:\s+(.+\.dll)/i)
{
my $dll = $1;
$dll =~ tr/A-Z/a-z/;
next if $dll =~ m/^(kernel32|msvcrt)\.dll$/;
next if $dll =~ m/^(kernel32|user32|msvcrt)\.dll$/;
$dlls{$dll} = 1;
}
}

View File

@ -10,7 +10,7 @@ installwin: all
mkdir $(DEST)/doc
cp libqpdf/$(OUTPUT_DIR)/$(STATIC_LIB_NAME) $(DEST)/lib
cp libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin
perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin
perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin $(OBJDUMP)
cp qpdf/$(OUTPUT_DIR)/qpdf.exe $(DEST)/bin
cp zlib-flate/$(OUTPUT_DIR)/zlib-flate.exe $(DEST)/bin
cp qpdf/fix-qdf $(DEST)/bin

View File

@ -62,7 +62,7 @@ endef
# 1 2 3 4 5 6 7
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
define makelib
dlltool -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(shell expr $(5) - $(7)).dll) $(1); \
$(DLLTOOL) -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(shell expr $(5) - $(7)).dll) $(1); \
$(CXX) -shared -o `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(shell expr $(5) - $(7)).dll \
$(1) $(3) $(4)
endef
@ -75,9 +75,9 @@ endef
# Install target
INSTALL_DIR = install-mingw
INSTALL_DIR = install-mingw$(WINDOWS_WORDSIZE)
STATIC_LIB_NAME = libqpdf.a
include make/installwin.mk
install: installwin
strip $(DEST)/bin/*.exe
strip $(DEST)/bin/*.dll
$(STRIP) $(DEST)/bin/*.exe
$(STRIP) $(DEST)/bin/*.dll

View File

@ -101,7 +101,7 @@ endef
# Install target
INSTALL_DIR = install-msvc
INSTALL_DIR = install-msvc$(WINDOWS_WORDSIZE)
STATIC_LIB_NAME = qpdf.lib
include make/installwin.mk
install: installwin

View File

@ -9,29 +9,19 @@ set -x
cwd=`pwd`
PATH=$cwd/libqpdf/build:$PATH
rm -rf install-mingw install-msvc
rm -rf install-mingw* install-msvc*
./config-mingw
./config-mingw64
make check install
make distclean
./config-msvc
./config-mingw32
make check install
make distclean
cd install-mingw
v=`ls -d qpdf-*`
cd ..
cp -p README-windows-install.txt install-mingw/$v/README.txt
cp -p README-windows-install.txt install-msvc/$v/README.txt
cd install-mingw
zip -r ../$v-bin-mingw.zip $v
cd ../install-msvc
zip -r ../$v-bin-msvc.zip $v
cd ..
set +x
echo ""
echo "$v-bin-mingw.zip and $v-bin-msvc.zip have been created."
echo ''
echo 'Now run "./make_windows_releases-msvc 64" in a 64-bit MSVC environment'
echo 'and "./make_windows_releases-msvc 32" in a 32-bit MSVC environment.'
echo 'Then run "./make_windows_releases-msvc-finish".'
echo ''

24
make_windows_releases-finish Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
if [ ! -d external-libs ]; then
echo "Please extract qpdf-external-libs-bin.zip and try again"
exit 2
fi
set -e
set -x
cwd=`pwd`
PATH=$cwd/libqpdf/build:$PATH
cd install-mingw32
v=`ls -d qpdf-*`
cd ..
for i in mingw32 mingw64 msvc32 msvc64; do
cp -p README-windows-install.txt install-$i/$v/README.txt
(cd install-$i; zip -r ../$v-bin-$i.zip $v)
done
set +x
echo ""
echo "$v-bin-mingw{32,64}.zip and $v-bin-msvc{32,64}.zip have been created."

21
make_windows_releases-msvc Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
if [ ! -d external-libs ]; then
echo "Please extract qpdf-external-libs-bin.zip and try again"
exit 2
fi
w=$1
if [ "$w" = "" ]; then
echo "Usage: $0 {32|64}"
exit 2
fi
set -e
set -x
cwd=`pwd`
PATH=$cwd/libqpdf/build:$PATH
./config-msvc $w
make check install
make distclean