openpkg/rpm.patch.porting

Tue, 06 Jan 2009 23:46:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2009 23:46:19 +0100
changeset 17
dabc4f22486f
parent 13
cb59d6afeb61
child 330
51aab9414a86
permissions
-rw-r--r--

Rewrite out of scope identifiers and remove IPv6 to correct build.

michael@13 1 ##
michael@13 2 ## rpm.patch.porting -- Annotated OpenPKG RPM Patch file
michael@13 3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@13 4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
michael@13 5 ##
michael@13 6 ## This file assembles changes to existing RPM source files between
michael@13 7 ## the original RedHat RPM and the OpenPKG RPM variant. It can be
michael@13 8 ## automatically applied to a vanilla RedHat RPM source tree with the
michael@13 9 ## 'patch' tool to upgrade those files. Each patch snippet is annotated
michael@13 10 ## with a short description.
michael@13 11 ##
michael@13 12 ## Created on: 13-Sep-2006
michael@13 13 ##
michael@13 14 ## ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
michael@13 15 ## RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
michael@13 16 ##
michael@13 17
michael@13 18 +---------------------------------------------------------------------------
michael@13 19 | Evil hack to get GNU libtool working under NetBSD 1.6
michael@13 20 | with the ugly way RPM currently has to use it.
michael@13 21 +---------------------------------------------------------------------------
michael@13 22 Index: ltconfig
michael@13 23 --- ltconfig 17 Jan 2001 16:22:58 -0000 1.1.1.7
michael@13 24 +++ ltconfig 29 Apr 2004 13:07:28 -0000 1.4
michael@13 25 @@ -2017,6 +2017,7 @@
michael@13 26 dynamic_linker='NetBSD ld.elf_so'
michael@13 27 fi
michael@13 28 shlibpath_var=LD_LIBRARY_PATH
michael@13 29 + deplibs_check_method=pass_all
michael@13 30 ;;
michael@13 31
michael@13 32 openbsd*)
michael@13 33
michael@13 34 +---------------------------------------------------------------------------
michael@13 35 | Disable special RedHat NPTL handling.
michael@13 36 +---------------------------------------------------------------------------
michael@13 37 Index: configure.ac
michael@13 38 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 39 +++ configure.ac 13 Sep 2006 13:40:20 -0000
michael@13 40 @@ -150,10 +151,10 @@
michael@13 41 dnl XXX Test for libpthread.a that is NPTL aware (static link only).
michael@13 42 dnl
michael@13 43 LDFLAGS_NPTL=
michael@13 44 -if test -f /usr/lib/nptl/libpthread.a ; then
michael@13 45 - LDFLAGS_NPTL="-L/usr/lib/nptl"
michael@13 46 -# INCPATH="$INCPATH -I/usr/include/nptl"
michael@13 47 -fi
michael@13 48 +dnl if test -f /usr/lib/nptl/libpthread.a ; then
michael@13 49 +dnl LDFLAGS_NPTL="-L/usr/lib/nptl"
michael@13 50 +dnl # INCPATH="$INCPATH -I/usr/include/nptl"
michael@13 51 +dnl fi
michael@13 52 AC_SUBST(LDFLAGS_NPTL)
michael@13 53
michael@13 54 dnl
michael@13 55
michael@13 56 +---------------------------------------------------------------------------
michael@13 57 | Disable any POSIX Pthread stuff because in OpenPKG we use
michael@13 58 | non-Pthread mutexes in Berkeley-DB.
michael@13 59 +---------------------------------------------------------------------------
michael@13 60 Index: configure.ac
michael@13 61 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 62 +++ configure.ac 13 Sep 2006 13:40:21 -0000
michael@13 63 @@ -446,14 +447,17 @@
michael@13 64 AC_CHECK_LIB(socket, socket)
michael@13 65 ])
michael@13 66
michael@13 67 -AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
michael@13 68 +dnl # required for HP-UX because of RPC stuff in DB
michael@13 69 +AC_CHECK_LIB(nsl, svc_run)
michael@13 70
michael@13 71 -AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
michael@13 72 - dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
michael@13 73 - AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
michael@13 74 - AC_CHECK_LIB(thread, mutex_lock)
michael@13 75 - ])
michael@13 76 -])
michael@13 77 +dnl AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
michael@13 78 +dnl
michael@13 79 +dnl AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
michael@13 80 +dnl dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
michael@13 81 +dnl AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
michael@13 82 +dnl AC_CHECK_LIB(thread, mutex_lock)
michael@13 83 +dnl ])
michael@13 84 +dnl ])
michael@13 85
michael@13 86 AC_CHECK_HEADERS(aio.h)
michael@13 87 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
michael@13 88
michael@13 89 +---------------------------------------------------------------------------
michael@13 90 | Add support for BSD getmntinfo(3).
michael@13 91 +---------------------------------------------------------------------------
michael@13 92 Index: configure.ac
michael@13 93 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 94 +++ configure.ac 13 Sep 2006 13:40:23 -0000
michael@13 95 @@ -963,12 +967,13 @@
michael@13 96 AC_CHECK_FUNCS(getpassphrase)
michael@13 97
michael@13 98 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
michael@13 99 + AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
michael@13 100 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
michael@13 101 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
michael@13 102 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
michael@13 103 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
michael@13 104 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
michael@13 105 - AC_LIBOBJ(getmntent)])])])])
michael@13 106 + AC_LIBOBJ(getmntent)])])])])])
michael@13 107
michael@13 108 AC_CHECK_FUNC(lchown,
michael@13 109 [__CHOWN_RHF="%{__chown} -Rhf"
michael@13 110
michael@13 111 +---------------------------------------------------------------------------
michael@13 112 | Remove RPM's "lib64" hack because we do not install
michael@13 113 | into any system locations at all.
michael@13 114 +---------------------------------------------------------------------------
michael@13 115 Index: configure.ac
michael@13 116 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 117 +++ configure.ac 13 Sep 2006 13:40:25 -0000
michael@13 118 @@ -1141,9 +1146,6 @@
michael@13 119
michael@13 120 dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
michael@13 121 MARK64=
michael@13 122 -case "${target_cpu}" in
michael@13 123 -x86_64*|ppc64*|powerpc64*|sparc64*|s390x*) MARK64=64 ;;
michael@13 124 -esac
michael@13 125 AC_SUBST(MARK64)
michael@13 126
michael@13 127 dnl Determine the canonical arch-vendor-os for the build machine
michael@13 128
michael@13 129 +---------------------------------------------------------------------------
michael@13 130 | Provide fallback definitions for uintX_t stuff, which is used by
michael@13 131 | build/rpmfile.h and not available on all platforms. We do this by
michael@13 132 | adding the same Autoconf checks file/configure already used for its
michael@13 133 | original file.h.
michael@13 134 | Additionally, do not try to configure in an internal
michael@13 135 | beecrypt subdirectory.
michael@13 136 +---------------------------------------------------------------------------
michael@13 137 Index: configure.ac
michael@13 138 --- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
michael@13 139 +++ configure.ac 13 Sep 2006 13:40:29 -0000
michael@13 140 @@ -1249,11 +1251,40 @@
michael@13 141
michael@13 142 AC_SUBST(OBJDUMP)
michael@13 143
michael@13 144 +dnl OpenPKG: rpmfile.h (used in RPM) from file(1) needs additional checks
michael@13 145 +dnl for its use of uintXX_t (which are available in file/config.h, but which
michael@13 146 +dnl we cannot include into RPM because of conflicts with RPM's config.h)
michael@13 147 +AC_DEFUN([AC_CHECK_TYPE_STDC],
michael@13 148 +[AC_REQUIRE([AC_HEADER_STDC])dnl
michael@13 149 +AC_MSG_CHECKING(for $1)
michael@13 150 +AC_CACHE_VAL(ac_cv_type_$1,
michael@13 151 +[AC_EGREP_CPP(dnl
michael@13 152 +[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
michael@13 153 +[#if HAVE_STDINT_H
michael@13 154 +#include <stdint.h>
michael@13 155 +#endif
michael@13 156 +#include <sys/types.h>
michael@13 157 +#if STDC_HEADERS
michael@13 158 +#include <stdlib.h>
michael@13 159 +#include <stddef.h>
michael@13 160 +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
michael@13 161 +AC_MSG_RESULT($ac_cv_type_$1)
michael@13 162 +if test $ac_cv_type_$1 = no; then
michael@13 163 + AC_DEFINE($1, $2, $1)
michael@13 164 +fi])
michael@13 165 +AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
michael@13 166 +AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
michael@13 167 +AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
michael@13 168 +
michael@13 169 +dnl OpenPKG: some strange platforms (like Unixware) really have MADV_XXX
michael@13 170 +dnl but no madvise(2) function itself, so check for madvise explicitly.
michael@13 171 +AC_CHECK_FUNC(madvise)
michael@13 172 +
michael@13 173 dnl XXX this causes popt to depend on zlib et al
michael@13 174 dnl # XXX Propagate -lucb to popt ...
michael@13 175 dnl export LIBS INCPATH CONFIG_SITE
michael@13 176
michael@13 177 -AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
michael@13 178 +AC_CONFIG_SUBDIRS(popt zlib elfutils file db3)
michael@13 179
michael@13 180 AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
michael@13 181 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
michael@13 182
michael@13 183 +---------------------------------------------------------------------------
michael@13 184 | Remove RPM's "lib64" hack because we do not install
michael@13 185 | into any system locations at all.
michael@13 186 +---------------------------------------------------------------------------
michael@13 187 Index: popt/configure.ac
michael@13 188 --- popt/configure.ac 27 Mar 2003 17:23:18 -0000 1.1.1.3
michael@13 189 +++ popt/configure.ac 12 May 2004 14:34:35 -0000 1.2
michael@13 190 @@ -53,9 +53,6 @@
michael@13 191
michael@13 192 dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
michael@13 193 MARK64=
michael@13 194 -case "${target_cpu}" in
michael@13 195 -x86_64*|powerpc64*|ppc64*|sparc64*|s390x*) MARK64=64 ;;
michael@13 196 -esac
michael@13 197 AC_SUBST(MARK64)
michael@13 198
michael@13 199 AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
michael@13 200
michael@13 201 +---------------------------------------------------------------------------
michael@13 202 | Prevent (at least NetBSD's) gcc 2.95 from optimizing (at least sha1.c)
michael@13 203 | and this way run into a resource (virtual memory) exhaustion situation.
michael@13 204 | Not all Bourne-Shells support embedded TAB characters in
michael@13 205 | here-document style constructs. Insert the TAB character indirectly
michael@13 206 | to workaround problems.
michael@13 207 | Additionally, there is no need to build a shared library version of
michael@13 208 | Berkeley-DB.
michael@13 209 | Finally, enforce the use of the standard UNIX/fcntl mutex type for
michael@13 210 | full portability and to get rid of Pthread library dependencies
michael@13 211 | (which especially are nasty for the external RPM API users).
michael@13 212 +---------------------------------------------------------------------------
michael@13 213 Index: db3/configure
michael@13 214 --- db3/configure 18 Jan 2003 14:04:22 -0000 1.1.1.4
michael@13 215 +++ db3/configure 6 Jun 2005 15:53:05 -0000 1.3
michael@13 216 @@ -7,19 +7,29 @@
michael@13 217 # XXX edit CFLAGS= ... out of invocation args ???
michael@13 218 ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
michael@13 219
michael@13 220 +# prevent gcc 2.95 from optimizing (at least sha1.c)
michael@13 221 +# and this way get into a resource exhaustion situation
michael@13 222 +if [ ".`($CC -v; $CC --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
michael@13 223 + case "`$CC -dumpversion 2>/dev/null`" in
michael@13 224 + 3.* ) ;;
michael@13 225 + * ) CFLAGS=`echo " $CFLAGS -O0" | sed -e 's; -O[0-9]* ; ;g' -e 's;^ *;;'` ;;
michael@13 226 + esac
michael@13 227 +fi
michael@13 228 +
michael@13 229 CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
michael@13 230 - --enable-shared --enable-static --enable-rpc \
michael@13 231 - --with-uniquename=_rpmdb --srcdir=$db_dist
michael@13 232 + --disable-shared --enable-static --enable-rpc \
michael@13 233 + --with-uniquename=_rpmdb --srcdir=$db_dist \
michael@13 234 + --with-mutex="UNIX/fcntl" --disable-largefile
michael@13 235
michael@13 236 mv Makefile Makefile.orig
michael@13 237 cat Makefile.orig | sed -e '/^install[:-]/c\
michael@13 238 .PHONY: listobjs\
michael@13 239 listobjs:\
michael@13 240 - @echo $(OBJS) $(C_OBJS) \
michael@13 241 +~@echo $(OBJS) $(C_OBJS) \
michael@13 242 \
michael@13 243 distdir install check:\
michael@13 244 \
michael@13 245 -db4_install: all install_setip' > Makefile
michael@13 246 +db4_install: all install_setip' | tr '~' ' ' > Makefile
michael@13 247
michael@13 248 mv db.h db.h.orig
michael@13 249 cat db.h.orig | sed \
michael@13 250
michael@13 251 +---------------------------------------------------------------------------
michael@13 252 | Add support for BSD getmntinfo(3).
michael@13 253 +---------------------------------------------------------------------------
michael@13 254 Index: lib/fs.c
michael@13 255 --- lib/fs.c 4 Jun 2003 18:09:43 -0000 1.1.1.13
michael@13 256 +++ lib/fs.c 25 Nov 2004 09:32:16 -0000 1.3
michael@13 257 @@ -164,6 +164,15 @@
michael@13 258 int nextMount = 0;
michael@13 259
michael@13 260 getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
michael@13 261 +# elif HAVE_GETMNTINFO
michael@13 262 +# if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
michael@13 263 +# define statfs statvfs
michael@13 264 +# endif
michael@13 265 + struct statfs * mounts = NULL;
michael@13 266 + int mntCount, flags = MNT_NOWAIT;
michael@13 267 + int nextMount = 0;
michael@13 268 +
michael@13 269 + mntCount = getmntinfo(&mounts, flags);
michael@13 270 # endif
michael@13 271
michael@13 272 filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
michael@13 273 @@ -193,6 +202,9 @@
michael@13 274 # elif HAVE_GETMNTINFO_R
michael@13 275 if (nextMount == mntCount) break;
michael@13 276 mntdir = mounts[nextMount++].f_mntonname;
michael@13 277 +# elif HAVE_GETMNTINFO
michael@13 278 + if (nextMount == mntCount) break;
michael@13 279 + mntdir = mounts[nextMount++].f_mntonname;
michael@13 280 # endif
michael@13 281
michael@13 282 if (stat(mntdir, &sb)) {
michael@13 283
michael@13 284 +---------------------------------------------------------------------------
michael@13 285 | Add support for Compaq/HP OSF1/Tru64.
michael@13 286 +---------------------------------------------------------------------------
michael@13 287 Index: misc/fnmatch.h
michael@13 288 --- misc/fnmatch.h 22 Feb 2002 17:12:15 -0000 1.1.1.3
michael@13 289 +++ misc/fnmatch.h 22 Jan 2004 21:42:26 -0000 1.2
michael@13 290 @@ -55,7 +55,7 @@
michael@13 291 #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
michael@13 292 #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
michael@13 293
michael@13 294 -#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
michael@13 295 +#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
michael@13 296 # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
michael@13 297 # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
michael@13 298 # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
michael@13 299
michael@13 300 +---------------------------------------------------------------------------
michael@13 301 | Use more correct Autoconf based size_t check.
michael@13 302 | Add support for Compaq/HP OSF1/Tru64 and SCO UnixWare.
michael@13 303 +---------------------------------------------------------------------------
michael@13 304 Index: misc/glob.h
michael@13 305 --- misc/glob.h 11 Mar 2000 20:59:30 -0000 1.1.1.3
michael@13 306 +++ misc/glob.h 22 Jan 2004 21:42:27 -0000 1.2
michael@13 307 @@ -46,7 +46,7 @@
michael@13 308 #endif /* C++ or ANSI C. */
michael@13 309
michael@13 310 /* We need `size_t' for the following definitions. */
michael@13 311 -#ifndef __size_t
michael@13 312 +#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
michael@13 313 # if defined __GNUC__ && __GNUC__ >= 2
michael@13 314 typedef __SIZE_TYPE__ __size_t;
michael@13 315 # ifdef _XOPEN_SOURCE
michael@13 316 @@ -74,7 +74,7 @@
michael@13 317 #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
michael@13 318
michael@13 319 #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
michael@13 320 - || defined _GNU_SOURCE)
michael@13 321 + || defined _GNU_SOURCE || defined __osf__ )
michael@13 322 # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
michael@13 323 # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
michael@13 324 # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
michael@13 325 @@ -151,7 +151,8 @@
michael@13 326 `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
michael@13 327 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
michael@13 328 Otherwise, `glob' returns zero. */
michael@13 329 -#if _FILE_OFFSET_BITS != 64
michael@13 330 +/* #if _FILE_OFFSET_BITS != 64 || defined(OPENPKG_UNIXWARE) */
michael@13 331 +#if !defined(__linux__)
michael@13 332 extern int glob __P ((__const char *__pattern, int __flags,
michael@13 333 int (*__errfunc) (__const char *, int),
michael@13 334 glob_t *__pglob));
michael@13 335
michael@13 336 +---------------------------------------------------------------------------
michael@13 337 | Better portability.
michael@13 338 +---------------------------------------------------------------------------
michael@13 339 Index: misc/glob.c
michael@13 340 --- misc/glob.c 11 Mar 2000 21:13:18 -0000 1.1.1.4
michael@13 341 +++ misc/glob.c 22 Jan 2004 21:42:26 -0000 1.2
michael@13 342 @@ -813,6 +813,7 @@
michael@13 343
michael@13 344
michael@13 345 /* Free storage allocated in PGLOB by a previous `glob' call. */
michael@13 346 +#if !defined(__linux__) || (defined(__linux__) && (_FILE_OFFSET_BITS != 64) || (__GNUC__ >= 2))
michael@13 347 void
michael@13 348 globfree (pglob)
michael@13 349 register glob_t *pglob;
michael@13 350 @@ -826,7 +827,7 @@
michael@13 351 free ((__ptr_t) pglob->gl_pathv);
michael@13 352 }
michael@13 353 }
michael@13 354 -
michael@13 355 +#endif
michael@13 356
michael@13 357 /* Do a collated comparison of A and B. */
michael@13 358 static int
michael@13 359
michael@13 360 +---------------------------------------------------------------------------
michael@13 361 | Add libmisc.a for platform portability.
michael@13 362 +---------------------------------------------------------------------------
michael@13 363 Index: tools/Makefile.am
michael@13 364 --- tools/Makefile.am 29 May 2003 17:40:17 -0000 1.1.1.14
michael@13 365 +++ tools/Makefile.am 22 Jan 2004 21:42:34 -0000 1.2
michael@13 366 @@ -22,7 +22,7 @@
michael@13 367
michael@13 368 LDADD = \
michael@13 369 $(top_builddir)/lib/librpm.la \
michael@13 370 - @INTLLIBS@
michael@13 371 + @INTLLIBS@ @LIBMISC@
michael@13 372
michael@13 373 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
michael@13 374
michael@13 375
michael@13 376 +---------------------------------------------------------------------------
michael@13 377 | Add libmisc.a for platform portability.
michael@13 378 +---------------------------------------------------------------------------
michael@13 379 Index: tools/Makefile.in
michael@13 380 --- tools/Makefile.in 16 Jul 2003 17:05:51 -0000 1.1.1.20
michael@13 381 +++ tools/Makefile.in 22 Jan 2004 21:42:35 -0000 1.2
michael@13 382 @@ -275,7 +275,7 @@
michael@13 383
michael@13 384 LDADD = \
michael@13 385 $(top_builddir)/lib/librpm.la \
michael@13 386 - @INTLLIBS@
michael@13 387 + @INTLLIBS@ @LIBMISC@
michael@13 388
michael@13 389
michael@13 390 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
michael@13 391
michael@13 392 +---------------------------------------------------------------------------
michael@13 393 | Drop GCC "inline" attribute if not compiling with GCC.
michael@13 394 | Workaround some other GCC'isms, too.
michael@13 395 | Do not take over "const" replacements from Zlib.
michael@13 396 +---------------------------------------------------------------------------
michael@13 397 Index: file/system.h
michael@13 398 --- file/system.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
michael@13 399 +++ file/system.h 6 Jun 2005 15:53:05 -0000 1.4
michael@13 400 @@ -13,6 +13,9 @@
michael@13 401 #endif
michael@13 402
michael@13 403 #include <sys/types.h>
michael@13 404 +#ifdef HAVE_INTTYPES_H
michael@13 405 +#include <inttypes.h>
michael@13 406 +#endif
michael@13 407
michael@13 408 #include <sys/stat.h>
michael@13 409 #include <stdio.h>
michael@13 410 @@ -53,6 +56,8 @@
michael@13 411 #else
michael@13 412 #if HAVE_ERROR && HAVE_ERROR_H
michael@13 413 #include <error.h>
michael@13 414 +#else
michael@13 415 +extern void error(int status, int errnum, const char *format, ...);
michael@13 416 #endif
michael@13 417 #endif
michael@13 418
michael@13 419 @@ -194,6 +199,7 @@
michael@13 420
michael@13 421 #ifdef HAVE_LIBZ
michael@13 422 #include <zlib.h>
michael@13 423 +#undef const
michael@13 424 #endif
michael@13 425
michael@13 426 #ifndef HAVE_STRERROR
michael@13 427 @@ -246,7 +252,11 @@
michael@13 428 */
michael@13 429 /*@-shadow@*/
michael@13 430 /*@unused@*/ /*@exits@*/ /*@only@*/
michael@13 431 +#if defined(__GNUC__)
michael@13 432 static inline void * vmefail(/*@unused@*/ size_t nb)
michael@13 433 +#else
michael@13 434 +static void * vmefail(/*@unused@*/ size_t nb)
michael@13 435 +#endif
michael@13 436 /*@globals fileSystem @*/
michael@13 437 /*@modifies fileSystem @*/
michael@13 438 {
michael@13 439 @@ -286,9 +296,33 @@
michael@13 440
michael@13 441 #if !defined(__LCLINT__)
michael@13 442 /* Memory allocation via macro defs to get meaningful locations from mtrace() */
michael@13 443 +#if defined(__GNUC__)
michael@13 444 #define xmalloc(_size) (malloc(_size) ? : vmefail(0))
michael@13 445 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(0))
michael@13 446 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(0))
michael@13 447 +#else
michael@13 448 +static void *xmalloc(size_t size)
michael@13 449 +{
michael@13 450 + void *vp = malloc(size);
michael@13 451 + if (vp == NULL)
michael@13 452 + vmefail(0);
michael@13 453 + return vp;
michael@13 454 +}
michael@13 455 +static void *xcalloc(size_t number, size_t size)
michael@13 456 +{
michael@13 457 + void *vp = calloc(number, size);
michael@13 458 + if (vp == NULL)
michael@13 459 + vmefail(0);
michael@13 460 + return vp;
michael@13 461 +}
michael@13 462 +static void *xrealloc(void *ptr, size_t size)
michael@13 463 +{
michael@13 464 + void *vp = realloc(ptr, size);
michael@13 465 + if (vp == NULL)
michael@13 466 + vmefail(0);
michael@13 467 + return vp;
michael@13 468 +}
michael@13 469 +#endif
michael@13 470 #define xstrdup(_str) (strcpy(xmalloc(strlen(_str)+1), (_str)))
michael@13 471 #endif
michael@13 472
michael@13 473 @@ -314,9 +348,14 @@
michael@13 474
michael@13 475 #if defined(__LCLINT__)
michael@13 476 #define FILE_RCSID(id)
michael@13 477 -#else
michael@13 478 +#elif defined(__GNUC__)
michael@13 479 #define FILE_RCSID(id) \
michael@13 480 static inline const char *rcsid(const char *p) { \
michael@13 481 + return rcsid(p = id); \
michael@13 482 +}
michael@13 483 +#else
michael@13 484 +#define FILE_RCSID(id) \
michael@13 485 +static const char *rcsid(const char *p) { \
michael@13 486 return rcsid(p = id); \
michael@13 487 }
michael@13 488 #endif
michael@13 489
michael@13 490 +---------------------------------------------------------------------------
michael@13 491 | Use GCC extensional features only if compiled with GCC.
michael@13 492 +---------------------------------------------------------------------------
michael@13 493 Index: file/file.h
michael@13 494 --- file/file.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
michael@13 495 +++ file/file.h 22 Jan 2004 21:42:22 -0000 1.2
michael@13 496 @@ -95,7 +95,11 @@
michael@13 497 } value; /* either number or string */
michael@13 498 uint32_t mask; /* mask before comparison with value */
michael@13 499 char desc[MAXDESC]; /* description */
michael@13 500 +#if defined(__GNUC__)
michael@13 501 } __attribute__((__packed__));
michael@13 502 +#else
michael@13 503 +};
michael@13 504 +#endif
michael@13 505
michael@13 506 #define BIT(A) (1 << (A))
michael@13 507 #define STRING_IGNORE_LOWERCASE BIT(0)
michael@13 508
michael@13 509 +---------------------------------------------------------------------------
michael@13 510 | Add int32_t detection and automatic fallback support.
michael@13 511 +---------------------------------------------------------------------------
michael@13 512 Index: file/config.h.in
michael@13 513 --- file/config.h.in 7 Mar 2003 19:39:18 -0000 1.1.1.1
michael@13 514 +++ file/config.h.in 13 Sep 2006 13:40:49 -0000
michael@13 515 @@ -106,6 +106,9 @@
michael@13 516 /* Define to 1 if you have the <unistd.h> header file. */
michael@13 517 #undef HAVE_UNISTD_H
michael@13 518
michael@13 519 +/* Define to 1 if you have the `vsnprintf' function. */
michael@13 520 +#undef HAVE_VSNPRINTF
michael@13 521 +
michael@13 522 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
michael@13 523 */
michael@13 524 #undef MAJOR_IN_MKDEV
michael@13 525 @@ -162,12 +165,16 @@
michael@13 526 /* Define to empty if `const' does not conform to ANSI C. */
michael@13 527 #undef const
michael@13 528
michael@13 529 +/* int32_t */
michael@13 530 +#undef int32_t
michael@13 531 +
michael@13 532 /* Define to `long' if <sys/types.h> does not define. */
michael@13 533 #undef off_t
michael@13 534
michael@13 535 /* Define to `unsigned' if <sys/types.h> does not define. */
michael@13 536 #undef size_t
michael@13 537
michael@13 538 +#ifndef HAVE_STDINT_H
michael@13 539 /* uint16_t */
michael@13 540 #undef uint16_t
michael@13 541
michael@13 542 @@ -179,3 +186,4 @@
michael@13 543
michael@13 544 /* uint8_t */
michael@13 545 #undef uint8_t
michael@13 546 +#endif
michael@13 547
michael@13 548 +---------------------------------------------------------------------------
michael@13 549 | Add int32_t detection and automatic fallback support.
michael@13 550 +---------------------------------------------------------------------------
michael@13 551 Index: file/configure.ac
michael@13 552 --- file/configure.ac 1 Dec 2002 21:34:06 -0000 1.1.1.1
michael@13 553 +++ file/configure.ac 6 Jun 2005 15:53:05 -0000 1.2
michael@13 554 @@ -92,6 +92,7 @@
michael@13 555 AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
michael@13 556 AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
michael@13 557 AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
michael@13 558 +AC_CHECK_TYPE_STDC(int32_t, int)
michael@13 559 AC_C_LONG_LONG
michael@13 560 if test $ac_cv_c_long_long = yes; then
michael@13 561 long64='unsigned long long';
michael@13 562 @@ -107,7 +108,7 @@
michael@13 563 AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
michael@13 564
michael@13 565 dnl Checks for functions
michael@13 566 -AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul)
michael@13 567 +AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul vsnprintf)
michael@13 568
michael@13 569 dnl Checks for libraries
michael@13 570 AC_CHECK_LIB(z, gzopen)
michael@13 571
michael@13 572 +---------------------------------------------------------------------------
michael@13 573 | Add int32_t detection and automatic fallback support.
michael@13 574 +---------------------------------------------------------------------------
michael@13 575 Index: file/configure
michael@13 576 --- file/configure 16 Jul 2003 17:05:25 -0000 1.1.1.2
michael@13 577 +++ file/configure 6 Jun 2005 15:53:05 -0000 1.2
michael@13 578 @@ -10847,6 +10847,46 @@
michael@13 579
michael@13 580 fi
michael@13 581
michael@13 582 +echo "$as_me:$LINENO: checking for int32_t" >&5
michael@13 583 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
michael@13 584 +if test "${ac_cv_type_int32_t+set}" = set; then
michael@13 585 + echo $ECHO_N "(cached) $ECHO_C" >&6
michael@13 586 +else
michael@13 587 + cat >conftest.$ac_ext <<_ACEOF
michael@13 588 +#line $LINENO "configure"
michael@13 589 +/* confdefs.h. */
michael@13 590 +_ACEOF
michael@13 591 +cat confdefs.h >>conftest.$ac_ext
michael@13 592 +cat >>conftest.$ac_ext <<_ACEOF
michael@13 593 +/* end confdefs.h. */
michael@13 594 +#if HAVE_STDINT_H
michael@13 595 +#include <stdint.h>
michael@13 596 +#endif
michael@13 597 +#include <sys/types.h>
michael@13 598 +#if STDC_HEADERS
michael@13 599 +#include <stdlib.h>
michael@13 600 +#include <stddef.h>
michael@13 601 +#endif
michael@13 602 +_ACEOF
michael@13 603 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
michael@13 604 + $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
michael@13 605 + ac_cv_type_int32_t=yes
michael@13 606 +else
michael@13 607 + ac_cv_type_int32_t=no
michael@13 608 +fi
michael@13 609 +rm -f conftest*
michael@13 610 +
michael@13 611 +fi
michael@13 612 +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
michael@13 613 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6
michael@13 614 +if test $ac_cv_type_int32_t = no; then
michael@13 615 +
michael@13 616 +cat >>confdefs.h <<\_ACEOF
michael@13 617 +#define int32_t int
michael@13 618 +_ACEOF
michael@13 619 +
michael@13 620 +fi
michael@13 621 +
michael@13 622 echo "$as_me:$LINENO: checking for long long" >&5
michael@13 623 echo $ECHO_N "checking for long long... $ECHO_C" >&6
michael@13 624 if test "${ac_cv_c_long_long+set}" = set; then
michael@13 625 @@ -11220,7 +11260,8 @@
michael@13 626
michael@13 627
michael@13 628
michael@13 629 -for ac_func in error mtrace mkstemp mmap strdup strerror strtoul
michael@13 630 +
michael@13 631 +for ac_func in error mtrace mkstemp mmap strdup strerror strtoul vsnprintf
michael@13 632 do
michael@13 633 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
michael@13 634 echo "$as_me:$LINENO: checking for $ac_func" >&5
michael@13 635
michael@13 636 +---------------------------------------------------------------------------
michael@13 637 | Fallback to vsprintf(3) if vsnprintf(3) does not exist.
michael@13 638 +---------------------------------------------------------------------------
michael@13 639 Index: file/print.c
michael@13 640 --- file/print.c 24 Jan 2003 19:41:56 -0000 1.1.1.1
michael@13 641 +++ file/print.c 6 Jun 2005 15:53:05 -0000 1.2
michael@13 642 @@ -187,7 +187,11 @@
michael@13 643
michael@13 644 va_start(va, f);
michael@13 645 /*@-boundswrite@*/
michael@13 646 +#ifdef HAVE_VSNPRINTF
michael@13 647 rc = vsnprintf(fm->obp, fm->nob, f, va);
michael@13 648 +#else
michael@13 649 + rc = vsprintf(fm->obp, f, va);
michael@13 650 +#endif
michael@13 651 /*@=boundswrite@*/
michael@13 652 va_end(va);
michael@13 653
michael@13 654
michael@13 655 +---------------------------------------------------------------------------
michael@13 656 | Use GNU libtool's weaker -static (link with own static libraries)
michael@13 657 | instead of the strong -all-static (link even with static libc, etc),
michael@13 658 | because OpenPKG does not need to be fully static.
michael@13 659 +---------------------------------------------------------------------------
michael@13 660 Index: rpmdb/Makefile.am
michael@13 661 --- rpmdb/Makefile.am 2 Jul 2003 20:14:07 -0000 1.1.1.7
michael@13 662 +++ rpmdb/Makefile.am 22 Jan 2004 21:42:29 -0000 1.2
michael@13 663 @@ -18,7 +18,7 @@
michael@13 664 EXTRA_PROGRAMS = tjfn
michael@13 665
michael@13 666 tjfn_SOURCES = tjfn.c
michael@13 667 -tjfn_LDFLAGS = -all-static
michael@13 668 +tjfn_LDFLAGS = -static
michael@13 669 tjfn_LDADD = librpmdb.la
michael@13 670
michael@13 671 pkgincdir = $(pkgincludedir)
michael@13 672 @@ -180,4 +180,4 @@
michael@13 673 $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
michael@13 674
michael@13 675 tdbi: librpmdb.la tdbi.o
michael@13 676 - $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
michael@13 677 + $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
michael@13 678
michael@13 679 +---------------------------------------------------------------------------
michael@13 680 | Use GNU libtool's weaker -static (link with own static libraries)
michael@13 681 | instead of the strong -all-static (link even with static libc, etc),
michael@13 682 | because OpenPKG does not need to be fully static.
michael@13 683 +---------------------------------------------------------------------------
michael@13 684 Index: rpmdb/Makefile.in
michael@13 685 --- rpmdb/Makefile.in 16 Jul 2003 17:05:48 -0000 1.1.1.7
michael@13 686 +++ rpmdb/Makefile.in 22 Jan 2004 21:42:29 -0000 1.2
michael@13 687 @@ -273,7 +273,7 @@
michael@13 688 EXTRA_PROGRAMS = tjfn
michael@13 689
michael@13 690 tjfn_SOURCES = tjfn.c
michael@13 691 -tjfn_LDFLAGS = -all-static
michael@13 692 +tjfn_LDFLAGS = -static
michael@13 693 tjfn_LDADD = librpmdb.la
michael@13 694
michael@13 695 pkgincdir = $(pkgincludedir)
michael@13 696 @@ -952,7 +952,7 @@
michael@13 697 $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
michael@13 698
michael@13 699 tdbi: librpmdb.la tdbi.o
michael@13 700 - $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
michael@13 701 + $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
michael@13 702 # Tell versions [3.59,3.63) of GNU make to not export all variables.
michael@13 703 # Otherwise a system limit (for SysV at least) may be exceeded.
michael@13 704 .NOEXPORT:
michael@13 705
michael@13 706 +---------------------------------------------------------------------------
michael@13 707 | Use GNU libtool's weaker -static (link with own static libraries)
michael@13 708 | instead of the strong -all-static (link even with static libc, etc),
michael@13 709 | because OpenPKG does not need to be fully static.
michael@13 710 +---------------------------------------------------------------------------
michael@13 711 Index: rpmio/Makefile.am
michael@13 712 --- rpmio/Makefile.am 5 Jun 2003 12:05:23 -0000 1.1.1.9
michael@13 713 +++ rpmio/Makefile.am 22 Jan 2004 21:42:31 -0000 1.2
michael@13 714 @@ -68,27 +68,27 @@
michael@13 715 tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 716
michael@13 717 tdir_SOURCES = tdir.c
michael@13 718 -tdir_LDFLAGS = -all-static
michael@13 719 +tdir_LDFLAGS = -static
michael@13 720 tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 721
michael@13 722 tfts_SOURCES = tfts.c
michael@13 723 -tfts_LDFLAGS = -all-static
michael@13 724 +tfts_LDFLAGS = -static
michael@13 725 tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 726
michael@13 727 tglob_SOURCES = tglob.c
michael@13 728 -tglob_LDFLAGS = -all-static
michael@13 729 +tglob_LDFLAGS = -static
michael@13 730 tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 731
michael@13 732 tinv_SOURCES = tinv.c
michael@13 733 -tinv_LDFLAGS = -all-static
michael@13 734 +tinv_LDFLAGS = -static
michael@13 735 tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 736
michael@13 737 tkey_SOURCES = tkey.c
michael@13 738 -tkey_LDFLAGS = -all-static
michael@13 739 +tkey_LDFLAGS = -static
michael@13 740 tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 741
michael@13 742 tring_SOURCES = tring.c
michael@13 743 -tring_LDFLAGS = -all-static
michael@13 744 +tring_LDFLAGS = -static
michael@13 745 tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 746
michael@13 747 trpmio_SOURCES = trpmio.c
michael@13 748
michael@13 749 +---------------------------------------------------------------------------
michael@13 750 | Use GNU libtool's weaker -static (link with own static libraries)
michael@13 751 | instead of the strong -all-static (link even with static libc, etc),
michael@13 752 | because OpenPKG does not need to be fully static.
michael@13 753 | Additionally, remove hard-coded Linux'ism of linking against POSIX
michael@13 754 | rt/pthread libraries (is not needed even under Linux itself) and
michael@13 755 | make sure the build does not break by an empty argument list when
michael@13 756 | iterating over (the not existing) BeeCrypt objects.
michael@13 757 +---------------------------------------------------------------------------
michael@13 758 Index: rpmio/Makefile.in
michael@13 759 --- rpmio/Makefile.in 16 Jul 2003 17:05:49 -0000 1.1.1.9
michael@13 760 +++ rpmio/Makefile.in 22 Jan 2004 21:42:31 -0000 1.2
michael@13 761 @@ -288,8 +288,7 @@
michael@13 762 librpmio_la_LDFLAGS = -release 4.2 \
michael@13 763 @WITH_BEECRYPT_LIB@ \
michael@13 764 $(top_builddir)/file/libfmagic.la \
michael@13 765 - @WITH_ZLIB_LIB@ \
michael@13 766 - -lrt -lpthread
michael@13 767 + @WITH_ZLIB_LIB@
michael@13 768
michael@13 769 librpmio_la_LIBADD = $(BEECRYPTLOBJS)
michael@13 770 librpmio_la_DEPENDENCIES = .created
michael@13 771 @@ -298,27 +297,27 @@
michael@13 772 tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 773
michael@13 774 tdir_SOURCES = tdir.c
michael@13 775 -tdir_LDFLAGS = -all-static
michael@13 776 +tdir_LDFLAGS = -static
michael@13 777 tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 778
michael@13 779 tfts_SOURCES = tfts.c
michael@13 780 -tfts_LDFLAGS = -all-static
michael@13 781 +tfts_LDFLAGS = -static
michael@13 782 tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 783
michael@13 784 tglob_SOURCES = tglob.c
michael@13 785 -tglob_LDFLAGS = -all-static
michael@13 786 +tglob_LDFLAGS = -static
michael@13 787 tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 788
michael@13 789 tinv_SOURCES = tinv.c
michael@13 790 -tinv_LDFLAGS = -all-static
michael@13 791 +tinv_LDFLAGS = -static
michael@13 792 tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 793
michael@13 794 tkey_SOURCES = tkey.c
michael@13 795 -tkey_LDFLAGS = -all-static
michael@13 796 +tkey_LDFLAGS = -static
michael@13 797 tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 798
michael@13 799 tring_SOURCES = tring.c
michael@13 800 -tring_LDFLAGS = -all-static
michael@13 801 +tring_LDFLAGS = -static
michael@13 802 tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
michael@13 803
michael@13 804 trpmio_SOURCES = trpmio.c
michael@13 805 @@ -743,8 +742,8 @@
michael@13 806 .created:
michael@13 807 if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
michael@13 808 ${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
michael@13 809 - for lo in $(BEECRYPTLOBJS); do \
michael@13 810 - [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
michael@13 811 + for lo in $(BEECRYPTLOBJS) ''; do \
michael@13 812 + [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
michael@13 813 done \
michael@13 814 fi
michael@13 815 touch $@
michael@13 816
michael@13 817 +---------------------------------------------------------------------------
michael@13 818 | Add Unixware support.
michael@13 819 +---------------------------------------------------------------------------
michael@13 820 Index: rpmio/fts.h
michael@13 821 --- rpmio/fts.h 18 Jan 2003 16:13:17 -0000 1.1.1.3
michael@13 822 +++ rpmio/fts.h 22 Jan 2004 21:42:32 -0000 1.2
michael@13 823 @@ -51,7 +51,7 @@
michael@13 824 # define _LARGEFILE64_SOURCE
michael@13 825 #endif
michael@13 826
michael@13 827 -#if defined(sun)
michael@13 828 +#if defined(sun) || defined(OPENPKG_UNIXWARE)
michael@13 829 # define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
michael@13 830 #endif
michael@13 831
michael@13 832
michael@13 833 +---------------------------------------------------------------------------
michael@13 834 | Add FreeBSD/NetBSD/OpenBSD support.
michael@13 835 | Workaround some GCC'isms.
michael@13 836 +---------------------------------------------------------------------------
michael@13 837 Index: rpmio/fts.c
michael@13 838 --- rpmio/fts.c 18 Jan 2003 16:13:17 -0000 1.1.1.3
michael@13 839 +++ rpmio/fts.c 8 Jun 2005 13:16:25 -0000 1.5
michael@13 840 @@ -34,6 +34,8 @@
michael@13 841 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
michael@13 842 #endif /* LIBC_SCCS and not lint */
michael@13 843
michael@13 844 +#include <limits.h>
michael@13 845 +
michael@13 846 #if defined(_LIBC)
michael@13 847 #include <sys/param.h>
michael@13 848 #include <include/sys/stat.h>
michael@13 849 @@ -45,20 +47,49 @@
michael@13 850 #include <string.h>
michael@13 851 #include <unistd.h>
michael@13 852 #else
michael@13 853 -#if defined(hpux)
michael@13 854 +#if defined(OPENPKG_HPUX)
michael@13 855 # define _INCLUDE_POSIX_SOURCE
michael@13 856 # define __errno_location() (&errno)
michael@13 857 # define dirfd(dirp) -1
michael@13 858 # define stat64 stat
michael@13 859 # define _STAT_VER 0
michael@13 860 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 861 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
michael@13 862 #endif
michael@13 863 -#if defined(sun)
michael@13 864 +#if defined(sun) || defined(OPENPKG_UNIXWARE)
michael@13 865 # define __errno_location() (&errno)
michael@13 866 # define dirfd(dirp) -1
michael@13 867 # define _STAT_VER 0
michael@13 868 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 869 #endif
michael@13 870 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
michael@13 871 +# define __errno_location() (&errno)
michael@13 872 +# define stat64 stat
michael@13 873 +# define _STAT_VER 0
michael@13 874 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 875 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
michael@13 876 +#endif
michael@13 877 +#if defined(__osf__)
michael@13 878 +# define __errno_location() (&errno)
michael@13 879 +# define dirfd(dirp) -1
michael@13 880 +# define stat64 stat
michael@13 881 +# define _STAT_VER 0
michael@13 882 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 883 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
michael@13 884 +#endif
michael@13 885 +#if defined(OPENPKG_IRIX64)
michael@13 886 +# define __errno_location() (&errno)
michael@13 887 +# define dirfd(dirp) -1
michael@13 888 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 889 +# define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
michael@13 890 +#endif
michael@13 891 +#if defined(OPENPKG_AIX)
michael@13 892 +# define __errno_location() (&errno)
michael@13 893 +# define _STAT_VER 0
michael@13 894 +# define dirfd(dirp) ((dirp)->dd_fd)
michael@13 895 +# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
michael@13 896 +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
michael@13 897 +#endif
michael@13 898 #include "system.h"
michael@13 899 #include "fts.h"
michael@13 900 #include "rpmio.h"
michael@13 901 @@ -73,7 +104,12 @@
michael@13 902 /* Largest alignment size needed, minus one.
michael@13 903 Usually long double is the worst case. */
michael@13 904 #ifndef ALIGNBYTES
michael@13 905 +#if defined(__GNUC__)
michael@13 906 #define ALIGNBYTES (__alignof__ (long double) - 1)
michael@13 907 +#else
michael@13 908 +/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
michael@13 909 +#define ALIGNBYTES (sizeof (long double) - 1)
michael@13 910 +#endif
michael@13 911 #endif
michael@13 912 /* Align P to that size. */
michael@13 913 #ifndef ALIGN
michael@13 914 @@ -107,9 +143,13 @@
michael@13 915 /*@modifies fileSystem, internalState @*/;
michael@13 916
michael@13 917 #ifndef MAX
michael@13 918 +#if defined(__GNUC__)
michael@13 919 #define MAX(a, b) ({ __typeof__ (a) _a = (a); \
michael@13 920 __typeof__ (b) _b = (b); \
michael@13 921 _a > _b ? _a : _b; })
michael@13 922 +#else
michael@13 923 +#define MAX(a, b) ((a) > (b) ? (a) : (b))
michael@13 924 +#endif
michael@13 925 #endif
michael@13 926
michael@13 927 #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
michael@13 928
michael@13 929 +---------------------------------------------------------------------------
michael@13 930 | Remove inclusion of system <glob.h> because RPM uses its own glob(3)
michael@13 931 | implementation and this can conflict with the system one.
michael@13 932 +---------------------------------------------------------------------------
michael@13 933 Index: rpmio/rpmio.h
michael@13 934 --- rpmio/rpmio.h 12 Jun 2003 18:22:18 -0000 1.1.1.7
michael@13 935 +++ rpmio/rpmio.h 22 Jan 2004 21:42:33 -0000 1.2
michael@13 936 @@ -9,9 +9,6 @@
michael@13 937 #include <sys/types.h>
michael@13 938 #include <sys/stat.h>
michael@13 939 #include <dirent.h>
michael@13 940 -/*@-noparams@*/
michael@13 941 -#include <glob.h>
michael@13 942 -/*@=noparams@*/
michael@13 943 #include <stdio.h>
michael@13 944 #include <stdlib.h>
michael@13 945 #include <unistd.h>
michael@13 946
michael@13 947 +---------------------------------------------------------------------------
michael@13 948 | Make this whole "dirent" fiddling at least working on
michael@13 949 | FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
michael@13 950 | is a bad corner of RPM which inherently leads to portability
michael@13 951 | problems.
michael@13 952 +---------------------------------------------------------------------------
michael@13 953 Index: rpmio/rpmrpc.c
michael@13 954 --- rpmio/rpmrpc.c 29 May 2003 22:14:04 -0000 1.1.1.8
michael@13 955 +++ rpmio/rpmrpc.c 8 Jun 2005 13:16:26 -0000 1.5
michael@13 956 @@ -1079,6 +1079,8 @@
michael@13 957 return rc;
michael@13 958 }
michael@13 959
michael@13 960 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
michael@13 961 +
michael@13 962 struct __dirstream {
michael@13 963 int fd; /* File descriptor. */
michael@13 964 char * data; /* Directory block. */
michael@13 965 @@ -1091,6 +1093,8 @@
michael@13 966 #endif
michael@13 967 };
michael@13 968
michael@13 969 +#endif
michael@13 970 +
michael@13 971 #if !defined(DT_DIR)
michael@13 972 # define DT_UNKNOWN 0
michael@13 973 # define DT_FIFO 1
michael@13 974 @@ -1101,14 +1105,30 @@
michael@13 975 # define DT_LNK 10
michael@13 976 # define DT_SOCK 12
michael@13 977 # define DT_WHT 14
michael@13 978 -typedef struct __dirstream * FTPDIR;
michael@13 979 -#else
michael@13 980 -typedef DIR * FTPDIR;
michael@13 981 #endif
michael@13 982
michael@13 983 +struct mydirstreament {
michael@13 984 + unsigned char type;
michael@13 985 + char *name;
michael@13 986 +};
michael@13 987 +struct mydirstream {
michael@13 988 + DIR dir;
michael@13 989 + struct dirent ent;
michael@13 990 + unsigned int offset;
michael@13 991 + unsigned int size;
michael@13 992 + struct mydirstreament av[1];
michael@13 993 +};
michael@13 994 +typedef struct mydirstream *FTPDIR;
michael@13 995 +
michael@13 996 /*@unchecked@*/
michael@13 997 static int ftpmagicdir = 0x8440291;
michael@13 998 -#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
michael@13 999 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_UNIXWARE) && !defined(OPENPKG_DARWIN) && !defined(__osf__) && !defined(OPENPKG_IRIX64) && !defined(OPENPKG_HPUX) && !defined(OPENPKG_AIX)
michael@13 1000 +#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
michael@13 1001 +#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
michael@13 1002 +#else
michael@13 1003 +#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
michael@13 1004 +#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
michael@13 1005 +#endif
michael@13 1006
michael@13 1007 /*@-boundswrite@*/
michael@13 1008 /*@-type@*/ /* FIX: abstract DIR */
michael@13 1009 @@ -1121,8 +1141,7 @@
michael@13 1010 struct dirent * dp;
michael@13 1011 size_t nb;
michael@13 1012 const char * s, * sb, * se;
michael@13 1013 - const char ** av;
michael@13 1014 - unsigned char * dt;
michael@13 1015 + struct mydirstreament * av;
michael@13 1016 char * t;
michael@13 1017 int ac;
michael@13 1018 int c;
michael@13 1019 @@ -1165,28 +1184,22 @@
michael@13 1020 }
michael@13 1021 }
michael@13 1022
michael@13 1023 - nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
michael@13 1024 + nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
michael@13 1025 mydir = xcalloc(1, nb);
michael@13 1026 /*@-abstract@*/
michael@13 1027 - dp = (struct dirent *) (mydir + 1);
michael@13 1028 - av = (const char **) (dp + 1);
michael@13 1029 - dt = (char *) (av + (ac + 1));
michael@13 1030 - t = (char *) (dt + ac + 1);
michael@13 1031 + dp = &mydir->ent;
michael@13 1032 + av = &mydir->av[0];
michael@13 1033 + t = (char *)&mydir->av[ac+1];
michael@13 1034 /*@=abstract@*/
michael@13 1035
michael@13 1036 - mydir->fd = ftpmagicdir;
michael@13 1037 -/*@-usereleased@*/
michael@13 1038 - mydir->data = (char *) dp;
michael@13 1039 -/*@=usereleased@*/
michael@13 1040 - mydir->allocation = nb;
michael@13 1041 - mydir->size = ac;
michael@13 1042 - mydir->offset = -1;
michael@13 1043 - mydir->filepos = 0;
michael@13 1044 + SETFTPMAGIC((DIR *)mydir);
michael@13 1045 + mydir->size = ac;
michael@13 1046 + mydir->offset = 0;
michael@13 1047
michael@13 1048 ac = 0;
michael@13 1049 /*@-dependenttrans -unrecog@*/
michael@13 1050 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
michael@13 1051 - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
michael@13 1052 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, "."); ++ac;
michael@13 1053 + av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
michael@13 1054 /*@=dependenttrans =unrecog@*/
michael@13 1055 sb = NULL;
michael@13 1056 s = se = ftpBuf;
michael@13 1057 @@ -1198,34 +1211,34 @@
michael@13 1058 /*@switchbreak@*/ break;
michael@13 1059 case '\r':
michael@13 1060 /*@-dependenttrans@*/
michael@13 1061 - av[ac] = t;
michael@13 1062 + av[ac].name = t;
michael@13 1063 /*@=dependenttrans@*/
michael@13 1064 if (sb == NULL) {
michael@13 1065 /*@-unrecog@*/
michael@13 1066 switch(*s) {
michael@13 1067 case 'p':
michael@13 1068 - dt[ac] = DT_FIFO;
michael@13 1069 + av[ac].type = DT_FIFO;
michael@13 1070 /*@innerbreak@*/ break;
michael@13 1071 case 'c':
michael@13 1072 - dt[ac] = DT_CHR;
michael@13 1073 + av[ac].type = DT_CHR;
michael@13 1074 /*@innerbreak@*/ break;
michael@13 1075 case 'd':
michael@13 1076 - dt[ac] = DT_DIR;
michael@13 1077 + av[ac].type = DT_DIR;
michael@13 1078 /*@innerbreak@*/ break;
michael@13 1079 case 'b':
michael@13 1080 - dt[ac] = DT_BLK;
michael@13 1081 + av[ac].type = DT_BLK;
michael@13 1082 /*@innerbreak@*/ break;
michael@13 1083 case '-':
michael@13 1084 - dt[ac] = DT_REG;
michael@13 1085 + av[ac].type = DT_REG;
michael@13 1086 /*@innerbreak@*/ break;
michael@13 1087 case 'l':
michael@13 1088 - dt[ac] = DT_LNK;
michael@13 1089 + av[ac].type = DT_LNK;
michael@13 1090 /*@innerbreak@*/ break;
michael@13 1091 case 's':
michael@13 1092 - dt[ac] = DT_SOCK;
michael@13 1093 + av[ac].type = DT_SOCK;
michael@13 1094 /*@innerbreak@*/ break;
michael@13 1095 default:
michael@13 1096 - dt[ac] = DT_UNKNOWN;
michael@13 1097 + av[ac].type = DT_UNKNOWN;
michael@13 1098 /*@innerbreak@*/ break;
michael@13 1099 }
michael@13 1100 /*@=unrecog@*/
michael@13 1101 @@ -1243,7 +1256,7 @@
michael@13 1102 /*@switchbreak@*/ break;
michael@13 1103 }
michael@13 1104 }
michael@13 1105 - av[ac] = NULL;
michael@13 1106 + av[ac].name = NULL;
michael@13 1107
michael@13 1108 /*@-kepttrans@*/
michael@13 1109 return (DIR *) mydir;
michael@13 1110 @@ -1258,43 +1271,50 @@
michael@13 1111 {
michael@13 1112 FTPDIR mydir = (FTPDIR)dir;
michael@13 1113 struct dirent * dp;
michael@13 1114 - const char ** av;
michael@13 1115 - unsigned char * dt;
michael@13 1116 + struct mydirstreament * av;
michael@13 1117 int ac;
michael@13 1118 int i;
michael@13 1119
michael@13 1120 /*@+voidabstract@*/
michael@13 1121 - if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
michael@13 1122 + if (dir == NULL || !ISFTPMAGIC(dir)) {
michael@13 1123 /* XXX TODO: EBADF errno. */
michael@13 1124 return NULL;
michael@13 1125 }
michael@13 1126 /*@=voidabstract@*/
michael@13 1127
michael@13 1128 - dp = (struct dirent *) mydir->data;
michael@13 1129 - av = (const char **) (dp + 1);
michael@13 1130 + dp = &mydir->ent;
michael@13 1131 + av = &mydir->av[0];
michael@13 1132 ac = mydir->size;
michael@13 1133 - dt = (char *) (av + (ac + 1));
michael@13 1134 - i = mydir->offset + 1;
michael@13 1135 + i = mydir->offset + 1;
michael@13 1136
michael@13 1137 /*@-boundsread@*/
michael@13 1138 - if (i < 0 || i >= ac || av[i] == NULL)
michael@13 1139 + if (i < 0 || i >= ac || av[i].name == NULL)
michael@13 1140 return NULL;
michael@13 1141 /*@=boundsread@*/
michael@13 1142
michael@13 1143 mydir->offset = i;
michael@13 1144
michael@13 1145 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
michael@13 1146 + dp->d_ino = i + 1;
michael@13 1147 + dp->d_reclen = 0;
michael@13 1148 + dp->d_type = av[i].type;
michael@13 1149 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
michael@13 1150 + dp->d_name[sizeof(dp->d_name)-1] = '\0';
michael@13 1151 + dp->d_namlen = strlen(dp->d_name);
michael@13 1152 +#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
michael@13 1153 + /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
michael@13 1154 + dp->d_ino = i + 1; /* W2DO? */
michael@13 1155 + dp->d_reclen = 0; /* W2DO? */
michael@13 1156 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
michael@13 1157 +#else
michael@13 1158 /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
michael@13 1159 dp->d_ino = i + 1; /* W2DO? */
michael@13 1160 dp->d_reclen = 0; /* W2DO? */
michael@13 1161 -
michael@13 1162 -#if !defined(hpux) && !defined(sun)
michael@13 1163 dp->d_off = 0; /* W2DO? */
michael@13 1164 -/*@-boundsread@*/
michael@13 1165 - dp->d_type = dt[i];
michael@13 1166 -/*@=boundsread@*/
michael@13 1167 + dp->d_type = av[i].type;
michael@13 1168 + strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
michael@13 1169 #endif
michael@13 1170
michael@13 1171 - strncpy(dp->d_name, av[i], sizeof(dp->d_name));
michael@13 1172 /*@+voidabstract@*/
michael@13 1173 if (_ftp_debug)
michael@13 1174 fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
michael@13 1175 @@ -1313,7 +1333,7 @@
michael@13 1176 /*@+voidabstract@*/
michael@13 1177 if (_ftp_debug)
michael@13 1178 fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
michael@13 1179 - if (mydir == NULL || !ISFTPMAGIC(mydir)) {
michael@13 1180 + if (dir == NULL || !ISFTPMAGIC(dir)) {
michael@13 1181 /* XXX TODO: EBADF errno. */
michael@13 1182 return -1;
michael@13 1183 }
michael@13 1184
michael@13 1185 +---------------------------------------------------------------------------
michael@13 1186 | Remove inclusion of ancient (and since years deprecated) <malloc.h>
michael@13 1187 | header. This especially makes sure RPM build does not break on
michael@13 1188 | strict platforms like FreeBSD 5.
michael@13 1189 +---------------------------------------------------------------------------
michael@13 1190 Index: system.h
michael@13 1191 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
michael@13 1192 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
michael@13 1193 @@ -256,10 +256,6 @@
michael@13 1194 #include <err.h>
michael@13 1195 #endif
michael@13 1196
michael@13 1197 -#if HAVE_MALLOC_H && !defined(__LCLINT__)
michael@13 1198 -#include <malloc.h>
michael@13 1199 -#endif
michael@13 1200 -
michael@13 1201 /*@-declundef -incondefs @*/ /* FIX: these are macros */
michael@13 1202 /**
michael@13 1203 */
michael@13 1204
michael@13 1205 +---------------------------------------------------------------------------
michael@13 1206 | Add support for BSD getmntinfo(3).
michael@13 1207 +---------------------------------------------------------------------------
michael@13 1208 Index: system.h
michael@13 1209 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
michael@13 1210 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
michael@13 1211 @@ -550,7 +546,7 @@
michael@13 1212 #define lchown chown
michael@13 1213 #endif
michael@13 1214
michael@13 1215 -#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
michael@13 1216 +#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
michael@13 1217 # define GETMNTENT_ONE 0
michael@13 1218 # define GETMNTENT_TWO 0
michael@13 1219 # if HAVE_SYS_MNTCTL_H
michael@13 1220
michael@13 1221 +---------------------------------------------------------------------------
michael@13 1222 | Drop GCC "inline" attribute if not compiling with GCC.
michael@13 1223 +---------------------------------------------------------------------------
michael@13 1224 Index: system.h
michael@13 1225 --- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
michael@13 1226 +++ system.h 8 Jun 2005 13:15:16 -0000 1.4
michael@13 1227 @@ -603,11 +599,24 @@
michael@13 1228
michael@13 1229 #if defined(__LCLINT__)
michael@13 1230 #define FILE_RCSID(id)
michael@13 1231 -#else
michael@13 1232 +#elif defined(__GNUC__)
michael@13 1233 #define FILE_RCSID(id) \
michael@13 1234 static inline const char *rcsid(const char *p) { \
michael@13 1235 return rcsid(p = id); \
michael@13 1236 }
michael@13 1237 +#else
michael@13 1238 +#define FILE_RCSID(id) \
michael@13 1239 +static const char *rcsid(const char *p) { \
michael@13 1240 + return rcsid(p = id); \
michael@13 1241 +}
michael@13 1242 +#endif
michael@13 1243 +
michael@13 1244 +/* for basename(3) and dirname(3) */
michael@13 1245 +#if !defined(OPENPKG_AIX)
michael@13 1246 +#include <libgen.h>
michael@13 1247 +#endif
michael@13 1248 +#if defined(OPENPKG_AIX)
michael@13 1249 +#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
michael@13 1250 #endif
michael@13 1251
michael@13 1252 #endif /* H_SYSTEM */
michael@13 1253
michael@13 1254 +---------------------------------------------------------------------------
michael@13 1255 | Remove GCC'ism.
michael@13 1256 +---------------------------------------------------------------------------
michael@13 1257 Index: build/rpmfile.h
michael@13 1258 --- build/rpmfile.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
michael@13 1259 +++ build/rpmfile.h 22 Jan 2004 21:42:14 -0000 1.2
michael@13 1260 @@ -95,7 +95,11 @@
michael@13 1261 } value; /* either number or string */
michael@13 1262 uint32_t mask; /* mask before comparison with value */
michael@13 1263 char desc[MAXDESC]; /* description */
michael@13 1264 +#if defined(__GNUC__)
michael@13 1265 } __attribute__((__packed__));
michael@13 1266 +#else
michael@13 1267 +};
michael@13 1268 +#endif
michael@13 1269
michael@13 1270 #define BIT(A) (1 << (A))
michael@13 1271 #define STRING_IGNORE_LOWERCASE BIT(0)
michael@13 1272
michael@13 1273 +---------------------------------------------------------------------------
michael@13 1274 | Better portability for madvise(2) usage.
michael@13 1275 +---------------------------------------------------------------------------
michael@13 1276 Index: rpmdb/legacy.c
michael@13 1277 --- rpmdb/legacy.c 18 Dec 2002 22:40:19 -0000 1.1.1.4
michael@13 1278 +++ rpmdb/legacy.c 22 Jan 2004 21:42:30 -0000 1.2
michael@13 1279 @@ -182,7 +182,7 @@
michael@13 1280 break;
michael@13 1281 }
michael@13 1282
michael@13 1283 -#ifdef MADV_SEQUENTIAL
michael@13 1284 +#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
michael@13 1285 xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
michael@13 1286 #endif
michael@13 1287
michael@13 1288
michael@13 1289 +---------------------------------------------------------------------------
michael@13 1290 | Better portability for madvise(2) usage.
michael@13 1291 +---------------------------------------------------------------------------
michael@13 1292 Index: lib/fsm.c
michael@13 1293 --- lib/fsm.c 3 Mar 2003 21:28:12 -0000 1.1.1.5
michael@13 1294 +++ lib/fsm.c 22 Jan 2004 21:42:23 -0000 1.2
michael@13 1295 @@ -879,7 +879,7 @@
michael@13 1296 rdbuf = fsm->rdbuf;
michael@13 1297 fsm->rdbuf = (char *) mapped;
michael@13 1298 fsm->rdlen = nmapped = st->st_size;
michael@13 1299 -#if defined(MADV_DONTNEED)
michael@13 1300 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
michael@13 1301 xx = madvise(mapped, nmapped, MADV_DONTNEED);
michael@13 1302 #endif
michael@13 1303 }
michael@13 1304 @@ -909,7 +909,7 @@
michael@13 1305 #if HAVE_MMAP
michael@13 1306 if (mapped != (void *)-1) {
michael@13 1307 xx = msync(mapped, nmapped, MS_ASYNC);
michael@13 1308 -#if defined(MADV_DONTNEED)
michael@13 1309 +#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
michael@13 1310 xx = madvise(mapped, nmapped, MADV_DONTNEED);
michael@13 1311 #endif
michael@13 1312 /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
michael@13 1313
michael@13 1314 +---------------------------------------------------------------------------
michael@13 1315 | Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
michael@13 1316 +---------------------------------------------------------------------------
michael@13 1317 Index: aclocal.m4
michael@13 1318 --- aclocal.m4 16 Jul 2003 17:05:28 -0000 1.1.1.10
michael@13 1319 +++ aclocal.m4 6 Jun 2005 15:53:03 -0000 1.4
michael@13 1320 @@ -2838,7 +2838,7 @@
michael@13 1321 runpath_var=LD_RUN_PATH
michael@13 1322 ;;
michael@13 1323
michael@13 1324 - sysv5uw7* | unixware7*)
michael@13 1325 + sysv5uw7* | unixware7* | sysv5UnixWare7* )
michael@13 1326 no_undefined_flag='${wl}-z ${wl}text'
michael@13 1327 if test "$GCC" = yes; then
michael@13 1328 archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
michael@13 1329 @@ -4311,6 +4311,7 @@
michael@13 1330 ;;
michael@13 1331 *) # Darwin 1.3 on
michael@13 1332 lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
michael@13 1333 + lt_cv_deplibs_check_method=pass_all
michael@13 1334 ;;
michael@13 1335 esac
michael@13 1336 ;;
michael@13 1337 @@ -4336,7 +4337,7 @@
michael@13 1338 ;;
michael@13 1339
michael@13 1340 hpux10.20*|hpux11*)
michael@13 1341 - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
michael@13 1342 + lt_cv_deplibs_check_method='pass_all'
michael@13 1343 lt_cv_file_magic_cmd=/usr/bin/file
michael@13 1344 lt_cv_file_magic_test_file=/usr/lib/libc.sl
michael@13 1345 ;;
michael@13 1346 @@ -4375,11 +4376,7 @@
michael@13 1347 ;;
michael@13 1348
michael@13 1349 netbsd*)
michael@13 1350 - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
michael@13 1351 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
michael@13 1352 - else
michael@13 1353 - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
michael@13 1354 - fi
michael@13 1355 + lt_cv_deplibs_check_method='pass_all'
michael@13 1356 ;;
michael@13 1357
michael@13 1358 newos6*)
michael@13 1359 @@ -4414,7 +4411,7 @@
michael@13 1360 lt_cv_file_magic_test_file=/lib/libc.so
michael@13 1361 ;;
michael@13 1362
michael@13 1363 -sysv5uw[[78]]* | sysv4*uw2*)
michael@13 1364 +sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
michael@13 1365 lt_cv_deplibs_check_method=pass_all
michael@13 1366 ;;
michael@13 1367
michael@13 1368
michael@13 1369 +---------------------------------------------------------------------------
michael@13 1370 | Use Linux i386 assembly specific stuff on Linux only.
michael@13 1371 +---------------------------------------------------------------------------
michael@13 1372 Index: rpmio/rpmsw.c
michael@13 1373 --- rpmio/rpmsw.c 5 Jun 2003 12:04:05 -0000 1.1.1.1
michael@13 1374 +++ rpmio/rpmsw.c 22 Jan 2004 21:42:33 -0000 1.2
michael@13 1375 @@ -27,7 +27,7 @@
michael@13 1376 /*@unchecked@*/
michael@13 1377 static int rpmsw_initialized = 0;
michael@13 1378
michael@13 1379 -#if defined(__i386__)
michael@13 1380 +#if defined(__linux__) && defined(__i386__)
michael@13 1381 /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
michael@13 1382
michael@13 1383 #define HP_TIMING_ZERO(Var) (Var) = (0)
michael@13 1384
michael@13 1385 +---------------------------------------------------------------------------
michael@13 1386 | Fix "environ" declaration.
michael@13 1387 +---------------------------------------------------------------------------
michael@13 1388 Index: lib/signature.c
michael@13 1389 --- lib/signature.c 29 May 2003 18:42:23 -0000 1.1.1.23
michael@13 1390 +++ lib/signature.c 22 Jan 2004 21:42:25 -0000 1.2
michael@13 1391 @@ -27,7 +27,7 @@
michael@13 1392 /*@access pgpDigParams@*/
michael@13 1393
michael@13 1394 #if !defined(__GLIBC__)
michael@13 1395 -char ** environ = NULL;
michael@13 1396 +extern char ** environ;
michael@13 1397 #endif
michael@13 1398
michael@13 1399 int rpmLookupSignatureType(int action)
michael@13 1400
michael@13 1401 +---------------------------------------------------------------------------
michael@13 1402 | Rename own mergesort(3) implementation to avoid conflicts
michael@13 1403 | with a possibly existing vendor version.
michael@13 1404 +---------------------------------------------------------------------------
michael@13 1405 Index: rpmdb/merge.c
michael@13 1406 --- rpmdb/merge.c 22 Jun 2002 18:51:58 -0000 1.1.1.2
michael@13 1407 +++ rpmdb/merge.c 22 Jan 2004 21:42:30 -0000 1.2
michael@13 1408 @@ -204,7 +204,7 @@
michael@13 1409 * Arguments are as for qsort.
michael@13 1410 */
michael@13 1411 int
michael@13 1412 -mergesort(void *base, size_t nmemb, size_t size,
michael@13 1413 +rpmdb_mergesort(void *base, size_t nmemb, size_t size,
michael@13 1414 int (*cmp) (const void *, const void *))
michael@13 1415 {
michael@13 1416 register int i, sense;
michael@13 1417
michael@13 1418 +---------------------------------------------------------------------------
michael@13 1419 | Rename own mergesort(3) implementation to avoid conflicts
michael@13 1420 | with a possibly existing vendor version.
michael@13 1421 +---------------------------------------------------------------------------
michael@13 1422 Index: rpmdb/rpmdb.h
michael@13 1423 --- rpmdb/rpmdb.h 18 Jan 2003 14:04:35 -0000 1.1.1.5
michael@13 1424 +++ rpmdb/rpmdb.h 22 Jan 2004 21:42:31 -0000 1.2
michael@13 1425 @@ -1080,7 +1080,7 @@
michael@13 1426 * Mergesort, same arguments as qsort(2).
michael@13 1427 */
michael@13 1428 /*@unused@*/
michael@13 1429 -int mergesort(void *base, size_t nmemb, size_t size,
michael@13 1430 +int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
michael@13 1431 int (*cmp) (const void *, const void *))
michael@13 1432 /*@globals errno @*/
michael@13 1433 /*@modifies base, errno @*/;
michael@13 1434
michael@13 1435 +---------------------------------------------------------------------------
michael@13 1436 | Rename own mergesort(3) implementation to avoid conflicts
michael@13 1437 | with a possibly existing vendor version.
michael@13 1438 +---------------------------------------------------------------------------
michael@13 1439 Index: rpmdb/rpmdb.c
michael@13 1440 --- rpmdb/rpmdb.c 2 Jul 2003 19:21:54 -0000 1.1.1.6
michael@13 1441 +++ rpmdb/rpmdb.c 22 Jan 2004 21:42:30 -0000 1.2
michael@13 1442 @@ -2361,7 +2361,7 @@
michael@13 1443 sizeof(*mi->mi_set->recs), hdrNumCmp);
michael@13 1444 /*@=boundsread@*/
michael@13 1445 #else
michael@13 1446 - mergesort(mi->mi_set->recs, mi->mi_set->count,
michael@13 1447 + rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
michael@13 1448 sizeof(*mi->mi_set->recs), hdrNumCmp);
michael@13 1449 #endif
michael@13 1450 mi->mi_sorted = 1;
michael@13 1451
michael@13 1452 +---------------------------------------------------------------------------
michael@13 1453 | Workaround a double-inclusion problem under AIX.
michael@13 1454 +---------------------------------------------------------------------------
michael@13 1455 Index: lib/getdate.y
michael@13 1456 --- lib/getdate.y 24 Sep 2001 21:53:15 -0000 1.1.1.2
michael@13 1457 +++ lib/getdate.y 8 Jun 2005 13:16:22 -0000 1.2
michael@13 1458 @@ -30,7 +30,9 @@
michael@13 1459 #undef static
michael@13 1460 #endif
michael@13 1461
michael@13 1462 +#ifndef OPENPKG_AIX
michael@13 1463 #include <stdio.h>
michael@13 1464 +#endif
michael@13 1465 #include <ctype.h>
michael@13 1466
michael@13 1467 /* The code at the top of get_date which figures out the offset of the
michael@13 1468
michael@13 1469 +---------------------------------------------------------------------------
michael@13 1470 | Workaround a double-inclusion problem under AIX.
michael@13 1471 +---------------------------------------------------------------------------
michael@13 1472 Index: lib/getdate.c
michael@13 1473 --- lib/getdate.c 2 Jul 2003 19:21:45 -0000 1.1.1.4
michael@13 1474 +++ lib/getdate.c 8 Jun 2005 13:16:21 -0000 1.2
michael@13 1475 @@ -50,7 +50,9 @@
michael@13 1476 #undef static
michael@13 1477 #endif
michael@13 1478
michael@13 1479 +#ifndef OPENPKG_AIX
michael@13 1480 #include <stdio.h>
michael@13 1481 +#endif
michael@13 1482 #include <ctype.h>
michael@13 1483
michael@13 1484 /* The code at the top of get_date which figures out the offset of the
michael@14 1485
michael@14 1486 +---------------------------------------------------------------------------
michael@14 1487 | The following patch works around a general failure of RPM to
michael@14 1488 | adhere to the ISO C standard, for which newer GCC releases claim
michael@14 1489 | compile errors and fail.
michael@14 1490 +---------------------------------------------------------------------------
michael@14 1491 Index: misc/err.h
michael@14 1492 --- misc/err.h 2009-01-06 22:48:16.104430941 +0100
michael@14 1493 +++ misc/err.h 2009-01-06 22:47:55.944312482 +0100
michael@14 1494 @@ -29,31 +29,4 @@
michael@14 1495 # define __gnuc_va_list __ptr_t
michael@14 1496 #endif
michael@14 1497
michael@14 1498 -__BEGIN_DECLS
michael@14 1499 -
michael@14 1500 -/* Print "program: ", FORMAT, ": ", the standard error string for errno,
michael@14 1501 - and a newline, on stderr. */
michael@14 1502 -extern void warn __P ((__const char *__format, ...))
michael@14 1503 - __attribute__ ((__format__ (__printf__, 1, 2)));
michael@14 1504 -extern void vwarn __P ((__const char *__format, __gnuc_va_list))
michael@14 1505 - __attribute__ ((__format__ (__printf__, 1, 0)));
michael@14 1506 -
michael@14 1507 -/* Likewise, but without ": " and the standard error string. */
michael@14 1508 -extern void warnx __P ((__const char *__format, ...))
michael@14 1509 - __attribute__ ((__format__ (__printf__, 1, 2)));
michael@14 1510 -extern void vwarnx __P ((__const char *__format, __gnuc_va_list))
michael@14 1511 - __attribute__ ((__format__ (__printf__, 1, 0)));
michael@14 1512 -
michael@14 1513 -/* Likewise, and then exit with STATUS. */
michael@14 1514 -extern void err __P ((int __status, __const char *__format, ...))
michael@14 1515 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
michael@14 1516 -extern void verr __P ((int __status, __const char *__format, __gnuc_va_list))
michael@14 1517 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
michael@14 1518 -extern void errx __P ((int __status, __const char *__format, ...))
michael@14 1519 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
michael@14 1520 -extern void verrx __P ((int __status, __const char *, __gnuc_va_list))
michael@14 1521 - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
michael@14 1522 -
michael@14 1523 -__END_DECLS
michael@14 1524 -
michael@14 1525 #endif /* err.h */
michael@14 1526
michael@14 1527 +---------------------------------------------------------------------------
michael@14 1528 | Due to either GCC enforcing ISO C or faulty references in the
michael@14 1529 | rpmio component, Solaris 11 fails to build while compiling fts.c.
michael@14 1530 | Hack a custom 'dirent.h' as found in /usr/include, remove the
michael@14 1531 | line 104 'extern int dirfd(DIR *);' from the header file, and
michael@14 1532 | place in directory openpkg-`date +%Y%m%d`/rpm-<version>/rpmio/.
michael@14 1533 +---------------------------------------------------------------------------

mercurial