Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Build libpkg under linux.
Vsevolod Stakhov committed 11 years ago
commit 5c407dd365d4cec26bd9b7b9def54c924d062ad1
parent 51c7470
9 files changed +32 -11
modified compat/bsd_compat.h
@@ -37,6 +37,10 @@
#include <bsd/stdlib.h>
#endif

+
#ifdef HAVE_BSD_UNISTD_H
+
#include <bsd/unistd.h>
+
#endif
+

#ifdef HAVE_BSD_STRING_H
#include <bsd/string.h>
#endif
modified configure.ac
@@ -117,7 +117,8 @@ AC_CHECK_HEADERS_ONCE([bsd/string.h])
AC_CHECK_HEADERS_ONCE([bsd/stdio.h]) 
AC_CHECK_HEADERS_ONCE([bsd/readpassphrase.h])
AC_CHECK_HEADERS_ONCE([bsd/libutil.h]) 
-
AC_CHECK_HEADERS_ONCE([bsd/err.h]) 
+
AC_CHECK_HEADERS_ONCE([bsd/err.h])
+
AC_CHECK_HEADERS_ONCE([bsd/unistd.h])  
AC_CHECK_HEADERS_ONCE([bsd/sys/cdefs.h])

AC_CHECK_HEADER([regex.h], [
modified libpkg/Makefile.am
@@ -99,10 +99,6 @@ if HAVE_MACHO_ABI
libpkg_la_LIBADD+=	$(top_builddir)/external/libmachista_static.la
endif

-
if HAVE_LIBBSD
-
libpkg_la_LIBADD+=	-lbsd
-
endif
-

libpkg_la_LDFLAGS=	-version-info @LIBPKG_SO_VERSION@
EXTRA_libpkg_la_DEPENDENCIES=	@REPOS_LDADD@

modified libpkg/pkg_elf.c
@@ -48,7 +48,7 @@
#include <fcntl.h>
#include <gelf.h>
#include <libgen.h>
-
#if defined(HAVE_LINK_H) && !defined(__DragonFly__)
+
#if defined(HAVE_LINK_H) && !defined(__DragonFly__) && defined(HAVE_LIBELF)
#include <link.h>
#endif
#include <paths.h>
modified libpkg/pkg_jobs.c
@@ -32,6 +32,8 @@
#include "pkg_config.h"
#endif

+
#include <bsd_compat.h>
+

#include <sys/param.h>
#include <sys/mount.h>
#include <sys/types.h>
@@ -49,7 +51,9 @@
#include <sys/wait.h>
#include <ctype.h>

-
#include <bsd_compat.h>
+
#ifdef HAVE_SYS_STATFS_H
+
#include <sys/statfs.h>
+
#endif

#include "utarray.h"

modified libpkg/pkg_printf.c
@@ -24,6 +24,7 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#include "bsd_compat.h"
#include <sys/types.h>
#include <sys/sbuf.h>
#include <sys/stat.h>
modified libpkg/pkgdb.c
@@ -36,6 +36,8 @@
#include "pkg_config.h"
#endif

+
#include <bsd_compat.h>
+

#include <sys/param.h>
#include <sys/mount.h>

@@ -55,7 +57,9 @@

#include <sqlite3.h>

-
#include <bsd_compat.h>
+
#ifdef HAVE_SYS_STATFS_H
+
#include <sys/statfs.h>
+
#endif

#include "pkg.h"
#include "private/event.h"
@@ -950,6 +954,7 @@ pkgdb_open_all(struct pkgdb **db_p, pkgdb_t type, const char *reponame)

		sqlite3_initialize();

+
#ifdef MNT_LOCAL
		/*
		 * Fall back on unix-dotfile locking strategy if on a network filesystem
		 */
@@ -957,7 +962,7 @@ pkgdb_open_all(struct pkgdb **db_p, pkgdb_t type, const char *reponame)
			if ((stfs.f_flags & MNT_LOCAL) != MNT_LOCAL)
				sqlite3_vfs_register(sqlite3_vfs_find("unix-dotfile"), 1);
		}
-

+
#endif
		if (sqlite3_open(localpath, &db->sqlite) != SQLITE_OK) {
			ERROR_SQLITE(db->sqlite, "sqlite open");
			pkgdb_close(db);
modified libpkg/private/pkg.h
@@ -30,6 +30,8 @@
#ifndef _PKG_PRIVATE_H
#define _PKG_PRIVATE_H

+
#include "bsd_compat.h"
+

#include <sys/param.h>
#include <sys/cdefs.h>
#include <sys/sbuf.h>
modified libpkg/repo/binary/init.c
@@ -39,6 +39,10 @@

#include <bsd_compat.h>

+
#ifdef HAVE_SYS_STATFS_H
+
#include <sys/statfs.h>
+
#endif
+

#include "pkg.h"
#include "private/event.h"
#include "private/pkg.h"
@@ -296,7 +300,6 @@ int
pkg_repo_binary_open(struct pkg_repo *repo, unsigned mode)
{
	char filepath[MAXPATHLEN];
-
	struct statfs stfs;
	const char *dbdir = NULL;
	sqlite3 *sqlite = NULL;
	int flags;
@@ -307,6 +310,8 @@ pkg_repo_binary_open(struct pkg_repo *repo, unsigned mode)
	sqlite3_initialize();
	dbdir = pkg_object_string(pkg_config_get("PKG_DBDIR"));

+
#ifdef MNT_LOCAL
+
	struct statfs stfs;
	/*
	 * Fall back on unix-dotfile locking strategy if on a network filesystem
	 */
@@ -314,6 +319,7 @@ pkg_repo_binary_open(struct pkg_repo *repo, unsigned mode)
		if ((stfs.f_flags & MNT_LOCAL) != MNT_LOCAL)
			sqlite3_vfs_register(sqlite3_vfs_find("unix-dotfile"), 1);
	}
+
#endif

	snprintf(filepath, sizeof(filepath), "%s/%s.meta",
		dbdir, pkg_repo_name(repo));
@@ -401,7 +407,6 @@ int
pkg_repo_binary_create(struct pkg_repo *repo)
{
	char filepath[MAXPATHLEN];
-
	struct statfs stfs;
	const char *dbdir = NULL;
	sqlite3 *sqlite = NULL;
	int retcode;
@@ -415,6 +420,8 @@ pkg_repo_binary_create(struct pkg_repo *repo)
	if (access(filepath, R_OK) == 0)
		return (EPKG_CONFLICT);

+
#ifdef MNT_LOCAL
+
	struct statfs stfs;
	/*
	 * Fall back on unix-dotfile locking strategy if on a network filesystem
	 */
@@ -422,6 +429,7 @@ pkg_repo_binary_create(struct pkg_repo *repo)
		if ((stfs.f_flags & MNT_LOCAL) != MNT_LOCAL)
			sqlite3_vfs_register(sqlite3_vfs_find("unix-dotfile"), 1);
	}
+
#endif

	/* Open for read/write/create */
	if (sqlite3_open(filepath, &sqlite) != SQLITE_OK)