libpkgconf: clean up _WIN32 include mess quite a bit

Ref: https://github.com/pkgconf/pkgconf/issues/406
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
Ariadne Conill 2025-12-20 15:25:17 -08:00
parent 530fc89d13
commit c863ef3f82
6 changed files with 16 additions and 46 deletions

View File

@ -21,10 +21,6 @@
#ifndef PKGCONF_LITE
#include "renderer-msvc.h"
#endif
#ifdef _WIN32
#include <io.h> /* for _setmode() */
#include <fcntl.h>
#endif
#define PKG_CFLAGS_ONLY_I (((uint64_t) 1) << 2)
#define PKG_CFLAGS_ONLY_OTHER (((uint64_t) 1) << 3)

View File

@ -31,23 +31,6 @@
extern "C" {
#endif
/* pkg-config uses ';' on win32 as ':' is part of path */
#ifdef _WIN32
#define PKG_CONFIG_PATH_SEP_S ";"
#else
#define PKG_CONFIG_PATH_SEP_S ":"
#endif
#ifdef _WIN32
#define PKG_DIR_SEP_S '\\'
#else
#define PKG_DIR_SEP_S '/'
#endif
#ifdef _WIN32
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
#endif
#define PKGCONF_BUFSIZE (65535)
typedef enum {

View File

@ -22,10 +22,6 @@
# define PKGCONF_CACHE_INODES
#endif
#ifdef _WIN32
# define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
#endif
static bool
#ifdef PKGCONF_CACHE_INODES
path_list_contains_entry(const char *text, pkgconf_list_t *dirlist, struct stat *st)
@ -410,6 +406,7 @@ pkgconf_path_relocate(char *buf, size_t buflen)
}
#ifdef _WIN32
#define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
/*
* !doc
*

View File

@ -24,10 +24,6 @@
* =========================
*/
#ifdef _WIN32
# define strcasecmp _stricmp
#endif
/*
* Increment each time the default personality is inited, decrement each time
* it's deinited. Whenever it is 0, then the deinit frees the personality. In

View File

@ -17,15 +17,6 @@
#include <libpkgconf/stdinc.h>
#include <libpkgconf/libpkgconf.h>
#ifndef _WIN32
#include <fcntl.h> // open
#include <libgen.h> // basename/dirname
#include <sys/stat.h> // lstat, S_ISLNK
#include <unistd.h> // close, readlinkat
#include <string.h>
#endif
/*
* !doc
*
@ -36,13 +27,6 @@
* routines.
*/
#ifdef _WIN32
# undef PKG_DEFAULT_PATH
# define PKG_DEFAULT_PATH "../lib/pkgconfig;../share/pkgconfig"
# define strncasecmp _strnicmp
# define strcasecmp _stricmp
#endif
#define PKG_CONFIG_EXT ".pc"
static unsigned int

View File

@ -31,6 +31,8 @@
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <malloc.h>
# include <io.h> /* for _setmode() */
# include <fcntl.h>
# define PATH_DEV_NULL "nul"
# ifdef _WIN64
# ifndef __MINGW32__
@ -52,9 +54,14 @@
# ifndef __MINGW32__
# include "win-dirent.h"
# else
# include <dirent.h>
# include <dirent.h>
# endif
# 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)
#else
# define PATH_DEV_NULL "/dev/null"
# define SIZE_FMT_SPECIFIER "%zu"
@ -65,11 +72,18 @@
# include <unistd.h>
# include <limits.h>
# include <strings.h>
# include <fcntl.h> // open
# include <libgen.h> // basename/dirname
# include <sys/stat.h> // lstat, S_ISLNK
# include <unistd.h> // close, readlinkat
# include <string.h>
# ifdef PATH_MAX
# define PKGCONF_ITEM_SIZE (PATH_MAX + 1024)
# else
# define PKGCONF_ITEM_SIZE (4096 + 1024)
# endif
# define PKG_CONFIG_PATH_SEP_S ":"
# define PKG_DIR_SEP_S '/'
#endif
#endif