forked from ariadne/pkgconf
libpkgconf: client: add pkgconf_client_[get|set]_prefix_varname()
parent
13cf74c7a3
commit
ced4f00363
|
@ -112,3 +112,21 @@ thread boundaries.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The client object to set the resolver-specific flags on.
|
:param pkgconf_client_t* client: The client object to set the resolver-specific flags on.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: const char *pkgconf_client_get_prefix_varname(const pkgconf_client_t *client)
|
||||||
|
|
||||||
|
Retrieves the name of the variable that should contain a module's prefix.
|
||||||
|
In some cases, it is necessary to override this variable to allow proper path relocation.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The client object to retrieve the prefix variable name from.
|
||||||
|
:return: the prefix variable name as a string
|
||||||
|
:rtype: const char *
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_client_set_prefix_varname(pkgconf_client_t *client, const char *prefix_varname)
|
||||||
|
|
||||||
|
Sets the name of the variable that should contain a module's prefix.
|
||||||
|
If the variable name is ``NULL``, then the default variable name (``prefix``) is used.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The client object to set the prefix variable name on.
|
||||||
|
:param char* prefix_varname: The prefix variable name to set.
|
||||||
|
:return: nothing
|
||||||
|
|
|
@ -50,6 +50,7 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
|
||||||
|
|
||||||
pkgconf_client_set_sysroot_dir(client, NULL);
|
pkgconf_client_set_sysroot_dir(client, NULL);
|
||||||
pkgconf_client_set_buildroot_dir(client, NULL);
|
pkgconf_client_set_buildroot_dir(client, NULL);
|
||||||
|
pkgconf_client_set_prefix_varname(client, NULL);
|
||||||
|
|
||||||
if (client->error_handler == NULL)
|
if (client->error_handler == NULL)
|
||||||
client->error_handler = pkgconf_default_error_handler;
|
client->error_handler = pkgconf_default_error_handler;
|
||||||
|
@ -98,6 +99,9 @@ pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handl
|
||||||
void
|
void
|
||||||
pkgconf_client_deinit(pkgconf_client_t *client)
|
pkgconf_client_deinit(pkgconf_client_t *client)
|
||||||
{
|
{
|
||||||
|
if (client->prefix_varname != NULL)
|
||||||
|
free(client->prefix_varname);
|
||||||
|
|
||||||
if (client->sysroot_dir != NULL)
|
if (client->sysroot_dir != NULL)
|
||||||
free(client->sysroot_dir);
|
free(client->sysroot_dir);
|
||||||
|
|
||||||
|
@ -290,3 +294,45 @@ pkgconf_client_set_flags(pkgconf_client_t *client, unsigned int flags)
|
||||||
{
|
{
|
||||||
client->flags = flags;
|
client->flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: const char *pkgconf_client_get_prefix_varname(const pkgconf_client_t *client)
|
||||||
|
*
|
||||||
|
* Retrieves the name of the variable that should contain a module's prefix.
|
||||||
|
* In some cases, it is necessary to override this variable to allow proper path relocation.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The client object to retrieve the prefix variable name from.
|
||||||
|
* :return: the prefix variable name as a string
|
||||||
|
* :rtype: const char *
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
pkgconf_client_get_prefix_varname(const pkgconf_client_t *client)
|
||||||
|
{
|
||||||
|
return client->prefix_varname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_client_set_prefix_varname(pkgconf_client_t *client, const char *prefix_varname)
|
||||||
|
*
|
||||||
|
* Sets the name of the variable that should contain a module's prefix.
|
||||||
|
* If the variable name is ``NULL``, then the default variable name (``prefix``) is used.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The client object to set the prefix variable name on.
|
||||||
|
* :param char* prefix_varname: The prefix variable name to set.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_client_set_prefix_varname(pkgconf_client_t *client, const char *prefix_varname)
|
||||||
|
{
|
||||||
|
if (prefix_varname == NULL)
|
||||||
|
prefix_varname = "prefix";
|
||||||
|
|
||||||
|
if (client->prefix_varname != NULL)
|
||||||
|
free(client->prefix_varname);
|
||||||
|
|
||||||
|
client->prefix_varname = strdup(prefix_varname);
|
||||||
|
}
|
||||||
|
|
|
@ -152,6 +152,8 @@ struct pkgconf_client_ {
|
||||||
char *buildroot_dir;
|
char *buildroot_dir;
|
||||||
|
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
|
char *prefix_varname;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
|
@ -165,6 +167,8 @@ const char *pkgconf_client_get_buildroot_dir(const pkgconf_client_t *client);
|
||||||
void pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot_dir);
|
void pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot_dir);
|
||||||
unsigned int pkgconf_client_get_flags(const pkgconf_client_t *client);
|
unsigned int pkgconf_client_get_flags(const pkgconf_client_t *client);
|
||||||
void pkgconf_client_set_flags(pkgconf_client_t *client, unsigned int flags);
|
void pkgconf_client_set_flags(pkgconf_client_t *client, unsigned int flags);
|
||||||
|
const char *pkgconf_client_get_prefix_varname(const pkgconf_client_t *client);
|
||||||
|
void pkgconf_client_set_prefix_varname(pkgconf_client_t *client, const char *prefix_varname);
|
||||||
|
|
||||||
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
|
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
|
||||||
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
||||||
|
|
Loading…
Reference in New Issue