pkgsrc-Changes archive

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

CVS commit: pkgsrc/fonts/fontconfig



Module Name:    pkgsrc
Committed By:   tnn
Date:           Tue Aug 18 08:19:17 UTC 2020

Modified Files:
        pkgsrc/fonts/fontconfig: Makefile distinfo
        pkgsrc/fonts/fontconfig/patches: patch-configure
Added Files:
        pkgsrc/fonts/fontconfig/files: uuid.h

Log Message:
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.)


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 pkgsrc/fonts/fontconfig/Makefile
cvs rdiff -u -r1.66 -r1.67 pkgsrc/fonts/fontconfig/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/fonts/fontconfig/files/uuid.h
cvs rdiff -u -r1.5 -r1.6 pkgsrc/fonts/fontconfig/patches/patch-configure

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

Modified files:

Index: pkgsrc/fonts/fontconfig/Makefile
diff -u pkgsrc/fonts/fontconfig/Makefile:1.118 pkgsrc/fonts/fontconfig/Makefile:1.119
--- pkgsrc/fonts/fontconfig/Makefile:1.118      Mon Aug 17 20:17:25 2020
+++ pkgsrc/fonts/fontconfig/Makefile    Tue Aug 18 08:19:17 2020
@@ -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 @@ EXTRACT_SUFX=   .tar.bz2
 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 @@ TEST_TARGET= check
 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 @@ post-install:
 
 .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"

Index: pkgsrc/fonts/fontconfig/distinfo
diff -u pkgsrc/fonts/fontconfig/distinfo:1.66 pkgsrc/fonts/fontconfig/distinfo:1.67
--- pkgsrc/fonts/fontconfig/distinfo:1.66       Sun Sep  2 20:30:43 2018
+++ pkgsrc/fonts/fontconfig/distinfo    Tue Aug 18 08:19:17 2020
@@ -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 @@ Size (fontconfig-2.13.1.tar.bz2) = 17236
 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

Index: pkgsrc/fonts/fontconfig/patches/patch-configure
diff -u pkgsrc/fonts/fontconfig/patches/patch-configure:1.5 pkgsrc/fonts/fontconfig/patches/patch-configure:1.6
--- pkgsrc/fonts/fontconfig/patches/patch-configure:1.5 Sun Sep  2 20:30:43 2018
+++ pkgsrc/fonts/fontconfig/patches/patch-configure     Tue Aug 18 08:19:17 2020
@@ -1,6 +1,8 @@
-$NetBSD: patch-configure,v 1.5 2018/09/02 20:30:43 wiz Exp $
+$NetBSD: patch-configure,v 1.6 2020/08/18 08:19:17 tnn Exp $
 
 Do not look for libuuid on Darwin, it is built-in.
+On other operating systems, pkgsrc fontconfig is patched to use
+bunled libuuid.
 
 Patch "GNU" gettext support to not depend unnecessary on "GNU" gettext.
 
@@ -65,7 +67,7 @@ Patch "GNU" gettext support to not depen
  # Check for uuid
  #
 -if test "$os_win32" != "yes"; then
-+if test "$os_win32" != "yes" -a "$os_darwin" != "yes"; then
++if false; then
        use_pkgconfig_for_uuid=yes
        if test -n "${UUID_LIBS}"; then
                save_UUID_LIBS=$UUID_LIBS

Added files:

Index: pkgsrc/fonts/fontconfig/files/uuid.h
diff -u /dev/null pkgsrc/fonts/fontconfig/files/uuid.h:1.1
--- /dev/null   Tue Aug 18 08:19:17 2020
+++ pkgsrc/fonts/fontconfig/files/uuid.h        Tue Aug 18 08:19:17 2020
@@ -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



Home | Main Index | Thread Index | Old Index