From 58b469b39172fc10691dc25286519a6eea745d82 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Added gdbm. --- .hgignore | 1 + gdbm/gdbm-1.8.0-64offset.patch | 64 +++++ gdbm/gdbm-1.8.0-cflags.patch | 31 +++ gdbm/gdbm-1.8.0-fhs.patch | 56 ++++ gdbm/gdbm-1.8.0-jbj.patch | 11 + gdbm/mingw32-gdbm-1.8.0-windows.patch | 490 ++++++++++++++++++++++++++++++++++ gdbm/mingw32-gdbm.spec | 108 ++++++++ 7 files changed, 761 insertions(+) create mode 100644 gdbm/gdbm-1.8.0-64offset.patch create mode 100644 gdbm/gdbm-1.8.0-cflags.patch create mode 100644 gdbm/gdbm-1.8.0-fhs.patch create mode 100644 gdbm/gdbm-1.8.0-jbj.patch create mode 100644 gdbm/mingw32-gdbm-1.8.0-windows.patch create mode 100644 gdbm/mingw32-gdbm.spec diff --git a/.hgignore b/.hgignore index a41d693..f72c261 100644 --- a/.hgignore +++ b/.hgignore @@ -13,6 +13,7 @@ freetype/freetype-2.3.7.tar.bz2 freetype/freetype-doc-2.3.7.tar.bz2 gcc/gcc-core-4.3.2.tar.bz2 gcc/gcc-g++-4.3.2.tar.bz2 +gdbm/gdbm-1.8.0.tar.gz gettext/gettext-0.17.tar.gz glib2/glib-2.18.0.tar.bz2 glib2/glib-2.18.1.tar.bz2 diff --git a/gdbm/gdbm-1.8.0-64offset.patch b/gdbm/gdbm-1.8.0-64offset.patch new file mode 100644 index 0000000..c76dfac --- /dev/null +++ b/gdbm/gdbm-1.8.0-64offset.patch @@ -0,0 +1,64 @@ +diff -buNr gdbm-1.8.0.orig/falloc.c gdbm-1.8.0/falloc.c +--- gdbm-1.8.0.orig/falloc.c Tue May 18 20:16:06 1999 ++++ gdbm-1.8.0/falloc.c Thu Apr 25 18:20:45 2002 +@@ -180,6 +180,13 @@ + avail_block *new_blk; + int index; + ++ if (dbf->header->avail.count == dbf->header->avail.size) ++ { ++ /* We're kind of stuck here, so we re-split the header in order to ++ avoid crashing. Sigh. */ ++ push_avail_block(dbf); ++ } ++ + /* Set up variables. */ + new_el.av_adr = dbf->header->avail.next_block; + new_el.av_size = ( ( (dbf->header->avail.size * sizeof (avail_elem)) >> 1) +@@ -196,12 +203,24 @@ + if (num_bytes != new_el.av_size) _gdbm_fatal (dbf, "read error"); + + /* Add the elements from the new block to the header. */ +- for (index = 0; index < new_blk->count; index++) ++ index = 0; ++ while (index < new_blk->count) ++ { ++ while(index < new_blk->count ++ && dbf->header->avail.count < dbf->header->avail.size) + { + /* With luck, this will merge a lot of blocks! */ + _gdbm_put_av_elem(new_blk->av_table[index], + dbf->header->avail.av_table, +- &dbf->header->avail.count, dbf->coalesce_blocks); ++ &dbf->header->avail.count, TRUE); ++ index++; ++ } ++ if (dbf->header->avail.count == dbf->header->avail.size) ++ { ++ /* We're kind of stuck here, so we re-split the header in order to ++ avoid crashing. Sigh. */ ++ push_avail_block(dbf); ++ } + } + + /* Fix next_block, as well. */ +@@ -210,9 +229,17 @@ + /* We changed the header. */ + dbf->header_changed = TRUE; + +- /* Free the previous avail block. */ ++ /* Free the previous avail block. It is possible that the header table ++ is now FULL, which will cause us to overflow it! */ ++ if (dbf->header->avail.count == dbf->header->avail.size) ++ { ++ /* We're kind of stuck here, so we re-split the header in order to ++ avoid crashing. Sigh. */ ++ push_avail_block(dbf); ++ } ++ + _gdbm_put_av_elem (new_el, dbf->header->avail.av_table, +- &dbf->header->avail.count, dbf->coalesce_blocks); ++ &dbf->header->avail.count, TRUE); + free (new_blk); + } + diff --git a/gdbm/gdbm-1.8.0-cflags.patch b/gdbm/gdbm-1.8.0-cflags.patch new file mode 100644 index 0000000..5a0b53a --- /dev/null +++ b/gdbm/gdbm-1.8.0-cflags.patch @@ -0,0 +1,31 @@ +--- gdbm-1.8.0/Makefile.in.cflags Tue Jun 12 19:50:21 2001 ++++ gdbm-1.8.0/Makefile.in Tue Jun 12 19:57:45 2001 +@@ -17,22 +17,23 @@ + MAKEINFO = makeinfo + TEXI2DVI = texi2dvi + +-DEFS = ++DEFS = @DEFS@ + + # Where the system [n]dbm routines are... + LIBS = @LIBS@ -lc + + # SunOS 4 users might wish to add '-fpcc-struct-return' to CFLAGS. see INSTALL. +-CFLAGS = -O +-LDFLAGS = ++CPPFLAGS = @CPPFLAGS@ ++CFLAGS = @CFLAGS@ ++LDFLAGS = @LDFLAGS@ + + # Common prefix for installation directories +-prefix = /usr/local ++prefix = /usr + exec_prefix = $(prefix) + mandir = $(prefix)/man + + # Directory in which to put libgdbm.a. +-libdir = $(exec_prefix)/lib ++libdir = $(prefix)/lib + # The include directory for gdbm.h and dbm.h. + includedir = $(prefix)/include + # Info and man directories. diff --git a/gdbm/gdbm-1.8.0-fhs.patch b/gdbm/gdbm-1.8.0-fhs.patch new file mode 100644 index 0000000..09c425d --- /dev/null +++ b/gdbm/gdbm-1.8.0-fhs.patch @@ -0,0 +1,56 @@ +--- gdbm-1.8.0/Makefile.in.fhs Mon Jun 5 15:12:15 2000 ++++ gdbm-1.8.0/Makefile.in Mon Jun 5 15:16:34 2000 +@@ -14,10 +14,6 @@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + +-# File ownership and group +-BINOWN = bin +-BINGRP = bin +- + MAKEINFO = makeinfo + TEXI2DVI = texi2dvi + +@@ -33,8 +29,7 @@ + # Common prefix for installation directories + prefix = /usr/local + exec_prefix = $(prefix) +-binprefix = $(exec_prefix) +-manprefix = $(prefix) ++mandir = $(prefix)/man + + # Directory in which to put libgdbm.a. + libdir = $(exec_prefix)/lib +@@ -42,7 +37,7 @@ + includedir = $(prefix)/include + # Info and man directories. + infodir = $(prefix)/info +-man3dir = $(prefix)/man/man3 ++man3dir = $(mandir)/man3 + manext = 3 + + #### End of system configuration section. #### +@@ -122,18 +117,14 @@ + install: libgdbm.la gdbm.h gdbm.info + $(srcdir)/mkinstalldirs $(libdir) $(includedir) $(man3dir) $(infodir) + $(LIBTOOL) install -c libgdbm.la $(libdir)/libgdbm.la +- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h $(includedir)/gdbm.h +- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \ +- $(man3dir)/gdbm.3 +- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \ +- $(infodir)/gdbm.info ++ $(INSTALL_DATA) gdbm.h $(includedir)/gdbm.h ++ $(INSTALL_DATA) $(srcdir)/gdbm.3 $(man3dir)/gdbm.3 ++ $(INSTALL_DATA) $(srcdir)/gdbm.info $(infodir)/gdbm.info + + install-compat: + $(srcdir)/mkinstalldirs $(includedir) +- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \ +- $(includedir)/dbm.h +- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \ +- $(includedir)/ndbm.h ++ $(INSTALL_DATA) $(srcdir)/dbm.h $(includedir)/dbm.h ++ $(INSTALL_DATA) $(srcdir)/ndbm.h $(includedir)/ndbm.h + + #libgdbm.a: $(OBJS) gdbm.h + # rm -f libgdbm.a diff --git a/gdbm/gdbm-1.8.0-jbj.patch b/gdbm/gdbm-1.8.0-jbj.patch new file mode 100644 index 0000000..37f494e --- /dev/null +++ b/gdbm/gdbm-1.8.0-jbj.patch @@ -0,0 +1,11 @@ +--- gdbm-1.8.0/gdbmopen.c.jbj Tue Aug 10 10:57:38 1999 ++++ gdbm-1.8.0/gdbmopen.c Tue Aug 10 10:59:06 1999 +@@ -214,7 +214,7 @@ + file_block_size = block_size; + + /* Get space for the file header. */ +- dbf->header = (gdbm_file_header *) malloc (file_block_size); ++ dbf->header = (gdbm_file_header *) calloc (1, file_block_size); + if (dbf->header == NULL) + { + gdbm_close (dbf); diff --git a/gdbm/mingw32-gdbm-1.8.0-windows.patch b/gdbm/mingw32-gdbm-1.8.0-windows.patch new file mode 100644 index 0000000..e73098e --- /dev/null +++ b/gdbm/mingw32-gdbm-1.8.0-windows.patch @@ -0,0 +1,490 @@ +diff -urN gdbm-1.8.0.orig/configure.in gdbm-1.8.0.flock/configure.in +--- gdbm-1.8.0.orig/configure.in 1999-05-19 01:17:02.000000000 +0100 ++++ gdbm-1.8.0.flock/configure.in 2008-10-03 16:55:30.000000000 +0100 +@@ -5,6 +5,7 @@ + AC_PROG_CC + AC_PROG_CPP + AC_PROG_INSTALL ++AC_LIBTOOL_WIN32_DLL + AM_PROG_LIBTOOL + dnl AC_PROG_RANLIB + dnl AC_WORDS_BIGENDIAN +@@ -13,8 +14,8 @@ + AC_HAVE_HEADERS(memory.h) + AC_CHECK_LIB(dbm, main) + AC_CHECK_LIB(ndbm, main) +-AC_HAVE_FUNCS(rename ftruncate flock bcopy fsync) +-AC_REPLACE_FUNCS(getopt) ++AC_HAVE_FUNCS(rename ftruncate bcopy) ++AC_REPLACE_FUNCS(flock fsync getopt) + AC_OFF_T + AC_ST_BLKSIZE + AC_OUTPUT(Makefile) +diff -urN gdbm-1.8.0.orig/dbminit.c gdbm-1.8.0.flock/dbminit.c +--- gdbm-1.8.0.orig/dbminit.c 1999-05-19 01:16:05.000000000 +0100 ++++ gdbm-1.8.0.flock/dbminit.c 2008-10-03 17:07:20.000000000 +0100 +@@ -91,6 +91,7 @@ + } + } + ++#if (!defined _WIN32 && !defined __WIN32__) || defined __CYGWIN__ + /* If the database is new, link "file.dir" to "file.pag". This is done + so the time stamp on both files is the same. */ + if (stat (dir_file, &dir_stat) == 0) +@@ -116,6 +117,7 @@ + goto done; + } + } ++#endif + + ret = 0; + +diff -urN gdbm-1.8.0.orig/dbmopen.c gdbm-1.8.0.flock/dbmopen.c +--- gdbm-1.8.0.orig/dbmopen.c 1999-05-19 01:16:05.000000000 +0100 ++++ gdbm-1.8.0.flock/dbmopen.c 2008-10-03 17:07:33.000000000 +0100 +@@ -105,6 +105,7 @@ + goto done; + } + ++#if (!defined _WIN32 && !defined __WIN32__) || defined __CYGWIN__ + /* If the database is new, link "file.dir" to "file.pag". This is done + so the time stamp on both files is the same. */ + if (stat (dir_file, &dir_stat) == 0) +@@ -130,6 +131,7 @@ + goto done; + } + } ++#endif + + done: + free (pag_file); +diff -urN gdbm-1.8.0.orig/flock.c gdbm-1.8.0.flock/flock.c +--- gdbm-1.8.0.orig/flock.c 1970-01-01 01:00:00.000000000 +0100 ++++ gdbm-1.8.0.flock/flock.c 2008-10-03 17:02:01.000000000 +0100 +@@ -0,0 +1,212 @@ ++/* Emulate flock on platforms that lack it, primarily Windows and MinGW. ++ ++ This is derived from sqlite3 sources. ++ http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/os_win.c ++ http://www.sqlite.org/copyright.html ++ ++ Written by Richard W.M. Jones ++ ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++#include "systems.h" ++ ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++/* _get_osfhandle */ ++#include ++ ++/* LockFileEx */ ++#define WIN32_LEAN_AND_MEAN ++#include ++ ++#include ++ ++/* Determine the current size of a file. Because the other braindead ++ * APIs we'll call need lower/upper 32 bit pairs, keep the file size ++ * like that too. ++ */ ++static BOOL ++file_size (HANDLE h, DWORD * lower, DWORD * upper) ++{ ++ *lower = GetFileSize (h, upper); ++ return 1; ++} ++ ++/* LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems. */ ++#ifndef LOCKFILE_FAIL_IMMEDIATELY ++# define LOCKFILE_FAIL_IMMEDIATELY 1 ++#endif ++ ++/* Acquire a lock. */ ++static BOOL ++do_lock (HANDLE h, int non_blocking, int exclusive) ++{ ++ BOOL res; ++ DWORD size_lower, size_upper; ++ OVERLAPPED ovlp; ++ int flags = 0; ++ ++ /* We're going to lock the whole file, so get the file size. */ ++ res = file_size (h, &size_lower, &size_upper); ++ if (!res) ++ return 0; ++ ++ /* Start offset is 0, and also zero the remaining members of this struct. */ ++ memset (&ovlp, 0, sizeof ovlp); ++ ++ if (non_blocking) ++ flags |= LOCKFILE_FAIL_IMMEDIATELY; ++ if (exclusive) ++ flags |= LOCKFILE_EXCLUSIVE_LOCK; ++ ++ return LockFileEx (h, flags, 0, size_lower, size_upper, &ovlp); ++} ++ ++/* Unlock reader or exclusive lock. */ ++static BOOL ++do_unlock (HANDLE h) ++{ ++ int res; ++ DWORD size_lower, size_upper; ++ ++ res = file_size (h, &size_lower, &size_upper); ++ if (!res) ++ return 0; ++ ++ return UnlockFile (h, 0, 0, size_lower, size_upper); ++} ++ ++/* Now our BSD-like flock operation. */ ++int ++flock (int fd, int operation) ++{ ++ HANDLE h = (HANDLE) _get_osfhandle (fd); ++ DWORD res; ++ int non_blocking; ++ ++ if (h == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ non_blocking = operation & LOCK_NB; ++ operation &= ~LOCK_NB; ++ ++ switch (operation) ++ { ++ case LOCK_SH: ++ res = do_lock (h, non_blocking, 0); ++ break; ++ case LOCK_EX: ++ res = do_lock (h, non_blocking, 1); ++ break; ++ case LOCK_UN: ++ res = do_unlock (h); ++ break; ++ default: ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Map Windows errors into Unix errnos. As usual MSDN fails to ++ * document the permissible error codes. ++ */ ++ if (!res) ++ { ++ DWORD err = GetLastError (); ++ switch (err) ++ { ++ /* This means someone else is holding a lock. */ ++ case ERROR_LOCK_VIOLATION: ++ errno = EAGAIN; ++ break; ++ ++ /* Out of memory. */ ++ case ERROR_NOT_ENOUGH_MEMORY: ++ errno = ENOMEM; ++ break; ++ ++ case ERROR_BAD_COMMAND: ++ errno = EINVAL; ++ break; ++ ++ /* Unlikely to be other errors, but at least don't lose the ++ * error code. ++ */ ++ default: ++ errno = err; ++ } ++ ++ return -1; ++ } ++ ++ return 0; ++} ++ ++#else /* !Windows */ ++ ++/* We know how to implement flock in terms of fcntl. */ ++ ++#ifdef HAVE_FCNTL_H ++#include ++#endif ++ ++#ifdef HAVE_UNISTD_H ++#include ++#endif ++ ++int ++flock (int fd, int operation) ++{ ++ int cmd, r; ++ struct flock fl; ++ ++ if (operation & LOCK_NB) ++ cmd = F_SETLK; ++ else ++ cmd = F_SETLKW; ++ operation &= ~LOCK_NB; ++ ++ memset (&fl, 0, sizeof fl); ++ fl.l_whence = SEEK_SET; ++ /* l_start & l_len are 0, which as a special case means "whole file". */ ++ ++ switch (operation) ++ { ++ case LOCK_SH: ++ fl.l_type = F_RDLCK; ++ break; ++ case LOCK_EX: ++ fl.l_type = F_WRLCK; ++ break; ++ case LOCK_UN: ++ fl.l_type = F_UNLCK; ++ break; ++ default: ++ errno = EINVAL; ++ return -1; ++ } ++ ++ r = fcntl (fd, cmd, &fl); ++ if (r == -1 && errno == EACCES) ++ errno = EAGAIN; ++ ++ return r; ++} ++ ++#endif /* !Windows */ +diff -urN gdbm-1.8.0.orig/fsync.c gdbm-1.8.0.flock/fsync.c +--- gdbm-1.8.0.orig/fsync.c 1970-01-01 01:00:00.000000000 +0100 ++++ gdbm-1.8.0.flock/fsync.c 2008-10-03 17:02:15.000000000 +0100 +@@ -0,0 +1,83 @@ ++/* Emulate fsync on platforms that lack it, primarily Windows and ++ cross-compilers like MinGW. ++ ++ This is derived from sqlite3 sources. ++ http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/os_win.c ++ http://www.sqlite.org/copyright.html ++ ++ Written by Richard W.M. Jones ++ ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++#include "systems.h" ++#include ++ ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++/* _get_osfhandle */ ++#include ++ ++/* FlushFileBuffers */ ++#define WIN32_LEAN_AND_MEAN ++#include ++ ++#include ++ ++int ++fsync (int fd) ++{ ++ HANDLE h = (HANDLE) _get_osfhandle (fd); ++ DWORD err; ++ ++ if (h == INVALID_HANDLE_VALUE) ++ { ++ errno = EBADF; ++ return -1; ++ } ++ ++ if (!FlushFileBuffers (h)) ++ { ++ /* Translate some Windows errors into rough approximations of Unix ++ * errors. MSDN is useless as usual - in this case it doesn't ++ * document the full range of errors. ++ */ ++ err = GetLastError (); ++ switch (err) ++ { ++ /* eg. Trying to fsync a tty. */ ++ case ERROR_INVALID_HANDLE: ++ errno = EINVAL; ++ break; ++ ++ default: ++ errno = EIO; ++ } ++ return -1; ++ } ++ ++ return 0; ++} ++ ++#else /* !Windows */ ++ ++int fsync (int fd) ++{ ++ sync (); ++ sync (); ++} ++ ++#endif /* !Windows */ +diff -urN gdbm-1.8.0.orig/Makefile.in gdbm-1.8.0.flock/Makefile.in +--- gdbm-1.8.0.orig/Makefile.in 2008-10-03 16:32:57.000000000 +0100 ++++ gdbm-1.8.0.flock/Makefile.in 2008-10-03 17:12:25.000000000 +0100 +@@ -20,7 +20,7 @@ + DEFS = @DEFS@ + + # Where the system [n]dbm routines are... +-LIBS = @LIBS@ -lc ++LIBS = @LIBS@ + + # SunOS 4 users might wish to add '-fpcc-struct-return' to CFLAGS. see INSTALL. + CPPFLAGS = @CPPFLAGS@ +@@ -132,10 +132,10 @@ + # ar q libgdbm.a $(OBJS) + # $(RANLIB) libgdbm.a + +-libgdbm.la: $(LOBJS) gdbm.h ++libgdbm.la: $(LOBJS) @LTLIBOBJS@ gdbm.h + rm -f libgdbm.la + $(LIBTOOL) --mode=link $(CC) -o libgdbm.la -rpath $(libdir) \ +- -version-info $(SHLIB_VER) $(LOBJS) ++ -version-info $(SHLIB_VER) -no-undefined $(LOBJS) @LTLIBOBJS@ + + gdbm.h: gdbm.proto gdbmerrno.h gdbm.proto2 + rm -f gdbm.h +@@ -146,19 +146,19 @@ + chmod -w gdbm.h + + testgdbm: testgdbm.o libgdbm.la @LIBOBJS@ +- $(LIBTOOL) $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@ ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@ + + testdbm: testdbm.o libgdbm.la +- $(LIBTOOL) $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la + + tdbm: testdbm.o +- $(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS) ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o tdbm testdbm.o libgdbm.la $(LIBS) + + testndbm.o: testndbm.c + $(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c + + testndbm: testndbm.o libgdbm.la +- $(LIBTOOL) $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la + + tndbm.o: testndbm.c + cp $(srcdir)/testndbm.c ./tndbm.c +@@ -166,10 +166,10 @@ + rm -f ./tndbm.c + + tndbm: tndbm.o +- $(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS) ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o tndbm tndbm.o libgdbm.la $(LIBS) + + conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@ +- $(LIBTOOL) $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@ ++ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@ + + lintgdbm: + lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c +diff -urN gdbm-1.8.0.orig/systems.h gdbm-1.8.0.flock/systems.h +--- gdbm-1.8.0.orig/systems.h 1999-05-19 03:09:46.000000000 +0100 ++++ gdbm-1.8.0.flock/systems.h 2008-10-03 16:54:09.000000000 +0100 +@@ -59,9 +59,9 @@ + #define L_SET SEEK_SET + #endif + +-/* Do we have flock? (BSD...) */ +- +-#if HAVE_FLOCK ++#ifndef HAVE_FLOCK ++extern int flock (int fd, int operation); ++#endif + + #ifndef LOCK_SH + #define LOCK_SH 1 +@@ -83,36 +83,6 @@ + #define READLOCK_FILE(dbf) lock_val = flock (dbf->desc, LOCK_SH + LOCK_NB) + #define WRITELOCK_FILE(dbf) lock_val = flock (dbf->desc, LOCK_EX + LOCK_NB) + +-#else +- +-/* Assume it is done like System V. */ +- +-#define UNLOCK_FILE(dbf) \ +- { \ +- struct flock flock; \ +- flock.l_type = F_UNLCK; \ +- flock.l_whence = SEEK_SET; \ +- flock.l_start = flock.l_len = 0L; \ +- fcntl (dbf->desc, F_SETLK, &flock); \ +- } +-#define READLOCK_FILE(dbf) \ +- { \ +- struct flock flock; \ +- flock.l_type = F_RDLCK; \ +- flock.l_whence = SEEK_SET; \ +- flock.l_start = flock.l_len = 0L; \ +- lock_val = fcntl (dbf->desc, F_SETLK, &flock); \ +- } +-#define WRITELOCK_FILE(dbf) \ +- { \ +- struct flock flock; \ +- flock.l_type = F_WRLCK; \ +- flock.l_whence = SEEK_SET; \ +- flock.l_start = flock.l_len = 0L; \ +- lock_val = fcntl (dbf->desc, F_SETLK, &flock); \ +- } +-#endif +- + /* Do we have bcopy? */ + #if !HAVE_BCOPY + #if HAVE_MEMORY_H +@@ -122,9 +92,8 @@ + #define bcopy(d1, d2, n) memcpy(d2, d1, n) + #endif + +-/* Do we have fsync? */ +-#if !HAVE_FSYNC +-#define fsync(f) {sync(); sync();} ++#ifndef HAVE_FSYNC ++extern int fsync (int fd); + #endif + + /* Default block size. Some systems do not have blocksize in their diff --git a/gdbm/mingw32-gdbm.spec b/gdbm/mingw32-gdbm.spec new file mode 100644 index 0000000..8ea56e2 --- /dev/null +++ b/gdbm/mingw32-gdbm.spec @@ -0,0 +1,108 @@ +%define __strip %{_mingw32_strip} +%define __objdump %{_mingw32_objdump} +%define _use_internal_dependency_generator 0 +%define __find_requires %{_mingw32_findrequires} +%define __find_provides %{_mingw32_findprovides} + +Name: mingw32-gdbm +Version: 1.8.0 +Release: 1%{?dist} +Summary: MinGW port of GNU database routines + +License: GPLv2+ +Group: Development/Libraries +URL: http://www.gnu.org/software/gdbm/ +Source0: ftp://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Patch0: gdbm-1.8.0-jbj.patch +Patch1: gdbm-1.8.0-fhs.patch +Patch2: gdbm-1.8.0-cflags.patch +Patch3: gdbm-1.8.0-64offset.patch + +Patch100: mingw32-gdbm-1.8.0-windows.patch + +BuildArch: noarch + +BuildRequires: mingw32-filesystem >= 26 +BuildRequires: mingw32-gcc +BuildRequires: mingw32-binutils + +BuildRequires: libtool + + +%description +Gdbm is a GNU database indexing library, including routines which use +extensible hashing. Gdbm works in a similar way to standard UNIX dbm +routines. Gdbm is useful for developers who write C applications and +need access to a simple and efficient database or who are building C +applications which will use such a database. + +This is the MinGW Windows port of the libraries and development tools. + + +%prep +%setup -q -n gdbm-%{version} +%patch0 -p 1 -b .jbj +%patch1 -p 1 -b .fhs +%patch2 -p 1 -b .cflags +%patch3 -p1 -b .offset + +%patch100 -p1 -b .windows + + +%build +libtoolize --force --copy +aclocal +autoreconf +%{_mingw32_configure} +make libdir=%{_mingw32_libdir} all progs + + +%install +rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{_mingw32_prefix} install + +# Install the binaries. Arguable whether we really want these. +install conv2gdbm.exe tdbm.exe testdbm.exe testgdbm.exe testndbm.exe tndbm.exe \ + $RPM_BUILD_ROOT%{_mingw32_bindir} + +# Native Fedora package seems to fluff this, but as far as I +# can tell they are trying to create which +# links to . +pushd $RPM_BUILD_ROOT%{_mingw32_includedir} +mkdir gdbm +cd gdbm +ln -s ../gdbm.h +popd + +# Remove the static library. +rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libgdbm.a + +# Remove man page and info file which duplicate what is in native package. +rm -r $RPM_BUILD_ROOT%{_mingw32_prefix}/man +rm -r $RPM_BUILD_ROOT%{_mingw32_prefix}/info + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%{_mingw32_bindir}/conv2gdbm.exe +%{_mingw32_bindir}/tdbm.exe +%{_mingw32_bindir}/testdbm.exe +%{_mingw32_bindir}/testgdbm.exe +%{_mingw32_bindir}/testndbm.exe +%{_mingw32_bindir}/tndbm.exe +%{_mingw32_bindir}/libgdbm-2.dll +%{_mingw32_libdir}/libgdbm.dll.a +%{_mingw32_libdir}/libgdbm.la +%{_mingw32_includedir}/gdbm.h +%{_mingw32_includedir}/gdbm + + +%changelog +* Fri Oct 3 2008 Richard W.M. Jones - 1.8.0-1 +- Initial RPM release. -- 1.8.3.1