Module Name:    src
Committed By:   mrg
Date:           Thu Mar  7 03:53:51 UTC 2019

Added Files:
        src/external/bsd/libuuid_ul/lib/libuuid_ul: Makefile
            libuuid_ul-rename.mk randutils.h

Log Message:
build glue libuuid_ul from util-linux's libuuid, with renamed functions,
as a private library so that fontconfig can link it in.

provide a randutils.h compat as the generic util-linux one is GPL.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/libuuid_ul/lib/libuuid_ul/Makefile \
    src/external/bsd/libuuid_ul/lib/libuuid_ul/libuuid_ul-rename.mk \
    src/external/bsd/libuuid_ul/lib/libuuid_ul/randutils.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/bsd/libuuid_ul/lib/libuuid_ul/Makefile
diff -u /dev/null src/external/bsd/libuuid_ul/lib/libuuid_ul/Makefile:1.1
--- /dev/null	Thu Mar  7 03:53:51 2019
+++ src/external/bsd/libuuid_ul/lib/libuuid_ul/Makefile	Thu Mar  7 03:53:51 2019
@@ -0,0 +1,40 @@
+#	$NetBSD: Makefile,v 1.1 2019/03/07 03:53:51 mrg Exp $
+
+# Makefile to build minimal util-linux libuuid locally, with special
+# prefix on all functions to avoid conflicts with libc uuid_compare(3).
+#
+
+LIB=	uuid_ul
+SRCS=	compare.c copy.c \
+	gen_uuid.c \
+	pack.c parse.c \
+	unpack.c unparse.c
+
+CPPFLAGS+= \
+	-DHAVE_UNISTD_H \
+	-DHAVE_STDLIB_H \
+	-DHAVE_SYS_TIME_H \
+	-DHAVE_SYS_FILE_H \
+	-DHAVE_SYS_IOCTL_H \
+	-DHAVE_SYS_SOCKET_H \
+	-DHAVE_SYS_SOCKIO_H \
+	-DHAVE_SYS_SOCKIO_H \
+	-DHAVE_NETINET_IN_H \
+	-DHAVE_SYS_UN_H \
+	-DHAVE_TLS \
+	-DHAVE_NET_IF_H \
+	-DHAVE_NET_IF_DL_H \
+	-DHAVE_SA_LEN
+
+CPPFLAGS+= \
+	-I${.CURDIR} \
+	-DUL_CLOEXECSTR=\"e\" \
+	-DUUIDD_OP_BULK_TIME_UUID=0
+
+.include "libuuid_ul-rename.mk"
+
+LIBISPRIVATE=	yes
+
+.include <bsd.lib.mk>
+
+.PATH: ${X11SRCDIR}/external/bsd/libuuid_ul/dist
Index: src/external/bsd/libuuid_ul/lib/libuuid_ul/libuuid_ul-rename.mk
diff -u /dev/null src/external/bsd/libuuid_ul/lib/libuuid_ul/libuuid_ul-rename.mk:1.1
--- /dev/null	Thu Mar  7 03:53:51 2019
+++ src/external/bsd/libuuid_ul/lib/libuuid_ul/libuuid_ul-rename.mk	Thu Mar  7 03:53:51 2019
@@ -0,0 +1,16 @@
+#	$NetBSD: libuuid_ul-rename.mk,v 1.1 2019/03/07 03:53:51 mrg Exp $
+
+#
+# functions exported by fontconfig's private libuuid copy are
+# renamed to have a "ul_" prefix (from util-linux).  listed here
+# so that both the libuuid_ul build and fontconfig can find them.
+#
+
+RENAME_FUNCS= \
+	uuid_compare uuid_copy \
+	uuid_generate uuid_generate_random \
+	uuid_parse uuid_unparse \
+	uuid_pack uuid_unpack
+.for _f in ${RENAME_FUNCS}
+CPPFLAGS+= -D${_f}=ul_${_f}
+.endfor
Index: src/external/bsd/libuuid_ul/lib/libuuid_ul/randutils.h
diff -u /dev/null src/external/bsd/libuuid_ul/lib/libuuid_ul/randutils.h:1.1
--- /dev/null	Thu Mar  7 03:53:51 2019
+++ src/external/bsd/libuuid_ul/lib/libuuid_ul/randutils.h	Thu Mar  7 03:53:51 2019
@@ -0,0 +1,44 @@
+/*	$NetBSD: randutils.h,v 1.1 2019/03/07 03:53:51 mrg Exp $	*/
+
+/*
+ * Copyright (c) 2019 Matthew R. Green
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef NETBSD_SHIM_RANDUTILS
+#define NETBSD_SHIM_RANDUTILS
+
+/* shim function for util-linux random_get_bytes() */
+
+#include <stdlib.h>
+
+static void __inline__
+random_get_bytes(void *buf, size_t nbytes)
+{
+	arc4random_buf(buf, nbytes);
+}
+
+#endif

Reply via email to