1*a3cefe7fSPierre Pronchery 2*a3cefe7fSPierre Proncherylibpkgconf `client` module 3*a3cefe7fSPierre Pronchery========================== 4*a3cefe7fSPierre Pronchery 5*a3cefe7fSPierre ProncheryThe libpkgconf `client` module implements the `pkgconf_client_t` "client" object. 6*a3cefe7fSPierre ProncheryClient objects store all necessary state for libpkgconf allowing for multiple instances to run 7*a3cefe7fSPierre Proncheryin parallel. 8*a3cefe7fSPierre Pronchery 9*a3cefe7fSPierre ProncheryClient objects are not thread safe, in other words, a client object should not be shared across 10*a3cefe7fSPierre Proncherythread boundaries. 11*a3cefe7fSPierre Pronchery 12*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_dir_list_build(pkgconf_client_t *client) 13*a3cefe7fSPierre Pronchery 14*a3cefe7fSPierre Pronchery Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client, 15*a3cefe7fSPierre Pronchery then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the 16*a3cefe7fSPierre Pronchery ``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used. 17*a3cefe7fSPierre Pronchery 18*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to bootstrap. 19*a3cefe7fSPierre Pronchery :return: nothing 20*a3cefe7fSPierre Pronchery 21*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality) 22*a3cefe7fSPierre Pronchery 23*a3cefe7fSPierre Pronchery Initialise a pkgconf client object. 24*a3cefe7fSPierre Pronchery 25*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client to initialise. 26*a3cefe7fSPierre Pronchery :param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors. 27*a3cefe7fSPierre Pronchery :param void* error_handler_data: user data passed to optional error handler 28*a3cefe7fSPierre Pronchery :param pkgconf_cross_personality_t* personality: the cross-compile personality to use for defaults 29*a3cefe7fSPierre Pronchery :return: nothing 30*a3cefe7fSPierre Pronchery 31*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_t* pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality) 32*a3cefe7fSPierre Pronchery 33*a3cefe7fSPierre Pronchery Allocate and initialise a pkgconf client object. 34*a3cefe7fSPierre Pronchery 35*a3cefe7fSPierre Pronchery :param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors. 36*a3cefe7fSPierre Pronchery :param void* error_handler_data: user data passed to optional error handler 37*a3cefe7fSPierre Pronchery :param pkgconf_cross_personality_t* personality: cross-compile personality to use 38*a3cefe7fSPierre Pronchery :return: A pkgconf client object. 39*a3cefe7fSPierre Pronchery :rtype: pkgconf_client_t* 40*a3cefe7fSPierre Pronchery 41*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_deinit(pkgconf_client_t *client) 42*a3cefe7fSPierre Pronchery 43*a3cefe7fSPierre Pronchery Release resources belonging to a pkgconf client object. 44*a3cefe7fSPierre Pronchery 45*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client to deinitialise. 46*a3cefe7fSPierre Pronchery :return: nothing 47*a3cefe7fSPierre Pronchery 48*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_free(pkgconf_client_t *client) 49*a3cefe7fSPierre Pronchery 50*a3cefe7fSPierre Pronchery Release resources belonging to a pkgconf client object and then free the client object itself. 51*a3cefe7fSPierre Pronchery 52*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client to deinitialise and free. 53*a3cefe7fSPierre Pronchery :return: nothing 54*a3cefe7fSPierre Pronchery 55*a3cefe7fSPierre Pronchery.. c:function:: const char *pkgconf_client_get_sysroot_dir(const pkgconf_client_t *client) 56*a3cefe7fSPierre Pronchery 57*a3cefe7fSPierre Pronchery Retrieves the client's sysroot directory (if any). 58*a3cefe7fSPierre Pronchery 59*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object being accessed. 60*a3cefe7fSPierre Pronchery :return: A string containing the sysroot directory or NULL. 61*a3cefe7fSPierre Pronchery :rtype: const char * 62*a3cefe7fSPierre Pronchery 63*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_set_sysroot_dir(pkgconf_client_t *client, const char *sysroot_dir) 64*a3cefe7fSPierre Pronchery 65*a3cefe7fSPierre Pronchery Sets or clears the sysroot directory on a client object. Any previous sysroot directory setting is 66*a3cefe7fSPierre Pronchery automatically released if one was previously set. 67*a3cefe7fSPierre Pronchery 68*a3cefe7fSPierre Pronchery Additionally, the global tuple ``$(pc_sysrootdir)`` is set as appropriate based on the new setting. 69*a3cefe7fSPierre Pronchery 70*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object being modified. 71*a3cefe7fSPierre Pronchery :param char* sysroot_dir: The sysroot directory to set or NULL to unset. 72*a3cefe7fSPierre Pronchery :return: nothing 73*a3cefe7fSPierre Pronchery 74*a3cefe7fSPierre Pronchery.. c:function:: const char *pkgconf_client_get_buildroot_dir(const pkgconf_client_t *client) 75*a3cefe7fSPierre Pronchery 76*a3cefe7fSPierre Pronchery Retrieves the client's buildroot directory (if any). 77*a3cefe7fSPierre Pronchery 78*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object being accessed. 79*a3cefe7fSPierre Pronchery :return: A string containing the buildroot directory or NULL. 80*a3cefe7fSPierre Pronchery :rtype: const char * 81*a3cefe7fSPierre Pronchery 82*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot_dir) 83*a3cefe7fSPierre Pronchery 84*a3cefe7fSPierre Pronchery Sets or clears the buildroot directory on a client object. Any previous buildroot directory setting is 85*a3cefe7fSPierre Pronchery automatically released if one was previously set. 86*a3cefe7fSPierre Pronchery 87*a3cefe7fSPierre Pronchery Additionally, the global tuple ``$(pc_top_builddir)`` is set as appropriate based on the new setting. 88*a3cefe7fSPierre Pronchery 89*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object being modified. 90*a3cefe7fSPierre Pronchery :param char* buildroot_dir: The buildroot directory to set or NULL to unset. 91*a3cefe7fSPierre Pronchery :return: nothing 92*a3cefe7fSPierre Pronchery 93*a3cefe7fSPierre Pronchery.. c:function:: bool pkgconf_error(const pkgconf_client_t *client, const char *format, ...) 94*a3cefe7fSPierre Pronchery 95*a3cefe7fSPierre Pronchery Report an error to a client-registered error handler. 96*a3cefe7fSPierre Pronchery 97*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to report the error to. 98*a3cefe7fSPierre Pronchery :param char* format: A printf-style format string to use for formatting the error message. 99*a3cefe7fSPierre Pronchery :return: true if the error handler processed the message, else false. 100*a3cefe7fSPierre Pronchery :rtype: bool 101*a3cefe7fSPierre Pronchery 102*a3cefe7fSPierre Pronchery.. c:function:: bool pkgconf_warn(const pkgconf_client_t *client, const char *format, ...) 103*a3cefe7fSPierre Pronchery 104*a3cefe7fSPierre Pronchery Report an error to a client-registered warn handler. 105*a3cefe7fSPierre Pronchery 106*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to report the error to. 107*a3cefe7fSPierre Pronchery :param char* format: A printf-style format string to use for formatting the warning message. 108*a3cefe7fSPierre Pronchery :return: true if the warn handler processed the message, else false. 109*a3cefe7fSPierre Pronchery :rtype: bool 110*a3cefe7fSPierre Pronchery 111*a3cefe7fSPierre Pronchery.. c:function:: bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t len, const char *funcname, const char *format, ...) 112*a3cefe7fSPierre Pronchery 113*a3cefe7fSPierre Pronchery Report a message to a client-registered trace handler. 114*a3cefe7fSPierre Pronchery 115*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to report the trace message to. 116*a3cefe7fSPierre Pronchery :param char* filename: The file the function is in. 117*a3cefe7fSPierre Pronchery :param size_t lineno: The line number currently being executed. 118*a3cefe7fSPierre Pronchery :param char* funcname: The function name to use. 119*a3cefe7fSPierre Pronchery :param char* format: A printf-style format string to use for formatting the trace message. 120*a3cefe7fSPierre Pronchery :return: true if the trace handler processed the message, else false. 121*a3cefe7fSPierre Pronchery :rtype: bool 122*a3cefe7fSPierre Pronchery 123*a3cefe7fSPierre Pronchery.. c:function:: bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data) 124*a3cefe7fSPierre Pronchery 125*a3cefe7fSPierre Pronchery The default pkgconf error handler. 126*a3cefe7fSPierre Pronchery 127*a3cefe7fSPierre Pronchery :param char* msg: The error message to handle. 128*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object the error originated from. 129*a3cefe7fSPierre Pronchery :param void* data: An opaque pointer to extra data associated with the client for error handling. 130*a3cefe7fSPierre Pronchery :return: true (the function does nothing to process the message) 131*a3cefe7fSPierre Pronchery :rtype: bool 132*a3cefe7fSPierre Pronchery 133*a3cefe7fSPierre Pronchery.. c:function:: unsigned int pkgconf_client_get_flags(const pkgconf_client_t *client) 134*a3cefe7fSPierre Pronchery 135*a3cefe7fSPierre Pronchery Retrieves resolver-specific flags associated with a client object. 136*a3cefe7fSPierre Pronchery 137*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to retrieve the resolver-specific flags from. 138*a3cefe7fSPierre Pronchery :return: a bitfield of resolver-specific flags 139*a3cefe7fSPierre Pronchery :rtype: uint 140*a3cefe7fSPierre Pronchery 141*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_set_flags(pkgconf_client_t *client, unsigned int flags) 142*a3cefe7fSPierre Pronchery 143*a3cefe7fSPierre Pronchery Sets resolver-specific flags associated with a client object. 144*a3cefe7fSPierre Pronchery 145*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to set the resolver-specific flags on. 146*a3cefe7fSPierre Pronchery :return: nothing 147*a3cefe7fSPierre Pronchery 148*a3cefe7fSPierre Pronchery.. c:function:: const char *pkgconf_client_get_prefix_varname(const pkgconf_client_t *client) 149*a3cefe7fSPierre Pronchery 150*a3cefe7fSPierre Pronchery Retrieves the name of the variable that should contain a module's prefix. 151*a3cefe7fSPierre Pronchery In some cases, it is necessary to override this variable to allow proper path relocation. 152*a3cefe7fSPierre Pronchery 153*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to retrieve the prefix variable name from. 154*a3cefe7fSPierre Pronchery :return: the prefix variable name as a string 155*a3cefe7fSPierre Pronchery :rtype: const char * 156*a3cefe7fSPierre Pronchery 157*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_client_set_prefix_varname(pkgconf_client_t *client, const char *prefix_varname) 158*a3cefe7fSPierre Pronchery 159*a3cefe7fSPierre Pronchery Sets the name of the variable that should contain a module's prefix. 160*a3cefe7fSPierre Pronchery If the variable name is ``NULL``, then the default variable name (``prefix``) is used. 161*a3cefe7fSPierre Pronchery 162*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to set the prefix variable name on. 163*a3cefe7fSPierre Pronchery :param char* prefix_varname: The prefix variable name to set. 164*a3cefe7fSPierre Pronchery :return: nothing 165*a3cefe7fSPierre Pronchery 166*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_get_warn_handler(const pkgconf_client_t *client) 167*a3cefe7fSPierre Pronchery 168*a3cefe7fSPierre Pronchery Returns the warning handler if one is set, else ``NULL``. 169*a3cefe7fSPierre Pronchery 170*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to get the warn handler from. 171*a3cefe7fSPierre Pronchery :return: a function pointer to the warn handler or ``NULL`` 172*a3cefe7fSPierre Pronchery 173*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_set_warn_handler(pkgconf_client_t *client, pkgconf_error_handler_func_t warn_handler, void *warn_handler_data) 174*a3cefe7fSPierre Pronchery 175*a3cefe7fSPierre Pronchery Sets a warn handler on a client object or uninstalls one if set to ``NULL``. 176*a3cefe7fSPierre Pronchery 177*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to set the warn handler on. 178*a3cefe7fSPierre Pronchery :param pkgconf_error_handler_func_t warn_handler: The warn handler to set. 179*a3cefe7fSPierre Pronchery :param void* warn_handler_data: Optional data to associate with the warn handler. 180*a3cefe7fSPierre Pronchery :return: nothing 181*a3cefe7fSPierre Pronchery 182*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_get_error_handler(const pkgconf_client_t *client) 183*a3cefe7fSPierre Pronchery 184*a3cefe7fSPierre Pronchery Returns the error handler if one is set, else ``NULL``. 185*a3cefe7fSPierre Pronchery 186*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to get the error handler from. 187*a3cefe7fSPierre Pronchery :return: a function pointer to the error handler or ``NULL`` 188*a3cefe7fSPierre Pronchery 189*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_set_error_handler(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler, void *error_handler_data) 190*a3cefe7fSPierre Pronchery 191*a3cefe7fSPierre Pronchery Sets a warn handler on a client object or uninstalls one if set to ``NULL``. 192*a3cefe7fSPierre Pronchery 193*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to set the error handler on. 194*a3cefe7fSPierre Pronchery :param pkgconf_error_handler_func_t error_handler: The error handler to set. 195*a3cefe7fSPierre Pronchery :param void* error_handler_data: Optional data to associate with the error handler. 196*a3cefe7fSPierre Pronchery :return: nothing 197*a3cefe7fSPierre Pronchery 198*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_get_trace_handler(const pkgconf_client_t *client) 199*a3cefe7fSPierre Pronchery 200*a3cefe7fSPierre Pronchery Returns the error handler if one is set, else ``NULL``. 201*a3cefe7fSPierre Pronchery 202*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to get the error handler from. 203*a3cefe7fSPierre Pronchery :return: a function pointer to the error handler or ``NULL`` 204*a3cefe7fSPierre Pronchery 205*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_client_set_trace_handler(pkgconf_client_t *client, pkgconf_error_handler_func_t trace_handler, void *trace_handler_data) 206*a3cefe7fSPierre Pronchery 207*a3cefe7fSPierre Pronchery Sets a warn handler on a client object or uninstalls one if set to ``NULL``. 208*a3cefe7fSPierre Pronchery 209*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The client object to set the error handler on. 210*a3cefe7fSPierre Pronchery :param pkgconf_error_handler_func_t trace_handler: The error handler to set. 211*a3cefe7fSPierre Pronchery :param void* trace_handler_data: Optional data to associate with the error handler. 212*a3cefe7fSPierre Pronchery :return: nothing 213