From fbf5d24abc9e07b71bf520c71356dc3584b0a15c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 20 Jul 2008 23:32:31 +0000 Subject: [PATCH] Implement Win32 bat changes made to Branch-2.4 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7410 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/bsock.c | 8 +- bacula/src/lib/bsock.h | 4 +- .../{README.mingw => README.mingw32} | 22 +++-- bacula/src/qt-console/console/console.cpp | 2 +- bacula/src/qt-console/mainwin.cpp | 6 -- bacula/src/qt-console/mainwin.h | 2 + bacula/src/qt-console/make-win32 | 16 +++ bacula/src/qt-console/win32-x-g++/qmake.conf | 97 ------------------- bacula/src/qt-console/win32/qmake.conf | 97 +++++++++++++++++++ .../{win32-x-g++ => win32}/qplatformdefs.h | 0 bacula/technotes-2.5 | 2 + 11 files changed, 136 insertions(+), 120 deletions(-) rename bacula/src/qt-console/{README.mingw => README.mingw32} (84%) create mode 100755 bacula/src/qt-console/make-win32 delete mode 100644 bacula/src/qt-console/win32-x-g++/qmake.conf create mode 100644 bacula/src/qt-console/win32/qmake.conf rename bacula/src/qt-console/{win32-x-g++ => win32}/qplatformdefs.h (100%) diff --git a/bacula/src/lib/bsock.c b/bacula/src/lib/bsock.c index 18b3019a01..67ce39f83a 100644 --- a/bacula/src/lib/bsock.c +++ b/bacula/src/lib/bsock.c @@ -774,7 +774,7 @@ void BSOCK::restore_blocking (int flags) * 0 if timeout * -1 if error */ -int BSOCK::wait_data(int sec) +int BSOCK::wait_data(int sec, int usec) { fd_set fdset; struct timeval tv; @@ -783,7 +783,7 @@ int BSOCK::wait_data(int sec) FD_SET((unsigned)m_fd, &fdset); for (;;) { tv.tv_sec = sec; - tv.tv_usec = 0; + tv.tv_usec = usec; switch (select(m_fd + 1, &fdset, NULL, NULL, &tv)) { case 0: /* timeout */ b_errno = 0; @@ -804,7 +804,7 @@ int BSOCK::wait_data(int sec) /* * As above, but returns on interrupt */ -int BSOCK::wait_data_intr(int sec) +int BSOCK::wait_data_intr(int sec, int usec) { fd_set fdset; struct timeval tv; @@ -812,7 +812,7 @@ int BSOCK::wait_data_intr(int sec) FD_ZERO(&fdset); FD_SET((unsigned)m_fd, &fdset); tv.tv_sec = sec; - tv.tv_usec = 0; + tv.tv_usec = usec; switch (select(m_fd + 1, &fdset, NULL, NULL, &tv)) { case 0: /* timeout */ b_errno = 0; diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index f5ba43a26f..ccea240602 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -110,8 +110,8 @@ public: int set_nonblocking(); int set_blocking(); void restore_blocking(int flags); - int wait_data(int sec); - int wait_data_intr(int sec); + int wait_data(int sec, int usec=0); + int wait_data_intr(int sec, int usec=0); bool authenticate_director(const char *name, const char *password, TLS_CONTEXT *tls_ctx, char *msg, int msglen); bool set_locking(); /* in bsock.c */ diff --git a/bacula/src/qt-console/README.mingw b/bacula/src/qt-console/README.mingw32 similarity index 84% rename from bacula/src/qt-console/README.mingw rename to bacula/src/qt-console/README.mingw32 index 185808ed7a..7f416e051e 100644 --- a/bacula/src/qt-console/README.mingw +++ b/bacula/src/qt-console/README.mingw32 @@ -33,7 +33,6 @@ bacula setup $ cd bacula/src/win32 $ make -Don't run any configure, make or make install Make sure that bacula/src/win32/release/bacula.dll is built QT4 setup @@ -51,13 +50,12 @@ $ wine qt-win-opensource-4.4.0-mingw.exe $ cp -r ~/.wine/drive_c/Qt/4.4.0/src/ depkgs-mingw32/include $ cp -r ~/.wine/drive_c/Qt/4.4.0/include depkgs-mingw32/include/qt $ cp -r ~/.wine/drive_c/Qt/4.4.0/lib depkgs-mingw32/lib/qt +# copy ~/.wine/drive_c/Qt/4.4.0/bin/QtCore4.dll to src/win32/release +# copy ~/.wine/drive_c/Qt/4.4.0/bin/QtGui4.dll to src/win32/release MINGW setup ----------- -If you have a problem with wchar.c about a redefinition of struct stat (i think you will have -this problem too) Apply this patch to your cross-tool installation. - --- cross-tools/mingw32/mingw32/include/wchar.h.org 2008-07-13 15:18:52.000000000 +0200 +++ cross-tools/mingw32/mingw32/include/wchar.h 2008-07-12 14:47:10.000000000 +0200 @@ -394,7 +394,7 @@ @@ -74,9 +72,14 @@ Compile bat ----------- $ cd bacula/src/qt-console -$ cp bat.pro.mingw bat.pro -$ qmake-qt4 -spec win32-x-g++ -$ make +$ ./make-win32 + +Cleanup +------- +$ cd bacula/src/qt-console +$ ./make-win32 clean + + Run Bat on Windows ------------------ @@ -92,17 +95,16 @@ You'll need mingwm10.dll bat.conf -You can find QT dlls on ~/.wine/drive_c/Qt/4.4.0/bin +You can find the Qt dlls in ~/.wine/drive_c/Qt/4.4.0/bin Run Bat with wine ----------------- $ cd bacula/src/qt-console/debug # configure a bat.conf -# copy all dll to this directory +# copy all dlls to this directory $ wine bat That all, easy isn't it ? - diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 8dfb282615..d437f42ab4 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -641,7 +641,7 @@ int Console::read() int stat = 0; while (m_sock) { for (;;) { - stat = bnet_wait_data_intr(m_sock, 1); + stat = m_sock->wait_data_intr(0, 50000); if (stat > 0) { break; } diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index eeefdf650c..a03e221025 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -266,11 +266,6 @@ void MainWin::closeEvent(QCloseEvent *event) { m_isClosing = true; writeSettings(); -/* foreach(Console *console, m_consoleHash){ - console->writeSettings(); - console->terminate(); - console->closeStackPage(); - } */ /* close all non console pages, this will call settings in destructors */ while (m_consoleHash.count() < m_pagehash.count()) { foreach(Pages *page, m_pagehash) { @@ -846,4 +841,3 @@ void MainWin::readPreferences() m_rtRestore3Debug = settings.value("rtRestore3Debug", false).toBool(); settings.endGroup(); } - diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 64df8f51da..383f8e3ede 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -113,7 +113,9 @@ public slots: void estimateButtonClicked(); void browseButtonClicked(); void statusPageButtonClicked(); +#ifdef HAVE_QWT void jobPlotButtonClicked(); +#endif void restoreButtonClicked(); void undockWindowButton(); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/make-win32 b/bacula/src/qt-console/make-win32 new file mode 100755 index 0000000000..4de01cf1b0 --- /dev/null +++ b/bacula/src/qt-console/make-win32 @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Used to build the Win32 version of bat +# +rm -f debug/bat.exe +if test -e ../config.h ; then + mv -f ../config.h ../config.h.orig +fi +qmake -spec win32 -unix -o Makefile.mingw32 bat.pro.mingw32 +make -j3 -f Makefile.mingw32 $1 +if test -e ../config.h.orig ; then + mv -f ../config.h.orig ../config.h +fi +if test -d ../win32/release; then + cp -f debug/bat.exe ../win32/release +fi diff --git a/bacula/src/qt-console/win32-x-g++/qmake.conf b/bacula/src/qt-console/win32-x-g++/qmake.conf deleted file mode 100644 index db2114adef..0000000000 --- a/bacula/src/qt-console/win32-x-g++/qmake.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# qmake configuration for win32-g++ -# -# Written for MinGW -# - -MAKEFILE_GENERATOR = MINGW -TEMPLATE = app -CONFIG += qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header -QT += core gui -DEFINES += UNICODE QT_LARGEFILE_SUPPORT -QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 - -QMAKE_EXT_OBJ = .o -QMAKE_EXT_RES = _res.o - -QMAKE_CC = ../../../cross-tools/mingw32/bin/mingw32-gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = byacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -DHAVE_MINGW -DHAVE_WIN32 -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses - -QMAKE_CXX = ../../../cross-tools/mingw32/bin/mingw32-g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DHAVE_MINGW -DHAVE_WIN32 -DHAVE_ZLIB_H -DHAVE_LIBZ -DHAVE_CRYPTO -DHAVE_OPENSSL -DHAVE_TLS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD -QMAKE_CXXFLAGS_RTTI_ON = -frtti -QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti -QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions - -QMAKE_INCDIR = ../../../depkgs-mingw32/include/pthreads ../../../depkgs-mingw32/include/ ../win32/compat -QMAKE_INCDIR_QT = ../../../depkgs-mingw32/include/qt -QMAKE_LIBDIR_QT = ../../../depkgs-mingw32/lib/qt - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -QMAKE_LINK = ../../../cross-tools/mingw32/bin/mingw32-g++ -QMAKE_LFLAGS = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -mno-cygwin -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc -mwindows - -QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl -QMAKE_LFLAGS_EXCEPTIONS_OFF = -QMAKE_LFLAGS_RELEASE = -Wl,-s -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console -QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows -QMAKE_LFLAGS_DLL = -shared -QMAKE_LINK_OBJECT_MAX = 10 -QMAKE_LINK_OBJECT_SCRIPT= object_script - - -QMAKE_LIBS = -lwsock32 -QMAKE_LIBS_CORE = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32 -QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 -QMAKE_LIBS_NETWORK = -lws2_32 -QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 -lgdi32 -luser32 -QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32 -QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain - -#!isEmpty(QMAKE_SH) { - MINGW_IN_SHELL = 1 - QMAKE_DIR_SEP = / - QMAKE_COPY = cp - QMAKE_COPY_DIR = cp -r - QMAKE_MOVE = mv - QMAKE_DEL_FILE = rm -f - QMAKE_MKDIR = mkdir -p - QMAKE_DEL_DIR = rm -rf - QMAKE_CHK_DIR_EXISTS = test -d - -QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc -QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic -QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc - -QMAKE_IDL = midl -QMAKE_LIB = ../../../cross-tools/mingw32/bin/mingw32-ar -ru -QMAKE_RC = ../../../cross-tools/mingw32/bin/mingw32-windres -QMAKE_ZIP = zip -r -9 - -QMAKE_STRIP = ../../../cross-tools/mingw32/bin/mingw32-strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -load(qt_config) diff --git a/bacula/src/qt-console/win32/qmake.conf b/bacula/src/qt-console/win32/qmake.conf new file mode 100644 index 0000000000..0799397f31 --- /dev/null +++ b/bacula/src/qt-console/win32/qmake.conf @@ -0,0 +1,97 @@ +# +# qmake configuration for win32-g++ +# +# Written for MinGW +# + +MAKEFILE_GENERATOR = MINGW +TEMPLATE = app +CONFIG += qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header +QT += core gui +DEFINES += UNICODE QT_LARGEFILE_SUPPORT +QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 + +QMAKE_EXT_OBJ = .o +QMAKE_EXT_RES = _res.o + +QMAKE_CC = ../../../cross-tools/mingw32/bin/mingw32-gcc +QMAKE_LEX = flex +QMAKE_LEXFLAGS = +QMAKE_YACC = byacc +QMAKE_YACCFLAGS = -d +QMAKE_CFLAGS = -DHAVE_MINGW -DHAVE_WIN32 +QMAKE_CFLAGS_DEPS = -M +QMAKE_CFLAGS_WARN_ON = -Wall +QMAKE_CFLAGS_WARN_OFF = -w +QMAKE_CFLAGS_RELEASE = -O2 +QMAKE_CFLAGS_DEBUG = -g +QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses + +QMAKE_CXX = ../../../cross-tools/mingw32/bin/mingw32-g++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DHAVE_MINGW -DHAVE_WIN32 -DHAVE_ZLIB_H -DHAVE_LIBZ -DHAVE_CRYPTO -DHAVE_OPENSSL -DHAVE_TLS +QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_RTTI_ON = -frtti +QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti +QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads +QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions + +QMAKE_INCDIR = ../../../depkgs-mingw32/include/pthreads ../../../depkgs-mingw32/include/ ../win32/compat +QMAKE_INCDIR_QT = ../../../depkgs-mingw32/include/qt +QMAKE_LIBDIR_QT = ../../../depkgs-mingw32/lib/qt + +QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src +QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< +QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src +QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +QMAKE_LINK = ../../../cross-tools/mingw32/bin/mingw32-g++ +QMAKE_LFLAGS = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -mno-cygwin -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc + +QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl +QMAKE_LFLAGS_EXCEPTIONS_OFF = +QMAKE_LFLAGS_RELEASE = -Wl,-s +QMAKE_LFLAGS_DEBUG = +QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console +QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows +QMAKE_LFLAGS_DLL = -shared +QMAKE_LINK_OBJECT_MAX = 10 +QMAKE_LINK_OBJECT_SCRIPT= object_script + + +QMAKE_LIBS = -lwsock32 +QMAKE_LIBS_CORE = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32 +QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 +QMAKE_LIBS_NETWORK = -lws2_32 +QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 -lgdi32 -luser32 +QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32 +QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain + +MINGW_IN_SHELL = 1 +QMAKE_DIR_SEP = / +QMAKE_COPY = cp +QMAKE_COPY_DIR = cp -r +QMAKE_MOVE = mv +QMAKE_DEL_FILE = rm -f +QMAKE_MKDIR = mkdir -p +QMAKE_DEL_DIR = rm -rf +QMAKE_RCC = rcc +QMAKE_CHK_DIR_EXISTS = test -d + +QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc +QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic +QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc + +QMAKE_IDL = midl +QMAKE_LIB = ../../../cross-tools/mingw32/bin/mingw32-ar -ru +QMAKE_RC = ../../../cross-tools/mingw32/bin/mingw32-windres +QMAKE_ZIP = zip -r -9 + +QMAKE_STRIP = ../../../cross-tools/mingw32/bin/mingw32-strip +QMAKE_STRIPFLAGS_LIB += --strip-unneeded +load(qt_config) diff --git a/bacula/src/qt-console/win32-x-g++/qplatformdefs.h b/bacula/src/qt-console/win32/qplatformdefs.h similarity index 100% rename from bacula/src/qt-console/win32-x-g++/qplatformdefs.h rename to bacula/src/qt-console/win32/qplatformdefs.h diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 5243827b55..ad3e964980 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -32,6 +32,8 @@ separator in console (!$%&'()*+,-/:;<>?[]^`{|}~) General: +21Jul08 +kes Implement Win32 bat changes made to Branch-2.4 20Jul08 kes Tweak separator command in console to start disabled and allow defining no separator character. Also make code a -- 2.39.5