summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBuildTools2015-08-05 22:36:39 -0700
committerBuildTools2015-08-05 22:36:39 -0700
commita4f2bd63341bf791bcf046dad9fc816d23bb9960 (patch)
tree36e168a002c4a527a4d17c261fca7f6057effce5
parent4ef09fb587a512fb61d9bb4be9918f1bd87ef637 (diff)
downloadaur-a4f2bd63341bf791bcf046dad9fc816d23bb9960.tar.gz
update to 4.0.4, updated widl patch as well
-rw-r--r--.SRCINFO10
-rw-r--r--.gitignore4
-rw-r--r--0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch768
-rw-r--r--PKGBUILD10
-rw-r--r--mingw-w64-tools-2.0.999-widl-includedir.patch22
5 files changed, 782 insertions, 32 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ed399e20c447..a1e6f1468a07 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = mingw-w64-tools
pkgdesc = MinGW-w64 utilities
- pkgver = 4.0.2
+ pkgver = 4.0.4
pkgrel = 1
url = http://mingw-w64.sourceforge.net
arch = i686
@@ -10,12 +10,12 @@ pkgbase = mingw-w64-tools
license = LGPL2
options = !libtool
options = !emptydirs
- source = http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v4.0.2.tar.bz2
+ source = http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v4.0.4.tar.bz2
source = mingw-w64-tools-2.0.999-s390.patch
- source = mingw-w64-tools-2.0.999-widl-includedir.patch
- md5sums = bb6404499342e02447b7c49f47b06b5e
+ source = 0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch
+ md5sums = d54e353670e17b54f1ac86df3bb33e31
md5sums = 85a915187d7092c659a56fca102da04c
- md5sums = e448767d2af073c99795f72bc4e1700c
+ md5sums = 4881e9b6cb7640e3542f45b88bd53a5e
pkgname = mingw-w64-tools
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..79ffea0ccae6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+pkg/
+src/
+*.bz2
+*.xz
diff --git a/0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch b/0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch
new file mode 100644
index 000000000000..bebdc69eb3b0
--- /dev/null
+++ b/0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch
@@ -0,0 +1,768 @@
+From 807e422aeb7e6c803edd07298b693a8e72a7158f Mon Sep 17 00:00:00 2001
+From: Ray Donnelly <mingw.android@gmail.com>
+Date: Sat, 18 Jul 2015 13:53:41 +0100
+Subject: [PATCH] widl: Relocate DEFAULT_INCLUDE_DIR
+
+---
+ mingw-w64-tools/widl/Makefile.am | 6 +-
+ mingw-w64-tools/widl/Makefile.in | 26 +-
+ mingw-w64-tools/widl/include/pathtools.h | 53 +++
+ mingw-w64-tools/widl/src/pathtools.c | 547 +++++++++++++++++++++++++++++++
+ mingw-w64-tools/widl/src/widl.c | 14 +-
+ 5 files changed, 640 insertions(+), 6 deletions(-)
+ create mode 100644 mingw-w64-tools/widl/include/pathtools.h
+ create mode 100644 mingw-w64-tools/widl/src/pathtools.c
+
+diff --git a/mingw-w64-tools/widl/Makefile.am b/mingw-w64-tools/widl/Makefile.am
+index 44013fe..1e348c7 100644
+--- a/mingw-w64-tools/widl/Makefile.am
++++ b/mingw-w64-tools/widl/Makefile.am
+@@ -36,6 +36,7 @@ widl_SOURCES = src/widl.h \
+ src/wpp/ppy.tab.c \
+ src/wpp/preproc.c \
+ src/wpp/wpp.c \
++ src/pathtools.c \
+ include/pshpack1.h \
+ include/pshpack2.h \
+ include/winbase.h \
+@@ -54,9 +55,10 @@ widl_SOURCES = src/widl.h \
+ include/pshpack4.h \
+ include/winnt.h \
+ include/winnls.h \
++ include/pathtools.h \
+ include/winnt.rh
+
+-widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\"
+-widl_CFLAGS = -O3 -g -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
++widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\" -DDEFAULT_BINDIR=\"$(bindir)\"
++widl_CFLAGS = -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
+
+ DISTCHECK_CONFIGURE_FLAGS = --host=$(host) --target=$(target)
+diff --git a/mingw-w64-tools/widl/Makefile.in b/mingw-w64-tools/widl/Makefile.in
+index 013ccf0..d76c66c 100644
+--- a/mingw-w64-tools/widl/Makefile.in
++++ b/mingw-w64-tools/widl/Makefile.in
+@@ -85,7 +85,8 @@ am_widl_OBJECTS = src/widl-client.$(OBJEXT) src/widl-expr.$(OBJEXT) \
+ src/widl-typetree.$(OBJEXT) src/widl-utils.$(OBJEXT) \
+ src/widl-widl.$(OBJEXT) src/widl-write_msft.$(OBJEXT) \
+ src/wpp/widl-ppl.yy.$(OBJEXT) src/wpp/widl-ppy.tab.$(OBJEXT) \
+- src/wpp/widl-preproc.$(OBJEXT) src/wpp/widl-wpp.$(OBJEXT)
++ src/wpp/widl-preproc.$(OBJEXT) src/wpp/widl-wpp.$(OBJEXT) \
++ src/widl-pathtools.$(OBJEXT)
+ widl_OBJECTS = $(am_widl_OBJECTS)
+ widl_LDADD = $(LDADD)
+ widl_LINK = $(CCLD) $(widl_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+@@ -262,6 +263,7 @@ widl_SOURCES = src/widl.h \
+ src/wpp/ppy.tab.c \
+ src/wpp/preproc.c \
+ src/wpp/wpp.c \
++ src/pathtools.c \
+ include/pshpack1.h \
+ include/pshpack2.h \
+ include/winbase.h \
+@@ -280,10 +282,11 @@ widl_SOURCES = src/widl.h \
+ include/pshpack4.h \
+ include/winnt.h \
+ include/winnls.h \
++ include/pathtools.h \
+ include/winnt.rh
+
+-widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\"
+-widl_CFLAGS = -O3 -g -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
++widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\" -DDEFAULT_BINDIR=\"$(bindir)\"
++widl_CFLAGS = -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
+ DISTCHECK_CONFIGURE_FLAGS = --host=$(host) --target=$(target)
+ all: all-am
+
+@@ -440,6 +443,8 @@ src/wpp/widl-preproc.$(OBJEXT): src/wpp/$(am__dirstamp) \
+ src/wpp/$(DEPDIR)/$(am__dirstamp)
+ src/wpp/widl-wpp.$(OBJEXT): src/wpp/$(am__dirstamp) \
+ src/wpp/$(DEPDIR)/$(am__dirstamp)
++src/widl-pathtools.$(OBJEXT): src/$(am__dirstamp) \
++ src/$(DEPDIR)/$(am__dirstamp)
+ widl$(EXEEXT): $(widl_OBJECTS) $(widl_DEPENDENCIES) $(EXTRA_widl_DEPENDENCIES)
+ @rm -f widl$(EXEEXT)
+ $(widl_LINK) $(widl_OBJECTS) $(widl_LDADD) $(LIBS)
+@@ -459,6 +464,7 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-header.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-parser.tab.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-parser.yy.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-pathtools.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-proxy.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-register.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/widl-server.Po@am__quote@
+@@ -800,6 +806,20 @@ src/wpp/widl-wpp.obj: src/wpp/wpp.c
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(widl_CPPFLAGS) $(CPPFLAGS) $(widl_CFLAGS) $(CFLAGS) -c -o src/wpp/widl-wpp.obj `if test -f 'src/wpp/wpp.c'; then $(CYGPATH_W) 'src/wpp/wpp.c'; else $(CYGPATH_W) '$(srcdir)/src/wpp/wpp.c'; fi`
+
++src/widl-pathtools.o: src/pathtools.c
++@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(widl_CPPFLAGS) $(CPPFLAGS) $(widl_CFLAGS) $(CFLAGS) -MT src/widl-pathtools.o -MD -MP -MF src/$(DEPDIR)/widl-pathtools.Tpo -c -o src/widl-pathtools.o `test -f 'src/pathtools.c' || echo '$(srcdir)/'`src/pathtools.c
++@am__fastdepCC_TRUE@ $(am__mv) src/$(DEPDIR)/widl-pathtools.Tpo src/$(DEPDIR)/widl-pathtools.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/pathtools.c' object='src/widl-pathtools.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(widl_CPPFLAGS) $(CPPFLAGS) $(widl_CFLAGS) $(CFLAGS) -c -o src/widl-pathtools.o `test -f 'src/pathtools.c' || echo '$(srcdir)/'`src/pathtools.c
++
++src/widl-pathtools.obj: src/pathtools.c
++@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(widl_CPPFLAGS) $(CPPFLAGS) $(widl_CFLAGS) $(CFLAGS) -MT src/widl-pathtools.obj -MD -MP -MF src/$(DEPDIR)/widl-pathtools.Tpo -c -o src/widl-pathtools.obj `if test -f 'src/pathtools.c'; then $(CYGPATH_W) 'src/pathtools.c'; else $(CYGPATH_W) '$(srcdir)/src/pathtools.c'; fi`
++@am__fastdepCC_TRUE@ $(am__mv) src/$(DEPDIR)/widl-pathtools.Tpo src/$(DEPDIR)/widl-pathtools.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/pathtools.c' object='src/widl-pathtools.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(widl_CPPFLAGS) $(CPPFLAGS) $(widl_CFLAGS) $(CFLAGS) -c -o src/widl-pathtools.obj `if test -f 'src/pathtools.c'; then $(CYGPATH_W) 'src/pathtools.c'; else $(CYGPATH_W) '$(srcdir)/src/pathtools.c'; fi`
++
+ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+diff --git a/mingw-w64-tools/widl/include/pathtools.h b/mingw-w64-tools/widl/include/pathtools.h
+new file mode 100644
+index 0000000..139b7c2
+--- /dev/null
++++ b/mingw-w64-tools/widl/include/pathtools.h
+@@ -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 --git a/mingw-w64-tools/widl/src/pathtools.c b/mingw-w64-tools/widl/src/pathtools.c
+new file mode 100644
+index 0000000..d150cd3
+--- /dev/null
++++ b/mingw-w64-tools/widl/src/pathtools.c
+@@ -0,0 +1,547 @@
++/*
++ .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)
++// widl can't include the normal Windows headers due to providing its own winnt.h (and others).
++#ifdef __x86_64__
++__attribute__((dllimport)) long GetModuleFileNameA (long hModule, void* lpFilename, long nSize);
++#else
++__attribute__((dllimport)) long __attribute__((__stdcall__)) GetModuleFileNameA (long hModule, void* lpFilename, long nSize);
++#endif
++#endif
++#else
++#define PATH_MAX 260
++#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(0, 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);
++ char *slash;
++ while ((slash = strchr(result, '\\')) != NULL) {
++ *slash++ = '/';
++ }
++ 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[PATH_MAX];
++ 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 --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
+index dfe2341..51186d1 100644
+--- a/mingw-w64-tools/widl/src/widl.c
++++ b/mingw-w64-tools/widl/src/widl.c
+@@ -42,6 +42,7 @@
+ #include "parser.h"
+ #include "wine/wpp.h"
+ #include "header.h"
++#include "pathtools.h"
+
+ /* future options to reserve characters for: */
+ /* A = ACF input filename */
+@@ -540,6 +541,7 @@ int main(int argc,char *argv[])
+ int opti = 0;
+ char *output_name = NULL;
+
++
+ signal( SIGTERM, exit_on_signal );
+ signal( SIGINT, exit_on_signal );
+ #ifdef SIGHUP
+@@ -695,7 +697,17 @@ int main(int argc,char *argv[])
+ }
+
+ #ifdef DEFAULT_INCLUDE_DIR
+- wpp_add_include_path(DEFAULT_INCLUDE_DIR);
++ char exe_path[PATH_MAX];
++ get_executable_path (argv[0], &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0]));
++ char * rel_to_includedir = get_relative_path (DEFAULT_BINDIR, DEFAULT_INCLUDE_DIR);
++ if (strrchr (exe_path, '/') != NULL) {
++ strrchr (exe_path, '/')[1] = '\0';
++ }
++ char relocated_default_include_dir[PATH_MAX];
++ strcpy (relocated_default_include_dir, exe_path);
++ strcat (relocated_default_include_dir, rel_to_includedir);
++ simplify_path (&relocated_default_include_dir[0]);
++ wpp_add_include_path(relocated_default_include_dir);
+ #endif
+
+ /* if nothing specified, try to guess output type from the output file name */
+--
+2.4.5
+
diff --git a/PKGBUILD b/PKGBUILD
index ffff312aecaf..bddb0eede434 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,5 @@
pkgname=mingw-w64-tools
-pkgver=4.0.2
+pkgver=4.0.4
_pkgver=${pkgver/rc/-rc}
pkgrel=1
pkgdesc="MinGW-w64 utilities"
@@ -10,17 +10,17 @@ groups=(mingw-w64)
options=(!libtool !emptydirs)
source=("http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v${_pkgver}.tar.bz2"
"mingw-w64-tools-2.0.999-s390.patch"
-"mingw-w64-tools-2.0.999-widl-includedir.patch")
-md5sums=('bb6404499342e02447b7c49f47b06b5e'
+"0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch")
+md5sums=('d54e353670e17b54f1ac86df3bb33e31'
'85a915187d7092c659a56fca102da04c'
- 'e448767d2af073c99795f72bc4e1700c')
+ '4881e9b6cb7640e3542f45b88bd53a5e')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
prepare() {
cd "${srcdir}/mingw-w64-v$_pkgver"
patch -p2 -i ../mingw-w64-tools-2.0.999-s390.patch
- patch -p1 -i ../mingw-w64-tools-2.0.999-widl-includedir.patch
+ patch -p1 -i ../0001-widl-Relocate-DEFAULT_INCLUDE_DIR.patch
}
build() {
diff --git a/mingw-w64-tools-2.0.999-widl-includedir.patch b/mingw-w64-tools-2.0.999-widl-includedir.patch
deleted file mode 100644
index d84811b4cf98..000000000000
--- a/mingw-w64-tools-2.0.999-widl-includedir.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/mingw-w64-tools/widl/Makefile.am 2012-11-14 03:19:32.000000000 -0600
-+++ b/mingw-w64-tools/widl/Makefile.am 2014-01-01 19:23:41.000000000 -0600
-@@ -56,7 +56,7 @@ widl_SOURCES = src/widl.h \
- include/winnls.h \
- include/winnt.rh
-
--widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\"
-+widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(prefix)/$(target)/sys-root/mingw/include\"
- widl_CFLAGS = -O3 -g -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
-
- DISTCHECK_CONFIGURE_FLAGS = --host=$(host) --target=$(target)
---- a/mingw-w64-tools/widl/Makefile.in 2012-11-14 03:19:32.000000000 -0600
-+++ b/mingw-w64-tools/widl/Makefile.in 2014-01-01 19:24:08.137423600 -0600
-@@ -282,7 +282,7 @@ widl_SOURCES = src/widl.h \
- include/winnls.h \
- include/winnt.rh
-
--widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(includedir)/../$(target)/include\"
-+widl_CPPFLAGS = -I$(top_srcdir)/include -DDEFAULT_INCLUDE_DIR=\"$(prefix)/$(target)/sys-root/mingw/include\"
- widl_CFLAGS = -O3 -g -Wall -Wformat -Wpacked -Wmissing-declarations -Wimplicit-function-declaration -Wmissing-prototypes -Wstrict-aliasing=2
- DISTCHECK_CONFIGURE_FLAGS = --host=$(host) --target=$(target)
- all: all-am