Fix build on SmartOS.

If this is irrelevant, please revert them.

* Use OS_VARIANT to include db_185.h
* Include posix stat function in ifdef to avoid binary change
This commit is contained in:
ryoon 2012-12-24 12:53:17 +00:00
parent e4c593d330
commit ca111ae08e
4 changed files with 73 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.32 2012/10/25 06:56:07 asau Exp $
# $NetBSD: Makefile,v 1.33 2012/12/24 12:53:17 ryoon Exp $
DISTNAME= mdocml-1.12.0
PKGREVISION= 2
@ -14,5 +14,11 @@ MAKE_FLAGS+= PREFIX=${PREFIX} DBLIB=${BDB_LIBS:Q}
CONFLICTS= man-pages-[0-9]* groff-[0-9]*
.include "../../mk/bsd.prefs.mk"
.if ${OS_VARIANT} == "SmartOS"
CFLAGS+= -D__SmartOS__
.endif
.include "../../mk/bdb.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,5 +1,7 @@
$NetBSD: distinfo,v 1.24 2011/10/10 12:31:56 wiz Exp $
$NetBSD: distinfo,v 1.25 2012/12/24 12:53:17 ryoon Exp $
SHA1 (mdocml-1.12.0.tar.gz) = 7c2c1a23c0bba61d9fc4ee7dc5b47a0a07e0b981
RMD160 (mdocml-1.12.0.tar.gz) = 3ea04c4b4639ae63ae924db3645f1712f149ec5b
Size (mdocml-1.12.0.tar.gz) = 236717 bytes
SHA1 (patch-apropos.c) = 8c219b5b1c61dc49d71f0a4207e8480f5aa79099
SHA1 (patch-mandocdb.c) = 325d80259553fc223b8f8e4c1a3949f127c74cae

View file

@ -0,0 +1,13 @@
$NetBSD: patch-apropos.c,v 1.1 2012/12/24 12:53:17 ryoon Exp $
--- apropos.c.orig 2011-10-08 20:07:21.000000000 +0000
+++ apropos.c
@@ -33,7 +33,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__SmartOS__)
# include <db_185.h>
#else
# include <db.h>

View file

@ -0,0 +1,50 @@
$NetBSD: patch-mandocdb.c,v 1.1 2012/12/24 12:53:17 ryoon Exp $
--- mandocdb.c.orig 2011-10-08 20:07:22.000000000 +0000
+++ mandocdb.c
@@ -29,12 +29,16 @@
#include <stdlib.h>
#include <string.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__SmartOS__)
# include <db_185.h>
#else
# include <db.h>
#endif
+#if defined(__sun)
+# include <sys/stat.h>
+#endif
+
#include "man.h"
#include "mdoc.h"
#include "mandoc.h"
@@ -1223,7 +1227,15 @@ ofile_dirbuild(const char *dir, int verb
while (NULL != (dp = readdir(d))) {
fn = dp->d_name;
+#if defined(__sun)
+ struct stat s;
+ stat(dp->d_name, &s);
+#endif
+#if !defined(__sun)
if (DT_DIR == dp->d_type) {
+#else
+ if (!(s.st_mode & S_IFDIR)) {
+#endif
if (0 == strcmp(".", fn))
continue;
if (0 == strcmp("..", fn))
@@ -1244,7 +1256,11 @@ ofile_dirbuild(const char *dir, int verb
fprintf(stderr, "%s: Path too long\n", dir);
return(0);
}
+#if !defined(__sun)
if (DT_REG != dp->d_type)
+#else
+ if (!(s.st_mode & S_IFREG))
+#endif
continue;
if (0 == strcmp(MANDOC_DB, fn) ||