From 14af45e9b9d01115610afe4b13559d49338f1670 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Sat, 12 Aug 2006 23:18:24 +0000 Subject: [PATCH] Reworked the MinGW32 build-dependencies script, it has been renamed to build-depkgs-mingw32. It now handles two options -h to display help and -C to reextract the source and apply the patches. The -C option is useful for updating the source after new patches are released. Moved the 3rd party package URLs to a separate file External-mingw32. This allows us to update to new versions without having to modify the script and makes it easier to figure out which packages and which versions are used. Added a new script build-depkgs-msvc.cmd which does the same thing as build-depkgs-mingw32 except they are built using Microsoft Visual C and placed in the depkgs-msvc directory. There is also an External-msvc file to describe the packages. Updated README.mingw32 with the updated instructions. Added a couple of missing files to the installer for PostgreSQL. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3282 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/win32/External-mingw32 | 35 ++ bacula/src/win32/External-msvc | 32 ++ bacula/src/win32/README.mingw32 | 25 +- ...uild-dependencies => build-depkgs-mingw32} | 165 +++++---- bacula/src/win32/build-depkgs-msvc.cmd | 320 ++++++++++++++++++ bacula/src/win32/installer/winbacula.nsi | 4 + bacula/src/win32/patches/mt.patch | 144 ++++---- bacula/src/win32/patches/mtx-msvc1.patch | 75 ++++ bacula/src/win32/patches/mtx-msvc2.patch | 40 +++ 9 files changed, 684 insertions(+), 156 deletions(-) create mode 100644 bacula/src/win32/External-mingw32 create mode 100644 bacula/src/win32/External-msvc rename bacula/src/win32/{build-dependencies => build-depkgs-mingw32} (70%) mode change 100755 => 100644 create mode 100644 bacula/src/win32/build-depkgs-msvc.cmd create mode 100644 bacula/src/win32/patches/mtx-msvc1.patch create mode 100644 bacula/src/win32/patches/mtx-msvc2.patch diff --git a/bacula/src/win32/External-mingw32 b/bacula/src/win32/External-mingw32 new file mode 100644 index 0000000000..555adcb0e5 --- /dev/null +++ b/bacula/src/win32/External-mingw32 @@ -0,0 +1,35 @@ +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +ZLIB|http://www.zlib.net/zlib-1.2.3.tar.gz +#ZLIB|http://superb-west.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz +PCRE|http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 +PTHREADS|ftp://sources.redhat.com/pub/pthreads-win32/pthreads-snap-2004-06-22.tar.gz +OPENSSL|http://www.openssl.org/source/openssl-0.9.8b.tar.gz +MYSQL|http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.22-win32.zip|mysql-5.0.22-win32 +POSTGRESQL|ftp://ftp2.us.postgresql.org/postgresql/source/v8.1.4/postgresql-base-8.1.4.tar.bz2|postgresql-8.1.4 +SQLITE|http://www.sqlite.org/sqlite-3.3.6.tar.gz +WX|http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.6.3.tar.gz +SCONS|http://superb-west.dl.sourceforge.net/sourceforge/scons/scons-0.96.92.tar.gz +NSIS_BIN|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip +NSIS_SRC|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17-src.tar.bz2 +MTX|http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz +MT|ftp://ftp.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz diff --git a/bacula/src/win32/External-msvc b/bacula/src/win32/External-msvc new file mode 100644 index 0000000000..5a10b3daba --- /dev/null +++ b/bacula/src/win32/External-msvc @@ -0,0 +1,32 @@ +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +ZLIB|http://www.zlib.net/zlib123.zip|zlib123|true +PCRE|http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 +PTHREADS|ftp://sources.redhat.com/pub/pthreads-win32/pthreads-2004-06-22x.exe|pthreads-2004-06-22x|true +OPENSSL|http://www.openssl.org/source/openssl-0.9.8b.tar.gz +MYSQL|http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.22-win32.zip|mysql-5.0.22-win32 +POSTGRESQL|ftp://ftp2.us.postgresql.org/postgresql/binary/v8.1.4/win32/postgresql-8.1.4-1-binaries-no-installer.zip|pgsql +POSTGRESQL_SRC|ftp://ftp4.us.postgresql.org/pub/postgresql/source/v8.1.4/postgresql-8.1.4.tar.bz2 +WX|http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.7.0.zip +NSIS_BIN|http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip +MTX|http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz +MT|ftp://ftp.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz diff --git a/bacula/src/win32/README.mingw32 b/bacula/src/win32/README.mingw32 index 1c33ad4266..f444e4b7e6 100644 --- a/bacula/src/win32/README.mingw32 +++ b/bacula/src/win32/README.mingw32 @@ -1,5 +1,6 @@ This file documents building Bacula for Microsoft Windows using the -cross-compiler tools on a Linux (or possibly another Unix) system. +cross-compiler tools on a Linux or FreeBSD system (other Unix systems +remain to be tested). The basic directory structure you need to have is: @@ -8,12 +9,12 @@ The basic directory structure you need to have is: src win32 main directory where the Windows version is built. - dekpgs-mingw32 3rd Party Dependencies + depkgs-mingw32 3rd Party Dependencies bin -- include | lib | man | Created by script - nsis |-- ..../bacula/src/win32/build-dependencies + nsis |-- ..../bacula/src/win32/build-depkgs-mingw32 scons | share | src | @@ -21,7 +22,7 @@ The basic directory structure you need to have is: vss inc A copy of the Windows VSS/inc directory - cross-tools Cross compilation tools (gcc, g++, mingw, ...) + cross-tools Cross compilation tools (gcc, g++, mingw32, ...) binutils-mingw32 -- gcc-mingw32 | Created by script mingw32 |-- ..../bacula/src/win32/build-win32-cross-tools @@ -41,7 +42,7 @@ Download and build the cross compiler tools ./build-win32-cross-tools Download and build the 3rd party dependencies - ./build-dependencies + ./build-depkgs-mingw32 You need the header files from the Microsoft VSS SDK. Unfortunately the SDK can only be downloaded and installed on a Windows system. You can find it on @@ -57,7 +58,7 @@ Normally the files will be installed in: c:/Program Files/Microsoft/VSSSDK72 -You only need to copy everything under the c:/Program Files/VSSSDK72/inc +You only need to copy everything under the c:/Program Files/Microsoft/VSSSDK72/inc directory into ..../depkgs-mingw32/vss/inc. The above only needs to be done once unless we change the cross-tools @@ -120,15 +121,15 @@ need to update the cross-tools or dependencies for it to build. You can install new patches by doing the following (we assume the patch in question is for openssl): - cd - # delete openssl - rm -rf depkgs-mingw32/src/openssl-0.9.8b cd /src/win32 - # Call script to reload/rebuild openssl - ./build-dependencies openssl + ./build-depkgs-mingw32 -C openssl +NOTE: The -C means clobber. Any local changes to the source code in +the depkgs-mingw32/src directory will be lost. The source will be +reextracted from the archive and the current patches will be applied. -Structure of the new Win32 build environment: +Structure of the new Win32 build environment +============================================ The basic strategy is each Makefile in the various subdirectories includes Makefile.inc, defines variables and rules specific to what is being built, diff --git a/bacula/src/win32/build-dependencies b/bacula/src/win32/build-depkgs-mingw32 old mode 100755 new mode 100644 similarity index 70% rename from bacula/src/win32/build-dependencies rename to bacula/src/win32/build-depkgs-mingw32 index 8fe7debb51..6d0e5922e6 --- a/bacula/src/win32/build-dependencies +++ b/bacula/src/win32/build-depkgs-mingw32 @@ -1,35 +1,30 @@ #!/bin/sh -VERBOSE=n -OVERWRITE=n +usage() +{ + echo "usage: $0 [-h] [-C] [] [] ..." + echo " -h Displays this usage" + echo " -C Clobbers (overwrites) the source code by " + echo " reextracting the archive and reapplying the" + echo " patches." + echo "" + echo " Optional dependency, If none are given then all" + echo " of them will be built." + echo "" + echo "Valid dependencies are:" + grep -v '^#' < External-mingw32 | cut -d'|' -f1 | cut -d'_' -f1 | tr A-Z a-z | sort -u | awk '{ print " " $1 }' +} -URL_ZLIB=http://www.zlib.net/zlib-1.2.3.tar.gz -#URL_ZLIB=http://superb-west.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz -DIR_ZLIB= -URL_PCRE=http://superb-west.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.bz2 -DIR_PCRE= -URL_PTHREADS=ftp://sources.redhat.com/pub/pthreads-win32/pthreads-snap-2004-06-22.tar.gz -DIR_PTHREADS= -URL_OPENSSL=http://www.openssl.org/source/openssl-0.9.8b.tar.gz -DIR_OPENSSL= -URL_MYSQL=http://mirror.x10.com/mirror/mysql/Downloads/MySQL-5.0/mysql-noinstall-5.0.22-win32.zip -DIR_MYSQL=mysql-5.0.22-win32 -URL_POSTGRESQL=ftp://ftp2.us.postgresql.org/postgresql/source/v8.1.4/postgresql-base-8.1.4.tar.bz2 -DIR_POSTGRESQL=postgresql-8.1.4 -URL_SQLITE=http://www.sqlite.org/sqlite-3.3.6.tar.gz -DIR_SQLITE= -URL_WX=http://superb-west.dl.sourceforge.net/sourceforge/wxwindows/wxWidgets-2.6.3.tar.gz -DIR_WX= -URL_SCONS=http://superb-west.dl.sourceforge.net/sourceforge/scons/scons-0.96.92.tar.gz -DIR_SCONS= -URL_NSIS_BIN=http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17.zip -DIR_NSIS_BIN= -URL_NSIS_SRC=http://superb-west.dl.sourceforge.net/sourceforge/nsis/nsis-2.17-src.tar.bz2 -DIR_NSIS_SRC= -URL_MTX=http://superb-west.dl.sourceforge.net/sourceforge/mtx/mtx-1.3.9.tar.gz -DIR_MTX= -URL_MT=ftp://ftp.ibiblio.org/pub/linux/system/backup/mt-st-0.9b.tar.gz -DIR_MT= +CLOBBER_SOURCE= + +while getopts "hHC" opt; do + case ${opt} in + H|h|\?) usage;exit 1;; + C) CLOBBER_SOURCE=true;; + esac +done + +[ ${OPTIND} -gt 1 ] && shift `expr ${OPTIND} - 1` cwd=`pwd` cd `dirname $0` @@ -54,19 +49,6 @@ fi [ ! -e ${TOP_DIR}/depkgs-mingw32 ] && mkdir ${TOP_DIR}/depkgs-mingw32 cd ${TOP_DIR}/depkgs-mingw32 DEPPKG_DIR=`pwd` -cd ${DEPPKG_DIR} - -case "${VERBOSE}" in -y*|t*) VERBOSE=true ;; -n*|f*) VERBOSE=false ;; -*) VERBOSE=false ;; -esac - -case ${OVERWRITE} in -y*|t*) OVERWRITE=true ;; -n*|f*) OVERWRITE=false ;; -*) OVERWRITE=true ;; -esac export PATH=${BIN_DIR}:${PATH} @@ -75,10 +57,20 @@ export PATH=${BIN_DIR}:${PATH} [ ! -e include ] && mkdir include [ ! -e lib ] && mkdir lib +OLD_IFS=${IFS};IFS="|"; +while read package url dir mkd; do + case ${package} in + \#*) ;; + *) eval "URL_${package}=${url};DIR_${package}=${dir};MKD_${package}=${mkd}";; + esac +done < ${SCRIPT_DIR}/External-mingw32 +IFS=${OLD_IFS};unset OLD_IFS + get_source() { URL=$1 SRC_DIR=$2 + MAKE_DIR=$3 ARCHIVE=`basename ${URL}` case ${ARCHIVE} in @@ -102,11 +94,12 @@ get_source() fi fi - if [ ! -e "${SRC_DIR}" -o "${OVERWRITE}" = "true" ] + if [ ! -e "${SRC_DIR}" -o "${CLOBBER_SOURCE}" = "true" ] then rm -rf ${SRC_DIR} + [ "${MAKE_DIR}" = "true" ] && mkdir ${SRC_DIR} && cd ${SRC_DIR} echo Extracting ${ARCHIVE} - ${ARCHIVER} ${ARCHIVE} 2>&1 > ${ARCHIVE}.log + ${ARCHIVER} ${ARCHIVE} &> ${ARCHIVE}.log cd ${SRC_DIR} return 0 fi @@ -117,10 +110,6 @@ get_source() parse_output() { - if [ "${VERBOSE}" = "true" ] - then - cat - else sed -ne '/\\$/N' -e 's/\\\n//' -e 's/\t\+/ /g' -e 's/ \+/ /g' \ -e '/ error: /p' \ -e "s%.*Entering directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+\).%Entering \\1%p" \ @@ -131,7 +120,6 @@ parse_output() -e 's/.* \([^ ]\+\.s\)\( .*\|\)$/Assembling \1/p' \ -e 's/.*ar [^ ]\+ \([^ ]\+\)\(\( [^ ]\+\.o\)\+\)/Updating \1 -\2/p' \ -e 's/.* -o \([^ ]\+\)\( .*\|\)$/Linking \1/p' - fi } do_patch() @@ -160,7 +148,7 @@ do_make() process_zlib() { - if get_source "${URL_ZLIB}" "${DIR_ZLIB}" + if get_source "${URL_ZLIB}" "${DIR_ZLIB}" "${MKD_ZLIB}" then echo Patching zlib >patch.log @@ -175,14 +163,19 @@ process_zlib() process_pcre() { - if get_source "${URL_PCRE}" "${DIR_PCRE}" + if get_source "${URL_PCRE}" "${DIR_PCRE}" "${MKD_PCRE}" then echo Patching PCRE >patch.log do_patch pcre.patch + echo Configuring PCRE + ./configure CC_FOR_BUILD=gcc \ + CXX_FOR_BUILD=g++ \ + --host=mingw32 \ + --prefix=${DEPPKG_DIR} \ + --enable-utf8 \ + --enable-unicode-properties &>make.log fi - echo Configuring PCRE - ./configure CC_FOR_BUILD=gcc CXX_FOR_BUILD=g++ --host=mingw32 --prefix=${DEPPKG_DIR} --enable-utf8 --enable-unicode-properties 2>&1 >make.log echo Building PCRE do_make Makefile PREFIX=${DEPPKG_DIR} all echo Installing PCRE @@ -191,7 +184,7 @@ process_pcre() process_pthreads() { - if get_source "${URL_PTHREADS}" "${DIR_PTHREADS}" + if get_source "${URL_PTHREADS}" "${DIR_PTHREADS}" "${MKD_PTHREADS}" then echo Patching pthreads >patch.log @@ -210,14 +203,18 @@ process_pthreads() process_openssl() { - if get_source "${URL_OPENSSL}" "${DIR_OPENSSL}" + if get_source "${URL_OPENSSL}" "${DIR_OPENSSL}" "${MKD_OPENSSL}" then echo Patching openssl >patch.log do_patch openssl.patch + echo Configuring openssl + ./Configure --prefix=${DEPPKG_DIR} \ + shared zlib-dynamic \ + threads \ + --with-zlib-include=${DEPPKG_DIR}/include \ + mingw32 &> make.log fi - echo Configuring openssl - ./Configure --prefix=${DEPPKG_DIR} shared zlib-dynamic threads --with-zlib-include=${DEPPKG_DIR}/include mingw32 2>&1 > make.log echo Building openssl perl util/mkdef.pl 32 libeay no-static-engine >ms/libeay32.def perl util/mkdef.pl 32 ssleay >ms/ssleay32.def @@ -228,7 +225,7 @@ process_openssl() process_mysql() { - get_source "${URL_MYSQL}" "${DIR_MYSQL}" + get_source "${URL_MYSQL}" "${DIR_MYSQL}" "${DIR_MYSQL}" "${MKD_MYSQL}" echo Converting mysql lib file if [ -e ${BIN_DIR}/reimp ] then @@ -244,16 +241,21 @@ process_mysql() cp -p lib/opt/libmysql.dll ../../bin } -process_postgreSQL() +process_postgresql() { - if get_source "${URL_POSTGRESQL}" "${DIR_POSTGRESQL}" + if get_source "${URL_POSTGRESQL}" "${DIR_POSTGRESQL}" "${MKD_POSTGRESQL}" then echo Patching postgreSQL >patch.log do_patch postgresql.patch + echo Configuring postgreSQL + ./configure --host=mingw32 \ + --enable-shared \ + --enable-thread-safety \ + --prefix=${DEPPKG_DIR} \ + --with-includes=${DEPPKG_DIR}/include:${DEPPKG_DIR}/include/pthreads \ + --with-libraries=${DEPPKG_DIR}/lib &> make.log fi - echo Configuring postgreSQL - ./configure --host=mingw32 --enable-shared --enable-thread-safety --prefix=${DEPPKG_DIR} --with-includes=${DEPPKG_DIR}/include:${DEPPKG_DIR}/include/pthreads --with-libraries=${DEPPKG_DIR}/lib 2>&1 > make.log echo Building postgreSQL if [ -e /usr/sbin/zic ]; then ZIC=/usr/sbin/zic elif [ -e /sbin/zic ]; then ZIC=/sbin/zic @@ -261,34 +263,33 @@ process_postgreSQL() elif [ -e /bin/zic ]; then ZIC=/bin/zic else ZIC=./zic fi - do_make Makefile AR=mingw32-ar DLLTOOL=mingw32-dlltool DLLWRAP=mingw32-dllwrap WINDRES=mingw32-windres PTHREAD_LIBS=-lpthreadGCE ZIC=${ZIC} clean all + do_make Makefile AR=mingw32-ar DLLTOOL=mingw32-dlltool DLLWRAP=mingw32-dllwrap WINDRES=mingw32-windres PTHREAD_LIBS=-lpthreadGCE ZIC=${ZIC} echo Installing postgreSQL do_make Makefile AR=mingw32-ar DLLTOOL=mingw32-dlltool DLLWRAP=mingw32-dllwrap WINDRES=mingw32-windres PTHREAD_LIBS=-lpthreadGCE ZIC=${ZIC} install } process_sqlite() { - if get_source "${URL_SQLITE}" "${DIR_SQLITE}" + if get_source "${URL_SQLITE}" "${DIR_SQLITE}" "${MKD_SQLITE}" then echo Patching SQLite >patch.log do_patch sqlite.patch fi - echo Configuring SQLite + echo Building SQLite [ ! -e bld ] && mkdir bld cd bld - echo Building SQLite > make.log - do_make ../Makefile.mingw32 CROSSTOOLS=${BIN_DIR} TLIBS="-L${DEPPKG_DIR}/lib" TCL_FLAGS="-I${DEPPKG_DIR}/include" clean all + do_make ../Makefile.mingw32 CROSSTOOLS=${BIN_DIR} TLIBS="-L${DEPPKG_DIR}/lib" TCL_FLAGS="-I${DEPPKG_DIR}/include" echo Installing SQLite cp -p sqlite3.exe ${DEPPKG_DIR}/bin cp -p libsqlite3.a ${DEPPKG_DIR}/lib cp -p sqlite3.h ${DEPPKG_DIR}/include } -process_wxWidgets() +process_wx() { - if get_source "${URL_WX}" "${DIR_WX}" + if get_source "${URL_WX}" "${DIR_WX}" "${MKD_WX}" then echo Patching wxWidgets >patch.log @@ -323,9 +324,9 @@ process_wxWidgets() process_scons() { - get_source "${URL_SCONS}" "${DIR_SCONS}" + get_source "${URL_SCONS}" "${DIR_SCONS}" "${MKD_SCONS}" echo Installing scons - if python setup.py install --prefix=${DEPPKG_DIR}/scons 2>&1 > make.log + if python setup.py install --prefix=${DEPPKG_DIR}/scons &> make.log then : else @@ -336,29 +337,21 @@ process_scons() process_nsis() { - get_source "${URL_NSIS_BIN}" "${DIR_NSIS_BIN}" + get_source "${URL_NSIS_BIN}" "${DIR_NSIS_BIN}" "${MKD_NSIS_BIN}" cd .. rm -rf ../nsis mv nsis-2.17 ../nsis - if get_source "${URL_NSIS_SRC}" "${DIR_NSIS_SRC}" + if get_source "${URL_NSIS_SRC}" "${DIR_NSIS_SRC}" "${MKD_NSIS_SRC}" then echo Patching nsis >patch.log do_patch nsis.patch fi - if [ "`uname -s`" = "FreeBSD" ] - then - ICONV_VARS="CPPPATH=/usr/local/include LIBPATH=/usr/local/lib" - else - ICONV_VARS= - fi echo Building nsis if ../../scons/bin/scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all \ PREFIX=${DEPPKG_DIR}/nsis PREFIX_BIN=${DEPPKG_DIR}/nsis/Bin \ PREFIX_CONF=${DEPPKG_DIR}/nsis PREFIX_DATA=${DEPPKG_DIR}/nsis \ - PREFIX_DOC=${DEPPKG_DIR}/nsis/Docs \ - ${ICONV_VARS} \ - 2>&1 | tee make.log | parse_output + PREFIX_DOC=${DEPPKG_DIR}/nsis/Docs 2>&1 | tee make.log | parse_output then : else @@ -371,7 +364,7 @@ process_nsis() process_mtx() { - if get_source "${URL_MTX}" "${DIR_MTX}" + if get_source "${URL_MTX}" "${DIR_MTX}" "${MKD_MTX}" then echo Patching mtx # We can't run configure in a cross-compile environment so we @@ -390,7 +383,7 @@ process_mtx() process_mt() { - if get_source "${URL_MT}" "${DIR_MT}" + if get_source "${URL_MT}" "${DIR_MT}" "${MKD_MT}" then echo Patching mt >patch.log @@ -410,8 +403,8 @@ then process_openssl process_mysql process_sqlite - process_postgreSQL - process_wxWidgets + process_postgresql + process_wx process_scons process_nsis process_mtx diff --git a/bacula/src/win32/build-depkgs-msvc.cmd b/bacula/src/win32/build-depkgs-msvc.cmd new file mode 100644 index 0000000000..3953036c48 --- /dev/null +++ b/bacula/src/win32/build-depkgs-msvc.cmd @@ -0,0 +1,320 @@ +@echo off +SETLOCAL + +SET CLOBBER_SOURCE= + +FOR /F "eol=# delims=| tokens=1-4" %%I in ( External-msvc ) DO SET URL_%%I=%%J & SET DIR_%%I=%%K & SET MKD_%%I=%%L + +SET CWD=%CD% +FOR %%I IN ( %0 ) DO CD %%~dpI +SET SCRIPT_DIR=%CD% + +CD ..\..\.. +set TOP_DIR=%CD% + +cd %TOP_DIR%/depkgs-win32 +set DEPPKG_DIR=%CD% + +cd %DEPPKG_DIR% + +IF /I "%CLOBBER_SOURCE:~0,1%"=="y" SET CLOBBER_SOURCE=true +IF /I "%CLOBBER_SOURCE:~0,1%"=="t" SET CLOBBER_SOURCE=true +IF /I "%CLOBBER_SOURCE:~0,1%"=="1" SET CLOBBER_SOURCE=true + +SET PATH=%DEPPKG_DIR%\tools;%PATH% +SET INCLUDE=%INCLUDE%;%DEPPKG_DIR%\include +SET LIB=%LIB%;%DEPPKG_DIR%\lib + +IF NOT EXIST bin\nul MKDIR bin +IF NOT EXIST src\nul MKDIR src +IF NOT EXIST include\nul MKDIR include +IF NOT EXIST lib\nul MKDIR lib + +CD src + +COPY NUL parse_output.sed +REM ECHO /\\$/N >>parse_output.sed +REM ECHO s/\\\n// >>parse_output.sed +ECHO s/\t\+/ /g >>parse_output.sed +ECHO s/ \+/ /g >>parse_output.sed +ECHO / [Ee]rror: /p >>parse_output.sed +REM ECHO s;.*Entering directory[ ]\+.%DEPPKG_DIR%/\([^^ ]\+\).;Entering \1;p >>parse_output.sed +REM ECHO s;.*Leaving directory[ ]\+.%DEPPKG_DIR%/\([^^ ]\+.\).;Leaving \1;p >>parse_output.sed +ECHO /[Cc][Ll] \^|[Ll][Ii][Nn][Kk] \^|[Ll][Ii][Bb] /!d >>parse_output.sed +ECHO s; \(\.\.\\\)\+; ;g >>parse_output.sed +ECHO s; \.\\; ;g >>parse_output.sed +ECHO s/.* \([^^ ]\+\(\.[Cc]\^|\.[Cc][Pp][Pp]\^|\.[Cc][Cc]\^|\.[Cc][Xx][Xx]\)\)\( .*\^|\)$/Compiling \1/p >>parse_output.sed +ECHO s/.* \([^^ ]\+\.[Aa][Ss][Mm]\)\( .*\^|\)$/Assembling \1/p >>parse_output.sed +ECHO s/.* \/[Oo][Uu][Tt]:\(\.\\\)*\(\.\.\\\)*\([^^ ]\+\)\( .*\^|\)$/Linking \3/p >>parse_output.sed +REM ECHO s/.*[Ll][Ii][Bb] [^^ ]\+ \([^^ ]\+\)\(\( [^^ ]\+\.o\)\+\)/Updating \1 -\2/p >>parse_output.sed + +IF NOT "%1"=="" GOTO :ProcessArgs + CALL :process_zlib +REM CALL :process_pcre + CALL :process_pthreads + CALL :process_openssl + CALL :process_mysql +REM CALL :process_sqlite + CALL :process_postgreSQL + CALL :process_wxWidgets +REM CALL :process_scons + CALL :process_nsis + CALL :process_mtx + CALL :process_mt + GOTO :EOF + +:ProcessArgs + IF "%1"=="" GOTO :EOF + + CALL :process_%1 + SHIFT + GOTO :ProcessArgs + +:get_source + SET URL=%1 + SET SRC_DIR=%2 + SET MAKE_SRC_ENABLE=%3 + SET BASENAME= + + IF NOT %2=="" GOTO :get_source_make_src + FOR %%I IN ( %URL% ) DO (SET BASENAME=%%~nI & IF NOT "%%~xI"==".gz" IF NOT "%%~xI"==".bz2" SET SRC_DIR=%%~nI) + IF %SRC_DIR%=="" FOR %%I IN ( %BASENAME% ) DO SET SRC_DIR=%%~nI + +:get_source_make_src + SET MAKE_SRC_DIR= + IF /I "%MAKE_SRC_ENABLE:~0,1%"=="y" SET MAKE_SRC_DIR=true + IF /I "%MAKE_SRC_ENABLE:~0,1%"=="t" SET MAKE_SRC_DIR=true + IF /I "%MAKE_SRC_ENABLE:~0,1%"=="1" SET MAKE_SRC_DIR=true + + FOR %%I IN ( %URL% ) DO SET ARCHIVE=%%~nxI + + CD %DEPPKG_DIR%\src + + IF EXIST %ARCHIVE% GOTO :get_source_check_srcdir + ECHO Downloading %URL% + wget -nv --passive-ftp "%URL%" + IF NOT ERRORLEVEL 1 GOTO :get_source_extract + ECHO Unable to download %ARCHIVE% + EXIT /B 2 + +:get_source_check_srcdir + IF NOT EXIST %SRC_DIR%\nul GOTO :get_source_extract + IF NOT "%CLOBBER_SOURCE%"=="true" GOTO :get_source_skipped + IF EXIST "%SRC_DIR%\nul" RD /s /q "%SRC_DIR%" +:get_source_extract + SET TAR_ARCHIVE= + FOR %%I IN ( "%ARCHIVE%" ) do IF "%%~xI"==".gz" SET TAR_ARCHIVE=%%~nI + FOR %%I IN ( "%ARCHIVE%" ) do IF "%%~xI"==".bz2" SET TAR_ARCHIVE=%%~nI + + SET TARGET_DIR=. + IF DEFINED MAKE_SRC_DIR IF NOT EXIST "%SRC_DIR%\nul" MKDIR %SRC_DIR% + IF DEFINED MAKE_SRC_DIR SET TARGET_DIR=%SRC_DIR% + + ECHO Extracting %ARCHIVE% + 7z x -bd -y -o"%TARGET_DIR%" "%ARCHIVE%" 2>&1 > "%ARCHIVE%.log" + IF ERRORLEVEL 1 EXIT /B 2 + IF NOT DEFINED TAR_ARCHIVE GOTO :get_source_done + ECHO Extracting %TAR_ARCHIVE% + 7z x -bd -y -o"%TARGET_DIR%" "%TARGET_DIR%\%TAR_ARCHIVE%" & del /q "%TAR_ARCHIVE%" 2>&1 >> "%ARCHIVE%.log" + +:get_source_done + CD "%SRC_DIR%" + EXIT /B 0 + +:get_source_skipped + CD %SRC_DIR% + EXIT /B 1 + +:process_zlib + CALL :get_source %URL_ZLIB% %DIR_ZLIB% %MKD_ZLIB% + ECHO Building zlib + COPY /Y nul make.log +REM XCOPY contrib\masmx86\gvmat32.asm . /Y +REM XCOPY contrib\masmx86\gvmat32c.c . /Y +REM XCOPY contrib\masmx86\inffas32.asm . /Y +REM CALL :do_nmake win32\Makefile.msc AS=nasmw ASFLAGS= LOC="-D_CRT_SECURE_NO_DEPRECATE -DASMV -DASMINF" OBJA="gvmat32c.obj gvmat32.obj inffas32.obj" all + CALL :do_nmake win32\Makefile.msc LOC="-D_CRT_SECURE_NO_DEPRECATE" all + ECHO Installing zlib + XCOPY zlib1.dll.manifest %DEPPKG_DIR%\bin\ /Y + XCOPY zlib1.dll %DEPPKG_DIR%\bin\ /Y + XCOPY zlib.lib %DEPPKG_DIR%\lib\ /Y + XCOPY zdll.lib %DEPPKG_DIR%\lib\ /Y + XCOPY zlib.h %DEPPKG_DIR%\include\ /Y + EXIT /B 0 + +:process_pcre + CALL :get_source %URL_PCRE% %DIR_PCRE% %MKD_PCRE% +REM ECHO Patching PCRE +REM COPY /Y nul patch.log +REM do_patch pcre.patch + ECHO Configuring PCRE + ./configure CC_FOR_BUILD=gcc CXX_FOR_BUILD=g++ --host=mingw32 --prefix=%DEPPKG_DIR% --enable-utf8 --enable-unicode-properties 2>&1 > make.log + ECHO Building PCRE + do_make Makefile PREFIX=%DEPPKG_DIR% all + ECHO Installing PCRE + do_make Makefile PREFIX=%DEPPKG_DIR% install + EXIT /B 0 + +:process_pthreads + CALL :get_source %URL_PTHREADS% %DIR_PTHREADS% %MKD_PTHREADS% + ECHO Installing pthreads + XCOPY Pre-built\include\*.h %DEPPKG_DIR%\include\ /Y + XCOPY Pre-built\lib\pthreadVCE.lib %DEPPKG_DIR%\lib\ /Y + XCOPY Pre-built\lib\pthreadVCE.dll %DEPPKG_DIR%\bin\ /Y + EXIT /B 0 + +:process_openssl + CALL :get_source %URL_OPENSSL% %DIR_OPENSSL% %MKD_OPENSSL% + IF ERRORLEVEL 2 GOTO :OpenSSLError + ECHO Configuring openssl + perl Configure VC-WIN32 --prefix=%DEPPKG_DIR:\=/% > make.log + ECHO Building openssl + CALL ms\do_nasm + @ECHO off + CALL :do_nmake ms\ntdll.mak + @ECHO off + ECHO Installing openssl + CALL :do_nmake ms\ntdll.mak install + EXIT /B 0 +:OpenSSLError + ECHO Unable to download OpenSSL source from %URL_OPENSSL% + EXIT /B 1 + +:process_mysql + CALL :get_source %URL_MYSQL% %DIR_MYSQL% %MKD_MYSQL% + ECHO Installing mysql + IF EXIST ..\..\include\mysql\nul RD /s /q ..\..\include\mysql + XCOPY include\* ..\..\include\mysql\ /e/h/k/y 2>&1 + XCOPY lib\opt\libmysql.lib ..\..\lib\ /y + XCOPY lib\opt\libmysql.dll ..\..\bin\ /y + EXIT /B 0 + +:process_postgreSQL + CALL :get_source %URL_POSTGRESQL% %DIR_POSTGRESQL% %MKD_POSTGRESQL% + IF ERRORLEVEL 2 GOTO :pstgreSQL_Error1 + CALL :get_source %URL_POSTGRESQL_SRC% %DIR_POSTGRESQL_SRC% %MKD_POSTGRESQL_SRC% + IF ERRORLEVEL 2 GOTO :pstgreSQL_Error2 +REM ECHO Patching postgreSQL +REM COPY /Y nul patch.log +REM do_patch postgresql.patch + ECHO Installing postgreSQL + XCOPY ..\pgsql\include\libpq-fe.h ..\..\include\ /Y 2>&1 + dlltool -l ..\..\lib\libpgsql.lib -D libpgsql.dll -d src/interfaces/libpq/libpqdll.def + XCOPY ..\pgsql\lib\libpq.dll ..\..\bin\ /Y + XCOPY ..\pgsql\lib\libintl-2.dll ..\..\bin\ /Y + XCOPY ..\pgsql\lib\libiconv-2.dll ..\..\bin\ /Y + EXIT /B 0 +:pstgreSQL_Error1 + ECHO Unable to download postgreSQL binaries from %URL_POSTGRESQL% + EXIT /B 1 +:pstgreSQL_Error2 + ECHO Unable to download postgreSQL source from %URL_POSTGRESQL_SRC% + EXIT /B 1 + +:process_sqlite + CALL :get_source %URL_SQLITE% %DIR_SQLITE% %MKD_SQLITE% + CALL :get_source %URL_SQLITE_WINSRC% %DIR_SQLITE_WINSRC% %MKD_SQLITE_WINSRC% +REM ECHO Patching SQLite +REM COPY /Y nul patch.log +REM do_patch sqlite.patch + ECHO Configuring SQLite + IF NOT EXIST bld/nul MKDIR bld + CD bld + ECHO Building SQLite + COPY /Y nul make.log + do_make ../Makefile.mingw32 CROSSTOOLS=%BIN_DIR% TLIBS="-L%DEPPKG_DIR%/lib" TCL_FLAGS="-I%DEPPKG_DIR%/include" clean all + ECHO Installing SQLite + cp -p sqlite3.exe %DEPPKG_DIR%/bin + cp -p libsqlite3.a %DEPPKG_DIR%/lib + cp -p sqlite3.h %DEPPKG_DIR%/include + EXIT /B 0 + +:process_wxWidgets + CALL :get_source %URL_WX% %DIR_WX% %MKD_WX% + IF ERRORLEVEL 2 GOTO :wxWidgets_error +REM IF ERRORLEVEL 1 GOTO :wxWidgets_skip_patch +REM ECHO Patching wxWidgets +REM COPY /Y nul patch.log +REM do_patch wx1.patch -o build/msw/config.mingw32 +REM do_patch wx2.patch +REM find . -name makefile.gcc -exec sh -c "sed -f %SCRIPT_DIR%/patches/wx.sed {% > \`ECHO {% | sed s/\.gcc$/\.mingw32/\`" \; + ECHO Building wxWidgets + cd build\msw + COPY /Y nul make.log + CALL :do_nmake makefile.vc BUILD=release SHARED=1 VENDOR=bacula DEBUG_INFO=1 + ECHO Installing wxWidgets + cd ..\.. + IF EXIST ..\..\include\wx\nul RD /s /q ..\..\include\wx + XCOPY include\wx ..\..\include\wx\ 2>&1 + XCOPY include\wx\generic ..\..\include\wx\generic\ 2>&1 + XCOPY include\wx\msw ..\..\include\wx\msw\ 2>&1 + XCOPY lib\vc_dll\*.dll ..\..\bin\ /y + IF EXIST ..\..\lib\wx_dll\nul RD /s /q ..\..\lib\wx_dll + XCOPY lib\vc_dll\*.lib ..\..\lib\wx_dll\ + XCOPY lib\vc_dll\msw ..\..\lib\wx_dll\msw\ /e 2>&1 + EXIT /B 0 +:wxWidgets_error + ECHO Unable to download wxWidgets source from %URL_MTX% + EXIT /B 1 + +:process_nsis + CALL :get_source %URL_NSIS_BIN% %DIR_NSIS_BIN% %MKD_NSIS_BIN% + CD .. + IF EXIST ..\nsis\nul RD /s /q ..\nsis + MOVE nsis-2.17 ..\nsis + EXIT /B 0 + +:process_mtx + CALL :get_source %URL_MTX% %DIR_MTX% %MKD_MTX% + IF ERRORLEVEL 2 GOTO :mtx_error + IF ERRORLEVEL 1 GOTO :mtx_skip_patch + ECHO Patching mtx + COPY /Y config.h.in config.h + COPY /Y Makefile.in Makefile + COPY /Y nul patch.log + CALL :do_patch mtx.patch + CALL :do_patch mtx-msvc1.patch + CALL :do_patch mtx-msvc2.patch +:mtx_skip_patch + ECHO Building mtx + CALL :do_nmake Makefile.msc PREFIX=%DEPPKG_DIR% all + ECHO Installing mtx + CALL :do_nmake Makefile.msc PREFIX=%DEPPKG_DIR% install + EXIT /B 0 +:mtx_error + ECHO Unable to download mtx source from %URL_MTX% + EXIT /B 1 + +:process_mt + CALL :get_source %URL_MT% %DIR_MT% %MKD_MT% + IF ERRORLEVEL 2 GOTO :mt_error + IF ERRORLEVEL 1 GOTO :mt_skip_patch + ECHO Patching mt + COPY /Y nul patch.log + CALL :do_patch mt.patch +:mt_skip_patch + ECHO Building mt + CALL :do_nmake Makefile.msc PREFIX=%DEPPKG_DIR% all + ECHO Installing mt + CALL :do_nmake Makefile.msc PREFIX=%DEPPKG_DIR% install + EXIT /B 0 +:mt_error + ECHO Unable to download mt source from %URL_MT% + EXIT /B 1 + +:do_patch + SET PATCH_FILE=%SCRIPT_DIR%\patches\%1 + SHIFT + patch -f -p0 %2 %3 %4 %5 %6 %7 %8 %9 >>patch.log < %PATCH_FILE% + IF NOT ERRORLEVEL 1 EXIT/B 0 + ECHO Patch failed - Check %CD%\patch.log > con + EXIT /B 1 + +:do_nmake + nmake /nologo -f %* 2>&1 | tee -a make.log | sed -nf "%DEPPKG_DIR%\src\parse_output.sed" + IF NOT ERRORLEVEL 1 EXIT/B 0 + ECHO Make failed - Check %CD%\make.log > con + EXIT /B 1 + +#vss +#Need to download from Microsoft diff --git a/bacula/src/win32/installer/winbacula.nsi b/bacula/src/win32/installer/winbacula.nsi index 3f00363b49..1dd755cb8b 100644 --- a/bacula/src/win32/installer/winbacula.nsi +++ b/bacula/src/win32/installer/winbacula.nsi @@ -200,6 +200,10 @@ Function InstallDatabase ${ElseIf} $OptionsDirectorDB = 2 File /oname=bacula_cats.dll "cats_pgsql.dll" File "libpq.dll" + File "comerr32.dll" + File "libintl-2.dll" + File "libiconv-2.dll" + File "krb5_32.dll" ${ElseIf} $OptionsDirectorDB = 3 File /oname=bacula_cats.dll "cats_bdb.dll" ${EndIf} diff --git a/bacula/src/win32/patches/mt.patch b/bacula/src/win32/patches/mt.patch index 70b916b109..d85840ab11 100644 --- a/bacula/src/win32/patches/mt.patch +++ b/bacula/src/win32/patches/mt.patch @@ -1,7 +1,6 @@ -Only in .: .svn -diff -ru ../../ibiblio/mt-st-0.9b/Makefile ./Makefile ---- ../../ibiblio/mt-st-0.9b/Makefile Tue Aug 16 12:16:28 2005 -+++ ./Makefile Sun Jul 30 05:59:14 2006 +diff -ru ..\release\mt-st-0.9b/Makefile ./Makefile +--- ..\release\mt-st-0.9b/Makefile 2005-08-16 12:16:28.000000000 -0700 ++++ ./Makefile 2006-08-09 03:26:58.292856500 -0700 @@ -1,29 +1,27 @@ +CC= mingw32-gcc CFLAGS= -Wall -O2 @@ -44,11 +43,9 @@ diff -ru ../../ibiblio/mt-st-0.9b/Makefile ./Makefile clean: - rm -f *~ \#*\# *.o mt stinit + rm -f *~ \#*\# *.o mt.exe stinit.exe -Only in .: compat.h -Only in .: mt -diff -ru ../../ibiblio/mt-st-0.9b/mt.1 ./mt.1 ---- ../../ibiblio/mt-st-0.9b/mt.1 Sun Aug 21 11:53:50 2005 -+++ ./mt.1 Sun Jul 30 05:16:07 2006 +diff -ru ..\release\mt-st-0.9b/mt.1 ./mt.1 +--- ..\release\mt-st-0.9b/mt.1 2005-08-21 11:53:50.000000000 -0700 ++++ ./mt.1 2006-08-09 03:26:58.302871100 -0700 @@ -48,20 +48,22 @@ files. The tape is positioned on the first block of the next file. @@ -78,10 +75,10 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.1 ./mt.1 .IP asf The tape is positioned at the beginning of the .I count -diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c ---- ../../ibiblio/mt-st-0.9b/mt.c Sun Aug 21 11:48:06 2005 -+++ ./mt.c Sun Jul 30 06:04:13 2006 -@@ -11,6 +11,12 @@ +diff -ru ..\release\mt-st-0.9b/mt.c ./mt.c +--- ..\release\mt-st-0.9b/mt.c 2005-08-21 11:48:06.000000000 -0700 ++++ ./mt.c 2006-08-09 04:00:01.093525100 -0700 +@@ -11,25 +11,35 @@ Last Modified: Sun Aug 21 21:48:06 2005 by kai.makisara */ @@ -92,9 +89,12 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c +#define O_NONBLOCK 0 + #include ++#if !defined(_MSC_VER) #include ++#endif #include -@@ -19,15 +25,17 @@ + #include + #include #include #include #include @@ -113,9 +113,12 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c -#define VERSION "0.9b" +#define VERSION "0.9b-bacula" - typedef int (* cmdfunc)(/* int, struct cmdef_tr *, int, char ** */); +-typedef int (* cmdfunc)(/* int, struct cmdef_tr *, int, char ** */); ++typedef int (* cmdfunc)(int, struct cmdef_tr *, int, char **); -@@ -143,12 +151,14 @@ + typedef struct cmdef_tr { + char *cmd_name; +@@ -143,12 +153,14 @@ FD_RDONLY, ONE_ARG, 0}, { "defcompression", MTSETDRVBUFFER, do_drvbuffer, MT_ST_DEF_COMPRESSION, FD_RDONLY, ONE_ARG, 0}, @@ -130,7 +133,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c { "densities", 0, print_densities, 0, NO_FD, NO_ARGS, 0 }, { "setpartition", MTSETPART, do_standard, 0, FD_RDONLY, ONE_ARG, -@@ -211,13 +221,19 @@ +@@ -211,13 +223,19 @@ {0x30, "AIT-1 or MLR3"}, {0x31, "AIT-2"}, {0x32, "AIT-3"}, @@ -151,7 +154,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c {0x80, "DLT 15GB uncomp. or Ecrix"}, {0x81, "DLT 15GB compressed"}, {0x82, "DLT 20GB uncompressed"}, -@@ -254,20 +270,25 @@ +@@ -254,20 +272,25 @@ {"no-blklimits", MT_ST_NO_BLKLIMS, "drive doesn't support read block limits"}, {"can-partitions",MT_ST_CAN_PARTITIONS,"drive can handle partitioned tapes"}, {"scsi2logical", MT_ST_SCSI2LOGICAL, "logical block addresses used with SCSI-2"}, @@ -179,7 +182,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c char *cmdstr; cmdef_tr *comp, *comp2; -@@ -344,7 +365,7 @@ +@@ -344,7 +367,7 @@ oflags = comp->cmd_fdtype == FD_RDONLY ? O_RDONLY : O_RDWR; if ((comp->error_tests & ET_ONLINE) == 0) oflags |= O_NONBLOCK; @@ -188,7 +191,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c perror(tape_name); exit(1); } -@@ -368,7 +389,7 @@ +@@ -368,7 +391,7 @@ } if (mtfd >= 0) @@ -197,7 +200,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c return i; } -@@ -409,9 +430,9 @@ +@@ -409,9 +432,9 @@ do_standard(int mtfd, cmdef_tr *cmd, int argc, char **argv) { struct mtop mt_com; @@ -209,7 +212,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c mt_com.mt_count = (argc > 0 ? strtol(*argv, &endp, 0) : 1); if (argc > 0 && endp != *argv) { if (*endp == 'k') -@@ -464,7 +485,8 @@ +@@ -464,7 +487,8 @@ static int do_options(int mtfd, cmdef_tr *cmd, int argc, char **argv) { @@ -219,7 +222,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c struct mtop mt_com; mt_com.mt_op = MTSETDRVBUFFER; -@@ -596,8 +618,10 @@ +@@ -596,8 +620,10 @@ type = "SCSI 1"; else if (status.mt_type == MT_ISSCSI2) type = "SCSI 2"; @@ -230,7 +233,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c else type = NULL; if (type == NULL) { -@@ -607,7 +631,7 @@ +@@ -607,7 +633,7 @@ printf("IDE-Tape (type code 0) ?\n"); else printf("Unknown tape drive type (type code %ld)\n", status.mt_type); @@ -239,7 +242,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c status.mt_fileno, status.mt_blkno); printf("mt_resid: %ld, mt_erreg: 0x%lx\n", status.mt_resid, status.mt_erreg); -@@ -617,14 +641,17 @@ +@@ -617,14 +643,17 @@ else { printf("%s tape drive:\n", type); if (status.mt_type == MT_ISSCSI2) @@ -262,7 +265,7 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c dens = (status.mt_dsreg & MT_ST_DENSITY_MASK) >> MT_ST_DENSITY_SHIFT; density = "no translation"; for (i=0; i < NBR_DENSITIES; i++) -@@ -666,8 +693,10 @@ +@@ -666,8 +695,10 @@ printf(" DR_OPEN"); if (GMT_IM_REP_EN(status.mt_gstat)) printf(" IM_REP_EN"); @@ -273,11 +276,9 @@ diff -ru ../../ibiblio/mt-st-0.9b/mt.c ./mt.c printf("\n"); return 0; } -Only in .: mt.exe -Only in .: mt.patch -diff -ru ../../ibiblio/mt-st-0.9b/mtio.h ./mtio.h ---- ../../ibiblio/mt-st-0.9b/mtio.h Tue Aug 16 12:16:28 2005 -+++ ./mtio.h Sun Jul 30 06:06:13 2006 +diff -ru ..\release\mt-st-0.9b/mtio.h ./mtio.h +--- ..\release\mt-st-0.9b/mtio.h 2005-08-16 12:16:28.000000000 -0700 ++++ ./mtio.h 2006-08-09 03:26:58.352944100 -0700 @@ -8,9 +8,7 @@ #ifndef _LINUX_MTIO_H #define _LINUX_MTIO_H @@ -305,11 +306,9 @@ diff -ru ../../ibiblio/mt-st-0.9b/mtio.h ./mtio.h /* mag tape io control commands */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ -Only in .: mtops.c -Only in .: mtops.h -diff -ru ../../ibiblio/mt-st-0.9b/stinit.def.examples ./stinit.def.examples ---- ../../ibiblio/mt-st-0.9b/stinit.def.examples Tue Aug 16 12:16:28 2005 -+++ ./stinit.def.examples Sun Jul 30 05:15:43 2006 +diff -ru ..\release\mt-st-0.9b/stinit.def.examples ./stinit.def.examples +--- ..\release\mt-st-0.9b/stinit.def.examples 2005-08-16 12:16:28.000000000 -0700 ++++ ./stinit.def.examples 2006-08-09 03:26:58.362958700 -0700 @@ -56,3 +56,169 @@ mode3 blocksize=0 density=1 # 800 bpi } @@ -480,27 +479,10 @@ diff -ru ../../ibiblio/mt-st-0.9b/stinit.def.examples ./stinit.def.examples +mode4 blocksize=0 density=0x4a compression=0 # 300 GB, no ompression +} + ---- /dev/null Sun Jul 30 06:23:05 2006 -+++ mtops.h Sun Jul 30 05:50:17 2006 -@@ -0,0 +1,15 @@ -+int tape_open(const char *file, int flags, int mode); -+int tape_read(int fd, void *buffer, unsigned int count); -+int tape_write(int fd, const void *buffer, unsigned int count); -+int tape_ioctl(int fd, unsigned long int request, ...); -+int tape_close(int fd); -+ -+typedef unsigned long __kernel_daddr_t; -+ -+#ifndef ENOMEDIUM -+#define ENOMEDIUM 123 -+#endif -+ -+#ifndef PATH_MAX -+#define PATH_MAX 1024 -+#endif ---- /dev/null Sun Jul 30 06:23:10 2006 -+++ mtops.c Sun Jul 30 05:46:08 2006 -@@ -0,0 +1,1158 @@ + +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ mtops.c 2006-08-09 04:03:09.307917500 -0700 +@@ -0,0 +1,1163 @@ +/* + * mtops.cpp - Emulate the Linux st (scsi tape) driver on Microsoft Windows. + * @@ -546,10 +528,15 @@ diff -ru ../../ibiblio/mt-st-0.9b/stinit.def.examples ./stinit.def.examples + +#include "mtops.h" +#include "mtio.h" ++#if defined(_MSC_VER) ++#include ++#include ++#else +#include +#include ++#endif + -+#ifndef __CPLUS_PLUS ++#ifndef __cplusplus +typedef char bool; +#define true 1 +#define false 0 @@ -1659,3 +1646,44 @@ diff -ru ../../ibiblio/mt-st-0.9b/stinit.def.examples ./stinit.def.examples + + return -1; +} +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ mtops.h 2006-08-09 03:26:58.372973300 -0700 +@@ -0,0 +1,15 @@ ++int tape_open(const char *file, int flags, int mode); ++int tape_read(int fd, void *buffer, unsigned int count); ++int tape_write(int fd, const void *buffer, unsigned int count); ++int tape_ioctl(int fd, unsigned long int request, ...); ++int tape_close(int fd); ++ ++typedef unsigned long __kernel_daddr_t; ++ ++#ifndef ENOMEDIUM ++#define ENOMEDIUM 123 ++#endif ++ ++#ifndef PATH_MAX ++#define PATH_MAX 1024 ++#endif +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ Makefile.msc 2006-08-09 04:00:53.970613100 -0700 +@@ -0,0 +1,20 @@ ++CC= cl ++CFLAGS= /nologo /Ox /Gy /Zi /W3 /TP \ ++ /D_CRT_SECURE_NO_DEPRECATE ++LDFLAGS= /link /DEBUG /INCREMENTAL:NO /OPT:NOREF /PDB:$*.pdb /OUT:$@ ++PREFIX= C:\ ++ ++all: mt.exe ++ ++mt.exe: mt.c ++ $(CC) $(CFLAGS) mt.c mtops.c $(LDFLAGS) ++ ++stinit.exe: stinit.c ++ $(CC) $(CFLAGS) stinit.c $(LDFLAGS) ++ ++install: mt.exe ++ if not exist $(PREFIX)\bin\nul mkdir $(PREFIX)\bin ++ !copy /y $** $(PREFIX)\bin ++ ++clean: ++ del /f *~ *.obj mt.exe stinit.exe diff --git a/bacula/src/win32/patches/mtx-msvc1.patch b/bacula/src/win32/patches/mtx-msvc1.patch new file mode 100644 index 0000000000..c4712c9d36 --- /dev/null +++ b/bacula/src/win32/patches/mtx-msvc1.patch @@ -0,0 +1,75 @@ +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ Makefile.msc 2006-08-09 02:52:26.191999700 -0700 +@@ -0,0 +1,72 @@ ++# WARNING -- THIS HAS BEEN RE-WRITTEN TO USE MICROSOFT NMAKE. ++# ++# Valid targets: ++# Microsoft Visual Studio ++# ++# Makefile changes by Lars Kellogg-Stedman for better integration with ++# GNU Autoconf. ++ ++# Version # for 'make dist'... ++VERSION=1.3.9 ++PREFIX=C:\ ++ ++BINS = mtx.exe tapeinfo.exe loaderinfo.exe scsitape.exe nsmhack.exe ++ ++CC = cl ++ ++CFLAGS = /nologo /Ox /Gy /Zi /W3 \ ++ -D_CRT_SECURE_NO_DEPRECATE \ ++ -DVERSION="\"$(VERSION)\"" \ ++ -DLONG_PRINT_REQUEST_SENSE=1 ++ ++LINK = link ++LDFLAGS = /nologo /DEBUG /INCREMENTAL:NO /OPT:NOREF /PDB:$*.pdb /OUT:$@ ++LIBS = ++ ++all: $(BINS) ++ ++install: $(BINS) ++ -mkdir $(PREFIX)\bin ++ !copy /y $** $(PREFIX)\bin ++ ++clean: ++ -del /f *.obj *~ ++ -del /f $(BINS) ++ -del /f mam2debug.exe mam2debug2.exe ++ ++loaderinfo.exe: loaderinfo.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) loaderinfo.obj mtxl.obj $(LIBS) ++ ++nsmhack.exe: nsmhack.obj mtxl.obj ++ $(LINK) $(LDFLAGS) nsmhack.obj mtxl.obj $(LIBS) ++ ++mtx.exe: mtx.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) mtx.obj mtxl.obj $(LIBS) ++ ++mam2debug.exe: mtxl.obj mam2debug.obj mtx.h ++ $(LINK) $(LDFLAGS) mtxl.obj mam2debug.obj $(LIBS) ++ ++tapeinfo.exe: tapeinfo.obj mtxl.obj mtx.h mtxl.h ++ $(LINK) $(LDFLAGS) tapeinfo.obj mtxl.obj $(LIBS) ++ ++mam2debug2.exe: mtxl.obj mam2debug2.obj mtx.h ++ $(LINK) $(LDFLAGS) mtxl.obj mam2debug2.obj $(LIBS) ++ ++scsitape.exe: scsitape.obj mtxl.obj mtxl.h mtx.h ++ $(LINK) $(LDFLAGS) scsitape.obj mtxl.obj $(LIBS) ++ ++scsitape.obj: scsitape.c mtx.h mtxl.h ++ ++loaderinfo.obj: loaderinfo.c mtx.h mtxl.h ++ ++tapeinfo.obj: tapeinfo.c mtx.h mtxl.h ++ ++mam2debug.obj: mam2debug.c mtx.h mtxl.h ++ ++mam2debug2.obj: mam2debug2.c mtx.h mtxl.h ++ ++mtx.obj: mtx.c mtx.h mtxl.h ++ ++mtxl.obj: mtxl.c mtx.h mtxl.h scsi_linux.c scsi_win32.c ++ ++nsmhack.obj: nsmhack.c mtxl.h mtx.h diff --git a/bacula/src/win32/patches/mtx-msvc2.patch b/bacula/src/win32/patches/mtx-msvc2.patch new file mode 100644 index 0000000000..38f93d3624 --- /dev/null +++ b/bacula/src/win32/patches/mtx-msvc2.patch @@ -0,0 +1,40 @@ +--- /dev/null 1969-12-31 16:00:00.000000000 -0800 ++++ msvc/config.h 2006-05-26 15:10:34.558337600 -0700 +@@ -0,0 +1,37 @@ ++/* config.h. Generated by configure. */ ++/* Copyright 2001 Enhanced Software Technologies Inc. ++ * Released under GNU General Public License V2 or Above ++ * See http://www.gnu.org for more information about the terms of ++ * the GNU General Public License. ++ * $Date$ ++ * $Revision$ ++ */ ++ ++#ifndef CONFIG_H ++#define CONFIG_H 1 ++ ++/* autoconf changes these. */ ++#define HAVE_STRING_H 1 ++#define HAVE_UNISTD_H 0 ++#define HAVE_STDLIB_H 1 ++#define HAVE_STDARG_H 1 ++#define HAVE_SCSI_SCSI_H 0 ++#define HAVE_SCSI_SCSI_IOCTL_H 0 ++#define HAVE_SCSI_SG_H 0 ++#define HAVE_SYS_GSCDDS_H 0 ++#define HAVE_CAMLIB_H 0 ++#define HAVE_SYS_SCSI_IMPL_USCSI_H 0 ++#define HAVE_SYS_SCSI_CTL_H 0 ++#define HAVE_DSLIB_H 0 ++#define HAVE_DU_DEFS_H 0 ++#define HAVE_SYS_STAT_H 1 ++#define HAVE_SYS_TYPES_H 1 ++#define HAVE_FCNTL_H 1 ++#define HAVE_SYS_IOCTL_H 0 ++#define HAVE_SYS_MTIO_H 0 ++#define HAVE_DDK_NTDDSCSI_H 0 ++ ++#define WORDS_BIGENDIAN 0 ++ ++#endif ++ -- 2.39.5