]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/fontconfig.patch
contrib: update ffmpeg win32 configure patch against current svn
[vlc] / extras / contrib / src / Patches / fontconfig.patch
1 --- fontconfig/src/Makefile.am  Mon Sep 18 07:06:41 2006
2 +++ fontconfig/src/Makefile.am  Sat Aug 18 20:48:45 2007
3 ***************
4 *** 31,35 ****
5   
6   install-libtool-import-lib: 
7 -       $(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)
8         $(INSTALL) fontconfig.def $(DESTDIR)$(libdir)/fontconfig.def
9   
10 --- 31,34 ----
11 --- fontconfig/src/Makefile.in  Sun Dec  3 10:27:33 2006
12 +++ fontconfig/src/Makefile.in  Sat Aug 18 20:53:40 2007
13 ***************
14 *** 614,618 ****
15   
16   @OS_WIN32_TRUE@install-libtool-import-lib: 
17 - @OS_WIN32_TRUE@       $(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)
18   @OS_WIN32_TRUE@       $(INSTALL) fontconfig.def $(DESTDIR)$(libdir)/fontconfig.def
19   
20 --- 614,617 ----
21 --- fontconfig/src/fcinit.c     Sun Dec  3 07:10:30 2006
22 +++ fontconfig/src/fcinit.c     Sun Aug 19 00:52:07 2007
23 ***************
24 *** 26,32 ****
25 --- 26,94 ----
26   #include <stdlib.h>
27   
28 + #ifdef _WIN32
29 + #define STRICT
30 + #include <windows.h>
31 + #undef STRICT
32
33 + static char *IsWindowsDir(char *p_dir_in, char **p_dir_out)
34 + {
35 +     *p_dir_out = NULL;
36
37 +     if( ! strcmp( p_dir_in, "WINDOWSFONTDIR" ))
38 +     {
39 +         int rc;
40
41 +         *p_dir_out = malloc( 1000 );
42 +         if( !*p_dir_out )
43 +         {
44 +             fprintf( stderr, "Fontconfig error: out of memory" );
45 +             return p_dir_in;
46 +         }
47 +         rc = GetWindowsDirectory( *p_dir_out, 800 );
48 +         if( rc == 0 || rc > 800 )
49 +         {
50 +             fprintf( stderr, "Fontconfig error: GetWindowsDirectory failed" );
51 +             free( *p_dir_out );
52 +             *p_dir_out = NULL;
53 +      
54 +             return p_dir_in;
55 +         }
56 +         if( (*p_dir_out)[ rc - 1 ] != '\\' )
57 +             strcpy( (*p_dir_out)+rc, "\\" );
58 +         strcat( *p_dir_out, "fonts" );
59 +  
60 +         return *p_dir_out;
61 +     }
62 +     else if( ! strcmp( p_dir_in, "WINDOWSTEMPDIR" ))
63 +     {
64 +         int rc;
65
66 +         *p_dir_out = malloc( 1000 );
67 +         if( !*p_dir_out )
68 +         {
69 +             fprintf( stderr, "Fontconfig error: out of memory" );
70 +             return p_dir_in;
71 +         }
72 +         rc = GetTempPath( 800, *p_dir_out );
73 +         if( rc == 0 || rc > 800 )
74 +         {
75 +             fprintf( stderr, "Fontconfig error: GetTempPath failed" );
76 +             free( *p_dir_out );
77 +             *p_dir_out = NULL;
78 +      
79 +             return p_dir_in;
80 +         }
81 +         return *p_dir_out;
82 +     }
83 +     return p_dir_in;
84 + }
85 + #else
86 +   #define IsWindowsDir(A, B)   A
87 + #endif
88
89   static FcConfig *
90   FcInitFallbackConfig (void)
91   {
92 +     char        *p_dir_out = NULL;
93       FcConfig  *config;
94   
95 ***************
96 *** 34,40 ****
97       if (!config)
98         goto bail0;
99 !     if (!FcConfigAddDir (config, (FcChar8 *) FC_DEFAULT_FONTS))
100         goto bail1;
101 !     if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR))
102         goto bail1;
103       return config;
104 --- 96,106 ----
105       if (!config)
106         goto bail0;
107 !     if (!FcConfigAddDir (config, (FcChar8 *) IsWindowsDir(FC_DEFAULT_FONTS, &p_dir_out)))
108         goto bail1;
109 !     if (p_dir_out)
110 !         free(p_dir_out);
111 !     p_dir_out = NULL;
112
113 !     if (!FcConfigAddCacheDir (config, (FcChar8 *) IsWindowsDir(FC_CACHEDIR, &p_dir_out)))
114         goto bail1;
115       return config;
116 ***************
117 *** 43,46 ****
118 --- 109,114 ----
119       FcConfigDestroy (config);
120   bail0:
121 +     if (p_dir_out)
122 +         free(p_dir_out);
123       return 0;
124   }
125 ***************
126 *** 73,84 ****
127       if (config->cacheDirs && config->cacheDirs->num == 0)
128       {
129         fprintf (stderr,
130                  "Fontconfig warning: no <cachedir> elements found. Check configuration.\n");
131         fprintf (stderr,
132                  "Fontconfig warning: adding <cachedir>%s</cachedir>\n",
133 !                FC_CACHEDIR);
134         fprintf (stderr,
135                  "Fontconfig warning: adding <cachedir>~/.fontconfig</cachedir>\n");
136 !       if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) ||
137             !FcConfigAddCacheDir (config, (FcChar8 *) "~/.fontconfig"))
138         {
139 --- 141,158 ----
140       if (config->cacheDirs && config->cacheDirs->num == 0)
141       {
142 +         char *p_dir_out = NULL;
143
144         fprintf (stderr,
145                  "Fontconfig warning: no <cachedir> elements found. Check configuration.\n");
146         fprintf (stderr,
147                  "Fontconfig warning: adding <cachedir>%s</cachedir>\n",
148 !                IsWindowsDir(FC_CACHEDIR, &p_dir_out));
149         fprintf (stderr,
150                  "Fontconfig warning: adding <cachedir>~/.fontconfig</cachedir>\n");
151 !         if (p_dir_out)
152 !             free(p_dir_out);
153 !         p_dir_out = NULL;
154
155 !         if (!FcConfigAddCacheDir (config, (FcChar8 *) IsWindowsDir(FC_CACHEDIR, &p_dir_out)) ||
156             !FcConfigAddCacheDir (config, (FcChar8 *) "~/.fontconfig"))
157         {
158 ***************
159 *** 86,91 ****
160 --- 160,172 ----
161                      "Fontconfig error: out of memory");
162             FcConfigDestroy (config);
163
164 +             if (p_dir_out)
165 +                 free(p_dir_out);
166 +             p_dir_out = NULL;
167
168             return FcInitFallbackConfig ();
169         }
170 +         if (p_dir_out)
171 +             free(p_dir_out);
172       }
173