From 701680f0be7ed7224eff28e7fb5c567647611dfe Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sun, 4 Nov 2012 20:48:07 -0800 Subject: [PATCH] add packaging --- packaging/baselibs.conf | 4 + packaging/gdbm-1.8.3-no-build-date.patch | 14 +++ packaging/gdbm-fix_testprogs.patch | 138 ++++++++++++++++++++++ packaging/gdbm-protoize_dbm_headers.patch | 114 ++++++++++++++++++ packaging/gdbm-prototype_static_functions.patch | 11 ++ packaging/gdbm.spec | 148 ++++++++++++++++++++++++ 6 files changed, 429 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/gdbm-1.8.3-no-build-date.patch create mode 100644 packaging/gdbm-fix_testprogs.patch create mode 100644 packaging/gdbm-protoize_dbm_headers.patch create mode 100644 packaging/gdbm-prototype_static_functions.patch create mode 100644 packaging/gdbm.spec diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..c468cd5 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,4 @@ +libgdbm3 +gdbm-devel + requires -gdbm- + requires "libgdbm3- = " diff --git a/packaging/gdbm-1.8.3-no-build-date.patch b/packaging/gdbm-1.8.3-no-build-date.patch new file mode 100644 index 0000000..5b44fd9 --- /dev/null +++ b/packaging/gdbm-1.8.3-no-build-date.patch @@ -0,0 +1,14 @@ +Index: version.c +=================================================================== +--- version.c.orig 2002-10-16 00:00:42.000000000 +0200 ++++ version.c 2010-08-30 01:41:23.653696000 +0200 +@@ -29,8 +29,4 @@ + #include "autoconf.h" + + /* Keep a string with the version number in it! */ +-const char * gdbm_version = "GDBM version 1.8.3. 10/15/2002" +-#if defined(__STDC__) && defined(__DATE__) && defined(__TIME__) +- " (built " __DATE__ " " __TIME__ ")" +-#endif +- ; ++const char * gdbm_version = "GDBM version 1.8.3. 10/15/2002"; diff --git a/packaging/gdbm-fix_testprogs.patch b/packaging/gdbm-fix_testprogs.patch new file mode 100644 index 0000000..2872256 --- /dev/null +++ b/packaging/gdbm-fix_testprogs.patch @@ -0,0 +1,138 @@ +--- testdbm.c ++++ testdbm.c +@@ -31,6 +31,9 @@ + #include "autoconf.h" + + #include ++#if HAVE_STRING_H ++#include ++#endif + #include + #if HAVE_STDLIB_H + #include +@@ -39,19 +42,15 @@ + #include + #endif + #include ++#ifdef GNU ++#include "dbm.h" ++#else ++#include ++#endif + + #define TRUE 1 + #define FALSE 0 + +-typedef struct { +- char *dptr; +- int dsize; +-} datum; +- +-extern datum fetch (); +-extern datum firstkey (); +-extern datum nextkey (); +- + /* The test program allows one to call all the routines plus the hash function. + The commands are single letter commands. The user is prompted for all other + information. The commands are q (quit), f (fetch), s (store), d (delete), +@@ -123,7 +122,7 @@ + + case 'f': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + return_data = fetch (key_data); +@@ -135,11 +134,11 @@ + + case 's': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + printf ("data -> "); +- gets (data_line); ++ fgets (data_line, sizeof(data_line), stdin); + data_data.dsize = strlen (data_line)+1; + if (store (key_data, data_data) != 0) + printf ("Item not inserted. \n"); +@@ -148,7 +147,7 @@ + + case 'd': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + if (delete (key_data) != 0) +--- testgdbm.c ++++ testgdbm.c +@@ -37,10 +37,22 @@ + + #include "getopt.h" + ++#if defined(__GNUC__) && __GNUC__ >=3 ++# define NORETURN __attribute__((__noreturn__)) ++#else ++# define NORETURN ++#endif ++ + extern const char * gdbm_version; + + extern const char *gdbm_strerror __P((gdbm_error)); + ++void print_bucket __P((hash_bucket *bucket, char *mesg)); ++void _gdbm_print_avail_list __P((gdbm_file_info *dbf)); ++void _gdbm_print_bucket_cache __P((gdbm_file_info *dbf)); ++void usage __P((char *)) NORETURN; ++ ++ + gdbm_file_info *gdbm_file; + + /* Debug procedure to print the contents of the current hash bucket. */ +--- testndbm.c ++++ testndbm.c +@@ -42,6 +42,9 @@ + #if HAVE_FCNTL_H + #include + #endif ++#if HAVE_STRING_H ++#include ++#endif + #ifdef GNU + #include "ndbm.h" + #else +@@ -120,7 +123,7 @@ + + case 'f': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + return_data = dbm_fetch (dbm_file, key_data); +@@ -132,11 +135,11 @@ + + case 's': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + printf ("data -> "); +- gets (data_line); ++ fgets (data_line, sizeof(data_line), stdin); + data_data.dsize = strlen (data_line)+1; + if (dbm_store (dbm_file, key_data, data_data, DBM_REPLACE) != 0) + printf ("Item not inserted. \n"); +@@ -145,7 +148,7 @@ + + case 'd': + printf ("key -> "); +- gets (key_line); ++ fgets (key_line, sizeof(key_line), stdin); + key_data.dptr = key_line; + key_data.dsize = strlen (key_line)+1; + if (dbm_delete (dbm_file, key_data) != 0) diff --git a/packaging/gdbm-protoize_dbm_headers.patch b/packaging/gdbm-protoize_dbm_headers.patch new file mode 100644 index 0000000..a8af2d8 --- /dev/null +++ b/packaging/gdbm-protoize_dbm_headers.patch @@ -0,0 +1,114 @@ +--- dbm.h ++++ dbm.h +@@ -1,7 +1,7 @@ + /* dbm.h - The include file for dbm users. */ + + /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. +- Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc. ++ Copyright (C) 1990, 1991, 1993, 2008 Free Software Foundation, Inc. + + GDBM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +@@ -32,21 +32,31 @@ + int dsize; + } datum; + ++/* The file information header. This is good enough for most applications. */ ++typedef struct {int dummy[10];} DBM; + +-/* These are the routines in dbm. */ + +-extern int dbminit (); ++/* Determine if the C(++) compiler requires complete function prototype */ ++#ifndef __P ++#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) ++#define __P(x) x ++#else ++#define __P(x) () ++#endif ++#endif ++ ++/* These are the routines in dbm. */ + +-extern datum fetch (); ++extern int dbminit __P((char *file)); + +-extern int store (); ++extern datum fetch __P((datum key)); + +-extern int delete (); ++extern int store __P((datum key, datum content)); + +-extern int delete (); ++extern int delete __P((datum key)); + +-extern datum firstkey (); ++extern datum firstkey __P((void)); + +-extern datum nextkey (); ++extern datum nextkey __P((datum key)); + +-extern int dbmclose (); ++extern int dbmclose __P((void)); +--- ndbm.h ++++ ndbm.h +@@ -1,7 +1,7 @@ + /* ndbm.h - The include file for ndbm users. */ + + /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson. +- Copyright (C) 1990, 1991, 1993 Free Software Foundation, Inc. ++ Copyright (C) 1990, 1991, 1993, 2008 Free Software Foundation, Inc. + + GDBM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +@@ -41,31 +41,39 @@ + /* The file information header. This is good enough for most applications. */ + typedef struct {int dummy[10];} DBM; + ++/* Determine if the C(++) compiler requires complete function prototype */ ++#ifndef __P ++#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) ++#define __P(x) x ++#else ++#define __P(x) () ++#endif ++#endif + + /* These are the routines (with some macros defining them!) */ + +-extern DBM *dbm_open (); ++extern DBM *dbm_open __P((char *file, int flags, int mode)); + +-extern void dbm_close (); ++extern void dbm_close __P((DBM *dbf)); + +-extern datum dbm_fetch (); ++extern datum dbm_fetch __P((DBM *dbf, datum key)); + +-extern int dbm_store (); ++extern int dbm_store __P((DBM *dbf, datum key, datum content, int flags)); + +-extern int dbm_delete (); ++extern int dbm_delete __P((DBM *dbf, datum key)); + +-extern int dbm_delete (); ++extern int dbm_delete __P((DBM *dbf, datum key)); + +-extern datum dbm_firstkey (); ++extern datum dbm_firstkey __P((DBM *)); + +-extern datum dbm_nextkey (); ++extern datum dbm_nextkey __P((DBM *)); + + #define dbm_error(dbf) (0) + + #define dbm_clearerr(dbf) + +-extern int dbm_dirfno (); ++extern int dbm_dirfno __P((DBM *dbf)); + +-extern int dbm_pagfno (); ++extern int dbm_pagfno __P((DBM *dbf)); + +-extern int dbm_rdonly (); ++extern int dbm_rdonly __P((DBM *dbf)); diff --git a/packaging/gdbm-prototype_static_functions.patch b/packaging/gdbm-prototype_static_functions.patch new file mode 100644 index 0000000..d672dc1 --- /dev/null +++ b/packaging/gdbm-prototype_static_functions.patch @@ -0,0 +1,11 @@ +--- gdbmseq.c ++++ gdbmseq.c +@@ -41,6 +41,8 @@ + at ELEM_LOC of the current bucket and using RETURN_VAL as the place to + put the data that is found. */ + ++static void get_next_key __P((gdbm_file_info *, int, datum *)); ++ + static void + get_next_key (dbf, elem_loc, return_val) + gdbm_file_info *dbf; diff --git a/packaging/gdbm.spec b/packaging/gdbm.spec new file mode 100644 index 0000000..4162e9d --- /dev/null +++ b/packaging/gdbm.spec @@ -0,0 +1,148 @@ +# +# spec file for package gdbm +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: gdbm +Version: 1.8.3 +Release: 0 +License: GPL-2.0+ +Summary: GNU dbm key/data database +%define lname libgdbm +Url: http://directory.fsf.org/GNU/gdbm.html +Group: System/Libraries +Source: %{name}-%{version}.tar.bz2 +Source2: baselibs.conf +Patch0: gdbm-%{version}.dif +Patch1: gdbm-protoize_dbm_headers.patch +Patch2: gdbm-prototype_static_functions.patch +Patch3: gdbm-fix_testprogs.patch +Patch4: gdbm-1.8.3-no-build-date.patch +BuildRequires: libtool +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +GNU dbm is a library of database functions that use extensible +hashing and work similar to the standard UNIX dbm. These routines are +provided to a programmer needing to create and manipulate a hashed +database. + +The basic use of GDBM is to store key/data pairs in a data file. Each +key must be unique and each key is paired with only one data item. + +The library provides primitives for storing key/data pairs, searching +and retrieving the data by its key and deleting a key along with its +data. It also supports sequential iteration over all key/data pairs in +a database. + +For compatibility with programs using old UNIX dbm functions, the +package also provides traditional dbm and ndbm interfaces. + +%package -n %lname +License: GPL-2.0+ +Summary: GNU dbm key/data database +Group: System/Libraries +# O/P added in 12.2 +Obsoletes: gdbm < %{version}-%{release} +Provides: gdbm = %{version}-%{release} + +%description -n %lname +GNU dbm is a library of database functions that use extensible +hashing and work similar to the standard UNIX dbm. These routines are +provided to a programmer needing to create and manipulate a hashed +database. + +The basic use of GDBM is to store key/data pairs in a data file. Each +key must be unique and each key is paired with only one data item. + +The library provides primitives for storing key/data pairs, searching +and retrieving the data by its key and deleting a key along with its +data. It also supports sequential iteration over all key/data pairs in +a database. + +For compatibility with programs using old UNIX dbm functions, the +package also provides traditional dbm and ndbm interfaces. + +%package devel +License: GPL-2.0+ ; LGPL-2.1+ +Summary: Include Files and Libraries mandatory for Development +Group: Development/Libraries/C and C++ +Requires: gdbm = %{version} +Provides: gdbm:/usr/lib/libgdbm.so + +%description devel +This package contains all necessary include files and libraries needed +to develop applications that require these. + +%prep +%setup -q +%patch0 +%patch1 +%patch2 +%patch3 +%patch4 + +%build +aclocal +autoreconf --force --install +%ifarch sparc64 +export CC="gcc -m64" +%endif +export CFLAGS="%{optflags} -Wa,--noexecstack" +%configure +make %{?_smp_mflags}; + +%install +make install INSTALL_ROOT=%{buildroot} +make install-compat INSTALL_ROOT=%{buildroot} +echo "/* GNU ld script + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ +GROUP ( %{_libdir}/libgdbm.so %{_libdir}/libgdbm_compat.so )" > %{buildroot}/%{_libdir}/libndbm.so +echo "/* GNU ld script + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ +GROUP ( %{_libdir}/libgdbm.a %{_libdir}/libgdbm_compat.a )" > %{buildroot}/%{_libdir}/libndbm.a + +%post -n %lname -p /sbin/ldconfig + +%postun -n %lname -p /sbin/ldconfig + +%files -n %lname +%defattr(-,root,root) +%doc COPYING README NEWS +%{_libdir}/libgdbm.so.3 +%{_libdir}/libgdbm.so.3.0.0 +%{_libdir}/libgdbm_compat.so.3 +%{_libdir}/libgdbm_compat.so.3.0.0 + +%files devel +%defattr(-,root,root) +%{_includedir}/dbm.h +%{_includedir}/gdbm.h +%{_includedir}/ndbm.h +%{_infodir}/gdbm.info.gz +%{_libdir}/libgdbm.a +%{_libdir}/libgdbm.so +%{_libdir}/libgdbm_compat.a +%{_libdir}/libgdbm_compat.so +%{_libdir}/libndbm.a +%{_libdir}/libndbm.so +%{_mandir}/man3/gdbm.3.gz +%exclude %{_libdir}/*.la + + +%changelog -- 2.7.4