Updated to 1.3.8 of pkgconf, currently installs as pkgconf and ${MINGW_PREFIX}-pkgconf but for a full replacement of pkg-config we can simply additionally do cp pkgconf pkg-config (#2844)
This commit is contained in:
2255
mingw-w64-pkgconf/0001-fix-mingw64-and-static.patch
Normal file
2255
mingw-w64-pkgconf/0001-fix-mingw64-and-static.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,716 +0,0 @@
|
||||
diff -Naur pkgconf-0.9.7-orig/configure.ac pkgconf-0.9.7/configure.ac
|
||||
--- pkgconf-0.9.7-orig/configure.ac 2014-06-08 00:32:08.000000000 +0400
|
||||
+++ pkgconf-0.9.7/configure.ac 2014-08-08 14:31:00.604400000 +0400
|
||||
@@ -15,6 +15,7 @@
|
||||
AC_INIT([pkgconf], [0.9.11], [http://github.com/pkgconf/pkgconf/issues])
|
||||
AC_CONFIG_SRCDIR([pkg.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
+AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CHECK_FUNCS([strlcpy strlcat strndup strtok_r])
|
||||
|
||||
|
||||
@@ -40,18 +41,27 @@
|
||||
PKGCONFIGDIR="${libdir}/pkgconfig:${datadir}/pkgconfig")
|
||||
|
||||
AC_SUBST([PKGCONFIGDIR])
|
||||
+AS_AC_EXPAND(PKGCONFIGDIR, $PKGCONFIGDIR)
|
||||
+AC_DEFINE_UNQUOTED(PKG_DEFAULT_PATH, ["$PKGCONFIGDIR"], [Directory with pkgconfig files])
|
||||
|
||||
AC_ARG_WITH([system-libdir],[AC_HELP_STRING([--with-system-libdir],[specify the
|
||||
system library directory (default LIBDIR)])],
|
||||
SYSTEM_LIBDIR="$withval", SYSTEM_LIBDIR="${libdir}")
|
||||
|
||||
AC_SUBST([SYSTEM_LIBDIR])
|
||||
+AS_AC_EXPAND(SYSTEM_LIBDIR, $SYSTEM_LIBDIR)
|
||||
+AC_DEFINE_UNQUOTED(SYSTEM_LIBDIR, ["$SYSTEM_LIBDIR"], [System library directory])
|
||||
|
||||
AC_ARG_WITH([system-includedir],[AC_HELP_STRING([--with-system-includedir],[specify the
|
||||
system include directory (default INCLUDEDIR)])],
|
||||
SYSTEM_INCLUDEDIR="$withval", SYSTEM_INCLUDEDIR="${includedir}")
|
||||
|
||||
AC_SUBST([SYSTEM_INCLUDEDIR])
|
||||
+AS_AC_EXPAND(SYSTEM_INCLUDEDIR, $SYSTEM_INCLUDEDIR)
|
||||
+AC_DEFINE_UNQUOTED(SYSTEM_INCLUDEDIR, ["$SYSTEM_INCLUDEDIR"], [System include directory])
|
||||
+
|
||||
+AS_AC_EXPAND(PACKAGE_BINDIR, $bindir)
|
||||
+AC_DEFINE_UNQUOTED(PACKAGE_BINDIR, ["$PACKAGE_BINDIR"], [Package bin directory])
|
||||
|
||||
AC_PROG_CPP
|
||||
AC_PROG_CC
|
||||
diff -Naur pkgconf-0.9.6-orig/m4/as-ac-expand.m4 pkgconf-0.9.6/m4/as-ac-expand.m4
|
||||
--- pkgconf-0.9.6-orig/m4/as-ac-expand.m4 1970-01-01 03:00:00.000000000 +0300
|
||||
+++ pkgconf-0.9.6/m4/as-ac-expand.m4 2014-08-07 17:35:24.000000000 +0400
|
||||
@@ -0,0 +1,49 @@
|
||||
+dnl as-ac-expand.m4 0.2.1
|
||||
+dnl autostars m4 macro for expanding directories using configure's prefix
|
||||
+dnl thomas@apestaart.org
|
||||
+
|
||||
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
|
||||
+dnl example
|
||||
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
|
||||
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
|
||||
+dnl Note: when using $prefix or $exec_prefix, avoid it expanding to NONE
|
||||
+dnl by calling it like this:
|
||||
+dnl AS_AC_EXPAND(PYTHONLIBDIR, "\${exec_prefix}/lib/python$PYVER/site-packages")
|
||||
+
|
||||
+AC_DEFUN([AS_AC_EXPAND],
|
||||
+[
|
||||
+ EXP_VAR=[$1]
|
||||
+ FROM_VAR=[$2]
|
||||
+
|
||||
+ dnl echo DEBUG: expand FROM_VAR $FROM_VAR
|
||||
+
|
||||
+ dnl first expand prefix and exec_prefix if necessary
|
||||
+ prefix_save=$prefix
|
||||
+ exec_prefix_save=$exec_prefix
|
||||
+
|
||||
+ dnl if no prefix given, then use /usr/local, the default prefix
|
||||
+ if test "x$prefix" = "xNONE"; then
|
||||
+ prefix="$ac_default_prefix"
|
||||
+ fi
|
||||
+ dnl if no exec_prefix given, then use prefix
|
||||
+ if test "x$exec_prefix" = "xNONE"; then
|
||||
+ exec_prefix=$prefix
|
||||
+ fi
|
||||
+
|
||||
+ full_var="$FROM_VAR"
|
||||
+ dnl loop until it doesn't change anymore
|
||||
+ while true; do
|
||||
+ dnl echo DEBUG: full_var: $full_var
|
||||
+ new_full_var="`eval echo $full_var`"
|
||||
+ if test "x$new_full_var" = "x$full_var"; then break; fi
|
||||
+ full_var=$new_full_var
|
||||
+ done
|
||||
+
|
||||
+ dnl clean up
|
||||
+ full_var=$new_full_var
|
||||
+ AC_SUBST([$1], "$full_var")
|
||||
+
|
||||
+ dnl restore prefix and exec_prefix
|
||||
+ prefix=$prefix_save
|
||||
+ exec_prefix=$exec_prefix_save
|
||||
+])
|
||||
diff -Naur pkgconf-0.9.6-orig/Makefile.in pkgconf-0.9.6/Makefile.in
|
||||
--- pkgconf-0.9.6-orig/Makefile.in 2014-06-08 00:32:08.000000000 +0400
|
||||
+++ pkgconf-0.9.6/Makefile.in 2014-08-08 15:11:03.504400000 +0400
|
||||
@@ -6,20 +6,17 @@
|
||||
datarootdir = @datarootdir@
|
||||
datadir = @datadir@
|
||||
includedir = @includedir@
|
||||
-system_includedir = @SYSTEM_INCLUDEDIR@
|
||||
-system_libdir = @SYSTEM_LIBDIR@
|
||||
-pkgconfigdir = @PKGCONFIGDIR@
|
||||
|
||||
CC = @CC@
|
||||
INSTALL = @INSTALL@
|
||||
PROG = pkgconf@EXEEXT@
|
||||
-SRCS = main.c cache.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c queue.c
|
||||
+SRCS = main.c cache.c pkg.c pathtools.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c queue.c
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
GCOV_OBJS = ${SRCS:.c=.og}
|
||||
PROF_OBJS = ${SRCS:.c=.op}
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
-CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${pkgconfigdir}\" -DSYSTEM_INCLUDEDIR=\"${system_includedir}\" -DSYSTEM_LIBDIR=\"${system_libdir}\" -Wall -Wextra -Wformat=2 -std=gnu99
|
||||
+CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -Wall -Wextra -Wformat=2 -std=gnu99
|
||||
MANDIR = ${datarootdir}/man/man1
|
||||
|
||||
all: build
|
||||
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,499 @@
|
||||
+/*
|
||||
+ .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;
|
||||
+}
|
||||
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,49 @@
|
||||
+/*
|
||||
+ .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 * get_relocated_path_list(char const * from, char const * to_path_list);
|
||||
+
|
||||
+#endif /* PATHTOOLS_H */
|
||||
diff -Naur pkgconf-0.9.6-orig/tuple.c pkgconf-0.9.6/tuple.c
|
||||
--- pkgconf-0.9.6-orig/tuple.c 2014-06-08 00:32:08.000000000 +0400
|
||||
+++ pkgconf-0.9.6/tuple.c 2014-08-08 16:55:44.126200000 +0400
|
||||
@@ -15,6 +15,26 @@
|
||||
|
||||
#include "pkg.h"
|
||||
#include "bsdstubs.h"
|
||||
+#include "pathtools.h"
|
||||
+
|
||||
+char *
|
||||
+package_path_relocation(const char *path)
|
||||
+{
|
||||
+#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 (PACKAGE_BINDIR, path);
|
||||
+ strcat (exe_path, rel_to_datadir);
|
||||
+ simplify_path (&exe_path[0]);
|
||||
+ return malloc_copy_string(exe_path);
|
||||
+#else
|
||||
+ return malloc_copy_string(path);
|
||||
+#endif
|
||||
+}
|
||||
|
||||
static pkg_list_t pkg_global_var = PKG_LIST_INITIALIZER;
|
||||
|
||||
@@ -143,7 +163,10 @@
|
||||
|
||||
*bptr = '\0';
|
||||
|
||||
- return strdup(buf);
|
||||
+ if ((*buf == '/') && (getenv("PKG_CONFIG_EXPAND_PATHS") != NULL))
|
||||
+ return package_path_relocation(buf);
|
||||
+ else
|
||||
+ return strdup(buf);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1,45 +1,41 @@
|
||||
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
||||
# Maintainer: Ilya Rakhlin <i.rakhlin@gmail.com>
|
||||
|
||||
_realname=pkgconf
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=0.9.12
|
||||
pkgver=1.3.8
|
||||
pkgrel=1
|
||||
pkgdesc='pkg-config compatible utility which does not depend on glib'
|
||||
url='https://github.com/nenolod/pkgconf'
|
||||
url='https://github.com/pkgconf/pkgconf'
|
||||
arch=('any')
|
||||
license=('ISC')
|
||||
options=('!debug' 'strip')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
|
||||
conflicts=("${MINGW_PACKAGE_PREFIX}-pkg-config")
|
||||
provides=("${MINGW_PACKAGE_PREFIX}-pkg-config")
|
||||
source=(http://rabbit.dereferenced.org/~nenolod/distfiles//$_realname-$pkgver.tar.bz2
|
||||
0002-relocate.patch)
|
||||
sha256sums=('7ec8b516e655e247f4ba976837cee808134785819ab8f538f652fe919cc6c09f'
|
||||
'b208aa88b3ab7be8425819f83ccf2ec1d3befc35b9e7b3de3a686d0e6812c0c8')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake")
|
||||
source=(https://distfiles.dereferenced.org/pkgconf/$_realname-$pkgver.tar.gz
|
||||
0001-fix-mingw64-and-static.patch)
|
||||
sha256sums=('fdac40205a50c77485f1f034a36bcda08d0935320b90bdba1734dc4436ba00ef'
|
||||
'f92d157c481128d301473b1cd229557ac25a75e0b6ffd6ff6bbf17be5b84c047')
|
||||
|
||||
prepare() {
|
||||
cd $_realname-$pkgver
|
||||
patch -p1 -i ${srcdir}/0002-relocate.patch
|
||||
|
||||
autoreconf -vfi
|
||||
patch -p1 -i ${srcdir}/0001-fix-mingw64-and-static.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
cd $_realname-$pkgver
|
||||
./configure --prefix=${MINGW_PREFIX} \
|
||||
--build=${MINGW_CHOST} \
|
||||
--host=${MINGW_CHOST} \
|
||||
--target=${MINGW_CHOST} \
|
||||
--sysconfdir=${MINGW_PREFIX}/etc \
|
||||
--mandir=${MINGW_PREFIX}/share/man \
|
||||
--infodir=${MINGW_PREFIX}/share/info \
|
||||
--localstatedir=${MINGW_PREFIX}/var
|
||||
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
|
||||
mkdir ${srcdir}/build-${MINGW_CHOST}
|
||||
cd ${srcdir}/build-${MINGW_CHOST}
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake \
|
||||
-G"MSYS Makefiles" \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
../${_realname}-${pkgver}
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd $_realname-$pkgver
|
||||
cd ${srcdir}/build-${MINGW_CHOST}
|
||||
make DESTDIR="$pkgdir" install
|
||||
cp "${pkgdir}${MINGW_PREFIX}"/bin/pkgconf "${pkgdir}${MINGW_PREFIX}"/bin/pkg-config
|
||||
cp "${pkgdir}${MINGW_PREFIX}"/bin/pkgconf "${pkgdir}${MINGW_PREFIX}"/bin/${MINGW_CHOST}-pkgconf
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user