diff --git a/mingw-w64-openssl/PKGBUILD b/mingw-w64-openssl/PKGBUILD index c52ed452dd..bfa59336ed 100644 --- a/mingw-w64-openssl/PKGBUILD +++ b/mingw-w64-openssl/PKGBUILD @@ -29,11 +29,13 @@ md5sums=('c8dc151a671b9b92ff3e4c118b174972' '60ca340e32944e4825747e3681ccd553' '10d0cebf2d9c0f64c307e82542f519e3' 'cf00f216c47f33272d281e302ab1906a' - '704ac62f19e63d8a2d7197dcbe913254') + '170f80b2fb479fc422557a48d566f432') prepare() { cd $startdir/ - [ -d $srcdir/${_realname}-$pkgver ] || tar -xzvf ${_realname}-${pkgver}.tar.gz -C $srcdir + # Clean up old sources so re-patching doesn't fail. + [ -d $srcdir/${_realname}-$pkgver ] && rm -rf $srcdir/${_realname}-$pkgver + tar -xzvf ${_realname}-${pkgver}.tar.gz -C $srcdir cd $srcdir/${_realname}-$pkgver patch -p1 -i ${srcdir}/openssl-1.0.0a-ldflags.patch diff --git a/mingw-w64-openssl/openssl-1.0.1i-relocation.patch b/mingw-w64-openssl/openssl-1.0.1i-relocation.patch index 384eaf0e80..fff017ab8c 100644 --- a/mingw-w64-openssl/openssl-1.0.1i-relocation.patch +++ b/mingw-w64-openssl/openssl-1.0.1i-relocation.patch @@ -122,11 +122,15 @@ diff -Naur openssl-1.0.1i-orig/crypto/opensslconf.h.in openssl-1.0.1i/crypto/ope diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtools.c --- openssl-1.0.1i-orig/crypto/pathtools.c 1970-01-01 03:00:00.000000000 +0300 +++ openssl-1.0.1i/crypto/pathtools.c 2014-08-08 09:30:52.000000000 +0400 -@@ -0,0 +1,485 @@ +@@ -0,0 +1,499 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#if defined(__APPLE__) @@ -163,7 +167,7 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool +char * +malloc_copy_string(char const * original) +{ -+ char * result = (char *) malloc (sizeof(char*) * strlen(original)+1); ++ char * result = (char *) malloc (sizeof (char*) * strlen (original)+1); + if (result != NULL) + { + strcpy (result, original); @@ -174,7 +178,7 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool +void +sanitise_path(char * path) +{ -+ size_t path_size = strlen(path); ++ size_t path_size = strlen (path); + + /* Replace any '\' with '/' */ + char * path_p = path; @@ -184,38 +188,48 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool + } + /* Replace any '//' with '/' */ + path_p = path; -+ while ((path_p = strstr(path_p, "//")) != NULL) ++ while ((path_p = strstr (path_p, "//")) != NULL) + { -+ memmove(path_p, path_p + 1, path_size--); ++ memmove (path_p, path_p + 1, path_size--); + } + return; +} + +char * -+get_relative_path(char const * from, char const * to) ++get_relative_path(char const * from_in, char const * to_in) +{ -+ size_t from_size = strlen (from); -+ size_t to_size = strlen (to); ++ size_t from_size = (from_in == NULL) ? 0 : strlen (from_in); ++ size_t to_size = (to_in == NULL) ? 0 : strlen (to_in); + size_t max_size = (from_size + to_size) * 2 + 4; -+ char * common_part = (char *) alloca (max_size); -+ char * result = (char *) alloca (max_size); ++ char * scratch_space = (char *) alloca (from_size + 1 + to_size + 1 + max_size + max_size); ++ char * from; ++ char * to; ++ char * common_part; ++ char * result; + size_t count; + -+ /* If either alloca failed, no from was given, from is not absolute -+ or either to or from contains '.' then return a copy of to; it's -+ the best we can do in this instance (though we could call a path -+ normalization function for some of these conditions). -+ */ -+ if (common_part == NULL -+ || result == NULL -+ || from == NULL -+ || from[0] != '/' -+ || strchr (to, '.') != NULL -+ || strchr (from, '.') != NULL) ++ /* No to, return "./" */ ++ if (to_in == NULL) + { -+ return malloc_copy_string (to); ++ return malloc_copy_string ("./"); + } + ++ /* If alloca failed or no from was given return a copy of to */ ++ if ( from_in == NULL ++ || scratch_space == NULL ) ++ { ++ return malloc_copy_string (to_in); ++ } ++ ++ from = scratch_space; ++ strcpy (from, from_in); ++ to = from + from_size + 1; ++ strcpy (to, to_in); ++ common_part = to + to_size + 1; ++ result = common_part + max_size; ++ simplify_path (from); ++ simplify_path (to); ++ + result[0] = '\0'; + + size_t match_size_dirsep = 0; /* The match size up to the last /. Always wind back to this - 1 */ @@ -298,7 +312,7 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool + } while ((result_p = strchr (result_p, '/')) != NULL); + + result_p = result; -+ char const ** toks = (char const **) alloca (sizeof(char const*) * n_toks); ++ char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks); + n_toks = 0; + do + { @@ -344,7 +358,7 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool + if (removals[j] >= 0) /* Can become -2 */ + { + --n_toks; -+ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof(char*)); ++ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*)); + --i; + if (!j) + { @@ -509,11 +523,11 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool + while ((path_list_p = strchr (path_list_p, split_char)) != NULL); + + /* allocate everything in one go. */ -+ char * all_memory = (char *) malloc (sizeof(char *) * path_count + strlen(path_list) + 1); ++ char * all_memory = (char *) malloc (sizeof (char *) * path_count + strlen(path_list) + 1); + if (all_memory == NULL) + return 0; + *arr = (char **)all_memory; -+ all_memory += sizeof(char *) * path_count; ++ all_memory += sizeof (char *) * path_count; + + path_count = 0; + path_list_p = path_list; @@ -542,7 +556,7 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool +{ + char exe_path[MAX_PATH]; + char * temp; -+ get_executable_path (NULL, &exe_path[0], sizeof(exe_path) / sizeof(exe_path[0])); ++ get_executable_path (NULL, &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0])); + if ((temp = strrchr (exe_path, '/')) != NULL) + { + temp[1] = '\0'; @@ -608,14 +622,18 @@ diff -Naur openssl-1.0.1i-orig/crypto/pathtools.c openssl-1.0.1i/crypto/pathtool + free ((void*)arr); + return result; +} -diff -Naur openssl-1.0.1i-orig/crypto/pathtools.h openssl-1.0.1i/crypto/pathtools.h ---- openssl-1.0.1i-orig/crypto/pathtools.h 1970-01-01 03:00:00.000000000 +0300 -+++ openssl-1.0.1i/crypto/pathtools.h 2014-08-08 09:36:15.000000000 +0400 -@@ -0,0 +1,45 @@ +diff -urN old/pathtools.h new/pathtools.h +--- old/pathtools.h 1970-01-01 01:00:00.000000000 +0100 ++++ new/pathtools.h 2014-08-28 18:40:03.939064600 +0100 +@@ -0,0 +1,49 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#ifndef PATHTOOLS_H diff --git a/mingw-w64-p11-kit/0000-no-proxy.mingw.patch b/mingw-w64-p11-kit/0000-no-proxy.mingw.patch index c078de05d6..789da096ca 100644 --- a/mingw-w64-p11-kit/0000-no-proxy.mingw.patch +++ b/mingw-w64-p11-kit/0000-no-proxy.mingw.patch @@ -1,8 +1,10 @@ ---- p11-kit-0.17.5/p11-kit/Makefile.am.orig 2013-04-01 19:54:53 +0400 -+++ p11-kit-0.17.5/p11-kit/Makefile.am 2013-04-01 20:02:29 +0400 -@@ -102,5 +102,4 @@ +--- p11-kit-0.17.5/p11-kit/Makefile.am.orig 2014-07-04 14:48:45.000000000 +0100 ++++ p11-kit-0.17.5/p11-kit/Makefile.am 2014-08-28 19:38:29.226555600 +0100 +@@ -100,7 +100,6 @@ # Proxy module is actually same as library, so install a link install-exec-hook: - $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libp11-kit.so` $(DESTDIR)$(libdir)/p11-kit-proxy.so $(MKDIR_P) $(DESTDIR)$(p11_package_config_modules) + + endif diff --git a/mingw-w64-p11-kit/p11-kit-relocation.patch b/mingw-w64-p11-kit/0006-p11-kit-relocation.patch similarity index 90% rename from mingw-w64-p11-kit/p11-kit-relocation.patch rename to mingw-w64-p11-kit/0006-p11-kit-relocation.patch index ad71d230bc..5103af3bf6 100644 --- a/mingw-w64-p11-kit/p11-kit-relocation.patch +++ b/mingw-w64-p11-kit/0006-p11-kit-relocation.patch @@ -85,11 +85,15 @@ diff -Naur p11-kit-0.20.3-orig/common/path.h p11-kit-0.20.3/common/path.h diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtools.c --- p11-kit-0.20.3-orig/common/pathtools.c 1970-01-01 03:00:00.000000000 +0300 +++ p11-kit-0.20.3/common/pathtools.c 2014-08-08 09:30:52.000000000 +0400 -@@ -0,0 +1,485 @@ +@@ -0,0 +1,499 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#if defined(__APPLE__) @@ -126,7 +130,7 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool +char * +malloc_copy_string(char const * original) +{ -+ char * result = (char *) malloc (sizeof(char*) * strlen(original)+1); ++ char * result = (char *) malloc (sizeof (char*) * strlen (original)+1); + if (result != NULL) + { + strcpy (result, original); @@ -137,7 +141,7 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool +void +sanitise_path(char * path) +{ -+ size_t path_size = strlen(path); ++ size_t path_size = strlen (path); + + /* Replace any '\' with '/' */ + char * path_p = path; @@ -147,38 +151,48 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool + } + /* Replace any '//' with '/' */ + path_p = path; -+ while ((path_p = strstr(path_p, "//")) != NULL) ++ while ((path_p = strstr (path_p, "//")) != NULL) + { -+ memmove(path_p, path_p + 1, path_size--); ++ memmove (path_p, path_p + 1, path_size--); + } + return; +} + +char * -+get_relative_path(char const * from, char const * to) ++get_relative_path(char const * from_in, char const * to_in) +{ -+ size_t from_size = strlen (from); -+ size_t to_size = strlen (to); ++ size_t from_size = (from_in == NULL) ? 0 : strlen (from_in); ++ size_t to_size = (to_in == NULL) ? 0 : strlen (to_in); + size_t max_size = (from_size + to_size) * 2 + 4; -+ char * common_part = (char *) alloca (max_size); -+ char * result = (char *) alloca (max_size); ++ char * scratch_space = (char *) alloca (from_size + 1 + to_size + 1 + max_size + max_size); ++ char * from; ++ char * to; ++ char * common_part; ++ char * result; + size_t count; + -+ /* If either alloca failed, no from was given, from is not absolute -+ or either to or from contains '.' then return a copy of to; it's -+ the best we can do in this instance (though we could call a path -+ normalization function for some of these conditions). -+ */ -+ if (common_part == NULL -+ || result == NULL -+ || from == NULL -+ || from[0] != '/' -+ || strchr (to, '.') != NULL -+ || strchr (from, '.') != NULL) ++ /* No to, return "./" */ ++ if (to_in == NULL) + { -+ return malloc_copy_string (to); ++ return malloc_copy_string ("./"); + } + ++ /* If alloca failed or no from was given return a copy of to */ ++ if ( from_in == NULL ++ || scratch_space == NULL ) ++ { ++ return malloc_copy_string (to_in); ++ } ++ ++ from = scratch_space; ++ strcpy (from, from_in); ++ to = from + from_size + 1; ++ strcpy (to, to_in); ++ common_part = to + to_size + 1; ++ result = common_part + max_size; ++ simplify_path (from); ++ simplify_path (to); ++ + result[0] = '\0'; + + size_t match_size_dirsep = 0; /* The match size up to the last /. Always wind back to this - 1 */ @@ -261,7 +275,7 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool + } while ((result_p = strchr (result_p, '/')) != NULL); + + result_p = result; -+ char const ** toks = (char const **) alloca (sizeof(char const*) * n_toks); ++ char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks); + n_toks = 0; + do + { @@ -307,7 +321,7 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool + if (removals[j] >= 0) /* Can become -2 */ + { + --n_toks; -+ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof(char*)); ++ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*)); + --i; + if (!j) + { @@ -472,11 +486,11 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool + while ((path_list_p = strchr (path_list_p, split_char)) != NULL); + + /* allocate everything in one go. */ -+ char * all_memory = (char *) malloc (sizeof(char *) * path_count + strlen(path_list) + 1); ++ char * all_memory = (char *) malloc (sizeof (char *) * path_count + strlen(path_list) + 1); + if (all_memory == NULL) + return 0; + *arr = (char **)all_memory; -+ all_memory += sizeof(char *) * path_count; ++ all_memory += sizeof (char *) * path_count; + + path_count = 0; + path_list_p = path_list; @@ -505,7 +519,7 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool +{ + char exe_path[MAX_PATH]; + char * temp; -+ get_executable_path (NULL, &exe_path[0], sizeof(exe_path) / sizeof(exe_path[0])); ++ get_executable_path (NULL, &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0])); + if ((temp = strrchr (exe_path, '/')) != NULL) + { + temp[1] = '\0'; @@ -573,12 +587,16 @@ diff -Naur p11-kit-0.20.3-orig/common/pathtools.c p11-kit-0.20.3/common/pathtool +} diff -Naur p11-kit-0.20.3-orig/common/pathtools.h p11-kit-0.20.3/common/pathtools.h --- p11-kit-0.20.3-orig/common/pathtools.h 1970-01-01 03:00:00.000000000 +0300 -+++ p11-kit-0.20.3/common/pathtools.h 2014-08-08 09:36:15.000000000 +0400 -@@ -0,0 +1,45 @@ ++++ p11-kit-0.20.3/common/pathtools.h 2014-08-08 09:30:52.000000000 +0400 +@@ -0,0 +1,49 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#ifndef PATHTOOLS_H diff --git a/mingw-w64-p11-kit/0007-add-debugging-to-mmap.patch b/mingw-w64-p11-kit/0007-add-debugging-to-mmap.patch new file mode 100644 index 0000000000..d4c590b28d --- /dev/null +++ b/mingw-w64-p11-kit/0007-add-debugging-to-mmap.patch @@ -0,0 +1,64 @@ +--- p11-kit-0.20.3/common/compat.c.orig 2014-07-04 14:48:45.000000000 +0100 ++++ p11-kit-0.20.3/common/compat.c 2014-08-28 15:33:25.872571900 +0100 +@@ -325,19 +325,27 @@ + + map->file = CreateFile (path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); + if (map->file == INVALID_HANDLE_VALUE) { ++ p11_message ("map->file (%s) == INVALID_HANDLE_VALUE", path); + errn = GetLastError (); + free (map); + SetLastError (errn); + if (errn == ERROR_PATH_NOT_FOUND || errn == ERROR_FILE_NOT_FOUND) ++ { ++ p11_message ("errn == ERROR_PATH_NOT_FOUND || errn == ERROR_FILE_NOT_FOUND, errn = %d", errn); + errno = ENOENT; ++ } + else if (errn == ERROR_ACCESS_DENIED) ++ { ++ p11_message ("errn == ERROR_ACCESS_DENIED"); + errno = EPERM; ++ } + return NULL; + } + + if (sb == NULL) { + if (!GetFileSizeEx (map->file, &large)) { + errn = GetLastError (); ++ p11_message ("GetFileSizeEx (map->file, &large), errn = %d", errn); + CloseHandle (map->file); + free (map); + SetLastError (errn); +@@ -352,6 +360,7 @@ + mapping = CreateFileMapping (map->file, NULL, PAGE_READONLY, 0, 0, NULL); + if (!mapping) { + errn = GetLastError (); ++ p11_message ("CreateFileMapping (map->file, NULL, PAGE_READONLY, 0, 0, NULL), errn = %d", errn); + CloseHandle (map->file); + free (map); + SetLastError (errn); +@@ -365,6 +374,7 @@ + + if (map->data == NULL) { + errn = GetLastError (); ++ p11_message ("MapViewOfFile (mapping, FILE_MAP_READ, 0, 0, large.QuadPart) map->data = NULL, errn = %d", errn); + CloseHandle (map->file); + free (map); + SetLastError (errn); +@@ -381,8 +391,15 @@ + void + p11_mmap_close (p11_mmap *map) + { +- UnmapViewOfFile (map->data); +- CloseHandle (map->file); ++ p11_message ("p11_mmap_close (p11_mmap *map = %p) called", map); ++ if (!UnmapViewOfFile (map->data)) ++ { ++ p11_message ("UnmapViewOfFile (map->data = %p) failed", map->data); ++ } ++ if (!CloseHandle (map->file)) ++ { ++ p11_message ("CloseHandle (map->file = %d) failed", map->file); ++ } + free (map); + } + diff --git a/mingw-w64-p11-kit/0008-add-debugging-to-path.patch b/mingw-w64-p11-kit/0008-add-debugging-to-path.patch new file mode 100644 index 0000000000..001345beef --- /dev/null +++ b/mingw-w64-p11-kit/0008-add-debugging-to-path.patch @@ -0,0 +1,15 @@ +--- p11-kit-0.20.3/common/path.c.orig 2014-08-28 15:38:41.193607200 +0100 ++++ p11-kit-0.20.3/common/path.c 2014-08-28 16:18:10.646132100 +0100 +@@ -336,8 +336,12 @@ + strrchr (exe_path, '/')[1] = '\0'; + } + char * rel_to_datadir = get_relative_path (P11_BINDIR, path); ++ p11_message ("get_relative_path (P11_BINDIR = %s, path = %s) = %s", P11_BINDIR, path, rel_to_datadir); ++ p11_message ("exe_path(1) = %s", exe_path); + strcat (exe_path, rel_to_datadir); ++ p11_message ("exe_path(2) = %s", exe_path); + simplify_path (&exe_path[0]); ++ p11_message ("exe_path(3) = %s", exe_path); + return malloc_copy_string(exe_path); + #else + return malloc_copy_string(path); diff --git a/mingw-w64-p11-kit/PKGBUILD b/mingw-w64-p11-kit/PKGBUILD index 544b9c230f..9d1d86fe18 100644 --- a/mingw-w64-p11-kit/PKGBUILD +++ b/mingw-w64-p11-kit/PKGBUILD @@ -22,27 +22,33 @@ source=($url/releases/$_realname-$pkgver.tar.gz{,.sig} 0003-fix-test-path.all.patch 0004-fix-abspath-check.all.patch 0005-no-getuid-on-w32.all.patch - p11-kit-relocation.patch) + 0006-p11-kit-relocation.patch + 0007-add-debugging-to-mmap.patch + 0008-add-debugging-to-path.patch) md5sums=('c0b057be50ab9721cfc15a7aae86ca3b' 'SKIP' - '9506243bd78f4136b9ab440fe216665d' + '70330b415eb5167e5a530c13bb96c212' 'b7a706e19b5e29d96889ca2410a151df' 'c11cba6726e4791ed8ff917978755596' 'd4feddce2bb360ab466861dbbe4fdadd' '9a91b743f18126ff7d4d08e43c38d0a3' '8837624f5b0c588ce043f2774388632d' - 'c332ac101f44d5d8c9af34c586c88f3c') + '07d3309cdd542206b2c6b83bc0ab085f' + '0dcd0d7e10d5d898f32da8866580d640' + '27793fc62cf1fbfe52964ba8099d2b44') prepare() { cd "${srcdir}"/${_realname}-${pkgver} - rm common/pathtools.c common/pathtools.h || true + rm -f common/pathtools.c common/pathtools.h > /dev/null 2>&1 || true patch -p1 -i ${srcdir}/0000-no-proxy.mingw.patch patch -p1 -i ${srcdir}/0001-allow-gtkdocize.all.patch patch -p1 -i ${srcdir}/0002-disable-managed-test.all.patch patch -p1 -i ${srcdir}/0003-fix-test-path.all.patch patch -p1 -i ${srcdir}/0004-fix-abspath-check.all.patch patch -p1 -i ${srcdir}/0005-no-getuid-on-w32.all.patch - patch -p1 -i ${srcdir}/p11-kit-relocation.patch + patch -p1 -i ${srcdir}/0006-p11-kit-relocation.patch + # patch -p1 -i ${srcdir}/0007-add-debugging-to-mmap.patch + # patch -p1 -i ${srcdir}/0008-add-debugging-to-path.patch autoreconf -fi } diff --git a/mingw-w64-pathtools/main.c b/mingw-w64-pathtools/main.c index a62bae8a9f..0843631998 100644 --- a/mingw-w64-pathtools/main.c +++ b/mingw-w64-pathtools/main.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) #define DATADIR "/mingw64/share" char exe_path[PATH_MAX]; - get_executable_path (argv[0], &exe_path[0], sizeof(exe_path) / sizeof(exe_path[0])); + get_executable_path (argv[0], &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0])); printf ("executable path is %s\n", exe_path); char * rel_to_datadir = get_relative_path (BINDIR, DATADIR); @@ -124,12 +124,14 @@ int main(int argc, char *argv[]) { get_relative_path_debug (argv[argc-2], argv[argc-1], 0); } - get_relative_path_debug ("/a/b/c/d", "/a/b/c", ".."); - get_relative_path_debug ("/a/b/c/d/", "/a/b/c/", "../"); - get_relative_path_debug ("/", "/", "/"); - get_relative_path_debug ("/a/testone/c/d", "/a/testtwo/c", "../../../testtwo/c"); - get_relative_path_debug ("/a/testone/c/d/", "/a/testtwo/c/", "../../../testtwo/c/"); - get_relative_path_debug ("/home/part2/part3/part4", "/work/proj1/proj2", "../../../../work/proj1/proj2"); + get_relative_path_debug (NULL, NULL, "./"); + get_relative_path_debug ("/mingw64/bin", "/mingw64/etc/pkcs11/pkcs11.conf", "../etc/pkcs11/pkcs11.conf"); + get_relative_path_debug ("/a/b/c/d", "/a/b/c", ".."); + get_relative_path_debug ("/a/b/c/d/", "/a/b/c/", "../"); + get_relative_path_debug ("/", "/", "/"); + get_relative_path_debug ("/a/testone/c/d", "/a/testtwo/c", "../../../testtwo/c"); + get_relative_path_debug ("/a/testone/c/d/", "/a/testtwo/c/", "../../../testtwo/c/"); + get_relative_path_debug ("/home/part2/part3/part4", "/work/proj1/proj2", "../../../../work/proj1/proj2"); simplify_path_debug ("a/b/..", "a"); simplify_path_debug ("a/b/c/../../", "a/"); diff --git a/mingw-w64-pathtools/pathtools.c b/mingw-w64-pathtools/pathtools.c index 650d3061b2..81ffa7e8a6 100644 --- a/mingw-w64-pathtools/pathtools.c +++ b/mingw-w64-pathtools/pathtools.c @@ -1,7 +1,11 @@ /* .Some useful path tools. - Written by Ray Donnelly in 2014. - Licensed under CC0. No warranty. + .ASCII only for now. + .Written by Ray Donnelly in 2014. + .Licensed under CC0 (and anything. + .else you need to license it under). + .No warranties whatsoever. + .email: . */ #if defined(__APPLE__) @@ -38,7 +42,7 @@ char * malloc_copy_string(char const * original) { - char * result = (char *) malloc (sizeof(char*) * strlen(original)+1); + char * result = (char *) malloc (sizeof (char*) * strlen (original)+1); if (result != NULL) { strcpy (result, original); @@ -49,7 +53,7 @@ malloc_copy_string(char const * original) void sanitise_path(char * path) { - size_t path_size = strlen(path); + size_t path_size = strlen (path); /* Replace any '\' with '/' */ char * path_p = path; @@ -59,38 +63,48 @@ sanitise_path(char * path) } /* Replace any '//' with '/' */ path_p = path; - while ((path_p = strstr(path_p, "//")) != NULL) + while ((path_p = strstr (path_p, "//")) != NULL) { - memmove(path_p, path_p + 1, path_size--); + memmove (path_p, path_p + 1, path_size--); } return; } char * -get_relative_path(char const * from, char const * to) +get_relative_path(char const * from_in, char const * to_in) { - size_t from_size = strlen (from); - size_t to_size = strlen (to); + size_t from_size = (from_in == NULL) ? 0 : strlen (from_in); + size_t to_size = (to_in == NULL) ? 0 : strlen (to_in); size_t max_size = (from_size + to_size) * 2 + 4; - char * common_part = (char *) alloca (max_size); - char * result = (char *) alloca (max_size); + char * scratch_space = (char *) alloca (from_size + 1 + to_size + 1 + max_size + max_size); + char * from; + char * to; + char * common_part; + char * result; size_t count; - /* If either alloca failed, no from was given, from is not absolute - or either to or from contains '.' then return a copy of to; it's - the best we can do in this instance (though we could call a path - normalization function for some of these conditions). - */ - if (common_part == NULL - || result == NULL - || from == NULL - || from[0] != '/' - || strchr (to, '.') != NULL - || strchr (from, '.') != NULL) + /* No to, return "./" */ + if (to_in == NULL) { - return malloc_copy_string (to); + return malloc_copy_string ("./"); } + /* If alloca failed or no from was given return a copy of to */ + if ( from_in == NULL + || scratch_space == NULL ) + { + return malloc_copy_string (to_in); + } + + from = scratch_space; + strcpy (from, from_in); + to = from + from_size + 1; + strcpy (to, to_in); + common_part = to + to_size + 1; + result = common_part + max_size; + simplify_path (from); + simplify_path (to); + result[0] = '\0'; size_t match_size_dirsep = 0; /* The match size up to the last /. Always wind back to this - 1 */ @@ -173,7 +187,7 @@ simplify_path(char * path) } while ((result_p = strchr (result_p, '/')) != NULL); result_p = result; - char const ** toks = (char const **) alloca (sizeof(char const*) * n_toks); + char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks); n_toks = 0; do { @@ -219,7 +233,7 @@ simplify_path(char * path) if (removals[j] >= 0) /* Can become -2 */ { --n_toks; - memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof(char*)); + memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*)); --i; if (!j) { @@ -384,11 +398,11 @@ split_path_list(char const * path_list, char split_char, char *** arr) while ((path_list_p = strchr (path_list_p, split_char)) != NULL); /* allocate everything in one go. */ - char * all_memory = (char *) malloc (sizeof(char *) * path_count + strlen(path_list) + 1); + char * all_memory = (char *) malloc (sizeof (char *) * path_count + strlen(path_list) + 1); if (all_memory == NULL) return 0; *arr = (char **)all_memory; - all_memory += sizeof(char *) * path_count; + all_memory += sizeof (char *) * path_count; path_count = 0; path_list_p = path_list; @@ -417,7 +431,7 @@ get_relocated_path_list(char const * from, char const * to_path_list) { char exe_path[MAX_PATH]; char * temp; - get_executable_path (NULL, &exe_path[0], sizeof(exe_path) / sizeof(exe_path[0])); + get_executable_path (NULL, &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0])); if ((temp = strrchr (exe_path, '/')) != NULL) { temp[1] = '\0'; diff --git a/mingw-w64-pathtools/pathtools.h b/mingw-w64-pathtools/pathtools.h index a4070c1193..a8a2928049 100644 --- a/mingw-w64-pathtools/pathtools.h +++ b/mingw-w64-pathtools/pathtools.h @@ -1,7 +1,11 @@ /* .Some useful path tools. - Written by Ray Donnelly in 2014. - Licensed under CC0. No warranty. + .ASCII only for now. + .Written by Ray Donnelly in 2014. + .Licensed under CC0 (and anything. + .else you need to license it under). + .No warranties whatsoever. + .email: . */ #ifndef PATHTOOLS_H diff --git a/mingw-w64-pkgconf/0002-relocate.patch b/mingw-w64-pkgconf/0002-relocate.patch index b88be2c247..c48a7ad746 100644 --- a/mingw-w64-pkgconf/0002-relocate.patch +++ b/mingw-w64-pkgconf/0002-relocate.patch @@ -119,11 +119,15 @@ diff -Naur pkgconf-0.9.6-orig/Makefile.in pkgconf-0.9.6/Makefile.in diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c --- pkgconf-0.9.6-orig/pathtools.c 1970-01-01 03:00:00.000000000 +0300 +++ pkgconf-0.9.6/pathtools.c 2014-08-08 09:30:52.000000000 +0400 -@@ -0,0 +1,485 @@ +@@ -0,0 +1,499 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#if defined(__APPLE__) @@ -160,7 +164,7 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c +char * +malloc_copy_string(char const * original) +{ -+ char * result = (char *) malloc (sizeof(char*) * strlen(original)+1); ++ char * result = (char *) malloc (sizeof (char*) * strlen (original)+1); + if (result != NULL) + { + strcpy (result, original); @@ -171,7 +175,7 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c +void +sanitise_path(char * path) +{ -+ size_t path_size = strlen(path); ++ size_t path_size = strlen (path); + + /* Replace any '\' with '/' */ + char * path_p = path; @@ -181,38 +185,48 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c + } + /* Replace any '//' with '/' */ + path_p = path; -+ while ((path_p = strstr(path_p, "//")) != NULL) ++ while ((path_p = strstr (path_p, "//")) != NULL) + { -+ memmove(path_p, path_p + 1, path_size--); ++ memmove (path_p, path_p + 1, path_size--); + } + return; +} + +char * -+get_relative_path(char const * from, char const * to) ++get_relative_path(char const * from_in, char const * to_in) +{ -+ size_t from_size = strlen (from); -+ size_t to_size = strlen (to); ++ size_t from_size = (from_in == NULL) ? 0 : strlen (from_in); ++ size_t to_size = (to_in == NULL) ? 0 : strlen (to_in); + size_t max_size = (from_size + to_size) * 2 + 4; -+ char * common_part = (char *) alloca (max_size); -+ char * result = (char *) alloca (max_size); ++ char * scratch_space = (char *) alloca (from_size + 1 + to_size + 1 + max_size + max_size); ++ char * from; ++ char * to; ++ char * common_part; ++ char * result; + size_t count; + -+ /* If either alloca failed, no from was given, from is not absolute -+ or either to or from contains '.' then return a copy of to; it's -+ the best we can do in this instance (though we could call a path -+ normalization function for some of these conditions). -+ */ -+ if (common_part == NULL -+ || result == NULL -+ || from == NULL -+ || from[0] != '/' -+ || strchr (to, '.') != NULL -+ || strchr (from, '.') != NULL) ++ /* No to, return "./" */ ++ if (to_in == NULL) + { -+ return malloc_copy_string (to); ++ return malloc_copy_string ("./"); + } + ++ /* If alloca failed or no from was given return a copy of to */ ++ if ( from_in == NULL ++ || scratch_space == NULL ) ++ { ++ return malloc_copy_string (to_in); ++ } ++ ++ from = scratch_space; ++ strcpy (from, from_in); ++ to = from + from_size + 1; ++ strcpy (to, to_in); ++ common_part = to + to_size + 1; ++ result = common_part + max_size; ++ simplify_path (from); ++ simplify_path (to); ++ + result[0] = '\0'; + + size_t match_size_dirsep = 0; /* The match size up to the last /. Always wind back to this - 1 */ @@ -295,7 +309,7 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c + } while ((result_p = strchr (result_p, '/')) != NULL); + + result_p = result; -+ char const ** toks = (char const **) alloca (sizeof(char const*) * n_toks); ++ char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks); + n_toks = 0; + do + { @@ -341,7 +355,7 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c + if (removals[j] >= 0) /* Can become -2 */ + { + --n_toks; -+ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof(char*)); ++ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*)); + --i; + if (!j) + { @@ -506,11 +520,11 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c + while ((path_list_p = strchr (path_list_p, split_char)) != NULL); + + /* allocate everything in one go. */ -+ char * all_memory = (char *) malloc (sizeof(char *) * path_count + strlen(path_list) + 1); ++ char * all_memory = (char *) malloc (sizeof (char *) * path_count + strlen(path_list) + 1); + if (all_memory == NULL) + return 0; + *arr = (char **)all_memory; -+ all_memory += sizeof(char *) * path_count; ++ all_memory += sizeof (char *) * path_count; + + path_count = 0; + path_list_p = path_list; @@ -539,7 +553,7 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c +{ + char exe_path[MAX_PATH]; + char * temp; -+ get_executable_path (NULL, &exe_path[0], sizeof(exe_path) / sizeof(exe_path[0])); ++ get_executable_path (NULL, &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0])); + if ((temp = strrchr (exe_path, '/')) != NULL) + { + temp[1] = '\0'; @@ -605,14 +619,18 @@ diff -Naur pkgconf-0.9.6-orig/pathtools.c pkgconf-0.9.6/pathtools.c + free ((void*)arr); + return result; +} -diff -Naur pkgconf-0.9.6-orig/pathtools.h pkgconf-0.9.6/pathtools.h ---- pkgconf-0.9.6-orig/pathtools.h 1970-01-01 03:00:00.000000000 +0300 -+++ pkgconf-0.9.6/pathtools.h 2014-08-08 09:36:15.000000000 +0400 -@@ -0,0 +1,45 @@ +diff -urN old/pathtools.h new/pathtools.h +--- old/pathtools.h 1970-01-01 01:00:00.000000000 +0100 ++++ new/pathtools.h 2014-08-28 18:40:03.939064600 +0100 +@@ -0,0 +1,49 @@ +/* + .Some useful path tools. -+ Written by Ray Donnelly in 2014. -+ Licensed under CC0. No warranty. ++ .ASCII only for now. ++ .Written by Ray Donnelly in 2014. ++ .Licensed under CC0 (and anything. ++ .else you need to license it under). ++ .No warranties whatsoever. ++ .email: . + */ + +#ifndef PATHTOOLS_H diff --git a/mingw-w64-pkgconf/PKGBUILD b/mingw-w64-pkgconf/PKGBUILD index bcdcd07654..5aab20bf99 100644 --- a/mingw-w64-pkgconf/PKGBUILD +++ b/mingw-w64-pkgconf/PKGBUILD @@ -17,10 +17,11 @@ source=(http://rabbit.dereferenced.org/~nenolod/distfiles//$_realname-$pkgver.ta 0002-relocate.patch) sha256sums=('c40a77543fe5c7259b813f70ddaf229c2760a250d1cf2ccef60b81fb1d3fc299' 'f7b3d51121844999a5a2c2b662d1c69f589d7f023a8c42931425937e64cff1dd' - '78a6331530c3ea1175aadf6002574a205d4ed6f19507c4af8452573013751da0') + '108e30feb249e68a2c494723485cafaa0e47158103699dca8d5916620361228a') prepare() { cd $_realname-$pkgver + rm -f pathtools.c pathtools.h m4/as-ac-expand.m4 > /dev/null 2>&1 || true patch -p1 -i ${srcdir}/0001-fix-windows-separator.patch patch -p1 -i ${srcdir}/0002-relocate.patch @@ -29,7 +30,9 @@ prepare() { build() { cd $_realname-$pkgver - ./configure --prefix=${MINGW_PREFIX} \ + [ -d ${CARCH} ] || mkdir ${CARCH} + cd ${CARCH} + ../configure --prefix=${MINGW_PREFIX} \ --build=${MINGW_CHOST} \ --host=${MINGW_CHOST} \ --target=${MINGW_CHOST} \ @@ -41,7 +44,7 @@ build() { } package() { - cd $_realname-$pkgver + cd $_realname-$pkgver/${CARCH} make DESTDIR="$pkgdir" install cp "${pkgdir}${MINGW_PREFIX}"/bin/pkgconf "${pkgdir}${MINGW_PREFIX}"/bin/pkg-config } diff --git a/mingw-w64-rust-git/PKGBUILD b/mingw-w64-rust-git/PKGBUILD index b1887116e9..25cb010326 100644 --- a/mingw-w64-rust-git/PKGBUILD +++ b/mingw-w64-rust-git/PKGBUILD @@ -3,7 +3,7 @@ _realname=rust pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=r31815.18d6eef +pkgver=r31823.b516532 pkgrel=1 pkgdesc="A safe, concurrent, practical language from Mozilla (mingw-w64)" arch=('any') @@ -51,3 +51,11 @@ package() { cd "${srcdir}"/build-${MINGW_CARCH} make DESTDIR=${pkgdir} install } + +# pushd /e/m2/repo/mingw-w64-rust-git/src/build- +# CFG_SRC_DIR=/e/m2/repo/mingw-w64-rust-git/src/rust/ /mingw64/bin/python2.7 /e/m2/repo/mingw-w64-rust-git/src/rust/src/etc/get-snapshot.py x86_64-w64-mingw32 +# .. +# rm -f dl/* ; /usr/bin/curl -o dl/rust-stage0-2014-08-17-a86d9ad-winnt-i386-c2b08d721c5c1628aea4932c0e09e5bf07d54881.tar.bz2.tmp https://static.rust-lang.org/stage0-snapshots/rust-stage0-2014-08-17-a86d9ad-winnt-i386-c2b08d721c5c1628aea4932c0e09e5bf07d54881.tar.bz2 +# vs +# rm -f dl/* ; /e/msys64/mingw64/bin/curl.exe -o dl/rust-stage0-2014-08-17-a86d9ad-winnt-i386-c2b08d721c5c1628aea4932c0e09e5bf07d54881.tar.bz2.tmp https://static.rust-lang.org/stage0-snapshots/rust-stage0-2014-08-17-a86d9ad-winnt-i386-c2b08d721c5c1628aea4932c0e09e5bf07d54881.tar.bz2 +#