Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/fonts/fontconfig fontconfig: drop libuuid dependency. ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/22dc17d584e3
branches:  trunk
changeset: 437197:22dc17d584e3
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Tue Aug 18 08:19:17 2020 +0000

description:
fontconfig: drop libuuid dependency. Bump PKGREVISION.

Provide minimal subset of libuuid functions in FILESDIR.
http://mail-index.netbsd.org/tech-pkg/2020/08/18/msg023687.html

(Apologies for not waiting for comments on the discussion thread.
I think a quick fix is important since this solves significant fallout
for X11_TYPE=modular users.)

diffstat:

 fonts/fontconfig/Makefile                |   16 +-
 fonts/fontconfig/distinfo                |    4 +-
 fonts/fontconfig/files/uuid.h            |  231 +++++++++++++++++++++++++++++++
 fonts/fontconfig/patches/patch-configure |    6 +-
 4 files changed, 247 insertions(+), 10 deletions(-)

diffs (truncated from 321 to 300 lines):

diff -r 5e4526784298 -r 22dc17d584e3 fonts/fontconfig/Makefile
--- a/fonts/fontconfig/Makefile Tue Aug 18 07:39:58 2020 +0000
+++ b/fonts/fontconfig/Makefile Tue Aug 18 08:19:17 2020 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.118 2020/08/17 20:17:25 leot Exp $
+# $NetBSD: Makefile,v 1.119 2020/08/18 08:19:17 tnn Exp $
 
 DISTNAME=      fontconfig-2.13.1
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    fonts
 MASTER_SITES=  https://www.fontconfig.org/release/
 EXTRACT_SUFX=  .tar.bz2
@@ -9,7 +9,7 @@
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=      https://www.fontconfig.org/
 COMMENT=       Library for configuring and customizing font access
-#LICENSE=      x11?
+#LICENSE=      x11? AND modified-bsd # (for uuid.h)
 
 # https://bugs.freedesktop.org/show_bug.cgi?id=101280
 TOOL_DEPENDS+= gperf-[0-9]*:../../devel/gperf
@@ -90,6 +90,13 @@
 CONFIGURE_ENV+=        CC_FOR_BUILD=${NATIVE_CC:Q}
 .endif
 
+.if ${OPSYS} != "Darwin"
+CFLAGS+=       -I${WRKDIR}
+post-extract:
+       mkdir -p ${WRKDIR}/uuid
+       cp ${FILESDIR}/uuid.h ${WRKDIR}/uuid/.
+.endif
+
 pre-configure:
        -cd ${BUILDLINK_X11_DIR:Q} && ${FIND} . -path "*fontconfig*" -type l -delete
 
@@ -98,9 +105,6 @@
 
 .include "../../archivers/bzip2/buildlink3.mk"
 .include "../../devel/gettext-lib/buildlink3.mk"
-.if ${OPSYS} != "Darwin"
-.include "../../devel/libuuid/buildlink3.mk"
-.endif
 .include "../../devel/zlib/buildlink3.mk"
 BUILDLINK_API_DEPENDS.freetype2+=      freetype2>=2.8.1
 .include "../../graphics/freetype2/buildlink3.mk"
diff -r 5e4526784298 -r 22dc17d584e3 fonts/fontconfig/distinfo
--- a/fonts/fontconfig/distinfo Tue Aug 18 07:39:58 2020 +0000
+++ b/fonts/fontconfig/distinfo Tue Aug 18 08:19:17 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.66 2018/09/02 20:30:43 wiz Exp $
+$NetBSD: distinfo,v 1.67 2020/08/18 08:19:17 tnn Exp $
 
 SHA1 (fontconfig-2.13.1.tar.bz2) = 75612356ef4f801735b49baf987f8942b4a7a5e1
 RMD160 (fontconfig-2.13.1.tar.bz2) = a971903874fb0395a7ab2d5705378af1ffce2b2c
@@ -7,7 +7,7 @@
 SHA1 (patch-aa) = ae9a465321dcaee634faf016e2dd01e2f544af12
 SHA1 (patch-ac) = 4a0b7b55aa4b5c106fd256c4ef81df2240224803
 SHA1 (patch-af) = d351265c894738284215f0bb38d47cc1c8f28ec7
-SHA1 (patch-configure) = 164cb8ae38d71e52eb9c41584d8597f6c44228b5
+SHA1 (patch-configure) = a4b18983ad7d2cff658b733dab5a09b25019842e
 SHA1 (patch-scandir.c) = e35f4c005f635dd0d8bb949cd32aa34f5e314200
 SHA1 (patch-src_fccharset.c) = f3855554b3b3cab2530b46bc1ccec6a33303de7a
 SHA1 (patch-src_fcfreetype.c) = 42542ae666b292af700313ee103d0f295cf69e4e
diff -r 5e4526784298 -r 22dc17d584e3 fonts/fontconfig/files/uuid.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/fonts/fontconfig/files/uuid.h     Tue Aug 18 08:19:17 2020 +0000
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * 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, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 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 ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY 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 NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * %End-Header%
+ */
+
+#ifndef _UUID_UUID_H
+#define _UUID_UUID_H
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+static const char *fmt_lower =
+       "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
+
+typedef unsigned char uuid_t[16];
+
+struct uuid {
+       uint32_t        time_low;
+       uint16_t        time_mid;
+       uint16_t        time_hi_and_version;
+       uint16_t        clock_seq;
+       uint8_t         node[6];
+};
+
+static void uuid_pack(const struct uuid *uu, uuid_t ptr)
+{
+       uint32_t        tmp;
+       unsigned char   *out = ptr;
+
+       tmp = uu->time_low;
+       out[3] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[2] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[1] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[0] = (unsigned char) tmp;
+
+       tmp = uu->time_mid;
+       out[5] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[4] = (unsigned char) tmp;
+
+       tmp = uu->time_hi_and_version;
+       out[7] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[6] = (unsigned char) tmp;
+
+       tmp = uu->clock_seq;
+       out[9] = (unsigned char) tmp;
+       tmp >>= 8;
+       out[8] = (unsigned char) tmp;
+
+       memcpy(out+10, uu->node, 6);
+}
+
+static int uuid_parse(const char *in, uuid_t uu)
+{
+       struct uuid     uuid;
+       int             i;
+       const char      *cp;
+       char            buf[3];
+
+       if (strlen(in) != 36)
+               return -1;
+       for (i=0, cp = in; i <= 36; i++,cp++) {
+               if ((i == 8) || (i == 13) || (i == 18) ||
+                   (i == 23)) {
+                       if (*cp == '-')
+                               continue;
+                       else
+                               return -1;
+               }
+               if (i== 36)
+                       if (*cp == 0)
+                               continue;
+               if (!isxdigit((int)*cp))
+                       return -1;
+       }
+       uuid.time_low = strtoul(in, NULL, 16);
+       uuid.time_mid = strtoul(in+9, NULL, 16);
+       uuid.time_hi_and_version = strtoul(in+14, NULL, 16);
+       uuid.clock_seq = strtoul(in+19, NULL, 16);
+       cp = in+24;
+       buf[2] = 0;
+       for (i=0; i < 6; i++) {
+               buf[0] = *cp++;
+               buf[1] = *cp++;
+               uuid.node[i] = strtoul(buf, NULL, 16);
+       }
+
+       uuid_pack(&uuid, uu);
+       return 0;
+}
+
+
+static void uuid_unpack(const uuid_t in, struct uuid *uu)
+{
+       const uint8_t   *ptr = in;
+       uint32_t        tmp;
+
+       tmp = *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       uu->time_low = tmp;
+
+       tmp = *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       uu->time_mid = tmp;
+
+       tmp = *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       uu->time_hi_and_version = tmp;
+
+       tmp = *ptr++;
+       tmp = (tmp << 8) | *ptr++;
+       uu->clock_seq = tmp;
+
+       memcpy(uu->node, ptr, 6);
+}
+
+static void uuid_copy(uuid_t dst, const uuid_t src)
+{
+       unsigned char           *cp1;
+       const unsigned char     *cp2;
+       int                     i;
+
+       for (i=0, cp1 = dst, cp2 = src; i < 16; i++)
+               *cp1++ = *cp2++;
+}
+
+static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
+{
+       struct uuid uuid;
+
+       uuid_unpack(uu, &uuid);
+       sprintf(out, fmt,
+               uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
+               uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
+               uuid.node[0], uuid.node[1], uuid.node[2],
+               uuid.node[3], uuid.node[4], uuid.node[5]);
+}
+
+static void uuid_unparse(const uuid_t uu, char *out)
+{
+       uuid_unparse_x(uu, out, fmt_lower);
+}
+
+static void random_get_bytes(void *buf, size_t nbytes)
+{
+       int fd;
+       char *p;
+
+       fd = open("/dev/urandom", O_RDONLY);
+       if (fd < 0) {
+               goto fail;
+       }
+       if (read(fd, buf, nbytes) != nbytes) {
+               close(fd);
+               goto fail;
+       }
+       close(fd);
+       return;
+       fail:
+       /* strong entropy not important for fontconfig */
+       for (p = (char*)buf; nbytes > 0; nbytes--) {
+               *p++ = (char)random();
+       }
+}
+
+static void __uuid_generate_random(uuid_t out, int *num)
+{
+       uuid_t  buf;
+       struct uuid uu;
+       int i, n;
+
+       if (!num || !*num)
+               n = 1;
+       else
+               n = *num;
+
+       for (i = 0; i < n; i++) {
+               random_get_bytes(buf, sizeof(buf));
+               uuid_unpack(buf, &uu);
+
+               uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000;
+               uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF)
+                       | 0x4000;
+               uuid_pack(&uu, out);
+               out += sizeof(uuid_t);
+       }
+}
+
+static void uuid_generate_random(uuid_t out)
+{
+       int     num = 1;
+       __uuid_generate_random(out, &num);
+}
+
+#endif
diff -r 5e4526784298 -r 22dc17d584e3 fonts/fontconfig/patches/patch-configure



Home | Main Index | Thread Index | Old Index