Re: Build failure with MinGW/2.10.92

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat Jan 12 10:17:11 PST 2013 Akira TAGOH wrote:
> On Sat, Jan 12, 2013 at 4:18 PM, Josh wrote:
> 
>> I am no longer able to build fontconfig on MinGW:
>> 
>> $ make make all-recursive make[1]: Entering directory 
>> `/mingw/src/fontconfig-2.10.**91' Making all in fontconfig
>> make[2]: Entering directory
>> `/mingw/src/fontconfig-2.10.**91/fontconfig' make[2]: Nothing to
>> be done for `all'. make[2]: Leaving directory 
>> `/mingw/src/fontconfig-2.10.**91/fontconfig' Making all in
>> fc-case make[2]: Entering directory 
>> `/mingw/src/fontconfig-2.10.**91/fc-case' make all-am make[3]: 
>> Entering directory `/mingw/src/fontconfig-2.10.**91/fc-case'
>> make[3]: Nothing to be done for `all-am'. make[3]: Leaving
>> directory `/mingw/src/fontconfig-2.10.**91/fc-case' make[2]:
>> Leaving directory `/mingw/src/fontconfig-2.10.**91/fc-case'
>> Making all in fc-lang make[2]: Entering directory 
>> `/mingw/src/fontconfig-2.10.**91/fc-lang' make all-am make[3]: 
>> Entering directory `/mingw/src/fontconfig-2.10.**91/fc-lang'
>> make[3]: Nothing to be done for `all-am'. make[3]: Leaving
>> directory `/mingw/src/fontconfig-2.10.**91/fc-lang' make[2]:
>> Leaving directory `/mingw/src/fontconfig-2.10.**91/fc-lang'
>> Making all in fc-glyphname make[2]: Entering directory 
>> `/mingw/src/fontconfig-2.10.**91/fc-glyphname' make all-am
>> make[3]: Entering directory
>> `/mingw/src/fontconfig-2.10.**91/fc-glyphname' make[3]: Nothing
>> to be done for `all-am'. make[3]: Leaving directory 
>> `/mingw/src/fontconfig-2.10.**91/fc-glyphname' make[2]: Leaving 
>> directory `/mingw/src/fontconfig-2.10.**91/fc-glyphname' Making
>> all in src make[2]: Entering directory 
>> `/mingw/src/fontconfig-2.10.**91/src' make all-am make[3]:
>> Entering directory `/mingw/src/fontconfig-2.10.**91/src' CC
>> fccompat.lo fccompat.c: In function 'FcMakeTempfile':
>> fccompat.c:103:2: error: #error no secure functions to create a
>> temporary file make[3]: *** [fccompat.lo] Error 1 make[3]:
>> Leaving directory `/mingw/src/fontconfig-2.10.**91/src' make[2]:
>> *** [all] Error 2 make[2]: Leaving directory
>> `/mingw/src/fontconfig-2.10.**91/src' make[1]: ***
>> [all-recursive] Error 1 make[1]: Leaving directory 
>> `/mingw/src/fontconfig-2.10.**91' make: *** [all] Error 2
>> 
>> This is the first time I ever had problems with fontconfig. I
>> link it with MPlayer, apparently the mingw.org toolchain doesn't
>> have "_MKTEMP_S" yet it worked fine before without it so why is
>> _MKTEMP_S required now?
>> 
>> I can't switch to MinGW-w64 for MPlayer even though it's more
>> updated and probably has it, I would like to, but I run endlessly
>> into even more errors with MPlayer on those toolchains..
> 
> Hmm, yeah, I tested it with MinGW-w64 and works fine. will have a
> look later, to fix this issue.
> 
> 
Here's a fix.

Also attached a fix for installation.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ+nYjAAoJEOs4Jb6SI2Cwi7sIALPFoA3XbW3pBE9XarL62zyO
awxdrHthONBnfY3s+lqslkUFS0LDhT5dEhWvdipoJDZcZCdhQuNJBtAQX3Q2u+rU
J7Ee80rtSkujCuItaNJtpmbxITwE+CPzhQJaO9Y3ueHB+ZZHlmPBkReZYLpb4wZo
OKjWJRZqS7V34pgHJYoUwYrzttfkXh3G8tFnceVRTXIGmR/ua/sCJtxa/7DXZlGX
G+mOPKeKUvK2irFX4wezJYeA4FLhODJRddzXOz/fh+l/zRxKjbEuqsiKaduy4MIy
gsv8zf8j7ZFy4G5bgvZWsPAeaDxdQqDqKASNoXnrhbQrbnr5IAuqpHX3DZuLWhU=
=W62v
-----END PGP SIGNATURE-----
--- fontconfig-2.10.91/src/fccompat.c.orig	2013-01-08 11:21:19 +0400
+++ fontconfig-2.10.91/src/fccompat.c	2013-01-19 14:16:29 +0400
@@ -48,6 +48,57 @@
 #define FC_O_LARGEFILE 0
 #endif
 
+#if defined(__MINGW32__) && !defined(__MINGW64__)
+#include <time.h>
+#include <math.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <string.h>
+
+static void
+randtemplate (char *template, size_t l)
+{
+  int i;
+  for (i = l - 6; i < l; i++)
+  {
+    int r = rand ();
+    if ((r / (RAND_MAX + 1)) > ((RAND_MAX + 1) / 2))
+      template[i] = 'A' + (double) rand () / (RAND_MAX + 1) * ('Z' - 'A');
+    else
+      template[i] = 'a' + (double) rand () / (RAND_MAX + 1) * ('z' - 'a');
+  }
+}
+
+static int
+mkstemp (char *template)
+{
+  int i;
+  size_t l;
+  
+  if (template == NULL)
+  {
+    errno = EINVAL;
+    return -1;
+  }
+  l = strlen (template);
+  if (l < 6 || strcmp (&template[l - 6], "XXXXXX") != 0)
+  {
+    errno = EINVAL;
+    return -1;
+  }
+  srand(time (NULL));
+  do
+  {
+    errno = 0;
+    randtemplate (template, l);
+    i = open (template, O_BINARY | O_CREAT | O_EXCL | O_TEMPORARY | O_NOINHERIT | O_RDWR, _S_IREAD | _S_IWRITE);
+  } while (i < 0 && errno == EEXIST);
+  if (i >= 0)
+    errno = 0;
+  return i;
+}
+#endif
+
 int
 FcOpen(const char *pathname, int flags, ...)
 {
@@ -99,6 +150,8 @@
    if (_mktemp_s(template, strlen(template) + 1) != 0)
        return -1;
    fd = FcOpen(template, O_RDWR | O_EXCL | O_CREAT, 0600);
+#elif defined(__MINGW32__) && !defined(__MINGW64__)
+  fd = mkstemp (template);
 #else
 #error no secure functions to create a temporary file
 #endif
--- fontconfig-2.10.1/src/Makefile.am.orig	2012-09-10 03:40:57 +0400
+++ fontconfig-2.10.1/src/Makefile.am	2012-09-10 03:44:14 +0400
@@ -30,7 +30,7 @@
 # gcc import library install/uninstall
 
 install-libtool-import-lib: 
-	$(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)
+	$(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)/libfontconfig.dll.a
 	$(INSTALL) fontconfig.def $(DESTDIR)$(libdir)/fontconfig.def
 
 uninstall-libtool-import-lib:
--- fontconfig-2.10.1/src/Makefile.am.orig	2012-09-18 09:30:57 +0400
+++ fontconfig-2.10.1/src/Makefile.am	2012-09-18 09:46:37 +0400
@@ -29,7 +29,8 @@
 
 # gcc import library install/uninstall
 
-install-libtool-import-lib: 
+install-libtool-import-lib: libfontconfig.la
+	$(MKDIR_P) $(DESTDIR)$(libdir)
 	$(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)/libfontconfig.dll.a
 	$(INSTALL) fontconfig.def $(DESTDIR)$(libdir)/fontconfig.def
 
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux