diff -r -u --strip-trailing-cr fontconfig-2.13.1.original/conf.d/Makefile.am fontconfig-2.13.1/conf.d/Makefile.am --- fontconfig-2.13.1.original/conf.d/Makefile.am 2019-05-22 02:13:14.873420300 +0200 +++ fontconfig-2.13.1/conf.d/Makefile.am 2019-05-22 02:13:09.258559300 +0200 @@ -95,9 +95,9 @@ @(echo cd $(DESTDIR)$(configdir); \ cd $(DESTDIR)$(configdir); \ for i in $(CONF_LINKS); do \ - echo $(RM) $$i";" ln -s $(templatedir)/$$i .; \ + echo $(RM) $$i";" ln -s $(DESTDIR)$(templatedir)/$$i .; \ $(RM) $$i; \ - ln -s $(templatedir)/$$i .; \ + ln -s $(DESTDIR)$(templatedir)/$$i .; \ done) uninstall-local: @(echo cd $(DESTDIR)$(configdir); \ diff -r -u --strip-trailing-cr fontconfig-2.13.1.original/m4/pkg.m4 fontconfig-2.13.1/m4/pkg.m4 --- fontconfig-2.13.1.original/m4/pkg.m4 2019-05-22 02:14:51.118586100 +0200 +++ fontconfig-2.13.1/m4/pkg.m4 2019-05-22 02:13:09.883520000 +0200 @@ -111,8 +111,8 @@ pkg_failed=no AC_MSG_CHECKING([for $1]) -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) +_PKG_CONFIG([$1][_CFLAGS], [cflags --dont-define-prefix], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs --dont-define-prefix], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. @@ -207,7 +207,7 @@ [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +_PKG_CONFIG([$1], [variable="][$3][" --dont-define-prefix], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl diff -r -u --strip-trailing-cr fontconfig-2.13.1.original/test/test-migration.c fontconfig-2.13.1/test/test-migration.c --- fontconfig-2.13.1.original/test/test-migration.c 2019-05-22 02:15:02.608443100 +0200 +++ fontconfig-2.13.1/test/test-migration.c 2019-05-22 02:13:09.758513300 +0200 @@ -31,6 +31,9 @@ #include #include #include +#ifdef _WIN32 +#define mkdir(path,mode) _mkdir(path) +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include #include @@ -51,6 +54,231 @@ } #endif +#if defined(_WIN32) +#include +#include +#include +#include +#include +#include +#include +#include + +static PSECURITY_DESCRIPTOR +create_sd (int permissions) +{ + PSECURITY_DESCRIPTOR pSD = NULL; + int i; + int j; + EXPLICIT_ACCESS ea[3]; + PSID sids[3] = { NULL, NULL, NULL }; + WELL_KNOWN_SID_TYPE sidtypes[3] = { WinCreatorOwnerSid, WinCreatorGroupSid, WinWorldSid }; + int ea_len = 0; + DWORD dwRes, dwDisposition; + PACL pACL = NULL; + + /* Initialize a security descriptor. */ + pSD = (PSECURITY_DESCRIPTOR) LocalAlloc (LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); + if (NULL == pSD) + { + errno = ENOMEM; + return NULL; + } + + if (!InitializeSecurityDescriptor (pSD, SECURITY_DESCRIPTOR_REVISION)) + { + LocalFree (pSD); + errno = EIO; + return NULL; + } + + for (i = 0; i < 3; i++) + { + BOOL b; + DWORD bytes; + int imasked = permissions & (07 << (2 - i)); + if (!imasked) + continue; + + bytes = SECURITY_MAX_SID_SIZE; + sids[ea_len] = (PSID) LocalAlloc (LMEM_FIXED, bytes); + if (NULL == sids[ea_len]) + { + errno = ENOMEM; + LocalFree (pSD); + for (j = 0; j < ea_len; j++) + { + if (sids[j] != NULL) + { + LocalFree (sids[j]); + sids[j] = NULL; + } + } + return NULL; + } + + b = CreateWellKnownSid (sidtypes[i], NULL, sids[ea_len], &bytes); + if (!b) + { + errno = EINVAL; + LocalFree (pSD); + for (j = 0; j < ea_len; j++) + { + if (sids[j] != NULL) + { + LocalFree (sids[j]); + sids[j] = NULL; + } + } + return NULL; + } + + /* Initialize an EXPLICIT_ACCESS structure for an ACE. */ + ZeroMemory (&ea[ea_len], sizeof(EXPLICIT_ACCESS)); + bytes = 0; + if (01 & imasked) + bytes = bytes | GENERIC_READ; + if (02 & imasked) + bytes = bytes | GENERIC_WRITE; + if (04 & imasked) + bytes = bytes | GENERIC_EXECUTE; + ea[ea_len].grfAccessPermissions = bytes; + ea[ea_len].grfAccessMode = SET_ACCESS; + ea[ea_len].grfInheritance= NO_INHERITANCE; + ea[ea_len].Trustee.TrusteeForm = TRUSTEE_IS_SID; + ea[ea_len].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; + ea[ea_len].Trustee.ptstrName = (LPTSTR) sids[ea_len]; + ea_len = ea_len + 1; + } + + /* Create a new ACL that contains the new ACEs. */ + dwRes = SetEntriesInAcl (ea_len, ea, NULL, &pACL); + if (ERROR_SUCCESS != dwRes) + { + errno = EIO; + LocalFree (pSD); + for (j = 0; j < ea_len; j++) + { + if (sids[j] != NULL) + { + LocalFree (sids[j]); + sids[j] = NULL; + } + } + return NULL; + } + + for (j = 0; j < ea_len; j++) + { + if (sids[j] != NULL) + { + LocalFree (sids[j]); + sids[j] = NULL; + } + } + + /* Add the ACL to the security descriptor. */ + if (!SetSecurityDescriptorDacl (pSD, + TRUE, // bDaclPresent flag + pACL, + FALSE)) // not a default DACL + { + errno = EIO; + LocalFree (pSD); + LocalFree (pACL); + return NULL; + } + + return pSD; +} + +static void +free_sd (PSECURITY_DESCRIPTOR sd) +{ + BOOL b, present, defaulted; + PACL pACL = NULL; + present = FALSE; + b = GetSecurityDescriptorDacl (sd, &present, &pACL, &defaulted); + if (b && present && !defaulted && pACL) + LocalFree (pACL); + LocalFree (sd); +} + +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 char * +mkdtemp (char *template) +{ + int i; + size_t l; + BOOL b; + SECURITY_ATTRIBUTES sa; + + if (template == NULL) + { + errno = EINVAL; + return NULL; + } + l = strlen (template); + if (l < 6 || strcmp (&template[l - 6], "XXXXXX") != 0) + { + errno = EINVAL; + return NULL; + } + srand(time (NULL)); + sa.nLength = sizeof (sa); + sa.lpSecurityDescriptor = create_sd (0700); + sa.bInheritHandle = FALSE; + do + { + randtemplate (template, l); + SetLastError (0); + b = CreateDirectoryA (template, &sa); + } while (!b && GetLastError () == ERROR_ALREADY_EXISTS); + free_sd (sa.lpSecurityDescriptor); + if (!b) + { + errno = EIO; + return NULL; + } + else + { + errno = 0; + return template; + } +} + +static int +setenv (const char *var, const char *val, int ovr) +{ + BOOL b; + char c[2]; + if (!ovr) + { + DWORD d; + d = GetEnvironmentVariableA (var, c, 2); + if (0 != d && GetLastError () != ERROR_ENVVAR_NOT_FOUND) + return; + } + b = SetEnvironmentVariableA (var, val); + if (b) + return 0; + return 1; +} +#endif + FcBool mkdir_p(const char *dir) {