Merge branch 'master' into readme-meson

master
Ariadne Conill 2022-02-21 04:27:11 -06:00 committed by GitHub
commit 0995e49977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 742 additions and 619 deletions

View File

@ -3,9 +3,9 @@
`pkgconf` is a program which helps to configure compiler and linker flags for `pkgconf` is a program which helps to configure compiler and linker flags for
development libraries. It is similar to pkg-config from freedesktop.org. development libraries. It is similar to pkg-config from freedesktop.org.
`libpkgconf` is a library which provides access to most of `pkgconf`'s functionality, to allow `libpkgconf` is a library which provides access to most of `pkgconf`'s functionality,
other tooling such as compilers and IDEs to discover and use libraries configured by to allow other tooling such as compilers and IDEs to discover and use libraries
pkgconf. configured by pkgconf.
## using `pkgconf` with autotools ## using `pkgconf` with autotools
@ -71,16 +71,17 @@ do let us know, but also make sure that the .pc files are valid and follow the r
the [pkg-config tutorial][fd-tut], as most likely fixing them to follow the specified the [pkg-config tutorial][fd-tut], as most likely fixing them to follow the specified
rules will solve the problem. rules will solve the problem.
Additionally, **we do not consider pkgconf doing what you tell it to do, when pkg-config Additionally, **we do not consider pkgconf doing what you tell it to do, in cases for
fails to do so, to be a bug**. which pkg-config fails to do so, to be a bug**.
If, for example, you use environment variables such as `PKG_CONFIG_SYSTEM_[INCLUDE|LIBRARY]_PATH` If, for example, you use environment variables such as `PKG_CONFIG_SYSTEM_[INCLUDE|LIBRARY]_PATH`
and then find yourself surprised that `pkgconf` is stripping `-I` and `-L` flags relating and then find yourself surprised that `pkgconf` is stripping `-I` and `-L` flags relating
to those paths, it's not a `pkgconf` problem -- `pkgconf` is doing exactly what you told to those paths, it is not a `pkgconf` problem -- `pkgconf` is doing exactly what you told
it to do. it to do.
We will reject bugs like this, and if you choose to violate our [Code of Conduct](CODE_OF_CONDUCT.md) We will reject bugs like this, and if someone insists on fixing such a non-bug, this
by demanding we fix your non-bug, we will fix the problem by banning you from the repo instead. constitutes a violation of our [Code of Conduct](CODE_OF_CONDUCT.md), which may be
addressed by banning from this repository.
## debug output ## debug output
@ -113,6 +114,7 @@ flags like so:
## compiling `pkgconf` and `libpkgconf` with Meson (usually for Windows) ## compiling `pkgconf` and `libpkgconf` with Meson (usually for Windows)
pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory, you could also use pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory, you could also use
Meson to build on UNIX, but this is not recommended at this time as it pkgconf is typically built Meson to build on UNIX, but this is not recommended at this time as it pkgconf is typically built
much earlier than Meson. much earlier than Meson.

View File

@ -85,7 +85,7 @@ FILE *error_msgout = NULL;
FILE *logfile_out = NULL; FILE *logfile_out = NULL;
static bool static bool
error_handler(const char *msg, const pkgconf_client_t *client, const void *data) error_handler(const char *msg, const pkgconf_client_t *client, void *data)
{ {
(void) client; (void) client;
(void) data; (void) data;

View File

@ -401,7 +401,7 @@ pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t linen
* :rtype: bool * :rtype: bool
*/ */
bool bool
pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data) pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, void *data)
{ {
(void) msg; (void) msg;
(void) client; (void) client;

View File

@ -167,7 +167,7 @@ struct pkgconf_pkg_ {
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data); typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);
typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data); typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data);
typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth); typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth);
typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, const void *data); typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, void *data);
struct pkgconf_client_ { struct pkgconf_client_ {
pkgconf_list_t dir_list; pkgconf_list_t dir_list;
@ -289,7 +289,7 @@ PKGCONF_API void pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_
PKGCONF_API bool pkgconf_error(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3); PKGCONF_API bool pkgconf_error(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
PKGCONF_API bool pkgconf_warn(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3); PKGCONF_API bool pkgconf_warn(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
PKGCONF_API bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t lineno, const char *funcname, const char *format, ...) PRINTFLIKE(5, 6); PKGCONF_API bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t lineno, const char *funcname, const char *format, ...) PRINTFLIKE(5, 6);
PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data); PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, void *data);
#ifndef PKGCONF_LITE #ifndef PKGCONF_LITE
#if defined(__GNUC__) || defined(__INTEL_COMPILER) #if defined(__GNUC__) || defined(__INTEL_COMPILER)

View File

@ -21,7 +21,13 @@
# define strcasecmp _stricmp # define strcasecmp _stricmp
#endif #endif
static bool default_personality_init = false; /*
* 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
* that case an additional call to init will create it anew.
*/
static unsigned default_personality_init = 0;
static pkgconf_cross_personality_t default_personality = { static pkgconf_cross_personality_t default_personality = {
.name = "default", .name = "default",
#ifdef _WIN32 #ifdef _WIN32
@ -85,30 +91,47 @@ build_default_search_path(pkgconf_list_t* dirlist)
* *
* Returns the default cross-compile personality. * Returns the default cross-compile personality.
* *
* Not thread safe.
*
* :rtype: pkgconf_cross_personality_t* * :rtype: pkgconf_cross_personality_t*
* :return: the default cross-compile personality * :return: the default cross-compile personality
*/ */
pkgconf_cross_personality_t * pkgconf_cross_personality_t *
pkgconf_cross_personality_default(void) pkgconf_cross_personality_default(void)
{ {
if (default_personality_init) if (default_personality_init) {
++default_personality_init;
return &default_personality; return &default_personality;
}
build_default_search_path(&default_personality.dir_list); build_default_search_path(&default_personality.dir_list);
pkgconf_path_split(SYSTEM_LIBDIR, &default_personality.filter_libdirs, false); pkgconf_path_split(SYSTEM_LIBDIR, &default_personality.filter_libdirs, false);
pkgconf_path_split(SYSTEM_INCLUDEDIR, &default_personality.filter_includedirs, false); pkgconf_path_split(SYSTEM_INCLUDEDIR, &default_personality.filter_includedirs, false);
default_personality_init = true; ++default_personality_init;
return &default_personality; return &default_personality;
} }
/*
* !doc
*
* .. c:function:: void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *)
*
* Decrements the count of default cross personality instances.
*
* Not thread safe.
*
* :rtype: void
*/
void void
pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality) pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality)
{ {
pkgconf_path_free(&personality->dir_list); if (--default_personality_init == 0) {
pkgconf_path_free(&personality->filter_libdirs); pkgconf_path_free(&personality->dir_list);
pkgconf_path_free(&personality->filter_includedirs); pkgconf_path_free(&personality->filter_libdirs);
pkgconf_path_free(&personality->filter_includedirs);
}
} }
#ifndef PKGCONF_LITE #ifndef PKGCONF_LITE

File diff suppressed because it is too large Load Diff