From 4279c2a8001b4980cb1846488f68a2181409cce8 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 26 Apr 2006 05:20:17 +0000 Subject: [PATCH] Implement cross compiled bconsole git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2971 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kes-1.39 | 2 + bacula/src/console/console.c | 5 +- bacula/src/filed/filed.c | 10 +--- bacula/src/filed/filed.h | 2 +- bacula/src/lib/Makefile.in | 4 +- bacula/src/lib/attr.c | 4 +- bacula/src/lib/bget_msg.c | 6 +- bacula/src/lib/message.c | 3 +- bacula/src/lib/winapi.c | 7 +++ bacula/src/version.h | 4 +- bacula/src/win32/Makefile.in | 110 +++++++++++++++++++++++++---------- 11 files changed, 102 insertions(+), 55 deletions(-) diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 9b7b094c83..b8a864255f 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,6 +2,8 @@ Kern Sibbald General: +26Apr06 +- Implement cross compiled bconsole 25Apr06 - Fix barcode test, eliminate BOOL (doesn't exist on Linux). - Write first cut of README.mingw32 diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index 7611e9008e..9f20f6de0a 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -7,7 +7,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 @@ -53,9 +53,6 @@ extern int rl_catch_signals; /* Imported functions */ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons); -/* Dummy functions */ -int generate_daemon_event(JCR *jcr, const char *event) { return 1; } - /* Forward referenced functions */ static void terminate_console(int sig); static int check_resources(); diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index f274444fe6..ae021bbf2c 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -7,7 +7,7 @@ * */ /* - 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 @@ -36,16 +36,8 @@ static int check_resources(); /* Exported variables */ CLIENT *me; /* my resource */ -char OK_msg[] = "2000 OK\n"; -char TERM_msg[] = "2999 Terminate\n"; bool no_signals = false; -#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) -const int win32_client = 1; -#else -const int win32_client = 0; -#endif - #define CONFIG_FILE "./bacula-fd.conf" /* default config file */ diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h index cfe3e56dec..906aab7c6c 100644 --- a/bacula/src/filed/filed.h +++ b/bacula/src/filed/filed.h @@ -32,6 +32,6 @@ #define uLongf uint32_t #endif -extern const int win32_client; /* Are we running on Windows? */ +extern int win32_client; /* Are we running on Windows? */ extern CLIENT *me; /* "Global" Client resource */ diff --git a/bacula/src/lib/Makefile.in b/bacula/src/lib/Makefile.in index 1256c46f86..b7693cfc3b 100644 --- a/bacula/src/lib/Makefile.in +++ b/bacula/src/lib/Makefile.in @@ -32,7 +32,7 @@ LIBSRCS = alloc.c attr.c base64.c berrno.c bsys.c bget_msg.c \ res.c rwlock.c scan.c serial.c sha1.c \ semlock.c signal.c smartall.c tls.c tree.c \ util.c var.c watchdog.c workq.c btimers.c \ - address_conf.c pythonlib.c + address_conf.c pythonlib.c winapi.c LIBOBJS = alloc.o attr.o base64.o berrno.o bsys.o bget_msg.o \ @@ -45,7 +45,7 @@ LIBOBJS = alloc.o attr.o base64.o berrno.o bsys.o bget_msg.o \ res.o rwlock.o scan.o serial.o sha1.o \ semlock.o signal.o smartall.o tls.o tree.o \ util.o var.o watchdog.o workq.o btimers.o \ - address_conf.o pythonlib.o + address_conf.o pythonlib.o winapi.o EXTRAOBJS = @OBJLIST@ diff --git a/bacula/src/lib/attr.c b/bacula/src/lib/attr.c index 1b56f86618..c041f5fd56 100644 --- a/bacula/src/lib/attr.c +++ b/bacula/src/lib/attr.c @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2003-2005 Kern Sibbald + Copyright (C) 2003-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 @@ -23,7 +23,7 @@ #include "bacula.h" #include "jcr.h" -extern const int win32_client; +extern int win32_client; ATTR *new_attr() { diff --git a/bacula/src/lib/bget_msg.c b/bacula/src/lib/bget_msg.c index 912aa5786b..9a5005b4fb 100644 --- a/bacula/src/lib/bget_msg.c +++ b/bacula/src/lib/bget_msg.c @@ -8,7 +8,7 @@ * */ /* - Copyright (C) 2001-2005 Kern Sibbald + Copyright (C) 2001-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 @@ -24,8 +24,8 @@ #include "bacula.h" /* pull in global headers */ -extern char OK_msg[]; -extern char TERM_msg[]; +static char OK_msg[] = "2000 OK\n"; +static char TERM_msg[] = "2999 Terminate\n"; #define msglvl 500 diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 724015463e..a394f0dac5 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -7,7 +7,7 @@ * */ /* - 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 @@ -51,6 +51,7 @@ char con_fname[500]; /* Console filename */ FILE *con_fd = NULL; /* Console file descriptor */ brwlock_t con_lock; /* Console lock structure */ + #ifdef HAVE_POSTGRESQL char catalog_db[] = "PostgreSQL"; #else diff --git a/bacula/src/lib/winapi.c b/bacula/src/lib/winapi.c index d8f8bbc420..5f649edcc4 100644 --- a/bacula/src/lib/winapi.c +++ b/bacula/src/lib/winapi.c @@ -26,6 +26,8 @@ #include "winapi.h" +int win32_client = 1; + #ifdef WIN32_VSS #include "vss.h" #endif @@ -244,4 +246,9 @@ InitWinAPIWrapper() #endif /* WIN32_VSS */ } +#else + +/* Not Windows */ +int win32_client = 0; + #endif diff --git a/bacula/src/version.h b/bacula/src/version.h index 77fa477a42..e0810e5c87 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.10" -#define BDATE "25 April 2006" -#define LSMDATE "25Apr06" +#define BDATE "26 April 2006" +#define LSMDATE "26Apr06" /* Debug flags */ #undef DEBUG diff --git a/bacula/src/win32/Makefile.in b/bacula/src/win32/Makefile.in index e42a432939..56e8c068c8 100644 --- a/bacula/src/win32/Makefile.in +++ b/bacula/src/win32/Makefile.in @@ -119,15 +119,15 @@ verify_vol.o: ../filed/verify_vol.c ###################################################################### -# Files in win32/compat +# Files in src/win32/compat OBJS_COMPAT = \ - $(OBJDIR)/print.o \ - $(OBJDIR)/compat.o \ - $(OBJDIR)/getopt.o \ - $(OBJDIR)/vss.o \ - $(OBJDIR)/vss_xp.o \ - $(OBJDIR)/vss_w2k3.o \ + $(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 @@ -230,7 +230,7 @@ save-cwd.o: ../findlib/save-cwd.c ###################################################################### -# Files in src/win32/lib, based on files in src/lib +# Files files in src/lib LIB_OBJS = \ $(OBJDIR)/address_conf.o \ @@ -282,24 +282,6 @@ LIB_OBJS = \ $(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 - # # Rules for generating from ../lib # @@ -448,19 +430,85 @@ winapi.o: ../lib/winapi.c workq.o: ../lib/workq.c $(CXX) -c ../lib/workq.c -o $(OBJDIR)/workq.o + +###################################################################### + +# Files in src/console +OBJS_CONSOLE = \ + $(OBJDIR)/cons_authenticate.o \ + $(OBJDIR)/console.o \ + $(OBJDIR)/console_conf.o + +cons_authenticate.o: ../console/authenticate.c + $(CXX) -I../src/console -c ../console/authenticate.c -o $(OBJDIR)/cons_authenticate.o + +console.o: ../console/console.c + $(CXX) -I../src/console -c ../console/console.c -o $(OBJDIR)/console.o + +console_conf.o: ../console/console_conf.c + $(CXX) -I../src/console -c ../console/console_conf.c -o $(OBJDIR)/console_conf.o + +###################################################################### + + +FD_OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_WIN) $(OBJS_FINDLIB) $(OBJS_FILED) + +FD_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 + +CONS_OBJS = $(LIB_OBJS) $(OBJS_COMPAT) $(OBJS_CONSOLE) + +CONS_LIBS = \ + -L$(LIB_MINGW) \ + $(LIB_PTHREADS) \ + $(LIB_SSL) \ + $(LIB_CRYPTO) \ + $(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 + + + # Targets -all: bacula-fd.exe +all: bacula-fd.exe bconsole.exe clean: rm -f $(OBJDIR)/*.o $(OBJDIR)/bacula-fd.exe $(OBJDIR)/winres.res - rm -f pthreadGCE.dll + rm -f pthreadGCE.dll $(OBJDIR)/bconsole.exe + +# Link the File daemon executable ... +bacula-fd.exe: $(FD_OBJS) + $(CXX) $(FD_OBJS) $(FD_LIBS) -o $(OBJDIR)/bacula-fd.exe + cp -f $(DEPKGS)/pthreads/pthreadGCE.dll . -# Link the executable ... -bacula-fd.exe: $(OBJS) - $(CXX) $(OBJS) $(LIBS) -o $(OBJDIR)/bacula-fd.exe +# Link the File daemon executable ... +bconsole.exe: $(CONS_OBJS) + $(CXX) $(CONS_OBJS) $(CONS_LIBS) -o $(OBJDIR)/bconsole.exe cp -f $(DEPKGS)/pthreads/pthreadGCE.dll . + + + # TODO ... # Fix vss files: check for consistent levels of pointer indirection # vss_generic.c: VSS_TIMEOUT defined as empty/null -- 2.39.5