Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Some more steps to portability.
Vsevolod Stakhov committed 11 years ago
commit 7e68f5eb4de996648d08662bc1beed44637461ae
parent db6d50e
7 files changed +68 -6
modified configure.ac
@@ -37,7 +37,7 @@ AC_TYPE_SIZE_T
AC_CHECK_FUNCS(memmove bcopy)
AC_PROG_LN_S

-
AC_CHECK_HEADERS_ONCE([fcntl.h unistd.h])
+
AC_CHECK_HEADERS_ONCE([fcntl.h unistd.h elf-hints.h])
AC_TYPE_OFF_T
AC_FUNC_MMAP

@@ -72,6 +72,7 @@ AC_LINK_IFELSE([

AC_CHECK_HEADERS_ONCE([machine/endian.h])
AC_CHECK_HEADERS_ONCE([endian.h])
+
AC_CHECK_HEADERS_ONCE([sys/endian.h])
AC_CHECK_HEADERS_ONCE([fcntl.h])
AC_CHECK_HEADERS_ONCE([dlfcn.h])
AC_CHECK_HEADERS_ONCE([memory.h])
@@ -196,7 +197,14 @@ AC_CHECK_HEADER([execinfo.h], [
AC_ARG_WITH([ldns], AS_HELP_STRING([--with-ldns], [Build with ldns for name resolving]))

AS_IF([test "x$with_ldns" = "xyes"], [
-
   PKG_CHECK_MODULES([LDNS], [libldns], [AC_DEFINE([HAVE_LDNS], [1], [Use ldns])])
+
   PKG_CHECK_MODULES([LDNS], [libldns], [AC_DEFINE([HAVE_LDNS], [1], [Use ldns])],
+
   [
+
   	AC_CHECK_HEADER([ldns/ldns.h], [
+
   		AC_CHECK_LIB(ldns, ldns_resolver_new_frm_file, [
+
   			AC_DEFINE([HAVE_LDNS], [1], [Use ldns])
+
   		])
+
   	])
+
   ])
])

AC_CHECK_HEADER([atf-c.h], [
modified libpkg/elfhints.c
@@ -34,7 +34,6 @@
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
-
#include <elf-hints.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
modified libpkg/pkg.h.in
@@ -33,10 +33,11 @@
#define _PKG_H

#include <sys/types.h>
+
#include <sys/param.h>
+
#include <sys/cdefs.h>
#include <stdarg.h>
#include <stdbool.h>
#include <sys/sbuf.h>
-
#include <stringlist.h>
#include <openssl/pem.h>
#include <sysexits.h>

@@ -66,6 +67,10 @@
#define OSMAJOR	__DragonFly__
#endif

+
#ifndef __DECONST
+
#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
+
#endif
+

/* Special exit status for worker processes indicating that a restart
 * is desired -- eg. after a child has updated pkg(8) itself.  Don't
 * clash with any of the sysexits values */
modified libpkg/pkg_elf.c
@@ -29,7 +29,13 @@
#include "pkg_config.h"
#endif

+
#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
+
#elif HAVE_ENDIAN_H
+
#include <endian.h>
+
#elif HAVE_MACHINE_ENDIAN_H
+
#include <machine/endian.h>
+
#endif
#include <sys/types.h>
#ifdef HAVE_LIBELF
#include <sys/elf_common.h>
@@ -39,7 +45,6 @@
#include <assert.h>
#include <ctype.h>
#include <dlfcn.h>
-
#include <elf-hints.h>
#include <err.h>
#include <fcntl.h>
#include <gelf.h>
modified libpkg/pkg_jobs.c
@@ -911,7 +911,7 @@ pkg_jobs_process_remote_pkg(struct pkg_jobs *j, struct pkg *p,
		pkg_debug(3, "already seen package %s-%s(%c) in the universe, do not add it again",
				uid, digest,
				seen->un->pkg->type == PKG_INSTALLED ? 'l' : 'r');
-
		if (seen->un->pkg->type != p->type) {
+
		if (seen->un->pkg->type != p->type && !force) {
			/* Remote package is the same as local */
			return (EPKG_INSTALLED);
		}
modified libpkg/private/ldconfig.h
@@ -29,8 +29,35 @@
#ifndef LDCONFIG_H
#define LDCONFIG_H 1

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <sys/cdefs.h>

+
#ifdef HAVE_ELF_HINTS_H
+
#include <elf-hints.h>
+
#else
+
/*
+
 * Hints file produced by ldconfig.
+
 */
+
struct elfhints_hdr
+
{
+
	u_int32_t magic; /* Magic number */
+
	u_int32_t version; /* File version (1) */
+
	u_int32_t strtab; /* Offset of string table in file */
+
	u_int32_t strsize; /* Size of string table */
+
	u_int32_t dirlist; /* Offset of directory list in
+
	 string table */
+
	u_int32_t dirlistlen; /* strlen(dirlist) */
+
	u_int32_t spare[26]; /* Room for expansion */
+
};
+

+
#define ELFHINTS_MAGIC  0x746e6845
+

+
#define _PATH_ELF_HINTS "/var/run/ld-elf.so.hints"
+
#endif
+

extern int	insecure;	/* -i flag, needed here for elfhints.c */

__BEGIN_DECLS
modified libpkg/private/pkg.h
@@ -49,6 +49,24 @@

#define PKG_NUM_SCRIPTS 9

+
/*
+
 * Some compatibility checks
+
 */
+
#ifndef MAXLOGNAME
+
# ifdef LOGIN_NAME_MAX
+
# define MAXLOGNAME LOGIN_NAME_MAX
+
# else
+
# define MAXLOGNAME 64
+
# endif
+
#endif
+
#ifndef __unused
+
# ifdef __GNUC__
+
# define __unused __attribute__ ((__unused__))
+
# else
+
# define __unused
+
# endif
+
#endif
+

#if ARCHIVE_VERSION_NUMBER < 3000002
#define archive_write_add_filter_xz(a) archive_write_set_compression_xz(a)
#define archive_write_add_filter_bzip2(a) archive_write_set_compression_bzip2(a)