From 0b2b3a7f799aa0be1d69b7733bc6912dbb67dc64 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 25 Apr 2006 10:51:29 +0000 Subject: [PATCH] - Integrate the majority of the Mingw cross-tools submission made by Howard Thomson. Everything compiles, with zlib, openssl, and VSS turned off. Linking needs a pthreads library ... git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2964 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 8 +- bacula/configure | 14 +- bacula/kes-1.39 | 4 + bacula/src/bacula.h | 9 +- bacula/src/filed/backup.c | 2 + bacula/src/version.h | 4 +- bacula/src/win32/.cvsignore | 4 +- bacula/src/win32/Makefile.in | 496 +++++++++++++++++++++--- bacula/src/win32/Makefile.vcpp.in | 78 ++++ bacula/src/win32/README.mingw | 5 + bacula/src/win32/compat/compat.cpp | 4 +- bacula/src/win32/compat/compat.h | 11 +- bacula/src/win32/compat/mingwconfig.h | 370 ++++++++++++++++++ bacula/src/win32/compat/stdint.h | 4 + bacula/src/win32/compat/sys/stat.h | 2 +- bacula/src/win32/compat/vss.cpp | 16 +- bacula/src/win32/compat/vss_generic.cpp | 3 +- bacula/src/win32/compat/winhost.h | 26 +- 18 files changed, 965 insertions(+), 95 deletions(-) create mode 100644 bacula/src/win32/Makefile.vcpp.in create mode 100644 bacula/src/win32/README.mingw create mode 100644 bacula/src/win32/compat/mingwconfig.h diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 271c602aa2..92342c964a 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -8,6 +8,7 @@ cd .. TOP_DIR=`pwd` cd ${BUILD_DIR} AC_SUBST(BUILD_DIR) +AC_SUBST(TOP_DIR) AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf) AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in) @@ -1940,9 +1941,9 @@ AC_OUTPUT([autoconf/Make.common \ scripts/bacula-tray-monitor.desktop \ scripts/logwatch/Makefile \ scripts/logwatch/logfile.bacula.conf \ - scripts/wxconsole.console_apps \ - scripts/wxconsole.desktop.consolehelper \ - scripts/wxconsole.desktop.xsu \ + scripts/wxconsole.console_apps \ + scripts/wxconsole.desktop.consolehelper \ + scripts/wxconsole.desktop.xsu \ src/Makefile \ src/host.h \ src/console/Makefile \ @@ -2008,6 +2009,7 @@ AC_OUTPUT([autoconf/Make.common \ src/win32/winbacula.nsi \ src/win32/baculafd/bacula-fd.conf \ src/win32/Makefile \ + src/win32/Makefile.vcpp \ src/win32/console/bconsole.conf \ src/win32/wx-console/wx-console.conf \ src/win32/pebuilder/Makefile \ diff --git a/bacula/configure b/bacula/configure index 2fc506b4e6..eeaf904311 100755 --- a/bacula/configure +++ b/bacula/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX DD MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO DVDRWFORMAT PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE SET_MAKE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC2 ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS DIRD_DIR DIR_TOOLS STORED_DIR CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS WRAPLIBS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TOP_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX DD MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO DVDRWFORMAT PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE SET_MAKE MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC2 ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS DIRD_DIR DIR_TOOLS STORED_DIR CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS WRAPLIBS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS' ac_subst_files='MCOMMON' # Initialize some variables set by options. @@ -1399,6 +1399,7 @@ cd .. TOP_DIR=`pwd` cd ${BUILD_DIR} + ac_aux_dir= for ac_dir in ${BUILD_DIR}/autoconf $srcdir/${BUILD_DIR}/autoconf; do if test -f $ac_dir/install-sh; then @@ -16552,7 +16553,12 @@ echo "$as_me: error: \"You can configure for only one database.\"" >&2;} { (exit 1); exit 1; }; }; fi if test "$withval" = "yes"; then - if test -f /usr/local/include/libpq-fe.h; then + PG_CONFIG=`which pg_config` + if test -n "$PG_CONFIG";then + POSTGRESQL_INCDIR=`"$PG_CONFIG" --includedir` + POSTGRESQL_LIBDIR=`"$PG_CONFIG" --libdir` + POSTGRESQL_BINDIR=`"$PG_CONFIG" --bindir` + elif test -f /usr/local/include/libpq-fe.h; then POSTGRESQL_INCDIR=/usr/local/include POSTGRESQL_LIBDIR=/usr/local/lib POSTGRESQL_BINDIR=/usr/local/bin @@ -29834,7 +29840,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then exit 1 fi - ac_config_files="$ac_config_files autoconf/Make.common Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/pygtk-console/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf src/win32/pebuilder/Makefile po/Makefile.in $PFILES" + ac_config_files="$ac_config_files autoconf/Make.common Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/pygtk-console/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/Makefile.vcpp src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf src/win32/pebuilder/Makefile po/Makefile.in $PFILES" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -30474,6 +30480,7 @@ do "src/win32/winbacula.nsi" ) CONFIG_FILES="$CONFIG_FILES src/win32/winbacula.nsi" ;; "src/win32/baculafd/bacula-fd.conf" ) CONFIG_FILES="$CONFIG_FILES src/win32/baculafd/bacula-fd.conf" ;; "src/win32/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/win32/Makefile" ;; + "src/win32/Makefile.vcpp" ) CONFIG_FILES="$CONFIG_FILES src/win32/Makefile.vcpp" ;; "src/win32/console/bconsole.conf" ) CONFIG_FILES="$CONFIG_FILES src/win32/console/bconsole.conf" ;; "src/win32/wx-console/wx-console.conf" ) CONFIG_FILES="$CONFIG_FILES src/win32/wx-console/wx-console.conf" ;; "src/win32/pebuilder/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/win32/pebuilder/Makefile" ;; @@ -30568,6 +30575,7 @@ s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@BUILD_DIR@,$BUILD_DIR,;t t +s,@TOP_DIR@,$TOP_DIR,;t t s,@TRUEPRG@,$TRUEPRG,;t t s,@FALSEPRG@,$FALSEPRG,;t t s,@VERSION@,$VERSION,;t t diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 0b204e2fab..ad5891848e 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,6 +2,10 @@ Kern Sibbald General: +25Apr06 +- Integrate the majority of the Mingw cross-tools submission + made by Howard Thomson. Everything compiles, with zlib, openssl, + and VSS turned off. Linking needs a pthreads library ... 23Apr06 - Add 'Dir Status' button to the gnome console. - More work on migration. diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index 6225d44e11..081611040d 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -4,7 +4,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -27,8 +27,13 @@ #endif #ifdef WIN32 +#ifdef HAVE_MINGW +#include "mingwconfig.h" +#include "winhost.h" +#else #include "winconfig.h" #include "winhost.h" +#endif #else #include "config.h" #include "host.h" @@ -93,7 +98,7 @@ #ifdef HAVE_SYS_SOCKET_H #include #endif -#ifdef HAVE_WIN32 +#if defined(HAVE_WIN32) & !defined(HAVE_MINGW) #include #else #include diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index ebf3d2c57f..494b24add6 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -587,6 +587,8 @@ int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, DIGEST *sign wbuf = jcr->compress_buf; /* compressed output here */ cipher_input = jcr->compress_buf; /* encrypt compressed data */ } +#else + const uint32_t max_compress_len = 0; #endif if (ff_pkt->flags & FO_ENCRYPT) { diff --git a/bacula/src/version.h b/bacula/src/version.h index d56476dcc8..77fa477a42 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.10" -#define BDATE "23 April 2006" -#define LSMDATE "23Apr06" +#define BDATE "25 April 2006" +#define LSMDATE "25Apr06" /* Debug flags */ #undef DEBUG diff --git a/bacula/src/win32/.cvsignore b/bacula/src/win32/.cvsignore index aa50c9ae1c..e528f4bfeb 100644 --- a/bacula/src/win32/.cvsignore +++ b/bacula/src/win32/.cvsignore @@ -1,6 +1,8 @@ +winres.res +Makefile.vcpp install install-debug winbacula.nsi Makefile bacula.ncb -bacula.suo \ No newline at end of file +bacula.suo diff --git a/bacula/src/win32/Makefile.in b/bacula/src/win32/Makefile.in index c129993211..be614a0965 100644 --- a/bacula/src/win32/Makefile.in +++ b/bacula/src/win32/Makefile.in @@ -1,78 +1,460 @@ # -# Makefile to build the native Win32 File daemon -# VC++ and tools must be on your path -# -# Kern Sibbald, February 2004 -# +# Makefile for win32 bacula executables +# Using MinGW cross-compiler on GNU/Linux +# -srcdir = . -VPATH = . -.PATH: . +# Configuration -# one up -basedir = .. -# top dir -topdir = ../.. -# this dir relative to top dir -thisdir = src/win32 +# Version for cross-tools-3.4.2 +TOPDIR = @TOP_DIR@ +CROSSTOOLS = $(TOPDIR)/cross-tools +MINGW = $(CROSSTOOLS)/mingw32 +INCLUDE_MINGW = -I $(MINGW)/mingw32/include +INCLUDE_GCC = -I $(MINGW)/lib/gcc/mingw32/3.4.5/include -DEBUG=@DEBUG@ +DEPKGS = $(TOPDIR)/depkgs-win32 +INCLUDE_BACULA = -I .. -I ./compat +INCLUDE_PTHREADS = -I$(DEPKGS)/pthreads +INCLUDE_ZLIB = -I$(DEPKGS)/zlib +INCLUDE_ATL = -I$(CROSSTOOLS)/atlmfc/include +INCLUDE_VSS = -I$(CROSSTOOLS) +INCLUDE_ICONS = -I ../filed/win32 +INCLUDE_OPENSSL = -I$(CROSSTOOLS)/openssl/include -NMAKE=nmake -MAKENSIS="c:/Program Files/NSIS/makensis" +LIB_MINGW = $(MINGW)/mingw32/lib +LIB_PTHREADS = $(DEPKGS)/pthreads/libpthreadGCE.a +#LIB_ZLIB = $(DEPKGS)/libz.a +#LIB_SSL = $(DEPKGS)/openssl/libssl.a +#LIB_CRYPTO = $(DEPKGS)/openssl/libcrypto.a -first_rule: all +BIN_DIR = $(MINGW)/bin -dummy: +INCLUDES = \ + $(INCLUDE_GCC) \ + $(INCLUDE_MINGW) \ + $(INCLUDE_PTHREADS) \ + $(INCLUDE_BACULA) \ + $(INCLUDE_ICONS) -all: bacula bconsole wx-console pebuilder installer +# $(INCLUDE_VSS) \ +# $(INCLUDE_ATL) \ +# $(INCLUDE_OPENSSL) +HAVES = \ + -DHAVE_MINGW \ + -DHAVE_WIN32 -bacula: dummy - (cd baculafd; env MAKEFLAGS= ${NMAKE} CFG="baculafd - Win32 Release" /f baculafd.mak) - -bconsole: dummy - (cd console; env MAKEFLAGS= ${NMAKE} CFG="console - Win32 Release" /f console.mak) +# -DWIN32_VSS \ +# -DHAVE_ZLIB_H \ +# -DHAVE_LIBZ \ +# -DHAVE_OPENSSL \ +# -DHAVE_TLS \ -wx-console: dummy - (cd wx-console; env MAKEFLAGS= ${NMAKE} CFG="wx-console - Win32 Release" /f wx-console.mak) +DEFINES = \ + -DWIN32 \ + $(HAVES) \ + -DCOMPILING_BACULA -pebuilder: bacula bconsole wx-console - (cd pebuilder; make) -# -# Quickie debug installation -# -install: bacula - cp -f ../../../depkgs-win32/pthreads/pthreadVCE.dll baculafd/Release - cp -f bacula-fd.conf baculafd/Release - (cd baculafd/Release; ./bacula-fd.exe /kill) - sleep 2 - cp -f baculafd/Release/bacula-fd.exe /bacula/bin - @echo "Please start Bacula from the Service Menu" -installer: winbacula.exe +CC = $(BIN_DIR)/mingw32-g++ $(DEFINES) $(INCLUDES) +CXX = $(BIN_DIR)/mingw32-g++ $(DEFINES) $(INCLUDES) 2>&1 +WINDRES = $(BIN_DIR)/mingw32-windres + +first: all + +OBJDIR = . + +########################################################################## + +# Files in src/win32/filed/ + +OBJS_FILED = \ + $(OBJDIR)/authenticate.o \ + $(OBJDIR)/backup.o \ + $(OBJDIR)/estimate.o \ + $(OBJDIR)/filed.o \ + $(OBJDIR)/filed_conf.o \ + $(OBJDIR)/heartbeat.o \ + $(OBJDIR)/job.o \ + $(OBJDIR)/restore.o \ + $(OBJDIR)/status.o \ + $(OBJDIR)/verify.o \ + $(OBJDIR)/verify_vol.o \ + +authenticate.o: ../filed/authenticate.c + $(CXX) -c ../filed/authenticate.c -o $(OBJDIR)/authenticate.o + +backup.o: ../filed/backup.c + $(CXX) -c ../filed/backup.c -o $(OBJDIR)/backup.o + +estimate.o: ../filed/estimate.c + $(CXX) -c ../filed/estimate.c -o $(OBJDIR)/estimate.o + +filed.o: ../filed/filed.c + $(CXX) -c ../filed/filed.c -o $(OBJDIR)/filed.o + +filed_conf.o: ../filed/filed_conf.c + $(CXX) -c ../filed/filed_conf.c -o $(OBJDIR)/filed_conf.o + +heartbeat.o: ../filed/heartbeat.c + $(CXX) -c ../filed/heartbeat.c -o $(OBJDIR)/heartbeat.o + +job.o: ../filed/job.c + $(CXX) -c ../filed/job.c -o $(OBJDIR)/job.o + +restore.o: ../filed/restore.c + $(CXX) -c ../filed/restore.c -o $(OBJDIR)/restore.o + +status.o: ../filed/status.c + $(CXX) -c ../filed/status.c -o $(OBJDIR)/status.o + +verify.o: ../filed/verify.c + $(CXX) -c ../filed/verify.c -o $(OBJDIR)/verify.o + +verify_vol.o: ../filed/verify_vol.c + $(CXX) -c ../filed/verify_vol.c -o $(OBJDIR)/verify_vol.o + +###################################################################### + +# Files in win32/compat + +OBJS_COMPAT = \ + $(OBJDIR)/print.o \ + $(OBJDIR)/compat.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/vss.o \ + $(OBJDIR)/vss_xp.o \ + $(OBJDIR)/vss_w2k3.o \ + +compat.o: ./compat/compat.cpp + $(CXX) -c ./compat/compat.cpp -o $(OBJDIR)/compat.o + +getopt.o: ./compat/getopt.c + $(CXX) -c ./compat/getopt.c -o $(OBJDIR)/getopt.o + +print.o: ./compat/print.cpp + $(CXX) -c ./compat/print.cpp -o $(OBJDIR)/print.o + +vss.o: ./compat/vss.cpp + $(CXX) -c ./compat/vss.cpp -o $(OBJDIR)/vss.o + +vss_xp.o: ./compat/vss_XP.cpp + $(CXX) -c ./compat/vss_XP.cpp -o $(OBJDIR)/vss_xp.o + +vss_w2k3.o: ./compat/vss_W2K3.cpp + $(CXX) -c ./compat/vss_W2K3.cpp -o $(OBJDIR)/vss_w2k3.o + +###################################################################### + +# Files in src/filed/win32 +OBJS_WIN = \ + $(OBJDIR)/winabout.o \ + $(OBJDIR)/winevents.o \ + $(OBJDIR)/winservice.o \ + $(OBJDIR)/winstat.o \ + $(OBJDIR)/wintray.o \ + $(OBJDIR)/winmain.o \ + $(OBJDIR)/winres.res + +winabout.o: ../filed/win32/winabout.cpp + $(CXX) -c ../filed/win32/winabout.cpp -o $(OBJDIR)/winabout.o + +winevents.o: ../filed/win32/winevents.cpp + $(CXX) -c ../filed/win32/winevents.cpp -o $(OBJDIR)/winevents.o + +winmain.o: ../filed/win32/winmain.cpp + $(CXX) -c ../filed/win32/winmain.cpp -o $(OBJDIR)/winmain.o + +winservice.o: ../filed/win32/winservice.cpp + $(CXX) -c ../filed/win32/winservice.cpp -o $(OBJDIR)/winservice.o + +winstat.o: ../filed/win32/winstat.cpp + $(CXX) -c ../filed/win32/winstat.cpp -o $(OBJDIR)/winstat.o + +wintray.o: ../filed/win32/wintray.cpp + $(CXX) -c ../filed/win32/wintray.cpp -o $(OBJDIR)/wintray.o + +winres.res: ../filed/win32/winres.rc + $(WINDRES) $(INCLUDE_ICONS) -o coff ../filed/win32/winres.rc -o $(OBJDIR)/winres.res +# $(WINDRES) --help +# mingw32-nm winres.res + +###################################################################### + +# Files in src/findlib +OBJS_FINDLIB = \ + $(OBJDIR)/attribs.o \ + $(OBJDIR)/bfile.o \ + $(OBJDIR)/create_file.o \ + $(OBJDIR)/enable_priv.o \ + $(OBJDIR)/find.o \ + $(OBJDIR)/find_one.o \ + $(OBJDIR)/fstype.o \ + $(OBJDIR)/makepath.o \ + $(OBJDIR)/match.o \ + $(OBJDIR)/save-cwd.o + +attribs.o: ../findlib/attribs.c + $(CXX) -c ../findlib/attribs.c -o $(OBJDIR)/attribs.o + +bfile.o: ../findlib/bfile.c + $(CXX) -c ../findlib/bfile.c -o $(OBJDIR)/bfile.o + +create_file.o: ../findlib/create_file.c + $(CXX) -c ../findlib/create_file.c -o $(OBJDIR)/create_file.o + +enable_priv.o: ../findlib/enable_priv.c + $(CXX) -c ../findlib/enable_priv.c -o $(OBJDIR)/enable_priv.o + +find.o: ../findlib/find.c + $(CXX) -c ../findlib/find.c -o $(OBJDIR)/find.o + +find_one.o: ../findlib/find_one.c + $(CXX) -c ../findlib/find_one.c -o $(OBJDIR)/find_one.o + +fstype.o: ../findlib/fstype.c + $(CXX) -c ../findlib/fstype.c -o $(OBJDIR)/fstype.o + +makepath.o: ../findlib/makepath.c + $(CXX) -c ../findlib/makepath.c -o $(OBJDIR)/makepath.o + +match.o: ../findlib/match.c + $(CXX) -c ../findlib/match.c -o $(OBJDIR)/match.o + +save-cwd.o: ../findlib/save-cwd.c + $(CXX) -c ../findlib/save-cwd.c -o $(OBJDIR)/save-cwd.o + + +###################################################################### + +# Files in src/win32/lib, based on files in src/lib + +LIB_OBJS = \ + $(OBJDIR)/address_conf.o \ + $(OBJDIR)/alist.o \ + $(OBJDIR)/alloc.o \ + $(OBJDIR)/attr.o \ + $(OBJDIR)/base64.o \ + $(OBJDIR)/berrno.o \ + $(OBJDIR)/bget_msg.o \ + $(OBJDIR)/bnet.o \ + $(OBJDIR)/bnet_server.o \ + $(OBJDIR)/bpipe.o \ + $(OBJDIR)/bregex.o \ + $(OBJDIR)/bshm.o \ + $(OBJDIR)/bsys.o \ + $(OBJDIR)/btime.o \ + $(OBJDIR)/btimers.o \ + $(OBJDIR)/cram-md5.o \ + $(OBJDIR)/crc32.o \ + $(OBJDIR)/daemon.o \ + $(OBJDIR)/dlist.o \ + $(OBJDIR)/edit.o \ + $(OBJDIR)/fnmatch.o \ + $(OBJDIR)/hmac.o \ + $(OBJDIR)/htable.o \ + $(OBJDIR)/idcache.o \ + $(OBJDIR)/jcr.o \ + $(OBJDIR)/lex.o \ + $(OBJDIR)/md5.o \ + $(OBJDIR)/mem_pool.o \ + $(OBJDIR)/message.o \ + $(OBJDIR)/parse_conf.o \ + $(OBJDIR)/pythonlib.o \ + $(OBJDIR)/queue.o \ + $(OBJDIR)/res.o \ + $(OBJDIR)/rwlock.o \ + $(OBJDIR)/semlock.o \ + $(OBJDIR)/serial.o \ + $(OBJDIR)/sha1.o \ + $(OBJDIR)/signal.o \ + $(OBJDIR)/smartall.o \ + $(OBJDIR)/tls.o \ + $(OBJDIR)/var.o \ + $(OBJDIR)/watchdog.o \ + $(OBJDIR)/winapi.o \ + $(OBJDIR)/workq.o \ + $(OBJDIR)/scan.o \ + $(OBJDIR)/tree.o \ + $(OBJDIR)/util.o \ + +OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_WIN) $(OBJS_FINDLIB) $(OBJS_FILED) + +LIBS = \ + -L$(LIB_MINGW) \ + $(LIB_PTHREADS) \ + $(LIB_SSL) \ + $(LIB_CRYPTO) \ + $(LIB_ZLIB) \ + $(LIB_MINGW)/libole32.a \ + $(LIB_MINGW)/liboleaut32.a \ + $(LIB_MINGW)/libuser32.a \ + $(LIB_MINGW)/libadvapi32.a \ + $(LIB_MINGW)/libgdi32.a \ + $(LIB_MINGW)/libwsock32.a \ + $(LIB_MINGW)/libshell32.a \ + $(LIB_MINGW)/libnetapi32.a \ + $(LIB_MINGW)/libuuid.a # -# Build installer -# -winbacula.exe: bacula - ${MAKENSIS} /V2 winbacula.nsi +# Rules for generating from ../lib +# + +address_conf.o: ../lib/address_conf.c + $(CXX) -c ../lib/address_conf.c -o $(OBJDIR)/address_conf.o + +alist.o: ../lib/alist.c + $(CXX) -c ../lib/alist.c -o $(OBJDIR)/alist.o + +alloc.o: ../lib/alloc.c + $(CXX) -c ../lib/alloc.c -o $(OBJDIR)/alloc.o + +attr.o: ../lib/attr.c + $(CXX) -c ../lib/attr.c -o $(OBJDIR)/attr.o + +base64.o: ../lib/base64.c + $(CXX) -c ../lib/base64.c -o $(OBJDIR)/base64.o + +berrno.o: ../lib/berrno.c + $(CXX) -c ../lib/berrno.c -o $(OBJDIR)/berrno.o + +bget_msg.o: ../lib/bget_msg.c + $(CXX) -c ../lib/bget_msg.c -o $(OBJDIR)/bget_msg.o + +bnet.o: ../lib/bnet.c + $(CXX) -c ../lib/bnet.c -o $(OBJDIR)/bnet.o + +bnet_server.o: ../lib/bnet_server.c + $(CXX) -c ../lib/bnet_server.c -o $(OBJDIR)/bnet_server.o + +bpipe.o: ../lib/bpipe.c + $(CXX) -c ../lib/bpipe.c -o $(OBJDIR)/bpipe.o + +bregex.o: ../lib/bregex.c + $(CXX) -c ../lib/bregex.c -o $(OBJDIR)/bregex.o + +bshm.o: ../lib/bshm.c + $(CXX) -c ../lib/bshm.c -o $(OBJDIR)/bshm.o + +bsys.o: ../lib/bsys.c + $(CXX) -c ../lib/bsys.c -o $(OBJDIR)/bsys.o + +btime.o: ../lib/btime.c + $(CXX) -c ../lib/btime.c -o $(OBJDIR)/btime.o + +btimers.o: ../lib/btimers.c + $(CXX) -c ../lib/btimers.c -o $(OBJDIR)/btimers.o + +cram-md5.o: ../lib/cram-md5.c + $(CXX) -c ../lib/cram-md5.c -o $(OBJDIR)/cram-md5.o + +crc32.o: ../lib/crc32.c + $(CXX) -c ../lib/crc32.c -o $(OBJDIR)/crc32.o + +daemon.o: ../lib/daemon.c + $(CXX) -c ../lib/daemon.c -o $(OBJDIR)/daemon.o + +dlist.o: ../lib/dlist.c + $(CXX) -c ../lib/dlist.c -o $(OBJDIR)/dlist.o + +edit.o: ../lib/edit.c + $(CXX) -c ../lib/edit.c -o $(OBJDIR)/edit.o + +fnmatch.o: ../lib/fnmatch.c + $(CXX) -c ../lib/fnmatch.c -o $(OBJDIR)/fnmatch.o + +hmac.o: ../lib/hmac.c + $(CXX) -c ../lib/hmac.c -o $(OBJDIR)/hmac.o + +htable.o: ../lib/htable.c + $(CXX) -c ../lib/htable.c -o $(OBJDIR)/htable.o +idcache.o: ../lib/idcache.c + $(CXX) -c ../lib/idcache.c -o $(OBJDIR)/idcache.o -Makefile: $(srcdir)/Makefile.in $(topdir)/config.status winbacula.nsi.in - cd $(topdir) \ - && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= \ - $(SHELL) ./config.status +jcr.o: ../lib/jcr.c + $(CXX) -c ../lib/jcr.c -o $(OBJDIR)/jcr.o + +lex.o: ../lib/lex.c + $(CXX) -c ../lib/lex.c -o $(OBJDIR)/lex.o + +md5.o: ../lib/md5.c + $(CXX) -c ../lib/md5.c -o $(OBJDIR)/md5.o + +mem_pool.o: ../lib/mem_pool.c + $(CXX) -c ../lib/mem_pool.c -o $(OBJDIR)/mem_pool.o + +message.o: ../lib/message.c + $(CXX) -c ../lib/message.c -o $(OBJDIR)/message.o + +parse_conf.o: ../lib/parse_conf.c + $(CXX) -c ../lib/parse_conf.c -o $(OBJDIR)/parse_conf.o + +pythonlib.o: ../lib/pythonlib.c + $(CXX) -c ../lib/pythonlib.c -o $(OBJDIR)/pythonlib.o + +queue.o: ../lib/queue.c + $(CXX) -c ../lib/queue.c -o $(OBJDIR)/queue.o + +res.o: ../lib/res.c + $(CXX) -c ../lib/res.c -o $(OBJDIR)/res.o + +rwlock.o: ../lib/rwlock.c + $(CXX) -c ../lib/rwlock.c -o $(OBJDIR)/rwlock.o + +scan.o: ../lib/scan.c + $(CXX) -c ../lib/scan.c -o $(OBJDIR)/scan.o + +semlock.o: ../lib/semlock.c + $(CXX) -c ../lib/semlock.c -o $(OBJDIR)/semlock.o + +serial.o: ../lib/serial.c + $(CXX) -c ../lib/serial.c -o $(OBJDIR)/serial.o + +sha1.o: ../lib/sha1.c + $(CXX) -c ../lib/sha1.c -o $(OBJDIR)/sha1.o + +signal.o: ../lib/signal.c + $(CXX) -c ../lib/signal.c -o $(OBJDIR)/signal.o + +smartall.o: ../lib/smartall.c + $(CXX) -c ../lib/smartall.c -o $(OBJDIR)/smartall.o + +tls.o: ../lib/tls.c + $(CXX) -c ../lib/tls.c -o $(OBJDIR)/tls.o + +tree.o: ../lib/tree.c + $(CXX) -c ../lib/tree.c -o $(OBJDIR)/tree.o + +util.o: ../lib/util.c + $(CXX) -c ../lib/util.c -o $(OBJDIR)/util.o + +var.o: ../lib/var.c + $(CXX) -c ../lib/var.c -o $(OBJDIR)/var.o + +watchdog.o: ../lib/watchdog.c + $(CXX) -c ../lib/watchdog.c -o $(OBJDIR)/watchdog.o + +winapi.o: ../lib/winapi.c + $(CXX) -c ../lib/winapi.c -o $(OBJDIR)/winapi.o + +workq.o: ../lib/workq.c + $(CXX) -c ../lib/workq.c -o $(OBJDIR)/workq.o + +# Targets + +all: bacula-fd.exe clean: - (cd baculafd; make clean) - (cd console; make clean) - (cd wx-console; make clean) - (cd pebuilder; make clean) - -distclean: clean - rm -rf baculafd/Release baculafd/Debug - rm -f winbacula-*.exe - rm -f winbacula-bartpe-*.zip + rm -f $(OBJDIR)/*.o $(OBJDIR)/bacula-fd.exe $(OBJDIR)/winres.res + +# Link the executable ... +bacula-fd.exe: $(OBJS) + $(CXX) $(OBJS) $(LIBS) -o $(OBJDIR)/bacula-fd.exe + +# TODO ... +# Fix vss files: check for consistent levels of pointer indirection +# vss_generic.c: VSS_TIMEOUT defined as empty/null +# bpipe.c: WTERMSIG undefined diff --git a/bacula/src/win32/Makefile.vcpp.in b/bacula/src/win32/Makefile.vcpp.in new file mode 100644 index 0000000000..c129993211 --- /dev/null +++ b/bacula/src/win32/Makefile.vcpp.in @@ -0,0 +1,78 @@ +# +# Makefile to build the native Win32 File daemon +# VC++ and tools must be on your path +# +# Kern Sibbald, February 2004 +# + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../.. +# this dir relative to top dir +thisdir = src/win32 + +DEBUG=@DEBUG@ + + +NMAKE=nmake +MAKENSIS="c:/Program Files/NSIS/makensis" + +first_rule: all + +dummy: + +all: bacula bconsole wx-console pebuilder installer + + +bacula: dummy + (cd baculafd; env MAKEFLAGS= ${NMAKE} CFG="baculafd - Win32 Release" /f baculafd.mak) + +bconsole: dummy + (cd console; env MAKEFLAGS= ${NMAKE} CFG="console - Win32 Release" /f console.mak) + +wx-console: dummy + (cd wx-console; env MAKEFLAGS= ${NMAKE} CFG="wx-console - Win32 Release" /f wx-console.mak) + +pebuilder: bacula bconsole wx-console + (cd pebuilder; make) + +# +# Quickie debug installation +# +install: bacula + cp -f ../../../depkgs-win32/pthreads/pthreadVCE.dll baculafd/Release + cp -f bacula-fd.conf baculafd/Release + (cd baculafd/Release; ./bacula-fd.exe /kill) + sleep 2 + cp -f baculafd/Release/bacula-fd.exe /bacula/bin + @echo "Please start Bacula from the Service Menu" + +installer: winbacula.exe + +# +# Build installer +# +winbacula.exe: bacula + ${MAKENSIS} /V2 winbacula.nsi + + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status winbacula.nsi.in + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= \ + $(SHELL) ./config.status + +clean: + (cd baculafd; make clean) + (cd console; make clean) + (cd wx-console; make clean) + (cd pebuilder; make clean) + +distclean: clean + rm -rf baculafd/Release baculafd/Debug + rm -f winbacula-*.exe + rm -f winbacula-bartpe-*.zip diff --git a/bacula/src/win32/README.mingw b/bacula/src/win32/README.mingw new file mode 100644 index 0000000000..472d689839 --- /dev/null +++ b/bacula/src/win32/README.mingw @@ -0,0 +1,5 @@ + +This readme will explain the Mingw cross-tools implementation that +allows building the Win32 FD on Linux. + + --- to be done --- diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 0dc526753a..2f5b6d7048 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -287,7 +287,7 @@ wchar_2_UTF8(char *pszUTF, const WCHAR *pszUCS, int cchChar) return nRet; } else - return NULL; + return 0; } int @@ -306,7 +306,7 @@ UTF8_2_wchar(POOLMEM **ppszUCS, const char *pszUTF) return nRet; } else - return NULL; + return 0; } diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index fc262b829e..c7ab33791e 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -4,7 +4,7 @@ // Copyright transferred from Raider Solutions, Inc to // Kern Sibbald and John Walker by express permission. // -// Copyright (C) 2004-2005 Kern Sibbald +// Copyright (C) 2004-2006 Kern Sibbald // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -70,10 +69,7 @@ #include #include #include -#if defined HAVE_MINGW -#include -#include -#endif +#include #include "getopt.h" @@ -148,6 +144,7 @@ typedef UINT32 mode_t; /* #ifndef _WX_DEFS_H_ ssize_t is defined in wx/defs.h */ typedef INT64 ssize_t; /* #endif */ + #endif /* HAVE_MINGW */ struct dirent { @@ -156,9 +153,9 @@ struct dirent { uint16_t d_reclen; char d_name[256]; }; - typedef void DIR; + #ifndef __cplusplus #ifndef true #define true 1 diff --git a/bacula/src/win32/compat/mingwconfig.h b/bacula/src/win32/compat/mingwconfig.h new file mode 100644 index 0000000000..e28d40120d --- /dev/null +++ b/bacula/src/win32/compat/mingwconfig.h @@ -0,0 +1,370 @@ +/* + * This file was originally generated by configure, but has been edited + * to provide the correct defines for the Native Win32 build under + * Visual Studio. + */ +/* ------------------------------------------------------------------------- */ +/* -- CONFIGURE SPECIFIED FEATURES -- */ +/* ------------------------------------------------------------------------- */ + +#ifndef __MINGWCONFIG_H +#define __MINGWCONFIG_H + + +/* Define if you want SmartAlloc debug code enabled */ +#define SMARTALLOC 1 + +/* Define if you need function prototypes */ +#define PROTOTYPES 1 + +/* Define if you have GCC */ +#define HAVE_GCC 1 + +/* Define to 1 if utime.h exists and declares struct utimbuf. */ +#define HAVE_UTIME_H 1 + +/* Data types */ +#define HAVE_U_INT 1 +#define HAVE_INTXX_T 1 +#define HAVE_U_INTXX_T 1 +/* #undef HAVE_UINTXX_T */ +#define HAVE_INT64_T 1 +#define HAVE_U_INT64_T 1 +#define HAVE_UINT64_T 1 +#define HAVE_INTMAX_T 1 +/* #undef HAVE_U_INTMAX_T */ + +/* Define if you want TCP Wrappers support */ +/* #undef HAVE_LIBWRAP */ + +/* Define if you have sys/bitypes.h */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define if you have zlib */ +/* #define HAVE_LIBZ 1 */ + +/* File daemon specif libraries */ +#define FDLIBS 1 + + +/* What kind of signals we have */ +/*#define HAVE_POSIX_SIGNALS 1 */ +/* #undef HAVE_BSD_SIGNALS */ +/* #undef HAVE_USG_SIGHOLD */ + + +/* Set to correct scanf value for long long int */ +#define lld "lld" +#define llu "llu" + +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 +#ifndef HAVE_MINGW +#define alloca _alloca +#endif + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostid' function. */ +#define HAVE_GETHOSTID 1 + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getmntent' function. */ +/*#define HAVE_GETMNTENT 1 */ + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 +#define getpid _getpid + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_GRP_H 1*/ + +/* Define to 1 if you have the `inet_pton' function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MTIO_H */ + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_PWD_H 1*/ + +/* Define to 1 if you have the `readdir_r' function. */ +/* #undef HAVE_READDIR_R */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_RESOLV_H 1*/ + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#if (defined _MSC_VER) && (_MSC_VER >= 1400) // VC8+ +/* Enable NLS only if we are using the new VC++. + * NLS should also work with VC++ 7.1, but the Makefiles are + * not adapted to support it (include, lib...). */ +#define ENABLE_NLS 1 +#endif + +#undef LOCALEDIR +#define LOCALEDIR "." + +#undef HAVE_NL_LANGINFO + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#define HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `signal' function. */ +/*#define HAVE_SIGNAL 1 */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncmp' function. */ +#define HAVE_STRNCMP 1 + +/* Define to 1 if you have the `strncpy' function. */ +#define HAVE_STRNCPY 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ + +/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ +#define HAVE_ST_BLKSIZE 1 + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#define HAVE_ST_BLOCKS 1 + +/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use + `HAVE_STRUCT_STAT_ST_RDEV' instead. */ +#define HAVE_ST_RDEV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MTIO_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +/* #undef HAVE_TM_ZONE */ + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#define HAVE_TZNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VARARGS_H */ + +/* Define to 1 if you have the `vfprintf' function. */ +#define HAVE_VFPRINTF 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_ZLIB_H 1 */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to 1 if the `setpgrp' function takes no argument. */ +#define SETPGRP_VOID 1 + +/* The size of a `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `int *', as computed by sizeof. */ +#define SIZEOF_INT_P 4 + +/* The size of a `long int', as computed by sizeof. */ +#define SIZEOF_LONG_INT 4 + +/* The size of a `long long int', as computed by sizeof. */ +#define SIZEOF_LONG_LONG_INT 8 + +/* The size of a `short int', as computed by sizeof. */ +#define SIZEOF_SHORT_INT 2 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + + +#endif /* __MINGWNCONFIG_H */ diff --git a/bacula/src/win32/compat/stdint.h b/bacula/src/win32/compat/stdint.h index 7273fef6de..ce2c545f75 100644 --- a/bacula/src/win32/compat/stdint.h +++ b/bacula/src/win32/compat/stdint.h @@ -1 +1,5 @@ +#ifndef HAVE_MINGW #include "compat.h" +#else +#include_next +#endif diff --git a/bacula/src/win32/compat/sys/stat.h b/bacula/src/win32/compat/sys/stat.h index 4a29f57430..cba282e793 100644 --- a/bacula/src/win32/compat/sys/stat.h +++ b/bacula/src/win32/compat/sys/stat.h @@ -1,5 +1,5 @@ #ifndef HAVE_MINGW #include "compat.h" #else -#include_next +#include_next #endif diff --git a/bacula/src/win32/compat/vss.cpp b/bacula/src/win32/compat/vss.cpp index a96b985bce..fc7a4fa8f8 100644 --- a/bacula/src/win32/compat/vss.cpp +++ b/bacula/src/win32/compat/vss.cpp @@ -21,6 +21,7 @@ // Created On : Fri May 06 21:44:00 2005 +#ifdef WIN32_VSS #include #include #include @@ -31,9 +32,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -55,10 +54,16 @@ #include using namespace std; -#ifndef HAVE_MINGW -#include +#ifdef HAVE_MINGW + +//#include +#include "ms_atl.h" #include +#else + +#include +#include // Used for safe string manipulation #include @@ -163,7 +168,7 @@ BOOL VSSClient::GetShadowPathW(const WCHAR *szFilePath, WCHAR *szShadowPath, int if (bIsValidName) { int nDriveIndex = towupper(szFilePath[0])-'A'; if (m_szShadowCopyName[nDriveIndex][0] != 0) { - wcsncpy(szShadowPath, CA2W(m_szShadowCopyName[nDriveIndex]), nBuflen); +// wcsncpy(szShadowPath, CA2W(m_szShadowCopyName[nDriveIndex]), nBuflen); nBuflen -= (int)strlen(m_szShadowCopyName[nDriveIndex]); wcsncat(szShadowPath, szFilePath+2, nBuflen); return TRUE; @@ -194,3 +199,4 @@ const int VSSClient::GetWriterState(size_t nIndex) vector* pV = (vector*) m_pVectorWriterStates; return pV->at(nIndex); } +#endif diff --git a/bacula/src/win32/compat/vss_generic.cpp b/bacula/src/win32/compat/vss_generic.cpp index c3ce639f7d..cc0dd6145b 100644 --- a/bacula/src/win32/compat/vss_generic.cpp +++ b/bacula/src/win32/compat/vss_generic.cpp @@ -20,7 +20,7 @@ // Author : Thorsten Engel // Created On : Fri May 06 21:44:00 2005 - +#ifdef WIN32_VSS #include #include #include @@ -606,3 +606,4 @@ BOOL VSSClientGeneric::CheckWriterStatus() errno = 0; return TRUE; } +#endif diff --git a/bacula/src/win32/compat/winhost.h b/bacula/src/win32/compat/winhost.h index 9fc81dca83..76ea3055fa 100644 --- a/bacula/src/win32/compat/winhost.h +++ b/bacula/src/win32/compat/winhost.h @@ -5,28 +5,32 @@ * */ /* - Copyright (C) 2000-2004 Kern Sibbald and John Walker + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ +#ifdef HAVE_MINGW + +#define HOST_OS "Linux" +#define DISTNAME "Cross-compile" +#define DISTVER "1" + +#else extern char WIN_VERSION_LONG[]; extern char WIN_VERSION[]; #define HOST_OS WIN_VERSION_LONG #define DISTNAME "MVS" #define DISTVER WIN_VERSION + +#endif -- 2.39.5