Update to pkgconf 3.0.6

Theo Buehler <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
Simple update. Only the --variable change is relevant to us (diff in
src/core.c). The rest is churn with little to no effect on OpenBSD.

Changes from 3.0.5 to 3.0.6:
----------------------------
* Command-line behavior:
  - --variable accepts multiple modules and prints the requested
    variable's value for each module, in argument order.  --path and
    --print-variables remain limited to a single module.
  - pccritic no longer reports the PC061 style finding for CRLF line endings,
    avoiding a noisy warning for normal Windows files.
    See https://github.com/pkgconf/pkgconf/issues/587.
* Build and portability fixes:
  - Improve OS/2 support by exporting libpkgconf APIs from DLL builds,
    recognizing OS/2 drive letters and path separators, comparing paths without
    case sensitivity, and using binary mode for redirected standard output and
    error.  Patches by KO Myung-Hun.
  - Declare pkgconf long-path-aware in its Windows application manifest,
    allowing paths beyond the traditional MAX_PATH limit when long paths are
    enabled by the operating system.  Patch by moi15moi.

Index: cli/core.c
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/cli/core.c,v
diff -u -p -r1.2 core.c
--- cli/core.c	7 Aug 2026 13:26:23 -0000	1.2
+++ cli/core.c	28 Aug 2026 05:28:47 -0000
@@ -1158,15 +1158,11 @@ pkgconf_cli_run(pkgconf_cli_state_t *sta
 		(state->want_flags & PKG_DUMP_SOURCE) == PKG_DUMP_SOURCE)
 		want_client_flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS;
 
-	/* if we are asking for a variable, path or list of variables, this only makes sense
+	/* if we are asking for a path or list of variables, this only makes sense
 	 * for a single package.
 	 */
-	if ((state->want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
-		(state->want_flags & PKG_PATH) == PKG_PATH ||
-		state->want_variable != NULL)
-	{
+	if ((state->want_flags & PKG_VARIABLES) == PKG_VARIABLES || (state->want_flags & PKG_PATH) == PKG_PATH)
 		state->maximum_package_count = 1;
-	}
 
 	if ((state->want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
 		(state->want_flags & PKG_CFLAGS))
Index: cli/main.c
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/cli/main.c,v
diff -u -p -r1.3 main.c
--- cli/main.c	7 Aug 2026 13:22:11 -0000	1.3
+++ cli/main.c	28 Aug 2026 05:28:47 -0000
@@ -82,7 +82,7 @@ deduce_personality(char *argv[])
 	if (i != NULL)
 		argv0 = i + 1;
 
-#if defined(_WIN32) || defined(_WIN64)
+#if defined(_WIN32) || defined(_WIN64) || defined(__OS2__)
 	i = strrchr(argv0, '\\');
 	if (i != NULL)
 		argv0 = i + 1;
@@ -269,7 +269,7 @@ main(int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__OS2__)
 	/* When running regression tests in cygwin, and building native
 	 * executable, tests fail unless native executable outputs unix
 	 * line endings.  Come to think of it, this will probably help
Index: libpkgconf/config.h
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/config.h,v
diff -u -p -r1.4 config.h
--- libpkgconf/config.h	7 Aug 2026 13:22:11 -0000	1.4
+++ libpkgconf/config.h	28 Aug 2026 05:28:47 -0000
@@ -1,6 +1,6 @@
 #define PACKAGE_NAME "pkgconf-lite"
 #define PACKAGE_BUGREPORT "https://github.com/pkgconf/pkgconf/issues"
-#define PACKAGE_VERSION "3.0.5"
+#define PACKAGE_VERSION "3.0.6"
 #define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION
 
 #define HAVE_DECL_STRNDUP	1
Index: libpkgconf/libpkgconf-api.h
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/libpkgconf-api.h,v
diff -u -p -r1.1.1.1 libpkgconf-api.h
--- libpkgconf/libpkgconf-api.h	3 May 2025 15:09:39 -0000	1.1.1.1
+++ libpkgconf/libpkgconf-api.h	28 Aug 2026 05:28:47 -0000
@@ -12,6 +12,12 @@
 # else
 #  define PKGCONF_API __declspec(dllimport)
 # endif
+#elif defined(__OS2__)
+# if defined(LIBPKGCONF_EXPORT) || defined(DLL_EXPORT)
+#  define PKGCONF_API __declspec(dllexport)
+# else
+#  define PKGCONF_API
+# endif
 #else
 # define PKGCONF_API __attribute__((visibility("default")))
 #endif
Index: libpkgconf/libpkgconf.h
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/libpkgconf.h,v
diff -u -p -r1.2 libpkgconf.h
--- libpkgconf/libpkgconf.h	7 Aug 2026 13:22:11 -0000	1.2
+++ libpkgconf/libpkgconf.h	28 Aug 2026 05:28:47 -0000
@@ -71,8 +71,8 @@ typedef struct pkgconf_license_ pkgconf_
 #define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
 	for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
 
-#define LIBPKGCONF_VERSION	30005
-#define LIBPKGCONF_VERSION_STR	"3.0.5"
+#define LIBPKGCONF_VERSION	30006
+#define LIBPKGCONF_VERSION_STR	"3.0.6"
 
 struct pkgconf_queue_ {
 	pkgconf_node_t iter;
Index: libpkgconf/path.c
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/path.c,v
diff -u -p -r1.2 path.c
--- libpkgconf/path.c	7 Aug 2026 13:22:11 -0000	1.2
+++ libpkgconf/path.c	28 Aug 2026 05:28:47 -0000
@@ -498,7 +498,7 @@ pkgconf_path_trim_basename(pkgconf_buffe
 		return false;
 
 	sep = strrchr(buf->base, PKG_DIR_SEP_S);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__OS2__)
 	char *sep2 = strrchr(buf->base, '/');
 	if (sep2 != NULL && (sep == NULL || sep2 > sep))
 		sep = sep2;
@@ -531,7 +531,7 @@ pkgconf_path_find_basename(const char *p
 	const char *sep;
 
 	sep = strrchr(path, PKG_DIR_SEP_S);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__OS2__)
 	const char *sep2 = strrchr(path, '/');
 	if (sep2 != NULL && (sep == NULL || sep2 > sep))
 		sep = sep2;
Index: libpkgconf/pkg.c
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/pkg.c,v
diff -u -p -r1.3 pkg.c
--- libpkgconf/pkg.c	7 Aug 2026 13:26:23 -0000	1.3
+++ libpkgconf/pkg.c	28 Aug 2026 05:28:47 -0000
@@ -121,7 +121,11 @@ pkg_get_parent_dir(pkgconf_pkg_t *pkg)
 		 *     /bar (absolute)  |  /foo/link (absolute)  |         /bar (absolute)
 		 *   ../bar (relative)  |  /foo/link (absolute)  |  /foo/../bar (relative)
 		 */
-		if ((sourcebuf[0] != '/') && strcmp(targetdir, "."))
+		if ((sourcebuf[0] != '/') &&
+#ifdef __OS2__
+			!(sourcebuf[0] != '\0' && sourcebuf[1] == ':') &&
+#endif
+			strcmp(targetdir, "."))
 		{
 			if (!pkgconf_buffer_append(&buf, targetdir) || !pkgconf_buffer_push_byte(&buf, '/'))
 				goto fail;
@@ -473,8 +477,8 @@ canonicalize_path(char *buf)
 static bool
 is_path_prefix_equal(const char *path1, const char *path2, size_t path2_len)
 {
-#ifdef _WIN32
-	return !_strnicmp(path1, path2, path2_len);
+#if defined(_WIN32) || defined(__OS2__)
+	return !strncasecmp(path1, path2, path2_len);
 #else
 	return !strncmp(path1, path2, path2_len);
 #endif
Index: libpkgconf/stdinc.h
===================================================================
RCS file: /cvs/src/usr.bin/pkgconf/libpkgconf/stdinc.h,v
diff -u -p -r1.3 stdinc.h
--- libpkgconf/stdinc.h	7 Aug 2026 13:22:11 -0000	1.3
+++ libpkgconf/stdinc.h	28 Aug 2026 05:28:47 -0000
@@ -35,9 +35,13 @@
 #include <errno.h>
 #include <limits.h>
 
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
+#if defined(_WIN32) || defined(__OS2__)
+# ifdef _WIN32
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+# else
+#  include <unistd.h>   /* readlink */
+# endif
 # include <malloc.h>
 # include <io.h>     /* for _setmode() */
 # include <fcntl.h>
@@ -63,7 +67,7 @@
 #   define SIZE_FMT_SPECIFIER	"%u"
 #  endif
 # endif
-# ifndef ssize_t
+# if !(defined(ssize_t) || defined(__OS2__))
 # ifndef __MINGW32__
 #  include <BaseTsd.h>
 # else
@@ -71,7 +75,7 @@
 # endif
 #  define ssize_t SSIZE_T
 # endif
-# ifndef __MINGW32__
+# if !(defined (__MINGW32__) || defined(__OS2__))
 #  include "win-dirent.h"
 # else
 #  include <dirent.h>
@@ -79,9 +83,13 @@
 # define PKGCONF_ITEM_SIZE (_MAX_PATH + 1024)
 # define PKG_CONFIG_PATH_SEP_S   ";"
 # define PKG_DIR_SEP_S   '\\'
-# define strcasecmp _stricmp
-# define strncasecmp _strnicmp
-# define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
+# ifndef __OS2__
+#  define strcasecmp _stricmp
+#  define strncasecmp _strnicmp
+#  define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
+# else
+#  define _setmode(h, m) if (!isatty((h))) setmode((h), (m))
+# endif
 #else
 # define PATH_DEV_NULL	"/dev/null"
 # define SIZE_FMT_SPECIFIER	"%zu"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.