Import and update mingw-w64-gettext from AUR

- Update to 0.19.8.1
- Fix patches
- Further patching to prevent linker errors
- Provide pkgconfig file for iconv

File for pkgconfig might help preventing errors when building
static Qt 5 modules.
This commit is contained in:
Martchus 2016-08-12 21:34:27 +02:00
parent 57517bafe5
commit b12ed5b227
8 changed files with 1084 additions and 0 deletions

View File

@ -0,0 +1,843 @@
diff -crBN gettext-0.19.8.1/gettext-runtime/intl/bindtextdom.c{.orig,}
*** gettext-0.19.8.1/gettext-runtime/intl/bindtextdom.c.orig 2016-03-20 08:37:53.000000000 +0100
--- gettext-0.19.8.1/gettext-runtime/intl/bindtextdom.c 2016-08-12 19:01:05.714025915 +0200
***************
*** 21,26 ****
--- 21,27 ----
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+ #include <unistd.h>
#include "gettextP.h"
#ifdef _LIBC
***************
*** 65,70 ****
--- 66,77 ----
# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
#endif
+ #if ENABLE_RELOCATABLE
+ # include "relocatex.h"
+ #else
+ # define relocate(pathname) (pathname)
+ #endif
+
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
to be used for the DOMAINNAME message catalog.
If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
***************
*** 317,350 ****
char *
BINDTEXTDOMAIN (const char *domainname, const char *dirname)
{
! #ifdef __EMX__
! const char *saved_dirname = dirname;
! char dirname_with_drive[_MAX_PATH];
!
! /* Resolve UNIXROOT into dirname if it is not resolved by os2compat.[ch]. */
! if (dirname && (dirname[0] == '/' || dirname[0] == '\\' ))
! {
! const char *unixroot = getenv ("UNIXROOT");
! size_t len = strlen (dirname) + 1;
!
! if (unixroot
! && unixroot[0] != '\0'
! && unixroot[1] == ':'
! && unixroot[2] == '\0'
! && 2 + len <= _MAX_PATH)
! {
! memcpy (dirname_with_drive, unixroot, 2);
! memcpy (dirname_with_drive + 2, dirname, len);
!
! dirname = dirname_with_drive;
! }
! }
! #endif
! set_binding_values (domainname, &dirname, NULL);
! #ifdef __EMX__
! dirname = saved_dirname;
! #endif
! return (char *) dirname;
}
/* Specify the character encoding in which the messages from the
--- 324,341 ----
char *
BINDTEXTDOMAIN (const char *domainname, const char *dirname)
{
! if (!access (dirname, R_OK)) {
! set_binding_values (domainname, &dirname, NULL);
! return (char *) dirname;
! } else {
! char *locale_dirname, *installdir = strdup (dirname), *s;
! if ((s = strrchr (installdir, '/'))) *s = '\0';
! if ((s = strrchr (installdir, '/'))) *s = '\0';
! locale_dirname = relocatex (installdir, dirname);
! set_binding_values (domainname, (const char **) &locale_dirname, NULL);
! if (installdir) free (installdir);
! return (char *) locale_dirname;
! }
}
/* Specify the character encoding in which the messages from the
diff -crBN gettext-0.18.3.1.orig/gettext-runtime/intl/canonicalize.c gettext-0.18.3.1/gettext-runtime/intl/canonicalize.c
*** gettext-0.18.3.1.orig/gettext-runtime/intl/canonicalize.c 1970-01-01 01:00:00.000000000 +0100
--- gettext-0.18.3.1/gettext-runtime/intl/canonicalize.c 2014-01-08 21:50:51.089192200 +0100
***************
*** 0 ****
--- 1,329 ----
+ /* Return the canonical absolute name of a given file.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <limits.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+ #include <errno.h>
+ #include <stddef.h>
+ #include <malloc.h>
+ #ifdef __WIN32__
+ # include <stdio.h>
+ # include <windows.h>
+ //# include <gw32.h>
+ #endif /* __WIN32__ */
+
+ #ifndef MAXSYMLINKS
+ # define MAXSYMLINKS 20
+ #endif
+
+ #ifndef __set_errno
+ # define __set_errno(Val) errno = (Val)
+ #endif
+
+ # ifdef VMS
+ /* We want the directory in Unix syntax, not in VMS syntax. */
+ # define __getcwd(buf, max) getcwd (buf, max, 0)
+ # else
+ # define __getcwd getcwd
+ # endif
+
+ #define weak_alias(local, symbol)
+
+ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+ /* Win32, Cygwin, OS/2, DOS */
+ # define ISDIRSEP(C) ((C) == '/' || (C) == '\\')
+ #else
+ /* Unix */
+ # define ISDIRSEP(C) ((C) == '/')
+ #endif
+
+ /* Return the canonical absolute name of file NAME. A canonical name
+ does not contain any `.', `..' components nor any repeated path
+ separators ('/') or symlinks. All path components must exist. If
+ RESOLVED is null, the result is malloc'd; otherwise, if the
+ canonical name is PATH_MAX chars or more, returns null with `errno'
+ set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+ returns the name in RESOLVED. If the name cannot be resolved and
+ RESOLVED is non-NULL, it contains the path of the first component
+ that cannot be resolved. If the path can be resolved, RESOLVED
+ holds the same value as the value returned.
+ RESOLVED must be at least PATH_MAX long */
+
+ static char *
+ canonicalize (const char *name, char *resolved)
+ {
+ char *rpath, *dest, *extra_buf = NULL;
+ const char *start, *end, *rpath_limit;
+ long int path_max;
+ int num_links = 0, old_errno;
+
+ if (name == NULL)
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ either parameter is a null pointer. We extend this to allow
+ the RESOLVED parameter to be NULL in case the we are expected to
+ allocate the room for the return value. */
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if (name[0] == '\0')
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ the name argument points to an empty string. */
+ __set_errno (ENOENT);
+ return NULL;
+ }
+ #ifdef __WIN32__
+ {
+ char *lpFilePart;
+ int len;
+ // fprintf(stderr, "name: %s\n", name);
+ rpath = resolved ? __builtin_alloca (MAX_PATH) : malloc (MAX_PATH);
+ // unix2winpath (name);
+ // fprintf(stderr, "name: %s\n", name);
+ len = GetFullPathName(name, MAX_PATH, rpath, &lpFilePart);
+ /* GetFullPathName returns bogus paths for *nix-style paths, like
+ * /foo/bar - it just prepends current drive to them. Keep them
+ * intact (they need to be for relocation to work!).
+ */
+ if (name[0] == '/') {
+ strncpy (rpath, name, MAX_PATH - 1);
+ rpath[MAX_PATH - 1] = '\0';
+ len = strlen (rpath);
+ }
+ // fprintf(stderr, "rpath: %s\n", rpath);
+ if (len == 0) {
+ //set_werrno;
+ return NULL;
+ }
+ if (len > MAX_PATH) {
+ if (resolved)
+ __set_errno(ENAMETOOLONG);
+ else {
+ rpath = realloc(rpath, len + 2);
+ GetFullPathName(name, len, rpath, &lpFilePart);
+ // fprintf(stderr, "rpath: %s\n", rpath);
+ }
+ }
+ // if ( ISDIRSEP(name[strlen(name)]) && !ISDIRSEP(rpath[len]) ) {
+ // rpath[len] = '\\';
+ // rpath[len + 1] = 0;
+ // }
+ old_errno = errno;
+ //if (!access (rpath, D_OK) && !ISDIRSEP(rpath[len - 1]) ){
+ if (!access (rpath, R_OK) && !ISDIRSEP(rpath[len - 1]) ){
+ rpath[len] = '\\';
+ rpath[len + 1] = 0;
+ }
+ errno = old_errno;
+ win2unixpath (rpath);
+ // fprintf(stderr, "rpath: %s\n", rpath);
+ return resolved ? strcpy(resolved, rpath) : rpath ;
+ }
+ #else /* __WIN32__ */
+
+ #ifdef PATH_MAX
+ path_max = PATH_MAX;
+ #else
+ path_max = pathconf (name, _PC_PATH_MAX);
+ if (path_max <= 0)
+ path_max = 1024;
+ #endif
+
+ rpath = resolved ? __builtin_alloca (path_max) : malloc (path_max);
+ rpath_limit = rpath + path_max;
+
+ if (name[0] != '/')
+ {
+ if (!__getcwd (rpath, path_max))
+ {
+ rpath[0] = '\0';
+ goto error;
+ }
+ dest = strchr (rpath, '\0');
+ }
+ else
+ {
+ rpath[0] = '/';
+ dest = rpath + 1;
+ }
+
+ for (start = end = name; *start; start = end)
+ {
+ #ifdef _LIBC
+ struct stat64 st;
+ #else
+ struct stat st;
+ #endif
+ int n;
+
+ /* Skip sequence of multiple path-separators. */
+ while (*start == '/')
+ ++start;
+
+ /* Find end of path component. */
+ for (end = start; *end && *end != '/'; ++end)
+ /* Nothing. */;
+
+ if (end - start == 0)
+ break;
+ else if (end - start == 1 && start[0] == '.')
+ /* nothing */;
+ else if (end - start == 2 && start[0] == '.' && start[1] == '.')
+ {
+ /* Back up to previous component, ignore if at root already. */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+ else
+ {
+ size_t new_size;
+
+ if (dest[-1] != '/')
+ *dest++ = '/';
+
+ if (dest + (end - start) >= rpath_limit)
+ {
+ ptrdiff_t dest_offset = dest - rpath;
+
+ if (resolved)
+ {
+ __set_errno (ENAMETOOLONG);
+ if (dest > rpath + 1)
+ dest--;
+ *dest = '\0';
+ goto error;
+ }
+ new_size = rpath_limit - rpath;
+ if (end - start + 1 > path_max)
+ new_size += end - start + 1;
+ else
+ new_size += path_max;
+ rpath = realloc (rpath, new_size);
+ rpath_limit = rpath + new_size;
+ if (rpath == NULL)
+ return NULL;
+
+ dest = rpath + dest_offset;
+ }
+
+ #ifdef _LIBC
+ dest = __mempcpy (dest, start, end - start);
+ #else
+ memcpy (dest, start, end - start);
+ dest += end - start;
+ #endif
+ *dest = '\0';
+
+ #ifdef _LIBC
+ if (__lxstat64 (_STAT_VER, rpath, &st) < 0)
+ #else
+ if (lstat (rpath, &st) < 0)
+ #endif
+ goto error;
+
+ #if HAVE_READLINK
+ if (S_ISLNK (st.st_mode))
+ {
+ char *buf = __builtin_alloca (path_max);
+ size_t len;
+
+ if (++num_links > MAXSYMLINKS)
+ {
+ __set_errno (ELOOP);
+ goto error;
+ }
+
+ n = __readlink (rpath, buf, path_max);
+ if (n < 0)
+ goto error;
+ buf[n] = '\0';
+
+ if (!extra_buf)
+ extra_buf = __builtin_alloca (path_max);
+
+ len = strlen (end);
+ if ((long int) (n + len) >= path_max)
+ {
+ __set_errno (ENAMETOOLONG);
+ goto error;
+ }
+
+ /* Careful here, end may be a pointer into extra_buf... */
+ memmove (&extra_buf[n], end, len + 1);
+ name = end = memcpy (extra_buf, buf, n);
+
+ if (buf[0] == '/')
+ dest = rpath + 1; /* It's an absolute symlink */
+ else
+ /* Back up to previous component, ignore if at root already: */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+ #endif
+ }
+ }
+ if (dest > rpath + 1 && dest[-1] == '/')
+ --dest;
+ *dest = '\0';
+
+ return resolved ? memcpy (resolved, rpath, dest - rpath + 1) : rpath;
+
+ error:
+ if (resolved)
+ strcpy (resolved, rpath);
+ else
+ free (rpath);
+ return NULL;
+
+ #endif /* __WIN32__ */
+ }
+
+
+ char *
+ __realpath (const char *name, char *resolved)
+ {
+ if (resolved == NULL)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return canonicalize (name, resolved);
+ }
+ weak_alias (__realpath, realpath)
+
+
+ char *
+ __canonicalize_file_name (const char *name)
+ {
+ return canonicalize (name, NULL);
+ }
+ weak_alias (__canonicalize_file_name, canonicalize_file_name)
+
+ char *
+ canonicalize_file_name (const char *name)
+ {
+ return canonicalize (name, NULL);
+ }
diff -crBN gettext-0.18.3.1.orig/gettext-runtime/intl/Makefile.in gettext-0.18.3.1/gettext-runtime/intl/Makefile.in
*** gettext-0.18.3.1.orig/gettext-runtime/intl/Makefile.in 2013-07-29 13:35:59.000000000 +0200
--- gettext-0.18.3.1/gettext-runtime/intl/Makefile.in 2014-01-08 21:52:05.080559000 +0100
***************
*** 122,127 ****
--- 122,128 ----
localcharset.h \
lock.h \
relocatable.h \
+ relocatex.h \
tsearch.h tsearch.c \
verify.h \
xsize.h \
***************
*** 152,157 ****
--- 153,160 ----
threadlib.c \
lock.c \
relocatable.c \
+ relocatex.c \
+ canonicalize.c \
langprefs.c \
localename.c \
log.c \
***************
*** 185,190 ****
--- 188,195 ----
threadlib.$lo \
lock.$lo \
relocatable.$lo \
+ relocatex.$lo \
+ canonicalize.$lo \
langprefs.$lo \
localename.$lo \
log.$lo \
***************
*** 287,292 ****
--- 292,301 ----
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/threadlib.c
lock.lo: $(srcdir)/lock.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/lock.c
+ relocatex.lo: $(srcdir)/relocatex.c
+ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/relocatex.c
+ canonicalize.lo: $(srcdir)/canonicalize.c
+ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/canonicalize.c
relocatable.lo: $(srcdir)/relocatable.c
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/relocatable.c
langprefs.lo: $(srcdir)/langprefs.c
diff -crBN gettext-0.18.3.1.orig/gettext-runtime/intl/relocatex.c gettext-0.18.3.1/gettext-runtime/intl/relocatex.c
*** gettext-0.18.3.1.orig/gettext-runtime/intl/relocatex.c 1970-01-01 01:00:00.000000000 +0100
--- gettext-0.18.3.1/gettext-runtime/intl/relocatex.c 2014-01-08 21:50:51.136095000 +0100
***************
*** 0 ****
--- 1,295 ----
+ /* Provide relocatable packages.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2003.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+
+ /* Specification. */
+ #include <errno.h>
+ #define _GNU_SOURCE
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
+ /* #include <path.h> */
+ #include "relocatex.h"
+ //#include "canonicalize.h"
+ /* #include <gw32.h> */
+
+
+ #if defined _WIN32 || defined __WIN32__
+ # define WIN32_LEAN_AND_MEAN
+ # include <windows.h>
+ //# define __GW32__
+ //# include <winx/errnox.h>
+ #endif
+ #define set_werrno
+
+ #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+ /* Win32, Cygwin, OS/2, DOS */
+ # define ISDIRSEP(C) ((C) == '/' || (C) == '\\')
+ #else
+ /* Unix */
+ # define ISDIRSEP(C) ((C) == '/')
+ #endif
+
+ /* Original installation prefix. */
+ static char *orig_prefix = NULL;
+ static size_t orig_prefix_len = 0;
+ /* Current installation prefix. */
+ static char *curr_prefix = NULL;
+ static size_t curr_prefix_len = 0;
+ /* These prefixes do not end in a slash. Anything that will be concatenated
+ to them must start with a slash. */
+
+
+ char *win2unixpath (char *FileName)
+ {
+ char *s = FileName;
+ while (*s) {
+ if (*s == '\\')
+ *s = '/';
+ *s++;
+ }
+ return FileName;
+ }
+
+ int win2posixpath (const char *winpath, char *posixpath)
+ {
+ strcpy (posixpath, winpath);
+ win2unixpath (posixpath);
+ return 0;
+ }
+
+
+ /* Sets the original and the current installation prefix of this module.
+ Relocation simply replaces a pathname starting with the original prefix
+ by the corresponding pathname with the current prefix instead. Both
+ prefixes should be directory names without trailing slash (i.e. use ""
+ instead of "/"). */
+ static char *
+ set_orig_prefix (const char *orig_prefix_arg)
+ {
+ char *memory;
+ // printf ("orig_prefix_arg: %s\n", orig_prefix_arg);
+ if (!orig_prefix_arg) {
+ orig_prefix = NULL;
+ orig_prefix_len = 0;
+ return NULL;
+ }
+ if (orig_prefix)
+ free (orig_prefix);
+
+ memory = canonicalize_file_name (orig_prefix_arg);
+ // printf ("memory: %s\n", memory);
+ // memory = (char *) malloc (orig_prefix_len + 1);
+ if (!memory) {
+ set_werrno;
+ orig_prefix = NULL;
+ orig_prefix_len = 0;
+ return NULL;
+ }
+ win2unixpath (memory);
+ // win2posixpath (orig_prefix_arg, memory);
+ orig_prefix = memory;
+ orig_prefix_len = strlen (orig_prefix);
+ // printf ("orig_prefix: %s\n", orig_prefix);
+ if (ISDIRSEP (orig_prefix[orig_prefix_len-1])) {
+ orig_prefix[orig_prefix_len-1] = '\0';
+ orig_prefix_len--;
+ }
+ // printf ("orig_prefix: %s\n", orig_prefix);
+ // printf ("orig_prefix_len: %d\n", orig_prefix_len);
+ return orig_prefix;
+ }
+
+ #if defined __WIN32__
+ static char *
+ set_current_prefix (const char *ModuleName)
+ {
+ LPTSTR curr_prefix_arg, q, lpFilePart;
+ DWORD len;
+ int nDIRSEP = 0;
+
+ if (curr_prefix)
+ free (curr_prefix);
+ curr_prefix_arg = malloc (MAX_PATH * sizeof (TCHAR));
+ if (!curr_prefix_arg) {
+ set_werrno;
+ curr_prefix = NULL;
+ curr_prefix_len = 0;
+ return NULL;
+ }
+ if (ModuleName) {
+ // printf ("ModuleName: %s\n", ModuleName);
+ len = SearchPath (NULL, ModuleName, ".DLL", MAX_PATH, curr_prefix_arg, &lpFilePart);
+ if (len) {
+ // printf ("ModulePath: %s\n", curr_prefix_arg);
+ // printf ("FilePart: %s\n", lpFilePart);
+ }
+ }
+ if (!ModuleName || !len) {
+ len = GetModuleFileName (NULL, curr_prefix_arg, MAX_PATH);
+ if (!len) {
+ set_werrno;
+ curr_prefix = NULL;
+ curr_prefix_len = 0;
+ return NULL;
+ }
+ }
+ // strncpy (curr_prefix_arg, ModuleName, MAX_PATH);
+ // printf ("curr_prefix_arg: %s\n", curr_prefix_arg);
+ win2posixpath (curr_prefix_arg, curr_prefix_arg);
+ curr_prefix = curr_prefix_arg;
+ q = curr_prefix_arg + len - 1;
+ /* strip name of executable and its directory */
+ while (!ISDIRSEP (*q) && (q > curr_prefix_arg) && nDIRSEP < 2) {
+ q--;
+ if (ISDIRSEP (*q)) {
+ *q = '\0';
+ nDIRSEP++;
+ }
+ }
+ curr_prefix_len = q - curr_prefix_arg;
+ // printf ("curr_prefix: %s\n", curr_prefix);
+ // printf ("curr_prefix_len: %d\n", curr_prefix_len);
+ return curr_prefix;
+ }
+
+ char *getshortpath (const char *longpath)
+ {
+ char *shortpath = NULL;
+ DWORD len, res;
+
+ // printf ("longpath: %s\n", longpath);
+ len = GetShortPathName(longpath, shortpath, 0);
+ // printf ("len: %ld\n", len);
+ if (!len) {
+ // WinErr ("getshortpath: len = 0");
+ set_werrno;
+ return (char *) longpath;
+ }
+ shortpath = (char *) malloc (len + 1);
+ if (!shortpath) {
+ // WinErr ("getshortpath: malloc");
+ set_werrno;
+ return (char *) longpath;
+ }
+ res = GetShortPathName(longpath, shortpath, len);
+ // printf ("res: %ld\n", res);
+ if (!res) {
+ // WinErr ("getshortpath: res = 0");
+ free (shortpath);
+ set_werrno;
+ return (char *) longpath;
+ }
+ // printf ("shortpath: %s\n", shortpath);
+ return shortpath;
+ }
+
+ char *relocaten (const char *ModuleName, const char *path)
+ {
+ char *relative_path, *relocated_path, *relocated_short_path;
+ int relative_path_len;
+
+ if (!curr_prefix)
+ set_current_prefix (ModuleName);
+ // printf ("path: %s\n", path);
+ // printf ("orig_prefix: %s\n", orig_prefix);
+ // printf ("curr_prefix: %s\n", curr_prefix);
+ // if (strncmp (orig_prefix, path, orig_prefix_len))
+ // if (strcmp (orig_prefix, path))
+ // return (char *) path;
+ relative_path = (char *) path + orig_prefix_len;
+ // printf ("relative_path: %s\n", relative_path);
+ relative_path_len = strlen (relative_path);
+ relocated_path = malloc (curr_prefix_len + relative_path_len + 1);
+ strcpy (relocated_path, curr_prefix);
+ strcat (relocated_path, relative_path);
+ // printf ("relocated_path: %s\n", relocated_path);
+ relocated_short_path = getshortpath (relocated_path);
+ // printf ("relocated_short_path: %s\n", relocated_short_path);
+ if (relocated_short_path) {
+ if (relocated_short_path != relocated_path)
+ free (relocated_path);
+ return relocated_short_path;
+ } else
+ return relocated_path;
+ }
+
+ #else // __WIN32__
+ char *relocaten (const char *ModuleName, const char *path)
+ {
+ // dummy function for Unix/Linux
+ return (char *)path;
+ }
+ #endif
+
+ char *relocaten2 (const char *ModuleName, const char *installdir, const char *path)
+ {
+ set_orig_prefix (installdir);
+ return relocaten (ModuleName, path);
+ }
+
+ char *relocatenx (const char *ModuleName, const char *installdir, const char *path)
+ {
+ char *p;
+
+ set_orig_prefix (installdir);
+ if (access (path, R_OK))
+ p = relocaten (ModuleName, path);
+ else
+ p = (char *) path;
+ // printf ("relocatenx: %s\n", p);
+ return p;
+ }
+
+ char *relocate2 (const char *installdir, const char *path)
+ {
+ return relocaten2 (NULL, installdir, path);
+ }
+
+ char *relocatex (const char *installdir, const char *path)
+ {
+ return relocatenx (NULL, installdir, path);
+ }
+
+ char *relocatepx (const char *cprefix, const char *installdir, const char *path)
+ {
+ if (curr_prefix)
+ free (curr_prefix);
+ curr_prefix = strdup (cprefix);
+ return relocatex (installdir, path);
+ }
+
+ static char *get_orig_prefix (void)
+ {
+ return orig_prefix;
+ }
+
+ static char *get_curr_prefix (void)
+ {
+ return curr_prefix;
+ }
+
+ static char *set_curr_prefix (const char *ModuleName)
+ {
+ if (curr_prefix)
+ free (curr_prefix);
+ set_current_prefix (ModuleName);
+ return curr_prefix;
+ }
diff -crBN gettext-0.18.3.1.orig/gettext-runtime/intl/relocatex.h gettext-0.18.3.1/gettext-runtime/intl/relocatex.h
*** gettext-0.18.3.1.orig/gettext-runtime/intl/relocatex.h 1970-01-01 01:00:00.000000000 +0100
--- gettext-0.18.3.1/gettext-runtime/intl/relocatex.h 2014-01-08 21:50:51.136095000 +0100
***************
*** 0 ****
--- 1,41 ----
+ /*
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GnuWin C Library.
+
+ The GnuWin C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GnuWin C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GnuWin32 C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+ #ifndef __RELOCATE_H__
+ #define __RELOCATE_H__ 1
+
+ /* #include <libc-dll.h> */
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ char *relocaten (const char *ModuleName, const char *path);
+ char *relocaten2 (const char *ModuleName, const char *installdir, const char *path);
+ char *relocatenx (const char *ModuleName, const char *installdir, const char *path);
+ char *relocate2 (const char *installdir, const char *path);
+ char *relocatex (const char *installdir, const char *path);
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+ //#endif /* __GW32__ */
+
+ #endif /* __RELOCATE_H__ */
diff -crBN gettext-0.18.3.1.orig/MINGW-PATCHES/README-relocatex-libintl.txt gettext-0.18.3.1/MINGW-PATCHES/README-relocatex-libintl.txt
*** gettext-0.18.3.1.orig/MINGW-PATCHES/README-relocatex-libintl.txt 1970-01-01 01:00:00.000000000 +0100
--- gettext-0.18.3.1/MINGW-PATCHES/README-relocatex-libintl.txt 2014-01-08 21:50:51.151701000 +0100
***************
*** 0 ****
--- 1,23 ----
+ The relocatex-libintl patch adds builtin relocation for executables to the
+ libintl dll. With this patch the programs are automatically relocatable. There
+ is no need anymore to add relocation code to your program when you use this
+ libintl DLL.
+
+ The patch was ported from the GnuWin32 port of libintl, which has also builtin
+ relacation support.
+
+ At the moment the relocation support is only active if you compile with MinGW
+ for Windows. If you compile for Unix/Linux/Cygwin the functionality is
+ unchanged.
+
+ See also:
+ http://waterlan.home.xs4all.nl/libintl.html
+ http://sourceforge.net/tracker/?func=detail&atid=302435&aid=3003879&group_id=2435
+ GnuWin32: http://gnuwin32.sourceforge.net/
+
+ Great thanks to GnuWin32 maintainer Kees Zeelenberg.
+
+ Erwin Waterlander
+ waterlan@xs4all.nl
+ http://waterlan.home.xs4all.nl/
+

View File

@ -0,0 +1,11 @@
--- gettext-runtime/intl/printf.c.orig 2012-09-22 16:23:24 +0400
+++ gettext-runtime/intl/printf.c 2012-09-22 23:45:29 +0400
@@ -209,7 +209,7 @@
int
libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list args)
{
- if (strchr (format, '$') == NULL)
+ if (0 && (strchr (format, '$') == NULL))
return system_vsnprintf (resultbuf, length, format, args);
else
{

View File

@ -0,0 +1,44 @@
--- gettext-tools/gnulib-lib/libxml/parser.c.orig 2013-01-18 10:24:37 +0400
+++ gettext-tools/gnulib-lib/libxml/parser.c 2013-01-18 10:36:35 +0400
@@ -42,6 +42,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/globals.h>
@@ -61,9 +64,6 @@
#include <libxml/xmlschemastypes.h>
#include <libxml/relaxng.h>
#endif
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
--- gettext-tools/gnulib-lib/libxml/threads.c.orig 2013-01-18 10:38:24 +0400
+++ gettext-tools/gnulib-lib/libxml/threads.c 2013-01-18 10:41:11 +0400
@@ -12,15 +12,16 @@
#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include <libxml/threads.h>
#include <libxml/globals.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif

View File

@ -0,0 +1,63 @@
--- gettext-runtime/libasprintf/vasnprintf.h.orig 2013-01-17 09:09:12 +0400
+++ gettext-runtime/libasprintf/vasnprintf.h 2013-05-01 17:33:31 +0400
@@ -40,6 +40,8 @@
extern "C" {
#endif
+#if !defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)
+
/* Write formatted output to a string dynamically allocated with malloc().
You can pass a preallocated buffer for the result in RESULTBUF and its
size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
@@ -64,11 +66,14 @@
free (output);
}
*/
+
extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 3, 0)));
+#endif /* !defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR) */
+
#ifdef __cplusplus
}
#endif
--- gettext-runtime/libasprintf/vasprintf.h.orig 2013-04-30 09:03:19 +0400
+++ gettext-runtime/libasprintf/vasprintf.h 2013-05-01 17:32:04 +0400
@@ -37,6 +37,8 @@
extern "C" {
#endif
+#if !defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)
+
/* Write formatted output to a string dynamically allocated with malloc().
If the memory allocation succeeds, store the address of the string in
*RESULT and return the number of resulting bytes, excluding the trailing
@@ -46,6 +48,8 @@
extern int vasprintf (char **result, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 2, 0)));
+#endif /* !defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR) */
+
#ifdef __cplusplus
}
#endif
--- gettext-runtime/libasprintf/vasnprintf.c.orig 2013-05-01 18:07:02 +0400
+++ gettext-runtime/libasprintf/vasnprintf.c 2013-05-01 18:42:46 +0400
@@ -67,7 +67,14 @@
#endif
#include <locale.h> /* localeconv() */
+#if defined(__MINGW64_VERSION_MAJOR) && defined(__USE_MINGW_ANSI_STDIO)
+# define REMOVED__USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
#include <stdio.h> /* snprintf(), sprintf() */
+#if defined(__MINGW64_VERSION_MAJOR) && defined(REMOVED__USE_MINGW_ANSI_STDIO)
+# define __USE_MINGW_ANSI_STDIO
+#endif
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <errno.h> /* errno */

View File

@ -0,0 +1,11 @@
--- gettext-runtime/intl/libgnuintl.in.h.old 2015-06-15 10:40:11.594942600 +0200
+++ gettext-runtime/intl/libgnuintl.in.h 2015-06-15 10:40:50.579345400 +0200
@@ -336,7 +336,7 @@ extern int vfprintf (FILE *, const char
#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
#undef printf
-#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
+#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__ || defined _MSC_VER
/* Don't break __attribute__((format(printf,M,N))).
This redefinition is only possible because the libc in NetBSD, Cygwin,
mingw does not have a function __printf__.

View File

@ -0,0 +1,11 @@
--- gettext-tools/gnulib-m4/asm-underscore.m4.orig 2016-08-12 19:58:41.845742375 +0200
+++ gettext-tools/gnulib-m4/asm-underscore.m4 2016-08-12 19:55:53.967056822 +0200
@@ -29,7 +29,7 @@
EOF
# Look for the assembly language name in the .s file.
AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
- if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
+ if LC_ALL=C grep -E '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then
gl_cv_prog_as_underscore=yes
else
gl_cv_prog_as_underscore=no

View File

@ -0,0 +1,88 @@
# Contributor: Filip Brcic <brcha@gna.org>
# Contributor: Martchus <martchus@gmx.net>
pkgname=mingw-w64-gettext
pkgver=0.19.8.1
pkgrel=1
arch=('any')
pkgdesc='GNU internationalization library (mingw-w64)'
depends=('mingw-w64-termcap' 'mingw-w64-libunistring')
makedepends=('gettext' 'mingw-w64-configure')
options=(!strip !buildflags staticlibs)
license=("GPL")
url="http://www.gnu.org/software/gettext/"
source=("http://ftp.gnu.org/pub/gnu/gettext/gettext-${pkgver}.tar.gz"{,.sig}
"00-relocatex-libintl-0.18.3.1.patch"
"05-always-use-libintl-vsnprintf.mingw.patch"
"06-dont-include-ctype-after-gnulibs-wctype.mingw.patch"
"07-fix-asprintf-conflict.mingw.patch"
"08-vs-compatible.patch"
"09-gnulib-fix-underscore-cond.patch"
"intl.pc")
md5sums=('97e034cf8ce5ba73a28ff6c3c0638092'
'SKIP'
'6f43ea4763a0cd461f60c71197832fba'
'27852a388b8cf38188dc392c244230ff'
'f69747f43f279b8a81286cfe5916b82f'
'3ebccf730ec3377b068027eb2283afb2'
'f5b611172ae58f1e4589a8d0c1d53414'
'bed0da63d251975a21ca830f2f156766'
'b0a123ec7ad1a345d0d712dae986a543')
validpgpkeys=('462225C3B46F34879FC8496CD605848ED7E69871') # Daiki Ueno
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
prepare() {
cd gettext-$pkgver
rm -f gettext-runtime/intl/canonicalize.c
rm -f gettext-runtime/intl/relocatex.{h,c}
rm -f MINGW-PATCHES/README-relocatex-libintl.txt
patch -p1 -i ${srcdir}/00-relocatex-libintl-0.18.3.1.patch
patch -p0 -i ${srcdir}/05-always-use-libintl-vsnprintf.mingw.patch
patch -p0 -i ${srcdir}/06-dont-include-ctype-after-gnulibs-wctype.mingw.patch
patch -p0 -i ${srcdir}/07-fix-asprintf-conflict.mingw.patch
patch -p0 -i ${srcdir}/08-vs-compatible.patch
# prevents "Cannot export rpl_printf: symbol not found"
patch -p0 -i ${srcdir}/09-gnulib-fix-underscore-cond.patch
}
build() {
cd gettext-${pkgver}
unset LDFLAGS
for _arch in ${_architectures}; do
mkdir -p build-${_arch} && pushd build-${_arch}
# define USER_LABEL_PREFIX_UNDERSCORE to prevent undefined reference to `__imp_exit_failure'
# and similar errors
local underscore_flag=''
[[ ${_arch} == i686-w64-mingw32 ]] && underscore_flag='-DUSER_LABEL_PREFIX_UNDERSCORE'
export CFLAGS="$underscore_flag"
export CXXFLAGS="$underscore_flag"
${_arch}-configure \
--disable-java \
--disable-native-java \
--disable-csharp \
--enable-threads=win32 \
--without-emacs ..
make
popd
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/${pkgname#mingw-w64-}-$pkgver/build-${_arch}"
make DESTDIR="$pkgdir" install
rm "$pkgdir/usr/${_arch}/bin/"{autopoint,gettext.sh,gettextize}
rm -r "$pkgdir/usr/${_arch}/lib/gettext"
rm -r "$pkgdir/usr/${_arch}/share"
${_arch}-strip --strip-all "$pkgdir"/usr/${_arch}/bin/*.exe
${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
# provide pkgconfig file for iconv library
install -dm755 "$pkgdir/usr/${_arch}/lib/pkgconfig"
install -m644 "$srcdir/intl.pc" "$pkgdir/usr/${_arch}/lib/pkgconfig"
sed -i "$pkgdir/usr/${_arch}/lib/pkgconfig/intl.pc" \
-e "s|@PREFIX[@]|/usr/${_arch}|g" \
-e "s|@VERSION[@]|$pkgver|g"
done
}

13
gettext/mingw-w64/intl.pc Normal file
View File

@ -0,0 +1,13 @@
prefix=@PREFIX@
exec_prefix=@PREFIX@
libdir=@PREFIX@/lib
includedir=@PREFIX@/include
Name: intl
Description: Provides native language support to programs
Version: @VERSION@
Libs: -L${libdir} -lintl
Libs.private: -liconv
Requires.private:
Cflags: -I${includedir}