From 26fa01dbeb272b7e6bbdc744d53195ae5e9a29a8 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Sat, 17 Apr 2004 17:38:37 +0000 Subject: [PATCH] mingw support. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1225 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/findlib/winapi.h | 12 +- bacula/src/lib/Makefile.mingw | 232 ++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+), 5 deletions(-) create mode 100644 bacula/src/lib/Makefile.mingw diff --git a/bacula/src/findlib/winapi.h b/bacula/src/findlib/winapi.h index 4672fdd49f..102eda1809 100644 --- a/bacula/src/findlib/winapi.h +++ b/bacula/src/findlib/winapi.h @@ -1,6 +1,6 @@ /* * Windows APIs that are different for each system. - * We use pointers to the entry points so that a + * We use pointers to the entry points so that a * single binary will run on all Windows systems. * * Kern Sibbald MMIII @@ -28,7 +28,9 @@ #ifndef __WINAPI_H #define __WINAPI_H #if defined(HAVE_WIN32) +#if !defined(HAVE_MINGW) // native.h not present on mingw #include +#endif #include #endif #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) @@ -36,7 +38,7 @@ typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE); typedef BOOL (WINAPI * t_AdjustTokenPrivileges)(HANDLE, BOOL, - PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); + PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); typedef BOOL (WINAPI * t_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID); extern t_OpenProcessToken p_OpenProcessToken; @@ -45,15 +47,15 @@ extern t_LookupPrivilegeValue p_LookupPrivilegeValue; /* In KERNEL32.DLL */ typedef BOOL (WINAPI * t_GetFileAttributesEx)(LPCTSTR, GET_FILEEX_INFO_LEVELS, - LPVOID); + LPVOID); typedef BOOL (WINAPI * t_SetProcessShutdownParameters)(DWORD, DWORD); typedef BOOL (WINAPI * t_BackupRead)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); typedef BOOL (WINAPI * t_BackupWrite)(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*); extern t_GetFileAttributesEx p_GetFileAttributesEx; extern t_SetProcessShutdownParameters p_SetProcessShutdownParameters; -extern t_BackupRead p_BackupRead; -extern t_BackupWrite p_BackupWrite; +extern t_BackupRead p_BackupRead; +extern t_BackupWrite p_BackupWrite; #endif diff --git a/bacula/src/lib/Makefile.mingw b/bacula/src/lib/Makefile.mingw new file mode 100644 index 0000000000..dab73ebe0b --- /dev/null +++ b/bacula/src/lib/Makefile.mingw @@ -0,0 +1,232 @@ +# $Id$ + +# autoconf/Make.common.in -*- Makefile -*- +# release date (man), LSM date, version number/name, current maintainer +DATE="15 Apr 2004" +LSMDATE=15Apr04 +VERSION=1.35.0 +VERNAME=bacula-$(VERSION)# +MAINT=Kern Sibbald# +MAINTEMAIL=# +WEBMAINT=# +WEBMAINTEMAIL=# +WEBPAGE=# +FTPSITENAME=# +FTPSITEDIR=# +#------------------------------------------------------------------------- + +SHELL = /bin/sh + +# Installation target directories & other installation stuff +prefix = +exec_prefix = +binprefix = +manprefix = +sbindir = /sbin +sysconfdir = /etc/bacula +scriptdir = /etc/bacula +mandir = ${prefix}/man/man1 +manext = 1 + +# Tools & program stuff +CC = gcc +CPP = gcc -E +CXX = g++ +MV = /usr/bin/mv +RM = /usr/bin/rm +RMF = /usr/bin/rm -f +CP = /usr/bin/cp +SED = /usr/bin/sed +AWK = /usr/bin/awk +ECHO = /usr/bin/echo +CMP = /usr/bin/cmp +TBL = /usr/bin/tbl +AR = ar +RANLIB = ranlib +INSTALL = /usr/bin/install -c +# add the -s to the following in PRODUCTION mode +INSTALL_PROGRAM = /usr/bin/install -c -m 754 +INSTALL_DATA = /usr/bin/install -c -m 644 +INSTALL_SCRIPT = /usr/bin/install -c -m 754 +INSTALL_CONFIG = /usr/bin/install -c -m 640 + +# Flags & libs +CFLAGS = -g -O2 -Wall +CPPFLAGS = +LDFLAGS = -O +TTOOL_LDFLAGS = +DEFS = -DHAVE_WIN32 -DHAVE_MINGW +LIBS = -lpthread +DINCLUDE = +DLIB = +DB_LIBS = + +# Windows (cygwin) flags +WCFLAGS = -mwindows +WLDFLAGS = -mwindows + +# X Include directory +#XINC = @XPM_CFLAGS@ + +# extra libraries needed by X on some systems, X library location +#XLIB = @XPM_LIBS@ -lX11 + +# End of common section of the Makefile +#------------------------------------------------------------------------- + +CWEB = @CWEB@ +CTANGLE = $(CWEB)/ctangle +CWEAVE = $(CWEB)/cweave +TEXINPUTS = TEXINPUTS=.:$(CWEB): + +# FIXME -- These should be found by autoconf +TEX = tex +PDFTEX = pdftex +XDVI = xdvi +DVIPS = dvips + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = .. +# top dir +topdir = ../.. +# this dir relative to top dir +thisdir = src/lib + + +DEBUG= + +GMP_INC=@GMP_INC@ + +first_rule: all +dummy: + +LIBSRCS = alloc.c attr.c base64.c bsys.c bget_msg.c \ + bnet.c bnet_server.c \ + bpipe.c bshm.c btime.c \ + cram-md5.c crc32.c daemon.c edit.c fnmatch.c \ + hmac.c idcache.c jcr.c lex.c alist.c dlist.c \ + md5.c message.c mem_pool.c parse_conf.c \ + queue.c rwlock.c scan.c serial.c sha1.c \ + semlock.c signal.c smartall.c tree.c \ + util.c var.c watchdog.c workq.c timers.c + + +LIBOBJS = alloc.o attr.o base64.o bsys.o bget_msg.o \ + bnet.o bnet_server.o \ + bpipe.o bshm.o btime.o \ + cram-md5.o crc32.o daemon.o edit.o fnmatch.o \ + hmac.o idcache.o jcr.o lex.o alist.o dlist.o \ + md5.o message.o mem_pool.o parse_conf.o \ + queue.o rwlock.o scan.o serial.o sha1.o \ + semlock.o signal.o smartall.o tree.o \ + util.o var.o watchdog.o workq.o timers.o + + + +EXTRAOBJS = + + +.SUFFIXES: .c .o .ch .dvi .pdf .tex .view .w .1 +.PHONY: +.DONTCARE: + +# inference rules +compat.o: ../win32/compat/compat.cpp + $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I../win32/compat \ + -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) -o compat.o ../win32/compat/compat.cpp + +.c.o: + $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I../win32/compat -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + +.cc.o: + $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I../win32/compat -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + +.w.c: + $(CTANGLE) $< + +.w.tex: + $(CWEAVE) $< + +.tex.dvi: + ( $(TEXINPUTS) ; export TEXINPUTS; $(TEX) $< ) + +.tex.pdf: + ( $(TEXINPUTS) ; export TEXINPUTS; $(PDFTEX) $< ) + +.dvi.view: + $(XDVI) -s 0 $< + +#------------------------------------------------------------------------- +all: Makefile libbac.a + @echo "==== Make of lib is good ====" + @echo " " + +libbac.a: $(LIBOBJS) compat.o + $(AR) rc $@ $(LIBOBJS) compat.o + $(RANLIB) $@ + + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +rwlock_test: + rm -f rwlock.o + $(CXX) -DTEST_RWLOCK $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) rwlock.c + $(CXX) $(LDFLAGS) -L. -o $@ rwlock.o $(LIBS) $(DLIB) -lbac -lm + rm -f rwlock.o + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) rwlock.c + +md5sum: + rm -f md5.o + $(CXX) -DMD5_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) md5.c + $(CXX) $(LDFLAGS) -L. -o $@ md5.o $(LIBS) $(DLIB) -lbac -lm + rm -f md5.o + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) md5.c + + +sha1sum: + rm -f sha1.o + $(CXX) -DSHA1_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sha1.c + $(CXX) $(LDFLAGS) -L. -o $@ sha1.o $(LIBS) $(DLIB) -lbac -lm + rm -f sha1.o + $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) md5.c + +install: + +uninstall: + +clean: + $(RMF) *.a core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3 + $(RMF) rwlock_test md5sum sha1sum + +realclean: clean + $(RMF) tags + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile; $(RMF) -r CVS) + +# Semi-automatic generation of dependencies: +# Use gcc -MM because X11 `makedepend' doesn't work on all systems +# and it also includes system headers. +# `semi'-automatic since dependencies are generated at distribution time. + +depend: + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ + $(MV) Makefile.bak Makefile; \ + echo -e "Something went wrong\n\a"; \ + fi + +# ----------------------------------------------------------------------- +# DO NOT DELETE: nice dependency list follows \ No newline at end of file -- 2.39.5