xref: /freebsd/contrib/pkgconf/cli/core.h (revision 592efe252472a3385acf36b1f49ecf710a7f3d9c)
1 /*
2  * core.h
3  * core, printer functions
4  *
5  * SPDX-License-Identifier: pkgconf
6  *
7  * Copyright (c) 2011-2025 pkgconf authors (see AUTHORS).
8  *
9  * Permission to use, copy, modify, and/or distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * This software is provided 'as is' and without any warranty, express or
14  * implied.  In no event shall the authors be liable for any damages arising
15  * from the use of this software.
16  */
17 
18 #ifndef __CLI_CORE_H
19 #define __CLI_CORE_H
20 
21 #define PKG_CFLAGS_ONLY_I		(((uint64_t) 1) << 2)
22 #define PKG_CFLAGS_ONLY_OTHER		(((uint64_t) 1) << 3)
23 #define PKG_CFLAGS			(PKG_CFLAGS_ONLY_I|PKG_CFLAGS_ONLY_OTHER)
24 #define PKG_LIBS_ONLY_LDPATH		(((uint64_t) 1) << 5)
25 #define PKG_LIBS_ONLY_LIBNAME		(((uint64_t) 1) << 6)
26 #define PKG_LIBS_ONLY_OTHER		(((uint64_t) 1) << 7)
27 #define PKG_LIBS			(PKG_LIBS_ONLY_LDPATH|PKG_LIBS_ONLY_LIBNAME|PKG_LIBS_ONLY_OTHER)
28 #define PKG_MODVERSION			(((uint64_t) 1) << 8)
29 #define PKG_REQUIRES			(((uint64_t) 1) << 9)
30 #define PKG_REQUIRES_PRIVATE		(((uint64_t) 1) << 10)
31 #define PKG_VARIABLES			(((uint64_t) 1) << 11)
32 #define PKG_DIGRAPH			(((uint64_t) 1) << 12)
33 #define PKG_KEEP_SYSTEM_CFLAGS		(((uint64_t) 1) << 13)
34 #define PKG_KEEP_SYSTEM_LIBS		(((uint64_t) 1) << 14)
35 #define PKG_VERSION			(((uint64_t) 1) << 15)
36 #define PKG_ABOUT			(((uint64_t) 1) << 16)
37 #define PKG_ENV_ONLY			(((uint64_t) 1) << 17)
38 #define PKG_ERRORS_ON_STDOUT		(((uint64_t) 1) << 18)
39 #define PKG_SILENCE_ERRORS		(((uint64_t) 1) << 19)
40 #define PKG_IGNORE_CONFLICTS		(((uint64_t) 1) << 20)
41 #define PKG_STATIC			(((uint64_t) 1) << 21)
42 #define PKG_NO_UNINSTALLED		(((uint64_t) 1) << 22)
43 #define PKG_UNINSTALLED			(((uint64_t) 1) << 23)
44 #define PKG_LIST			(((uint64_t) 1) << 24)
45 #define PKG_HELP			(((uint64_t) 1) << 25)
46 #define PKG_PRINT_ERRORS		(((uint64_t) 1) << 26)
47 #define PKG_SIMULATE			(((uint64_t) 1) << 27)
48 #define PKG_NO_CACHE			(((uint64_t) 1) << 28)
49 #define PKG_PROVIDES			(((uint64_t) 1) << 29)
50 #define PKG_VALIDATE			(((uint64_t) 1) << 30)
51 #define PKG_LIST_PACKAGE_NAMES		(((uint64_t) 1) << 31)
52 #define PKG_NO_PROVIDES			(((uint64_t) 1) << 32)
53 #define PKG_PURE			(((uint64_t) 1) << 33)
54 #define PKG_PATH			(((uint64_t) 1) << 34)
55 #define PKG_DEFINE_PREFIX		(((uint64_t) 1) << 35)
56 #define PKG_DONT_DEFINE_PREFIX		(((uint64_t) 1) << 36)
57 #define PKG_DONT_RELOCATE_PATHS		(((uint64_t) 1) << 37)
58 #define PKG_DEBUG			(((uint64_t) 1) << 38)
59 #define PKG_SHORT_ERRORS		(((uint64_t) 1) << 39)
60 #define PKG_EXISTS			(((uint64_t) 1) << 40)
61 #define PKG_MSVC_SYNTAX			(((uint64_t) 1) << 41)
62 #define PKG_INTERNAL_CFLAGS		(((uint64_t) 1) << 42)
63 #define PKG_DUMP_PERSONALITY		(((uint64_t) 1) << 43)
64 #define PKG_SHARED			(((uint64_t) 1) << 44)
65 #define PKG_DUMP_LICENSE		(((uint64_t) 1) << 45)
66 #define PKG_SOLUTION			(((uint64_t) 1) << 46)
67 #define PKG_EXISTS_CFLAGS		(((uint64_t) 1) << 47)
68 #define PKG_FRAGMENT_TREE		(((uint64_t) 1) << 48)
69 #define PKG_DUMP_SOURCE			(((uint64_t) 1) << 49)
70 #define PKG_DUMP_LICENSE_FILE		(((uint64_t) 1) << 50)
71 #define PKG_NEWLINES			(((uint64_t) 1) << 51)
72 #define PKG_PRINT_DIGRAPH_QUERY_NODES	(((uint64_t) 1) << 52)
73 #define PKG_LINK_ABI			(((uint64_t) 1) << 53)
74 
75 typedef struct {
76 	pkgconf_client_t pkg_client;
77 	pkgconf_fragment_render_ops_t *want_render_ops;
78 
79 	uint64_t want_flags;
80 	int verbosity;
81 	int maximum_traverse_depth;
82 	size_t maximum_package_count;
83 
84 	const char *want_variable;
85 	const char *want_fragment_filter;
86 	const char *want_env_prefix;
87 
88 	char *required_pkgconfig_version;
89 	const char *required_exact_module_version;
90 	const char *required_max_module_version;
91 	const char *required_module_version;
92 
93 	FILE *error_msgout;
94 	FILE *logfile_out;
95 
96 	bool opened_error_msgout;
97 } pkgconf_cli_state_t;
98 
99 extern void path_list_to_buffer(const pkgconf_list_t *list, pkgconf_buffer_t *buffer, char delim);
100 extern int pkgconf_cli_run(pkgconf_cli_state_t *state, int argc, char *argv[], int last_argc);
101 extern void pkgconf_cli_state_reset(pkgconf_cli_state_t *state);
102 
103 #endif
104