From: Eric Bollengier Date: Thu, 15 Jan 2009 13:01:18 +0000 (+0000) Subject: ebl Too many external segfault in this way X-Git-Tag: Release-3.0.0~307 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=da4e438a68a797263ff09679a3f2e7cd48c7ab49;p=bacula%2Fbacula ebl Too many external segfault in this way git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8370 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/build-w64.patch b/bacula/patches/testing/build-w64.patch deleted file mode 100644 index be694733f0..0000000000 --- a/bacula/patches/testing/build-w64.patch +++ /dev/null @@ -1,542 +0,0 @@ -Index: src/win32/filed/vss.cpp -=================================================================== ---- src/win32/filed/vss.cpp (revision 8361) -+++ src/win32/filed/vss.cpp (working copy) -@@ -215,7 +215,7 @@ - const int VSSClient::GetWriterState(int nIndex) - { - alist* pV = (alist*)m_pAlistWriterState; -- return (int)pV->get(nIndex); -+ return (int)(intptr_t)pV->get(nIndex); - } - - void VSSClient::AppendWriterInfo(int nState, const char* pszInfo) -Index: src/win32/filed/Makefile -=================================================================== ---- src/win32/filed/Makefile (revision 8361) -+++ src/win32/filed/Makefile (working copy) -@@ -62,7 +62,7 @@ - $(LIBS_ZLIB) \ - -lole32 \ - -loleaut32 \ -- -lwsock32 \ -+ -lws2_32 \ - -luuid \ - -lcomctl32 - -Index: src/win32/build-depkgs-mingw-w64 -=================================================================== ---- src/win32/build-depkgs-mingw-w64 (revision 8361) -+++ src/win32/build-depkgs-mingw-w64 (working copy) -@@ -246,7 +246,14 @@ - perl util/mkdef.pl 32 libeay no-static-engine >ms/libeay32.def - perl util/mkdef.pl 32 ssleay >ms/ssleay32.def - perl util/mkdef.pl crypto ssl NT update -- CFLAG=-I${DEPPKG_DIR}/include do_make Makefile all -+ CFLAGS=-I${DEPPKG_DIR}/include do_make Makefile all -+ cd engines -+ touch lib4758cca.bad libaep.bad libatalla.bad libcswift.bad libchil.bad libgmp.bad libnuron.bad libsureware.bad libubsec.bad libcapi.bad -+ cd .. -+ sed -i 's/ cc/ mingw32-gcc/' crypto/comp/Makefile -+ sed -i 's/ ar/ mingw32-ar/' crypto/comp/Makefile -+ sed -i 's:^CFLAGS=:CFLAGS= -I${DEPPKG_DIR}/include:' crypto/comp/Makefile -+ CFLAGS=-I${DEPPKG_DIR}/include do_make Makefile all - echo Installing openssl - do_make Makefile install_sw - } -Index: src/win32/Makefile -=================================================================== ---- src/win32/Makefile (revision 8361) -+++ src/win32/Makefile (working copy) -@@ -1,4 +1,4 @@ --ECHO_CMD=@ -+ECHO_CMD= - - DIRS= dll \ - cats \ -Index: src/win32/compat/winhost.h -=================================================================== ---- src/win32/compat/winhost.h (revision 8361) -+++ src/win32/compat/winhost.h (working copy) -@@ -41,7 +41,11 @@ - - #define HOST_OS "Linux" - #define DISTNAME "Cross-compile" -+#ifdef MINGW64 -+#define DISTVER "Win64" -+#else - #define DISTVER "Win32" -+#endif - - #else - -Index: src/win32/compat/compat.cpp -=================================================================== ---- src/win32/compat/compat.cpp (revision 8361) -+++ src/win32/compat/compat.cpp (working copy) -@@ -733,7 +733,7 @@ - } - - int --fstat(int fd, struct stat *sb) -+fstat(intptr_t fd, struct stat *sb) - { - BY_HANDLE_FILE_INFORMATION info; - -@@ -827,7 +827,7 @@ - return -1; - } - -- rval = fstat((int)h, sb); -+ rval = fstat((intptr_t)h, sb); - CloseHandle(h); - - if (attr & FILE_ATTRIBUTE_DIRECTORY && -@@ -2201,7 +2201,7 @@ - // process terminates we can - // detect eof. - // ugly but convert WIN32 HANDLE to FILE* -- int rfd = _open_osfhandle((long)hChildStdoutRdDup, O_RDONLY | O_BINARY); -+ int rfd = _open_osfhandle((intptr_t)hChildStdoutRdDup, O_RDONLY | O_BINARY); - if (rfd >= 0) { - bpipe->rfd = _fdopen(rfd, "rb"); - } -@@ -2210,7 +2210,7 @@ - CloseHandle(hChildStdinRd); // close our read side so as not - // to interfre with child's copy - // ugly but convert WIN32 HANDLE to FILE* -- int wfd = _open_osfhandle((long)hChildStdinWrDup, O_WRONLY | O_BINARY); -+ int wfd = _open_osfhandle((intptr_t)hChildStdinWrDup, O_WRONLY | O_BINARY); - if (wfd >= 0) { - bpipe->wfd = _fdopen(wfd, "wb"); - } -@@ -2316,6 +2316,7 @@ - return result; - } - -+#ifndef MINGW64 - int - utime(const char *fname, struct utimbuf *times) - { -@@ -2367,6 +2368,7 @@ - } - return rval; - } -+#endif - - #if 0 - int -Index: src/win32/compat/compat.h -=================================================================== ---- src/win32/compat/compat.h (revision 8361) -+++ src/win32/compat/compat.h (working copy) -@@ -57,6 +57,15 @@ - - #include - -+#ifdef MINGW64 -+#include -+#define _declspec __declspec -+#endif -+ -+#ifdef _WIN64 -+# define GWL_USERDATA GWLP_USERDATA -+#endif -+ - typedef UINT64 u_int64_t; - typedef UINT64 uint64_t; - typedef INT64 int64_t; -@@ -74,8 +83,11 @@ - #endif - - #if !defined(_MSC_VER) || (_MSC_VER < 1400) // VC8+ --typedef long time_t; -+#ifndef _TIME_T_DEFINED -+#define _TIME_T_DEFINED -+ typedef long time_t; - #endif -+#endif - - #if __STDC__ && !defined(HAVE_MINGW) - typedef _dev_t dev_t; -@@ -129,10 +141,15 @@ - #endif - #endif - -+#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ -+#define _TIMEZONE_DEFINED -+ - struct timezone { - int foo; - }; - -+#endif -+ - int strcasecmp(const char*, const char *); - int gettimeofday(struct timeval *, struct timezone *); - -@@ -244,10 +261,12 @@ - ssize_t win32_write(int fd, const void *buffer, size_t count); - int win32_ioctl(int fd, unsigned long int req, ...); - --#define open _open -+#if !defined(MINGW64) -+# define open _open -+#endif - - int fcntl(int fd, int cmd, long arg); --int fstat(int fd, struct stat *sb); -+int fstat(intptr_t fd, struct stat *sb); - - int inet_aton(const char *cp, struct in_addr *inp); - int kill(int pid, int signo); -@@ -263,7 +282,6 @@ - #define snprintf _snprintf - #endif //HAVE_MINGW - -- - #define WNOHANG 0 - #define WIFEXITED(x) 0 - #define WEXITSTATUS(x) x -Index: src/win32/compat/print.cpp -=================================================================== ---- src/win32/compat/print.cpp (revision 8361) -+++ src/win32/compat/print.cpp (working copy) -@@ -340,7 +340,7 @@ - case 'p': - strvalue = (char *) va_arg(args, void *); - flags |= DP_F_UNSIGNED; -- fmtint(buffer, &currlen, maxlen, (long) strvalue, 16, min, max, -+ fmtint(buffer, &currlen, maxlen, (INT64) strvalue, 16, min, max, - flags, outch); - break; - case 'n': -Index: src/win32/libwin32/statusDialog.cpp -=================================================================== ---- src/win32/libwin32/statusDialog.cpp (revision 8361) -+++ src/win32/libwin32/statusDialog.cpp (working copy) -@@ -110,7 +110,7 @@ - - if (*p == '\n') { - SendMessage(statDlg->m_textWin, EM_SETSEL, (WPARAM)-1, (LPARAM)-1); -- SendMessage(statDlg->m_textWin, EM_REPLACESEL, 0, (LONG)"\r\n"); -+ SendMessage(statDlg->m_textWin, EM_REPLACESEL, 0, (LPARAM)"\r\n"); - } - - if (*p == '\0'){ -@@ -149,7 +149,7 @@ - { - if (show && !m_visible) { - DialogBoxParam(appInstance, MAKEINTRESOURCE(IDD_STATUS), NULL, -- (DLGPROC)dialogProc, (LONG)this); -+ (DLGPROC)dialogProc, (LPARAM)this); - } - } - -Index: src/win32/libwin32/bacula.rc -=================================================================== ---- src/win32/libwin32/bacula.rc (revision 8361) -+++ src/win32/libwin32/bacula.rc (working copy) -@@ -104,15 +104,14 @@ - * About Dialog - */ - IDD_ABOUT DIALOG 0, 0, 250, 145 --STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU - CAPTION "About Bacula" - FONT 8, "MS Sans Serif" - BEGIN -- DEFPUSHBUTTON "OK",IDOK,190,120,50,15 -+// DEFPUSHBUTTON "OK",IDOK,190,120,50,15 - // CONTROL "\3", IDC_BACULABMP,"Static",SS_ICON | SS_CENTERIMAGE | - // SS_SUNKEN,7,5,73,65 - #ifndef HAVE_MINGW -- CONTROL IDB_BACULABMP,IDB_BACULABMP,"Static",SS_BITMAP|SS_SUNKEN,7,5,32,32 -+// CONTROL IDB_BACULABMP,IDB_BACULABMP,"Static",SS_BITMAP|SS_SUNKEN,7,5,32,32 - #endif - - LTEXT " by Kern Sibbald",-1,134,38,78,10 -@@ -132,10 +131,10 @@ - * Status Dialog - */ - IDD_STATUS DIALOGEX 0, 0, 411, 244 --STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -+//STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME - CAPTION "Bacula Status" - FONT 8, "Courier New" - BEGIN -- DEFPUSHBUTTON "&OK",IDOK,355,5,51,15 -- EDITTEXT IDC_TEXTDISPLAY, 2, 2, 350, 240, WS_VSCROLL | WS_HSCROLL | WS_BORDER | ES_READONLY | ES_MULTILINE -+// DEFPUSHBUTTON "&OK",IDOK,355,5,51,15 -+// EDITTEXT IDC_TEXTDISPLAY, 2, 2, 350, 240, WS_VSCROLL | WS_HSCROLL | WS_BORDER | ES_READONLY | ES_MULTILINE - END -Index: src/win32/libwin32/main.cpp -=================================================================== ---- src/win32/libwin32/main.cpp (revision 8361) -+++ src/win32/libwin32/main.cpp (working copy) -@@ -53,7 +53,7 @@ - #include - - #undef _WIN32_IE --#define _WIN32_IE 0x0401 -+#define _WIN32_IE 0x0501 - #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0501 - #include -Index: src/win32/libwin32/trayMonitor.cpp -=================================================================== ---- src/win32/libwin32/trayMonitor.cpp (revision 8361) -+++ src/win32/libwin32/trayMonitor.cpp (working copy) -@@ -73,7 +73,7 @@ - } - - /* Save our class pointer */ -- SetWindowLong(m_hwnd, GWL_USERDATA, (LONG)this); -+ SetWindowLong(m_hwnd, GWL_USERDATA, (LPARAM)this); - - - // Load the icons for the tray -Index: src/win32/libwin32/aboutDialog.cpp -=================================================================== ---- src/win32/libwin32/aboutDialog.cpp (revision 8361) -+++ src/win32/libwin32/aboutDialog.cpp (working copy) -@@ -76,6 +76,6 @@ - { - if (show && !m_visible) { - DialogBoxParam(appInstance, MAKEINTRESOURCE(IDD_ABOUT), NULL, -- (DLGPROC)DialogProc, (LONG)this); -+ (DLGPROC)DialogProc, (LPARAM)this); - } - } -Index: src/win32/Makefile.inc.in -=================================================================== ---- src/win32/Makefile.inc.in (revision 8361) -+++ src/win32/Makefile.inc.in (working copy) -@@ -9,7 +9,7 @@ - - # Global Configuration - --ECHO_CMD = @ -+ECHO_CMD = - - # Main Bacula source dir - MAINDIR := @WIN32MAINDIR@ -@@ -37,12 +37,12 @@ - AR := $(MINGW_BIN)/mingw32-ar - RANLIB := $(MINGW_BIN)/mingw32-ranlib - WINDRES := $(MINGW_BIN)/mingw32-windres --DLLTOOL := $(MINGW_BIN)/../mingw32/bin/dlltool -+DLLTOOL := $(MINGW_BIN)/mingw32-dlltool - OBJCPY := $(MINGW_BIN)/mingw32-objcopy - NSIS_DIR := $(DEPKGS)/nsis - STAB2CV := $(DEPKGS)/tools/bin/stab2cv - --CFLAGS := -g -Wall -mno-cygwin -m32 -mwin32 -mthreads -O3 -fno-strict-aliasing -+CFLAGS := -g -Wall -mno-cygwin -mthreads -O3 -fno-strict-aliasing -DHAVE_VSS64 - LDFLAGS := -g -Wall -mno-cygwin -Wl,--disable-auto-import - - INCLUDE_DDK := -I$(MINGW_INCLUDE)/ddk -Index: src/win32/dll/bacula.def -=================================================================== ---- src/win32/dll/bacula.def (revision 8361) -+++ src/win32/dll/bacula.def (working copy) -@@ -23,8 +23,8 @@ - _Z17SetVSSPathConvertPFiPKcPciEPFiPKwPwiE - _Z18CreateChildProcessPKcPvS1_S1_ - _Z18GetApplicationNamePKcPPcPS0_ -+_Z18cvt_utime_to_ftimeRKxR9_FILETIME - _Z18cvt_ftime_to_utimeRK9_FILETIME --_Z18cvt_utime_to_ftimeRKlR9_FILETIME - _Z18unix_name_to_win32PPcS_ - _Z21Win32ConvCleanupCachev - _Z21make_wchar_win32_pathPcPi -@@ -37,7 +37,7 @@ - _Z5chownPKcjj - _Z5fcntlii - _Z5fcntliil --_Z5fstatiP4stat -+_Z5fstatxP4stat - _Z5lstatPKcP4stat - _Z5sleepi - _Z6execvpPKcPPc -@@ -73,11 +73,11 @@ - _Z19dbg_plugin_add_hookPFvP6PluginP6_iobufE - - ; print.o --_Z10__snprintfPcjPKcz - _Z10__vsprintfPcPKcS_ --_Z11__vsnprintfPcjPKcS_ --_Z4doprPcjPKcS_PFvS_PjjiE -+_Z11__vsnprintfPcyPKcS_ -+_Z10__snprintfPcyPKcz - _Z9__sprintfPcPKcz -+_Z4doprPcyPKcS_PFvS_PyyiE - - ; winapi.o - _Z17InitWinAPIWrapperv -@@ -89,12 +89,6 @@ - _Z14set_attributesP3JCRP4ATTRP5BFILE - _Z16encode_attribsExP3JCRPcP6FF_PKT - _Z18select_data_streamP6FF_PKT --_Z4plugIjEvRT_y --_Z4plugIlEvRT_y --_Z4plugImEvRT_y --_Z4plugIsEvRT_y --_Z4plugItEvRT_y --_Z4plugIyEvRT_y - _Z9win_errorP3JCRPcS1_ - _Z9win_errorP3JCRPcm - -@@ -109,15 +103,15 @@ - _Z18is_portable_backupP5BFILE - _Z19set_portable_backupP5BFILE - _Z14set_cmd_pluginP5BFILEP3JCR --_Z26processWin32BackupAPIBlockP5BFILEPvl -+_Z26processWin32BackupAPIBlockP5BFILEPvx - _Z27is_restore_stream_supportedi - _Z5binitP5BFILE - _Z5bopenP5BFILEPKcit --_Z5breadP5BFILEPvj -+_Z5breadP5BFILEPvy - _Z6bcloseP5BFILE - _Z6blseekP5BFILExi --_Z6bwriteP5BFILEPvj - _Z8is_bopenP5BFILE -+_Z6bwriteP5BFILEPvy - - ; create_file.o - _Z11create_fileP3JCRP4ATTRP5BFILEi -@@ -133,7 +127,7 @@ - _Z13is_in_filesetP6FF_PKT - _Z15init_find_filesv - _Z15term_find_filesP6FF_PKT --_Z16set_find_optionsP6FF_PKTil -+_Z16set_find_optionsP6FF_PKTix - _Z22get_win32_drivelettersP6FF_PKTPc - _Z25set_find_changed_functionP6FF_PKTPFbP3JCRS0_E - -@@ -269,7 +263,7 @@ - _ZN7BREGEXP7replaceEPKc - - ; bregex.o --_Z24re_registers_to_regmatchP12re_registersP12b_regmatch_tj -+_Z24re_registers_to_regmatchP12re_registersP12b_regmatch_ty - b_re_compile_fastmap - b_re_compile_initialize - b_re_compile_pattern -@@ -298,12 +292,12 @@ - _ZN5BSOCK4initEv - _ZN5BSOCK4recvEv - _ZN5BSOCK4sendEv --_ZN5BSOCK5_openEP3JCRPKcPcS4_ixPi -+_ZN5BSOCK4openEP3JCRPKcPcS4_ixPi -+_ZN5BSOCK7despoolEPFvxEx - _ZN5BSOCK5closeEv - _ZN5BSOCK5fsendEPKcz - _ZN5BSOCK6signalEi - _ZN5BSOCK7connectEP3JCRixxPKcPcS4_ii --_ZN5BSOCK7despoolEPFvlEl - _ZN5BSOCK7destroyEv - _ZN5BSOCK8fin_initEP3JCRiPKcS3_iP8sockaddr - _ZN5BSOCK8get_peerEPci -@@ -311,7 +305,7 @@ - _ZN5BSOCK9wait_dataEii - - ; bsys.o --_Z10b_strerroriPcj -+_Z10b_strerroriPcy - _Z11bmicrosleepii - _Z15create_pid_filePcPKci - _Z15delete_pid_filePcPKci -@@ -322,11 +316,11 @@ - _Z4dropPcS_ - _Z5bfreePv - _Z6bfgetsPciP6_iobuf --_Z7bcallocjj -+_Z7bcallocyy - _Z7bstrcmpPKcS0_ - _Z7cstrlenPKc --_Z8b_mallocPKcij --_Z8breallocPvj -+_Z8b_mallocPKciy -+_Z8breallocPvy - _Z8bstrncatPcPKci - _Z8bstrncatPcR8POOL_MEMi - _Z8bstrncpyPcPKci -@@ -349,7 +343,6 @@ - _Z17date_time_compareP9date_timeS0_ - _Z17get_current_btimev - _Z6tm_womii --_Z6tm_woyl - _Z9bstrftimePcix - _Z9bstrutimePcix - _Z9tm_decodeP9date_timeP2tm -@@ -359,7 +352,7 @@ - _Z16stop_bsock_timerP8btimer_t - _Z16stop_child_timerP8btimer_t - _Z17start_bsock_timerP5BSOCKj --_Z17start_child_timerP3JCRij -+_Z17start_child_timerP3JCRxj - _Z17stop_thread_timerP8btimer_t - _Z18start_thread_timerP3JCRP10pthread_t_j - -Index: src/win32/dll/Makefile -=================================================================== ---- src/win32/dll/Makefile (revision 8361) -+++ src/win32/dll/Makefile (working copy) -@@ -109,7 +109,7 @@ - $(LIBS_CRYPTO) \ - $(LIBS_PTHREADS) \ - $(LIBS_ZLIB) \ -- -lwsock32 \ -+ -lws2_32 \ - -lole32 \ - -loleaut32 \ - -luuid -Index: src/lib/message.c -=================================================================== ---- src/lib/message.c (revision 8361) -+++ src/lib/message.c (working copy) -@@ -370,10 +370,10 @@ - { - if (jcr) { - Mmsg(name, "%s/%s.%s.%d.mail", working_directory, my_name, -- jcr->Job, (int)(long)d); -+ jcr->Job, (int)(intptr_t)d); - } else { - Mmsg(name, "%s/%s.%s.%d.mail", working_directory, my_name, -- my_name, (int)(long)d); -+ my_name, (int)(intptr_t)d); - } - Dmsg1(850, "mailname=%s\n", name); - } -Index: src/lib/smartall.c -=================================================================== ---- src/lib/smartall.c (revision 8361) -+++ src/lib/smartall.c (working copy) -@@ -134,7 +134,7 @@ - head->ablineno = (sm_ushort)lineno; - head->abin_use = true; - /* Emplace end-clobber detector at end of buffer */ -- buf[nbytes - 1] = (uint8_t)((((long) buf) & 0xFF) ^ 0xC5); -+ buf[nbytes - 1] = (uint8_t)((((intptr_t) buf) & 0xFF) ^ 0xC5); - buf += HEAD_SIZE; /* Increment to user data start */ - if (++sm_buffers > sm_max_buffers) { - sm_max_buffers = sm_buffers; -@@ -212,7 +212,7 @@ - allocated space in the buffer by comparing the end of buffer - checksum with the address of the buffer. */ - -- if (((unsigned char *)cp)[head->ablen - 1] != ((((long) cp) & 0xFF) ^ 0xC5)) { -+ if (((unsigned char *)cp)[head->ablen - 1] != ((((intptr_t) cp) & 0xFF) ^ 0xC5)) { - V(mutex); - Emsg2(M_ABORT, 0, _("Buffer overrun called from %s:%d\n"), file, line); - } -@@ -463,7 +463,7 @@ - bad |= 0x2; - } - if (((unsigned char *) ap)[((struct abufhead *)ap)->ablen - 1] != -- ((((long) ap) & 0xFF) ^ 0xC5)) { -+ ((((intptr_t) ap) & 0xFF) ^ 0xC5)) { - bad |= 0x4; - } - } else { diff --git a/bacula/src/win32/build-depkgs-mingw-w64 b/bacula/src/win32/build-depkgs-mingw-w64 deleted file mode 100755 index 78234add8c..0000000000 --- a/bacula/src/win32/build-depkgs-mingw-w64 +++ /dev/null @@ -1,267 +0,0 @@ -#!/bin/sh -# -# This file is driven by the parameters that are defined in -# the file External-mingw-w64 -# - -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-mingw-w64 | cut -d'|' -f1 | cut -d'_' -f1 | tr A-Z a-z | sort -u | awk '{ print " " $1 }' -} - -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` -SCRIPT_DIR=`pwd` - -cd ../../.. -TOP_DIR=`pwd` - -if [ -e ${TOP_DIR}/cross-tools/mingw-w64/bin/x86_64-pc-mingw32-gcc ] -then - cd ${TOP_DIR}/cross-tools/mingw-w64/bin - BIN_DIR=`pwd` -else - echo "The GCC cross compiler isn\'t installed." - echo "You must run build-win64-cross-tools first" - exit 1 -fi - -[ ! -e ${TOP_DIR}/depkgs-mingw-w64 ] && mkdir ${TOP_DIR}/depkgs-mingw-w64 -cd ${TOP_DIR}/depkgs-mingw-w64 -DEPPKG_DIR=`pwd` - -export PATH=${BIN_DIR}:${PATH} - -[ ! -e bin ] && mkdir bin -[ ! -e src ] && mkdir src -[ ! -e include ] && mkdir include -[ ! -e lib ] && mkdir lib - -OLD_IFS=${IFS};IFS="|"; -while read package url dir mkd; do - echo "Got package ${package}" - case ${package} in - \#*) ;; - *) eval "URL_${package}=${url};DIR_${package}=${dir};MKD_${package}=${mkd}";; - esac -done < ${SCRIPT_DIR}/External-mingw-w64 -IFS=${OLD_IFS};unset OLD_IFS - -get_source() -{ - URL=$1 - SRC_DIR=$2 - MAKE_DIR=$3 - echo "Processing ${URL}" - ARCHIVE=`basename ${URL}` - - case ${ARCHIVE} in - *.tar.gz) ARCHIVER="tar xzf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.gz'`;; - *.tar.bz2) ARCHIVER="tar xjf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.bz2'`;; - *.zip) ARCHIVER="unzip -q"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; - *.exe) ARCHIVER=""; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; - *) echo Unsupported archive type - $ARCHIVE; exit 1;; - esac - - cd ${DEPPKG_DIR}/src - - if [ ! -e "${ARCHIVE}" ] - then - echo Downloading "${URL}" - if wget --passive-ftp "${URL}" - then - : - else - echo Unable to download ${ARCHIVE} - exit 1 - fi - fi - - [ -z "${ARCHIVER}" ] && return 0 - - if [ ! -e "${SRC_DIR}" -o "${CLOBBER_SOURCE}" = "true" ] - then - rm -rf ${SRC_DIR} - echo Extracting ${ARCHIVE} - if [ "${MAKE_DIR}" = "true" ] - then - mkdir ${SRC_DIR} - cd ${SRC_DIR} - ${ARCHIVER} ../${ARCHIVE} > ../${ARCHIVE}.log 2>&1 - else - ${ARCHIVER} ${ARCHIVE} > ${ARCHIVE}.log 2>&1 - cd ${SRC_DIR} - fi - return 0 - fi - - cd ${SRC_DIR} - return 1 -} - -parse_output() -{ - 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" \ - -e "s%.*Leaving directory[ ]\\+.${DEPPKG_DIR}/\\([^ ]\+.\).%Leaving \\1%p" \ - -e '/gcc \|g\+\+ \|ar /!d' \ - -e 's/ \(\.\.\/\)\+/ /g' \ - -e 's/.* \([^ ]\+\(\.c\|\.cpp\|\.cc\|\.cxx\)\)\( .*\|\)$/Compiling \1/p' \ - -e 's/.* \([^ ]\+\.s\)\( .*\|\)$/Assembling \1/p' \ - -e 's/.*ar [^ ]\+ \([^ ]\+\)\(\( [^ ]\+\.o\)\+\)/Updating \1 -\2/p' \ - -e 's/.* -o \([^ ]\+\)\( .*\|\)$/Linking \1/p' -} - -do_patch() -{ - PATCH_FILE=${SCRIPT_DIR}/patches/$1; shift - - if patch -f -p0 "$@" >>patch.log < ${PATCH_FILE} - then - : - else - echo "Patch failed - Check `pwd`/patch.log" > /dev/tty - exit 1 - fi -} - -do_make() -{ - if make -f "$@" 2>&1 - then - : - else - echo "Make failed - Check `pwd`/make.log" > /dev/tty - exit 1 - fi | tee -a make.log | parse_output -} - -process_zlib() -{ - if get_source "${URL_ZLIB}" "${DIR_ZLIB}" "${MKD_ZLIB}" - then - echo "Patching zlib" - >patch.log - do_patch zlib.patch - fi - echo Building zlib - > make.log - do_make win32/Makefile.mingw32 PREFIX=${DEPPKG_DIR} all - echo Installing zlib - do_make win32/Makefile.mingw32 PREFIX=${DEPPKG_DIR} install -} - -process_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=x86_64-pc-mingw32 \ - --prefix=${DEPPKG_DIR} \ - --enable-utf8 \ - --enable-unicode-properties >make.log 2>&1 - fi - echo Building PCRE - do_make Makefile PREFIX=${DEPPKG_DIR} all - echo Installing PCRE - do_make Makefile PREFIX=${DEPPKG_DIR} install -} - -process_db() -{ - if get_source "${URL_DB}" "${DIR_DB}" "${MKD_DB}" - then - echo No Patch - fi - cd build_unix - ../dist/configure --host=x86_64-pc-mingw32 --enable-mingw --prefix=${DEPPKG_DIR} - > make.log - echo Building DB - do_make Makefile - echo Installing DB - do_make Makefile install_setup install_include install_lib -} - -process_pthreads() -{ - if get_source "${URL_PTHREADS}" "${DIR_PTHREADS}" "${MKD_PTHREADS}" - then - echo Patching pthreads - >patch.log - do_patch pthreads-w64+bacula.patch - fi - echo Building pthreads - > make.log - do_make GNUmakefile GCE - echo Installing pthreads - rm -rf ${DEPPKG_DIR}/include/pthreads - mkdir ${DEPPKG_DIR}/include/pthreads - cp -p *.h ${DEPPKG_DIR}/include/pthreads - cp -p *.dll ${DEPPKG_DIR}/bin - cp -p *.a ${DEPPKG_DIR}/lib -} - -process_openssl() -{ - if get_source "${URL_OPENSSL}" "${DIR_OPENSSL}" "${MKD_OPENSSL}" - then - echo Patching openssl - >patch.log - do_patch openssl-w64.patch - echo Configuring openssl - ./Configure --prefix=${DEPPKG_DIR} \ - shared zlib-dynamic no-dso no-hw \ - threads \ - --with-zlib-include=${DEPPKG_DIR}/include \ - mingw64 > make.log 2>&1 - fi - echo Building openssl - perl util/mkdef.pl 32 libeay no-static-engine >ms/libeay32.def - perl util/mkdef.pl 32 ssleay >ms/ssleay32.def - perl util/mkdef.pl crypto ssl NT update - CFLAG=-I${DEPPKG_DIR}/include do_make Makefile all - echo Installing openssl - do_make Makefile install_sw -} - -if [ "$#" -eq 0 ] -then - process_zlib - process_pcre - process_pthreads - process_openssl -else - for dependency in "$@" - do - eval "process_${dependency}" - done -fi -#vss -#Need to download from Microsoft