This commit is contained in:
Alexey Pavlov
2015-09-16 09:09:58 +03:00
8 changed files with 162 additions and 645 deletions

View File

@@ -0,0 +1,11 @@
--- go.orig/src/cmd/dist/buildtool.go 2015-09-08 21:24:01.000000000 -0400
+++ go/src/cmd/dist/buildtool.go 2015-09-12 11:34:53.808544100 -0400
@@ -108,7 +108,7 @@
os.Setenv("GOHOSTARCH", "")
// Run Go 1.4 to build binaries.
- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
+ run(workspace, ShowOutput|CheckExit, "go", "install", "-v", "bootstrap/...")
// Copy binaries into tool binary directory.
for _, name := range bootstrapDirs {

View File

@@ -0,0 +1,28 @@
--- go.org/src/make.bat 2015-09-08 21:24:02.000000000 -0400
+++ go/src/make.bat 2015-09-12 14:22:08.562197600 -0400
@@ -59,13 +59,13 @@
echo ##### Building Go bootstrap tool.
echo cmd/dist
if not exist ..\bin\tool mkdir ..\bin\tool
-if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4
-if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
+
+if not exist "%GOROOT_BOOTSTRAP%\..\..\bin\go.exe" goto bootstrapfail
setlocal
set GOROOT=%GOROOT_BOOTSTRAP%
set GOOS=
set GOARCH=
-"%GOROOT_BOOTSTRAP%\bin\go" build -o cmd\dist\dist.exe .\cmd\dist
+go build -o cmd\dist\dist.exe .\cmd\dist
endlocal
if errorlevel 1 goto fail
.\cmd\dist\dist env -w -p >env.bat
@@ -123,7 +123,7 @@
goto end
:bootstrapfail
-echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe
+echo ERROR: Cannot find go.exe
echo "Set GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4."
:fail

View File

@@ -2,9 +2,9 @@
_realname=go
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.4.2
pkgver=1.5.1
pkgrel=1
pkgdesc="Go Lang (miongw-w64)"
pkgdesc="Go Lang (mingw-w64)"
arch=('any')
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
@@ -12,26 +12,24 @@ url="http://www.golang.org/"
depends=()
options=('!strip')
source=("http://golang.org/dl/go${pkgver}.src.tar.gz"
"msys2-unix-files.patch"
"relocation-support.patch")
sha1sums=('460caac03379f746c473814a65223397e9c9a2f6'
'86ed6c4f5ab069e4470e3efc0cb9ae912ff7a31b'
'995907f84dd53e6d04d21d350766e47a866e6b6e')
0001-run-proper-go.path
0002-run-proper-go.path)
sha1sums=('0df564746d105f4180c2b576a1553ebca9d9a124'
'385000e119ccf65244b95c869bfe156e9ac703fa'
'59bcd02985f3ede3f527ac74c966abac40f443cd')
prepare() {
pushd "${srcdir}"/${_realname}
[[ -f src/cmd/dist/pathtools.c ]] && rm -f src/cmd/dist/pathtools.c
[[ -f src/cmd/dist/pathtools.h ]] && rm -f src/cmd/dist/pathtools.h
#patch -p1 -i ${srcdir}/msys2-unix-files.patch
patch -p1 -i ${srcdir}/relocation-support.patch
popd
[[ -d "${srcdir}"/$_realname-$pkgver ]] && rm -rf "${srcdir}"/${_realname}-${pkgver}
mv "${srcdir}"/${_realname} "${srcdir}"/${_realname}-${pkgver}
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i ${srcdir}/0001-run-proper-go.path
patch -p1 -i ${srcdir}/0002-run-proper-go.path
}
build() {
cd "${srcdir}"/${_realname}-${pkgver}/src
export GOROOT_BOOTSTRAP=/`echo ${MSYSTEM} | tr '[:upper:]' '[:lower:]'`/lib/go
export GOROOT="${srcdir}/${_realname}-${pkgver}"
export GOBIN="${GOROOT}/bin"
export GOPATH="${srcdir}/"
@@ -61,9 +59,7 @@ package() {
cp -a pkg "${pkgdir}${MINGW_PREFIX}/lib/go"
cp -a "$GOROOT/src" "${pkgdir}${MINGW_PREFIX}/lib/go/"
cp -a "$GOROOT/src/cmd" "${pkgdir}${MINGW_PREFIX}/lib/go/src/cmd"
cp -a "$GOROOT/src/lib9" "${pkgdir}${MINGW_PREFIX}/lib/go/src/"
cp -a "$GOROOT/lib" "${pkgdir}${MINGW_PREFIX}/lib/go/"
cp -a "$GOROOT/include" "${pkgdir}${MINGW_PREFIX}/lib/go/"
install -Dm644 src/Make.* "${pkgdir}${MINGW_PREFIX}/lib/go/src"
@@ -76,12 +72,6 @@ package() {
# Remove all executable source files
find "${pkgdir}${MINGW_PREFIX}/lib/go/src" -type f -executable -delete
# Headers for C modules
install -Dm644 src/runtime/runtime.h \
"${pkgdir}${MINGW_PREFIX}/lib/go/src/runtime/runtime.h"
install -Dm644 src/runtime/cgocall.h \
"${pkgdir}${MINGW_PREFIX}/lib/go/src/runtime/cgocall.h"
# This is to make go get code.google.com/p/go-tour/gotour and
# then running the gotour executable work out of the box.
# ln -sf ${MINGW_PREFIX}/bin "${pkgdir}${MINGW_PREFIX}/lib/go/bin"

View File

@@ -1,12 +0,0 @@
diff --git a/usr/mingw32/src/pkg/os/exec/lp_windows.go b/usr/mingw32/src/pkg/os/exec/lp_windows.go
index c3efd67..139cf33 100644
--- a/src/pkg/os/exec/lp_windows.go
+++ b/src/pkg/os/exec/lp_windows.go
@@ -70,6 +70,7 @@ func LookPath(file string) (f string, err error) {
}
exts = append(exts, e)
}
+ exts = append(exts, "")
if strings.IndexAny(file, `:\/`) != -1 {
if f, err = findExecutable(file, exts); err == nil {
return

View File

@@ -1,611 +0,0 @@
diff -urN go.orig/src/cmd/dist/pathtools.c go/src/cmd/dist/pathtools.c
--- go.orig/src/cmd/dist/pathtools.c 1970-01-01 01:00:00.000000000 +0100
+++ go/src/cmd/dist/pathtools.c 2015-01-14 21:52:47.223036600 +0000
@@ -0,0 +1,538 @@
+/*
+ .Some useful path tools.
+ .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: <mingw.android@gmail.com>.
+ */
+
+#if defined(__APPLE__)
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#if defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__)
+#include <alloca.h>
+#endif
+#include <unistd.h>
+
+/* If you don't define this, then get_executable_path()
+ can only use argv[0] which will often not work well */
+#define IMPLEMENT_SYS_GET_EXECUTABLE_PATH
+
+#if defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH)
+#if defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__)
+/* Nothing needed, unistd.h is enough. */
+#elif defined(__APPLE__)
+#include <mach-o/dyld.h>
+#elif defined(_WIN32)
+#define WIN32_MEAN_AND_LEAN
+#include <windows.h>
+#include <psapi.h>
+#endif
+#endif /* defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH) */
+
+#include "pathtools.h"
+
+char *
+malloc_copy_string(char const * original)
+{
+ char * result = (char *) malloc (sizeof (char*) * strlen (original)+1);
+ if (result != NULL)
+ {
+ strcpy (result, original);
+ }
+ return result;
+}
+
+void
+sanitise_path(char * path)
+{
+ size_t path_size = strlen (path);
+
+ /* Replace any '\' with '/' */
+ char * path_p = path;
+ while ((path_p = strchr (path_p, '\\')) != NULL)
+ {
+ *path_p = '/';
+ }
+ /* Replace any '//' with '/' */
+ path_p = path;
+ while ((path_p = strstr (path_p, "//")) != NULL)
+ {
+ memmove (path_p, path_p + 1, path_size--);
+ }
+ return;
+}
+
+char *
+get_relative_path(char const * from_in, char const * to_in)
+{
+ 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 * 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;
+
+ /* No to, return "./" */
+ if (to_in == NULL)
+ {
+ 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 */
+ size_t match_size = 0; /* The running (and final) match size. */
+ size_t largest_size = (from_size > to_size) ? from_size : to_size;
+ int to_final_is_slash = (to[to_size-1] == '/') ? 1 : 0;
+ char from_c;
+ char to_c;
+ for (match_size = 0; match_size < largest_size; ++match_size)
+ {
+ /* To simplify the logic, always pretend the strings end with '/' */
+ from_c = (match_size < from_size) ? from[match_size] : '/';
+ to_c = (match_size < to_size) ? to[match_size] : '/';
+
+ if (from_c != to_c)
+ {
+ if (from_c != '\0' || to_c != '\0')
+ {
+ match_size = match_size_dirsep;
+ }
+ break;
+ }
+ else if (from_c == '/')
+ {
+ match_size_dirsep = match_size;
+ }
+ }
+ strncpy (common_part, from, match_size);
+ common_part[match_size] = '\0';
+ from += match_size;
+ to += match_size;
+ size_t ndotdots = 0;
+ char const* from_last = from + strlen(from) - 1;
+ while ((from = strchr (from, '/')) && from != from_last)
+ {
+ ++ndotdots;
+ ++from;
+ }
+ for (count = 0; count < ndotdots; ++count)
+ {
+ strcat(result, "../");
+ }
+ if (strlen(to) > 0)
+ {
+ strcat(result, to+1);
+ }
+ /* Make sure that if to ends with '/' result does the same, and
+ vice-versa. */
+ size_t size_result = strlen(result);
+ if ((to_final_is_slash == 1)
+ && (!size_result || result[size_result-1] != '/'))
+ {
+ strcat (result, "/");
+ }
+ else if (!to_final_is_slash
+ && size_result && result[size_result-1] == '/')
+ {
+ result[size_result-1] = '\0';
+ }
+
+ return malloc_copy_string (result);
+}
+
+void
+simplify_path(char * path)
+{
+ ssize_t n_toks = 1; /* in-case we need an empty initial token. */
+ ssize_t i, j;
+ size_t tok_size;
+ size_t in_size = strlen (path);
+ int it_ended_with_a_slash = (path[in_size - 1] == '/') ? 1 : 0;
+ char * result = path;
+ sanitise_path(result);
+ char * result_p = result;
+
+ do
+ {
+ ++n_toks;
+ ++result_p;
+ } while ((result_p = strchr (result_p, '/')) != NULL);
+
+ result_p = result;
+ char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks);
+ n_toks = 0;
+ do
+ {
+ if (result_p > result)
+ {
+ *result_p++ = '\0';
+ }
+ else if (*result_p == '/')
+ {
+ /* A leading / creates an empty initial token. */
+ toks[n_toks++] = result_p;
+ *result_p++ = '\0';
+ }
+ toks[n_toks++] = result_p;
+ } while ((result_p = strchr (result_p, '/')) != NULL);
+
+ /* Remove all non-leading '.' and any '..' we can match
+ with an earlier forward path (i.e. neither '.' nor '..') */
+ for (i = 1; i < n_toks; ++i)
+ {
+ int removals[2] = { -1, -1 };
+ if ( strcmp (toks[i], "." ) == 0)
+ {
+ removals[0] = i;
+ }
+ else if ( strcmp (toks[i], ".." ) == 0)
+ {
+ /* Search backwards for a forward path to collapse.
+ If none are found then the .. also stays. */
+ for (j = i - 1; j > -1; --j)
+ {
+ if ( strcmp (toks[j], "." )
+ && strcmp (toks[j], ".." ) )
+ {
+ removals[0] = j;
+ removals[1] = i;
+ break;
+ }
+ }
+ }
+ for (j = 0; j < 2; ++j)
+ {
+ if (removals[j] >= 0) /* Can become -2 */
+ {
+ --n_toks;
+ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*));
+ --i;
+ if (!j)
+ {
+ --removals[1];
+ }
+ }
+ }
+ }
+ result_p = result;
+ for (i = 0; i < n_toks; ++i)
+ {
+ tok_size = strlen(toks[i]);
+ memcpy (result_p, toks[i], tok_size);
+ result_p += tok_size;
+ if ((!i || tok_size) && ((i < n_toks - 1) || it_ended_with_a_slash == 1))
+ {
+ *result_p = '/';
+ ++result_p;
+ }
+ }
+ *result_p = '\0';
+}
+
+/* Returns actual_to by calculating the relative path from -> to and
+ applying that to actual_from. An assumption that actual_from is a
+ dir is made, and it may or may not end with a '/' */
+char const *
+get_relocated_path (char const * from, char const * to, char const * actual_from)
+{
+ char const * relative_from_to = get_relative_path (from, to);
+ char * actual_to = (char *) malloc (strlen(actual_from) + 2 + strlen(relative_from_to));
+ return actual_to;
+}
+
+int
+get_executable_path(char const * argv0, char * result, ssize_t max_size)
+{
+ char * system_result = (char *) alloca (max_size);
+ ssize_t system_result_size = -1;
+ ssize_t result_size = -1;
+
+ if (system_result != NULL)
+ {
+#if defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH)
+#if defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__)
+ system_result_size = readlink("/proc/self/exe", system_result, max_size);
+#elif defined(__APPLE__)
+ uint32_t bufsize = (uint32_t)max_size;
+ if (_NSGetExecutablePath(system_result, &bufsize) == 0)
+ {
+ system_result_size = (ssize_t)bufsize;
+ }
+#elif defined(_WIN32)
+ unsigned long bufsize = (unsigned long)max_size;
+ system_result_size = GetModuleFileNameA(NULL, system_result, bufsize);
+ if (system_result_size == 0 || system_result_size == (ssize_t)bufsize)
+ {
+ /* Error, possibly not enough space. */
+ system_result_size = -1;
+ }
+ else
+ {
+ /* Early conversion to unix slashes instead of more changes
+ everywhere else .. */
+ char * winslash;
+ system_result[system_result_size] = '\0';
+ while ((winslash = strchr (system_result, '\\')) != NULL)
+ {
+ *winslash = '/';
+ }
+ }
+#else
+#warning "Don't know how to get executable path on this system"
+#endif
+#endif /* defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH) */
+ }
+ /* Use argv0 as a default in-case of failure */
+ if (system_result_size != -1)
+ {
+ strncpy (result, system_result, system_result_size);
+ result[system_result_size] = '\0';
+ }
+ else
+ {
+ if (argv0 != NULL)
+ {
+ strncpy (result, argv0, max_size);
+ result[max_size-1] = '\0';
+ }
+ else
+ {
+ result[0] = '\0';
+ }
+ }
+ result_size = strlen (result);
+ return result_size;
+}
+
+char const *
+strip_n_prefix_folders(char const * path, size_t n)
+{
+ if (path == NULL)
+ {
+ return NULL;
+ }
+
+ if (path[0] != '/')
+ {
+ return path;
+ }
+
+ char const * last = path;
+ while (n-- && path != NULL)
+ {
+ last = path;
+ path = strchr (path + 1, '/');
+ }
+ return (path == NULL) ? last : path;
+}
+
+void
+strip_n_suffix_folders(char * path, size_t n)
+{
+ if (path == NULL)
+ {
+ return;
+ }
+ while (n--)
+ {
+ if (strrchr (path + 1, '/'))
+ {
+ *strrchr (path + 1, '/') = '\0';
+ }
+ else
+ {
+ return;
+ }
+ }
+ return;
+}
+
+size_t
+split_path_list(char const * path_list, char split_char, char *** arr)
+{
+ size_t path_count;
+ size_t path_list_size;
+ char const * path_list_p;
+
+ path_list_p = path_list;
+ if (path_list == NULL || path_list[0] == '\0')
+ {
+ return 0;
+ }
+ path_list_size = strlen (path_list);
+
+ path_count = 0;
+ do
+ {
+ ++path_count;
+ ++path_list_p;
+ }
+ 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);
+ if (all_memory == NULL)
+ return 0;
+ *arr = (char **)all_memory;
+ all_memory += sizeof (char *) * path_count;
+
+ path_count = 0;
+ path_list_p = path_list;
+ char const * next_path_list_p = 0;
+ do
+ {
+ next_path_list_p = strchr (path_list_p, split_char);
+ if (next_path_list_p != NULL)
+ {
+ ++next_path_list_p;
+ }
+ size_t this_size = (next_path_list_p != NULL)
+ ? next_path_list_p - path_list_p - 1
+ : &path_list[path_list_size] - path_list_p;
+ memcpy (all_memory, path_list_p, this_size);
+ all_memory[this_size] = '\0';
+ (*arr)[path_count++] = all_memory;
+ all_memory += this_size + 1;
+ } while ((path_list_p = next_path_list_p) != NULL);
+
+ return path_count;
+}
+
+char *
+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]));
+ if ((temp = strrchr (exe_path, '/')) != NULL)
+ {
+ temp[1] = '\0';
+ }
+
+ char **arr = NULL;
+ /* Ask Alexey why he added this. Are we not 100% sure
+ that we're dealing with unix paths here? */
+ char split_char = ':';
+ if (strchr (to_path_list, ';'))
+ {
+ split_char = ';';
+ }
+ size_t count = split_path_list (to_path_list, split_char, &arr);
+ int result_size = 1 + (count - 1); /* count - 1 is for ; delim. */
+ size_t exe_path_size = strlen (exe_path);
+ size_t i;
+ /* Space required is:
+ count * (exe_path_size + strlen (rel_to_datadir))
+ rel_to_datadir upper bound is:
+ (count * strlen (from)) + (3 * num_slashes (from))
+ + strlen(arr[i]) + 1.
+ .. pathalogically num_slashes (from) is strlen (from)
+ (from = ////////) */
+ size_t space_required = (count * (exe_path_size + 4 * strlen (from))) + count - 1;
+ for (i = 0; i < count; ++i)
+ {
+ space_required += strlen (arr[i]);
+ }
+ char * scratch = (char *) alloca (space_required);
+ if (scratch == NULL)
+ return NULL;
+ for (i = 0; i < count; ++i)
+ {
+ char * rel_to_datadir = get_relative_path (from, arr[i]);
+ scratch[0] = '\0';
+ arr[i] = scratch;
+ strcat (scratch, exe_path);
+ strcat (scratch, rel_to_datadir);
+ simplify_path (arr[i]);
+ size_t arr_i_size = strlen (arr[i]);
+ result_size += arr_i_size;
+ scratch = arr[i] + arr_i_size + 1;
+ }
+ char * result = (char *) malloc (result_size);
+ if (result == NULL)
+ {
+ return NULL;
+ }
+ result[0] = '\0';
+ for (i = 0; i < count; ++i)
+ {
+ strcat (result, arr[i]);
+ if (i != count-1)
+ {
+#if defined(_WIN32)
+ strcat (result, ";");
+#else
+ strcat (result, ":");
+#endif
+ }
+ }
+ free ((void*)arr);
+ return result;
+}
+
+char *
+single_path_relocation(const char *from, const char *to)
+{
+#if defined(__MINGW32__)
+ char exe_path[PATH_MAX];
+ get_executable_path (NULL, &exe_path[0], sizeof(exe_path)/sizeof(exe_path[0]));
+ if (strrchr (exe_path, '/') != NULL)
+ {
+ strrchr (exe_path, '/')[1] = '\0';
+ }
+ char * rel_to_datadir = get_relative_path (from, to);
+ strcat (exe_path, rel_to_datadir);
+ simplify_path (&exe_path[0]);
+ return malloc_copy_string(exe_path);
+#else
+ return malloc_copy_string(to);
+#endif
+}
+
+char *
+pathlist_relocation(const char *from_path, const char *to_path_list)
+{
+#if defined(__MINGW32__)
+ static char stored_path[PATH_MAX];
+ static int stored = 0;
+ if (stored == 0)
+ {
+ char const * relocated = get_relocated_path_list(from_path, to_path_list);
+ strncpy (stored_path, relocated, PATH_MAX);
+ stored_path[PATH_MAX-1] = '\0';
+ free ((void *)relocated);
+ stored = 1;
+ }
+ return stored_path;
+#else
+ return (to_path_list);
+#endif
+}
diff -urN go.orig/src/cmd/dist/pathtools.h go/src/cmd/dist/pathtools.h
--- go.orig/src/cmd/dist/pathtools.h 1970-01-01 01:00:00.000000000 +0100
+++ go/src/cmd/dist/pathtools.h 2015-01-14 21:54:12.092030900 +0000
@@ -0,0 +1,53 @@
+/*
+ .Some useful path tools.
+ .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: <mingw.android@gmail.com>.
+ */
+
+#ifndef PATHTOOLS_H
+#define PATHTOOLS_H
+
+#include <unistd.h>
+#if defined(__APPLE__)
+#include <stdlib.h>
+#else
+#include <malloc.h>
+#endif
+#include <stdio.h>
+
+char * malloc_copy_string(char const * original);
+
+/* In-place replaces any '\' with '/' and any '//' with '/' */
+void sanitise_path(char * path);
+
+/* Uses a host OS specific function to determine the path of the executable,
+ if IMPLEMENT_SYS_GET_EXECUTABLE_PATH is defined, otherwise uses argv0. */
+int get_executable_path(char const * argv0, char * result, ssize_t max_size);
+
+/* Where possible, in-place removes occourances of '.' and 'path/..' */
+void simplify_path(char * path);
+
+/* Allocates (via malloc) and returns the path to get from from to to. */
+char * get_relative_path(char const * from, char const * to);
+
+size_t split_path_list(char const * path_list, char split_char, char *** arr);
+
+/* Advances path along by the amount that removes n prefix folders. */
+char const *
+strip_n_prefix_folders(char const * path, size_t n);
+
+/* NULL terminates path to remove n suffix folders. */
+void
+strip_n_suffix_folders(char * path, size_t n);
+
+char const * get_relocated_path (char const * from, char const * to, char const * actual_from);
+char * get_relocated_path_list(char const * from, char const * to_path_list);
+
+char * single_path_relocation(const char *from, const char *to);
+char * pathlist_relocation(const char *from_path, const char *to_path_list);
+
+#endif /* PATHTOOLS_H */
diff -urN go.orig/src/make.bat go/src/make.bat
--- go.orig/src/make.bat 2015-01-14 21:47:40.689086100 +0000
+++ go/src/make.bat 2015-01-14 21:54:03.409794400 +0000
@@ -60,7 +60,7 @@
echo cmd/dist
if not exist ..\bin\tool mkdir ..\bin\tool
:: Windows has no glob expansion, so spell out cmd/dist/*.c.
-gcc -O2 -Wall -Werror -o cmd/dist/dist.exe -Icmd/dist %DEFGOROOT% cmd/dist/buf.c cmd/dist/build.c cmd/dist/buildgc.c cmd/dist/buildgo.c cmd/dist/buildruntime.c cmd/dist/main.c cmd/dist/windows.c cmd/dist/arm.c
+gcc -O2 -Wall -Werror -o cmd/dist/dist.exe -Icmd/dist %DEFGOROOT% cmd/dist/buf.c cmd/dist/build.c cmd/dist/buildgc.c cmd/dist/buildgo.c cmd/dist/buildruntime.c cmd/dist/main.c cmd/dist/windows.c cmd/dist/arm.c cmd/dist/pathtools.c
if errorlevel 1 goto fail
.\cmd\dist\dist env -wp >env.bat
if errorlevel 1 goto fail

View File

@@ -0,0 +1,76 @@
# Maintainer: Nazar Mishturak <nazar m x at gmail dot com>
_realname=mbedtls
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.0
pkgrel=1
arch=('any')
url='https://tls.mbed.org/'
pkgdesc='mbed TLS is an open source and commercial SSL library licensed by ARM Limited. (mingw-w64)'
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-doxygen")
checkdepends=("${MINGW_PACKAGE_PREFIX}-perl")
license=('Apache License 2.0')
options=('strip' 'staticlibs' 'docs')
source=(${_realname}-${pkgver}.tar.gz::"https://tls.mbed.org/download/mbedtls-${pkgver}-apache.tgz"
'symlink-test.patch'
'dll-location.patch')
sha1sums=('13fcb4858145e972f8abaedf029ceb5c8461408e'
'72e420d5676007a168a82210dba960bea4e29190'
'e905d99cacf3b3d91872e8736ff03ef950b32a34')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i "${srcdir}/symlink-test.patch"
patch -p1 -i "${srcdir}/dll-location.patch"
}
build() {
cd "${srcdir}/${_realname}-${pkgver}"
local BUILD_TYPE="Release"
if check_option "debug" "y"; then
BUILD_TYPE="Debug"
fi
# Build static libs
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
mkdir -p ${srcdir}/build-${MINGW_CHOST}
cd ${srcdir}/build-${MINGW_CHOST}
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_C_COMPILER=${MINGW_CHOST}-gcc \
-DENABLE_TESTING=ON \
-DENABLE_PROGRAMS=OFF \
-DENABLE_ZLIB_SUPPORT=ON \
-DUSE_SHARED_MBEDTLS_LIBRARY=ON \
-DUSE_STATIC_MBEDTLS_LIBRARY=ON \
../${_realname}-${pkgver}
make
# Generate the documentation
make apidoc
}
check() {
cd "${srcdir}/build-${MINGW_CHOST}"
cp -p library/*.dll tests/ # Tests are dynamically linked
make test
}
package () {
cd "${srcdir}/build-${MINGW_CHOST}"
make DESTDIR=${pkgdir} install
# Install the documentation
cd "${srcdir}/${_realname}-${pkgver}"
mkdir -p "${pkgdir}/${MINGW_PREFIX}/share/doc/${_realname}"
cp -Rp apidoc "${pkgdir}/${MINGW_PREFIX}/share/doc/${_realname}/html"
}

View File

@@ -0,0 +1,24 @@
--- mbedtls-2.1.0/library/CMakeLists.txt.orig 2015-09-04 15:38:26.000000000 +0300
+++ mbedtls-2.1.0/library/CMakeLists.txt 2015-09-14 17:32:04.783122700 +0300
@@ -132,7 +132,9 @@
target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target})
install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target}
- DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION "bin"
+ LIBRARY DESTINATION "lib"
+ ARCHIVE DESTINATION "lib"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif(USE_STATIC_MBEDTLS_LIBRARY)
@@ -150,7 +152,9 @@
target_link_libraries(mbedtls ${libs} mbedx509)
install(TARGETS mbedtls mbedx509 mbedcrypto
- DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION "bin"
+ LIBRARY DESTINATION "lib"
+ ARCHIVE DESTINATION "lib"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif(USE_SHARED_MBEDTLS_LIBRARY)

View File

@@ -0,0 +1,11 @@
--- mbedtls-2.1.0/tests/CMakeLists.txt.orig 2015-09-04 15:38:26.000000000 +0300
+++ mbedtls-2.1.0/tests/CMakeLists.txt 2015-09-13 21:45:47.677244800 +0300
@@ -101,7 +101,7 @@
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data_files" target)
if (NOT EXISTS ${link})
- if (CMAKE_HOST_UNIX)
+ if (CMAKE_HOST_UNIX OR MSYS)
set(command ln -s ${target} ${link})
else()
set(command cmd.exe /c mklink /d ${link} ${target})