Source: MontaVista Software, Inc. Type: Defect Fix Disposition: local Description: Get rpm building on solaris and cygwin. The changes are somewhat invasive, so the upstream is not interested in them as is. Index: rpm-4.3.3/file/src/stubs.c =================================================================== --- /dev/null +++ rpm-4.3.3/file/src/stubs.c @@ -0,0 +1,12 @@ +/** + * \file rpmio/stubs.c + */ + +/* XXX Portable shared libraries require rpmlib to contain these functions. */ + +#include "system.h" + +#if !defined(HAVE_STPCPY) +#include "../misc/stpcpy.c" +#endif + Index: rpm-4.3.3/rpmio/rpmsq.h =================================================================== --- rpm-4.3.3.orig/rpmio/rpmsq.h +++ rpm-4.3.3/rpmio/rpmsq.h @@ -6,6 +6,8 @@ * */ +#include + #include /** Index: rpm-4.3.3/lib/rpmsx.c =================================================================== --- rpm-4.3.3.orig/lib/rpmsx.c +++ rpm-4.3.3/lib/rpmsx.c @@ -157,7 +157,14 @@ } sxs = sx->sxs + sx->nsxs; sxs->len = stem_len; +#if !defined(sun) /*@i@*/ sxs->stem = strndup(*bpp, stem_len); +#else + /* Apparently solaris doesn't have strndup... */ + sxs->stem = xmalloc(stem_len+1); + sxs->stem = strncpy(sxs->stem, *bpp, stem_len); + ((char *)sxs->stem)[stem_len+1]='\0'; +#endif sx->nsxs++; *bpp += stem_len; return sx->nsxs - 1; Index: rpm-4.3.3/file/src/Makefile.am =================================================================== --- rpm-4.3.3.orig/file/src/Makefile.am +++ rpm-4.3.3/file/src/Makefile.am @@ -21,7 +21,7 @@ libmagic_la_LDFLAGS = -version-info 1:0:0 noinst_PROGRAMS = file -file_SOURCES = file.c +file_SOURCES = file.c stubs.c file_LDFLAGS = -all-static file_LDADD = libmagic.la Index: rpm-4.3.3/rpmio/fts.h =================================================================== --- rpm-4.3.3.orig/rpmio/fts.h +++ rpm-4.3.3/rpmio/fts.h @@ -52,7 +52,7 @@ #endif #if defined(sun) -# define _D_EXACT_NAMLEN(d) ((d)->d_reclen) +# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) #endif #endif Index: rpm-4.3.3/rpmdb/rpmdb.c =================================================================== --- rpm-4.3.3.orig/rpmdb/rpmdb.c +++ rpm-4.3.3/rpmdb/rpmdb.c @@ -28,6 +28,7 @@ /*@=declundef =exportheader @*/ #endif +#include #include #include #include Index: rpm-4.3.3/rpmio/rpmsq.c =================================================================== --- rpm-4.3.3.orig/rpmio/rpmsq.c +++ rpm-4.3.3/rpmio/rpmsq.c @@ -4,6 +4,10 @@ #include "system.h" +#if defined(__CYGWIN__) +#include "../misc/signals.c" +#endif /* cygwin */ + #if defined(__LCLINT__) #define _BITS_SIGTHREAD_H /* XXX avoid __sigset_t heartburn. */ @@ -128,7 +132,11 @@ /*@unchecked@*/ /*@-type@*/ +#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +#else +static pthread_mutex_t rpmsigTbl_lock = PTHREAD_MUTEX_INITIALIZER; +#endif /*@=type@*/ #define DO_LOCK() pthread_mutex_lock(&rpmsigTbl_lock); Index: rpm-4.3.3/lua/local/lposix.c =================================================================== --- rpm-4.3.3.orig/lua/local/lposix.c +++ rpm-4.3.3/lua/local/lposix.c @@ -820,7 +820,11 @@ /*@observer@*/ /*@unchecked@*/ static const int Ksysconf[] = { +#ifdef __CYGWIN__ + _SC_ARG_MAX, _SC_CHILD_MAX, _SC_CLK_TCK, _SC_NGROUPS_MAX, +#else _SC_ARG_MAX, _SC_CHILD_MAX, _SC_CLK_TCK, _SC_NGROUPS_MAX, _SC_STREAM_MAX, +#endif /* CYGWIN */ _SC_TZNAME_MAX, _SC_OPEN_MAX, _SC_JOB_CONTROL, _SC_SAVED_IDS, _SC_VERSION, -1 }; @@ -835,7 +839,11 @@ /*@observer@*/ /*@unchecked@*/ static const char *const Ssysconf[] = { +#ifdef __CYGWIN__ + "arg_max", "child_max", "clk_tck", "ngroups_max", +#else "arg_max", "child_max", "clk_tck", "ngroups_max", "stream_max", +#endif /* CYGWIN */ "tzname_max", "open_max", "job_control", "saved_ids", "version", NULL }; Index: rpm-4.3.3/rpmio/fts.c =================================================================== --- rpm-4.3.3.orig/rpmio/fts.c +++ rpm-4.3.3/rpmio/fts.c @@ -59,6 +59,16 @@ # define _STAT_VER 0 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp)) #endif +#if defined(__CYGWIN__) +# define __errno_location() (&errno) +# define _STAT_VER 0 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp)) +# define _D_EXACT_NAMLEN(d) strlen((d)->d_name) +#define __INSIDE_CYGWIN__ +#include +#include +# define stat64 __stat64 +#endif #include "system.h" #include "fts.h" #include "rpmio.h" Index: rpm-4.3.3/db/dist/configure =================================================================== --- rpm-4.3.3.orig/db/dist/configure +++ rpm-4.3.3/db/dist/configure @@ -26980,12 +26980,21 @@ fi LIBS=$ac_func_search_save_LIBS fi + +build_os=`uname 2>/dev/null` +case $build_os in + CYGWIN*|*cygwin) +LOAD_LIBS="$LOAD_LIBS " +;; + *) echo "$as_me:$LINENO: result: $ac_cv_search_sched_yield" >&5 echo "${ECHO_T}$ac_cv_search_sched_yield" >&6 if test "$ac_cv_search_sched_yield" != no; then test "$ac_cv_search_sched_yield" = "none required" || LIBS="$ac_cv_search_sched_yield $LIBS" LOAD_LIBS="$LOAD_LIBS -lrt" fi +;; +esac fi Index: rpm-4.3.3/misc/features.h =================================================================== --- /dev/null +++ rpm-4.3.3/misc/features.h @@ -0,0 +1,287 @@ +/* Copyright (C) 1991-1993,1995-2000,2001,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C 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. + + The GNU C 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 Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FEATURES_H +#define _FEATURES_H 1 + +/* These are defined by the user (or the compiler) + to specify the desired environment: + + __STRICT_ANSI__ ISO Standard C. + _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. + _POSIX_SOURCE IEEE Std 1003.1. + _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; + if >=199309L, add IEEE Std 1003.1b-1993; + if >=199506L, add IEEE Std 1003.1c-1995 + _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if + Single Unix conformance is wanted, to 600 for the + upcoming sixth revision. + _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. + _LARGEFILE_SOURCE Some more functions for correct standard I/O. + _LARGEFILE64_SOURCE Additional functionality from LFS for large files. + _FILE_OFFSET_BITS=N Select default filesystem interface. + _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. + _SVID_SOURCE ISO C, POSIX, and SVID things. + _GNU_SOURCE All of the above, plus GNU extensions. + _REENTRANT Select additionally reentrant object. + _THREAD_SAFE Same as _REENTRANT, often used by other systems. + + The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. + If none of these are defined, the default is to have _SVID_SOURCE, + _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to + 199506L. If more than one of these are defined, they accumulate. + For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE + together give you ISO C, 1003.1, and 1003.2, but nothing else. + + These are defined by this file and are used by the + header files to decide what to declare or define: + + __USE_ISOC99 Define ISO C99 things. + __USE_POSIX Define IEEE Std 1003.1 things. + __USE_POSIX2 Define IEEE Std 1003.2 things. + __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. + __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. + __USE_XOPEN Define XPG things. + __USE_XOPEN_EXTENDED Define X/Open Unix things. + __USE_UNIX98 Define Single Unix V2 things. + __USE_XOPEN2K Define XPG6 things. + __USE_LARGEFILE Define correct standard I/O things. + __USE_LARGEFILE64 Define LFS things with separate names. + __USE_FILE_OFFSET64 Define 64bit interface as default. + __USE_BSD Define 4.3BSD things. + __USE_SVID Define SVID things. + __USE_MISC Define things common to BSD and System V Unix. + __USE_GNU Define GNU extensions. + __USE_REENTRANT Define reentrant/thread-safe *_r functions. + __FAVOR_BSD Favor 4.3BSD things in cases of conflict. + + All macros listed above as possibly being defined by this file are + explicitly undefined if they are not explicitly defined. + Feature-test macros that are not defined by the user or compiler + but are implied by the other feature-test macros defined (or by the + lack of any definitions) are defined by the file. */ + + +/* Undefine everything, so we get a clean slate. */ +#undef __USE_ISOC99 +#undef __USE_POSIX +#undef __USE_POSIX2 +#undef __USE_POSIX199309 +#undef __USE_POSIX199506 +#undef __USE_XOPEN +#undef __USE_XOPEN_EXTENDED +#undef __USE_UNIX98 +#undef __USE_XOPEN2K +#undef __USE_LARGEFILE +#undef __USE_LARGEFILE64 +#undef __USE_FILE_OFFSET64 +#undef __USE_BSD +#undef __USE_SVID +#undef __USE_MISC +#undef __USE_GNU +#undef __USE_REENTRANT +#undef __FAVOR_BSD +#undef __KERNEL_STRICT_NAMES + +/* Suppress kernel-name space pollution unless user expressedly asks + for it. */ +#ifndef _LOOSE_KERNEL_NAMES +# define __KERNEL_STRICT_NAMES +#endif + +/* Always use ISO C things. */ +#define __USE_ANSI 1 + + +/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ +#if defined _BSD_SOURCE && \ + !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ + defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \ + defined _GNU_SOURCE || defined _SVID_SOURCE) +# define __FAVOR_BSD 1 +#endif + +/* If _GNU_SOURCE was defined by the user, turn on all the other features. */ +#ifdef _GNU_SOURCE +# undef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +# undef _POSIX_SOURCE +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 199506L +# undef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +# undef _XOPEN_SOURCE_EXTENDED +# define _XOPEN_SOURCE_EXTENDED 1 +# undef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE 1 +# undef _BSD_SOURCE +# define _BSD_SOURCE 1 +# undef _SVID_SOURCE +# define _SVID_SOURCE 1 +#endif + +/* If nothing (other than _GNU_SOURCE) is defined, + define _BSD_SOURCE and _SVID_SOURCE. */ +#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \ + !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \ + !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \ + !defined _BSD_SOURCE && !defined _SVID_SOURCE) +# define _BSD_SOURCE 1 +# define _SVID_SOURCE 1 +#endif + +/* This is to enable the ISO C99 extension. Also recognize the old macro + which was used prior to the standard acceptance. This macro will + eventually go away and the features enabled by default once the ISO C99 + standard is widely adopted. */ +#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) +# define __USE_ISOC99 1 +#endif + +/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 + (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ +#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \ + !defined _POSIX_C_SOURCE) +# define _POSIX_SOURCE 1 +# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 +# define _POSIX_C_SOURCE 2 +# else +# define _POSIX_C_SOURCE 199506L +# endif +#endif + +#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE +# define __USE_POSIX 1 +#endif + +#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE +# define __USE_POSIX2 1 +#endif + +#if (_POSIX_C_SOURCE - 0) >= 199309L +# define __USE_POSIX199309 1 +#endif + +#if (_POSIX_C_SOURCE - 0) >= 199506L +# define __USE_POSIX199506 1 +#endif + +#ifdef _XOPEN_SOURCE +# define __USE_XOPEN 1 +# if (_XOPEN_SOURCE - 0) >= 500 +# define __USE_XOPEN_EXTENDED 1 +# define __USE_UNIX98 1 +# undef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# if (_XOPEN_SOURCE - 0) >= 600 +# define __USE_XOPEN2K 1 +# undef __USE_ISOC99 +# define __USE_ISOC99 1 +# endif +# else +# ifdef _XOPEN_SOURCE_EXTENDED +# define __USE_XOPEN_EXTENDED 1 +# endif +# endif +#endif + +#ifdef _LARGEFILE_SOURCE +# define __USE_LARGEFILE 1 +#endif + +#ifdef _LARGEFILE64_SOURCE +# define __USE_LARGEFILE64 1 +#endif + +#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 +# define __USE_FILE_OFFSET64 1 +#endif + +#if defined _BSD_SOURCE || defined _SVID_SOURCE +# define __USE_MISC 1 +#endif + +#ifdef _BSD_SOURCE +# define __USE_BSD 1 +#endif + +#ifdef _SVID_SOURCE +# define __USE_SVID 1 +#endif + +#ifdef _GNU_SOURCE +# define __USE_GNU 1 +#endif + +#if defined _REENTRANT || defined _THREAD_SAFE +# define __USE_REENTRANT 1 +#endif + +/* We do support the IEC 559 math functionality, real and complex. */ +#define __STDC_IEC_559__ 1 +#define __STDC_IEC_559_COMPLEX__ 1 + +/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */ +#define __STDC_ISO_10646__ 200009L + +/* Convenience macros to test the versions of glibc and gcc. + Use them like this: + #if __GNUC_PREREQ (2,8) + ... code requiring gcc 2.8 or later ... + #endif + Note - they won't work for gcc1 or glibc1, since the _MINOR macros + were not defined then. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define __GNUC_PREREQ(maj, min) 0 +#endif + +/* This is here only because every header file already includes this one. */ +#ifndef __ASSEMBLER__ +# ifndef _SYS_CDEFS_H +# include "misc/cdefs.h" +# endif + +/* If we don't have __REDIRECT, prototypes will be missing if + __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ +# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT +# define __USE_LARGEFILE 1 +# define __USE_LARGEFILE64 1 +# endif + +#endif /* !ASSEMBLER */ + +/* Decide whether we can define 'extern inline' functions in headers. */ +#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ +# define __USE_EXTERN_INLINES 1 +#endif + + +/* This is here only because every header file already includes this one. + Get the definitions of all the appropriate `__stub_FUNCTION' symbols. + contains `#define __stub_FUNCTION' when FUNCTION is a stub + that will always return failure (and set errno to ENOSYS). */ +//#include + + +#endif /* features.h */ Index: rpm-4.3.3/Makefile.am =================================================================== --- rpm-4.3.3.orig/Makefile.am +++ rpm-4.3.3/Makefile.am @@ -42,13 +42,13 @@ @WITH_BEECRYPT_LIB@ rpmbindir = `echo $(bindir) | sed -e s,usr/bin,bin,` -rpmbin_PROGRAMS = rpm +rpmbin_PROGRAMS = rpm$(EXEEXT) -bin_PROGRAMS = rpm2cpio +bin_PROGRAMS = rpm2cpio$(EXEEXT) bin_SCRIPTS = gendiff pkglibdir = @RPMCONFIGDIR@ -pkglib_PROGRAMS = rpmb rpmd rpmi rpmk rpmq +pkglib_PROGRAMS = rpmb$(EXEEXT) rpmd$(EXEEXT) rpmi$(EXEEXT) rpmk$(EXEEXT) rpmq$(EXEEXT) pkglib_DATA = rpmrc rpmpopt-$(VERSION) macros pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \ config.guess config.sub config.site @@ -133,27 +133,27 @@ @@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc @rm -f $(DESTDIR)$(libdir)/rpmpopt @@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt - @rm -f $(DESTDIR)$(libdir)/rpm/rpmt - @@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt - @rm -f $(DESTDIR)$(libdir)/rpm/rpme - @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme - @rm -f $(DESTDIR)$(libdir)/rpm/rpmu - @@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu - @rm -f $(DESTDIR)$(libdir)/rpm/rpmv - @@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/rpmv - rm -f $(DESTDIR)$(bindir)/rpmbuild - @LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild - rm -f $(DESTDIR)$(bindir)/rpmquery - @LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery - rm -f $(DESTDIR)$(bindir)/rpmverify - @LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify - rm -f $(DESTDIR)$(bindir)/rpmsign - @LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign - rm -f $(DESTDIR)$(bindir)/rpmdb ; \ - @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \ + @rm -f $(DESTDIR)$(libdir)/rpm/rpmt$(EXEEXT) + @@LN_S@ rpmb$(EXEEXT) $(DESTDIR)$(libdir)/rpm/rpmt$(EXEEXT) + @rm -f $(DESTDIR)$(libdir)/rpm/rpme$(EXEEXT) + @@LN_S@ rpmi$(EXEEXT) $(DESTDIR)$(libdir)/rpm/rpme$(EXEEXT) + @rm -f $(DESTDIR)$(libdir)/rpm/rpmu$(EXEEXT) + @@LN_S@ rpmi$(EXEEXT) $(DESTDIR)$(libdir)/rpm/rpmu$(EXEEXT) + @rm -f $(DESTDIR)$(libdir)/rpm/rpmv$(EXEEXT) + @@LN_S@ rpmq$(EXEEXT) $(DESTDIR)$(libdir)/rpm/rpmv$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/rpmbuild$(EXEEXT) + @LN_S@ ../lib/rpm/rpmb$(EXEEXT) $(DESTDIR)$(bindir)/rpmbuild$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/rpmquery$(EXEEXT) + @LN_S@ ../lib/rpm/rpmq$(EXEEXT) $(DESTDIR)$(bindir)/rpmquery$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/rpmverify$(EXEEXT) + @LN_S@ ../lib/rpm/rpmv$(EXEEXT) $(DESTDIR)$(bindir)/rpmverify$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/rpmsign$(EXEEXT) + @LN_S@ ../lib/rpm/rpmk$(EXEEXT) $(DESTDIR)$(bindir)/rpmsign$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/rpmdb$(EXEEXT) ; \ + @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb$(EXEEXT) ; \ for bf in e i u ; do \ - rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \ - @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \ + rm -f $(DESTDIR)$(bindir)/rpm$$bf$(EXEEXT) ; \ + @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf$(EXEEXT) ; \ done @for dir in BUILD RPMS SOURCES SPECS SRPMS ; do\ $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/$$dir;\ Index: rpm-4.3.3/rpmio/rpmio.h =================================================================== --- rpm-4.3.3.orig/rpmio/rpmio.h +++ rpm-4.3.3/rpmio/rpmio.h @@ -10,7 +10,11 @@ #include #include /*@-noparams@*/ +#ifdef __CYGWIN__ +#include "../misc/glob.h" +#else /* cygwin */ #include +#endif /*@=noparams@*/ #include #include Index: rpm-4.3.3/misc/error.c =================================================================== --- rpm-4.3.3.orig/misc/error.c +++ rpm-4.3.3/misc/error.c @@ -40,14 +40,9 @@ # define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; #endif -#if STDC_HEADERS || _LIBC # include # include -#else void exit (); -#endif - -#include "error.h" #ifndef _ # define _(String) String @@ -85,8 +80,12 @@ /* The calling program should define program_name and set it to the name of the executing program. */ -extern char *program_name; - +char *program_name; +#define __progname program_name +#define setprogname(pn) \ + { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \ + else __progname = pn; \ + } # ifdef HAVE_STRERROR_R # define __strerror_r strerror_r # else Index: rpm-4.3.3/tools/debugedit.c =================================================================== --- rpm-4.3.3.orig/tools/debugedit.c +++ rpm-4.3.3/tools/debugedit.c @@ -20,10 +20,24 @@ #define _FILE_OFFSET_BITS 64 #include +#include + +#if defined(__sun__) || defined (__CYGWIN__) + #if defined(__sun__) + #include + #define __BYTE_ORDER 4321 + #else /* defined __CYGWIN__ */ + #define __BYTE_ORDER 1234 + #endif + #define __BIG_ENDIAN 4321 + #define __LITTLE_ENDIAN 1234 + #include "../misc/byteswap.h" +#else #include #include -#include #include +#endif + #include #include #include @@ -38,6 +52,10 @@ #include "hashtab.h" +#if defined(__sun__) || defined(__CYGWIN__) +#include "../misc/error.c" +#endif + #define DW_TAG_partial_unit 0x3c char *base_dir = NULL; @@ -1267,6 +1285,10 @@ const char **args; struct stat stat_buf; char *p; + +#if defined(__sun__) || defined(__CYGWIN__) + setprogname(argv[0]); +#endif optCon = poptGetContext("debugedit", argc, (const char **)argv, optionsTable, 0); Index: rpm-4.3.3/misc/signals.c =================================================================== --- /dev/null +++ rpm-4.3.3/misc/signals.c @@ -0,0 +1,66 @@ +/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if defined(__CYGWIN__) +#define __rtems__ +#define _POSIX_REALTIME_SIGNALS +#define _KERNEL +#include +#endif /* cygwin */ + +#define __need_NULL +#include +#include + +int +sighold (sig) + int sig; +{ + sigset_t set; + + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; + + /* Add the specified signal. */ + if (sigaddset (&set, sig) < 0) + return -1; + + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); +} + + +int +sigrelse (sig) + int sig; +{ + sigset_t set; + + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; + + /* Remove the specified signal. */ + if (sigdelset (&set, sig) < 0) + return -1; + + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); +} Index: rpm-4.3.3/lib/signature.c =================================================================== --- rpm-4.3.3.orig/lib/signature.c +++ rpm-4.3.3/lib/signature.c @@ -26,7 +26,7 @@ /*@access pgpDig@*/ /*@access pgpDigParams@*/ -#if !defined(__GLIBC__) +#if !defined(__GLIBC__) && !defined(__CYGWIN__) char ** environ = NULL; #endif Index: rpm-4.3.3/db3/configure =================================================================== --- rpm-4.3.3.orig/db3/configure +++ rpm-4.3.3/db3/configure @@ -10,9 +10,19 @@ # XXX edit CFLAGS= ... out of invocation args ??? ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`" +build_os=`uname 2>/dev/null` +case $build_os in + CYGWIN*|*cygwin) +CC="$CC" LDFLAGS="-lrpc $LDFLAGS" CFLAGS="$CFLAGS" $db_dist/configure $ARGS LDFLAGS="-lrpc $LDFLAGS" \ + --enable-shared --enable-static --enable-rpc \ + --with-uniquename=_rpmdb --srcdir=$db_dist +;; + *) CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \ --enable-shared --enable-static --enable-rpc \ --with-uniquename=_rpmdb --srcdir=$db_dist +;; +esac mv Makefile Makefile.orig cat Makefile.orig | sed -e '/^install[:-]/c\ Index: rpm-4.3.3/rpmio/rpmrpc.c =================================================================== --- rpm-4.3.3.orig/rpmio/rpmrpc.c +++ rpm-4.3.3/rpmio/rpmrpc.c @@ -1279,6 +1279,7 @@ /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */ /*@-type@*/ dp->d_ino = i + 1; /* W2DO? */ +#if !defined(__CYGWIN__) dp->d_reclen = 0; /* W2DO? */ #if !defined(hpux) && !defined(sun) @@ -1286,7 +1287,8 @@ /*@-boundsread@*/ dp->d_type = dt[i]; /*@=boundsread@*/ -#endif +#endif /* !hpux && !sun */ +#endif /* !cygwin */ /*@=type@*/ strncpy(dp->d_name, av[i], sizeof(dp->d_name)); Index: rpm-4.3.3/misc/cdefs.h =================================================================== --- /dev/null +++ rpm-4.3.3/misc/cdefs.h @@ -0,0 +1,260 @@ +/* Copyright (C) 1992-2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C 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. + + The GNU C 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 Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H 1 + +/* We are almost always included from features.h. */ +#ifndef _FEATURES_H +# include "features.h" +#endif + +/* The GNU libc does not support any K&R compilers or the traditional mode + of ISO C compilers anymore. Check for some of the combinations not + anymore supported. */ +#if defined __GNUC__ && !defined __STDC__ +# error "You need a ISO C conforming compiler to use the glibc headers" +#endif + +/* Some user header file might have defined this before. */ +#undef __P +#undef __PMT + +#ifdef __GNUC__ + +/* GCC can always grok prototypes. For C++ programs we add throw() + to help it optimize the function calls. But this works only with + gcc 2.8.x and egcs. */ +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +# define __P(args) args __THROW +/* This macro will be used for functions which might take C++ callback + functions. */ +# define __PMT(args) args + +#else /* Not GCC. */ + +# define __inline /* No inline functions. */ + +# define __THROW +# define __P(args) args +# define __PMT(args) args + +# define __const const +# define __signed signed +# define __volatile volatile + +#endif /* GCC. */ + +/* For these things, GCC behaves the ANSI way normally, + and the non-ANSI way under -traditional. */ + +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +/* This is not a typedef so `const __ptr_t' does the right thing. */ +#define __ptr_t void * +#define __long_double_t long double + + +/* C++ needs to know that types and declarations are C, not C++. */ +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + + +/* The standard library needs the functions from the ISO C90 standard + in the std namespace. At the same time we want to be safe for + future changes and we include the ISO C99 code in the non-standard + namespace __c99. The C++ wrapper header take case of adding the + definitions to the global namespace. */ +#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES +# define __BEGIN_NAMESPACE_STD namespace std { +# define __END_NAMESPACE_STD } +# define __USING_NAMESPACE_STD(name) using std::name; +# define __BEGIN_NAMESPACE_C99 namespace __c99 { +# define __END_NAMESPACE_C99 } +# define __USING_NAMESPACE_C99(name) using __c99::name; +#else +/* For compatibility we do not add the declarations into any + namespace. They will end up in the global namespace which is what + old code expects. */ +# define __BEGIN_NAMESPACE_STD +# define __END_NAMESPACE_STD +# define __USING_NAMESPACE_STD(name) +# define __BEGIN_NAMESPACE_C99 +# define __END_NAMESPACE_C99 +# define __USING_NAMESPACE_C99(name) +#endif + + +/* Support for bounded pointers. */ +#ifndef __BOUNDED_POINTERS__ +# define __bounded /* nothing */ +# define __unbounded /* nothing */ +# define __ptrvalue /* nothing */ +#endif + + +/* Support for flexible arrays. */ +#if __GNUC_PREREQ (2,97) +/* GCC 2.97 supports C99 flexible array members. */ +# define __flexarr [] +#else +# ifdef __GNUC__ +# define __flexarr [0] +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __flexarr [] +# else +/* Some other non-C99 compiler. Approximate with [1]. */ +# define __flexarr [1] +# endif +# endif +#endif + + +/* __asm__ ("xyz") is used throughout the headers to rename functions + at the assembly language level. This is wrapped by the __REDIRECT + macro, in order to support compilers that can do this some other + way. When compilers don't support asm-names at all, we have to do + preprocessor tricks instead (which don't have exactly the right + semantics, but it's the best we can do). + + Example: + int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ + +#if defined __GNUC__ && __GNUC__ >= 2 + +# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname + +/* +#elif __SOME_OTHER_COMPILER__ + +# define __REDIRECT(name, proto, alias) name proto; \ + _Pragma("let " #name " = " #alias) +*/ +#endif + +/* GCC has various useful declarations that can be made with the + `__attribute__' syntax. All of the ways we use this do fine if + they are omitted for compilers that don't understand it. */ +#if !defined __GNUC__ || __GNUC__ < 2 +# define __attribute__(xyz) /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `malloc' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_malloc__ __attribute__ ((__malloc__)) +#else +# define __attribute_malloc__ /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `pure' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) +# define __attribute_pure__ __attribute__ ((__pure__)) +#else +# define __attribute_pure__ /* Ignore */ +#endif + +/* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (3,1) +# define __attribute_used__ __attribute__ ((__used__)) +# define __attribute_noinline__ __attribute__ ((__noinline__)) +#else +# define __attribute_used__ __attribute__ ((__unused__)) +# define __attribute_noinline__ /* Ignore */ +#endif + +/* gcc allows marking deprecated functions. */ +#if __GNUC_PREREQ (3,2) +# define __attribute_deprecated__ __attribute__ ((__deprecated__)) +#else +# define __attribute_deprecated__ /* Ignore */ +#endif + +/* At some point during the gcc 2.8 development the `format_arg' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. + If several `format_arg' attributes are given for the same function, in + gcc-3.0 and older, all but the last one are ignored. In newer gccs, + all designated arguments are considered. */ +#if __GNUC_PREREQ (2,8) +# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) +#else +# define __attribute_format_arg__(x) /* Ignore */ +#endif + +/* At some point during the gcc 2.97 development the `strfmon' format + attribute for functions was introduced. We don't want to use it + unconditionally (although this would be possible) since it + generates warnings. */ +#if __GNUC_PREREQ (2,97) +# define __attribute_format_strfmon__(a,b) \ + __attribute__ ((__format__ (__strfmon__, a, b))) +#else +# define __attribute_format_strfmon__(a,b) /* Ignore */ +#endif + +/* It is possible to compile containing GCC extensions even if GCC is + run in pedantic mode if the uses are carefully marked using the + `__extension__' keyword. But this is not generally available before + version 2.8. */ +#if !__GNUC_PREREQ (2,8) +# define __extension__ /* Ignore */ +#endif + +/* __restrict is known in EGCS 1.2 and above. */ +#if !__GNUC_PREREQ (2,92) +# define __restrict /* Ignore */ +#endif + +/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is + array_name[restrict] + GCC 3.1 supports this. */ +#if __GNUC_PREREQ (3,1) && !defined __GNUG__ +# define __restrict_arr __restrict +#else +# ifdef __GNUC__ +# define __restrict_arr /* Not supported in old GCC. */ +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict_arr restrict +# else +/* Some other non-C99 compiler. */ +# define __restrict_arr /* Not supported. */ +# endif +# endif +#endif + +#endif /* sys/cdefs.h */