lite: disable some bloat

pull/191/head
William Pitcock 2019-05-06 15:13:17 -05:00
parent fb98f5a866
commit 43ca536b9f
3 changed files with 36 additions and 11 deletions

View File

@ -28,10 +28,9 @@ SRCS = \
libpkgconf/queue.c \ libpkgconf/queue.c \
libpkgconf/tuple.c \ libpkgconf/tuple.c \
cli/getopt_long.c \ cli/getopt_long.c \
cli/main.c \ cli/main.c
cli/renderer-msvc.c
OBJS = ${SRCS:.c=.o} OBJS = ${SRCS:.c=.o}
CFLAGS = ${STATIC} -I. -Ilibpkgconf -Icli -DSYSTEM_LIBDIR=\"${SYSTEM_LIBDIR}\" -DSYSTEM_INCLUDEDIR=\"${SYSTEM_INCLUDEDIR}\" -DPERSONALITY_PATH=\"${PERSONALITY_PATH}\" -DPKG_DEFAULT_PATH=\"${PKG_DEFAULT_PATH}\" CFLAGS = ${STATIC} -DPKGCONF_LITE -I. -Ilibpkgconf -Icli -DSYSTEM_LIBDIR=\"${SYSTEM_LIBDIR}\" -DSYSTEM_INCLUDEDIR=\"${SYSTEM_INCLUDEDIR}\" -DPKG_DEFAULT_PATH=\"${PKG_DEFAULT_PATH}\"
STATIC = STATIC =
all: pkgconf-lite all: pkgconf-lite
@ -53,7 +52,7 @@ clean:
rm -f ${OBJS} rm -f ${OBJS}
rm -f pkgconf-lite rm -f pkgconf-lite
preflight: preflight-system-libdir preflight-system-includedir preflight-pkg-default-path preflight-personality-path preflight: preflight-system-libdir preflight-system-includedir preflight-pkg-default-path
preflight-system-libdir: preflight-system-libdir:
@if test -z "${SYSTEM_LIBDIR}"; then \ @if test -z "${SYSTEM_LIBDIR}"; then \
@ -67,16 +66,10 @@ preflight-system-includedir:
exit 1; \ exit 1; \
fi fi
preflight-personality-path:
@if test -z "${PERSONALITY_PATH}"; then \
echo "PERSONALITY_PATH not set."; \
exit 1; \
fi
preflight-pkg-default-path: preflight-pkg-default-path:
@if test -z "${PKG_DEFAULT_PATH}"; then \ @if test -z "${PKG_DEFAULT_PATH}"; then \
echo "PKG_DEFAULT_PATH not set."; \ echo "PKG_DEFAULT_PATH not set."; \
exit 1; \ exit 1; \
fi fi
.PHONY: preflight preflight-system-libdir preflight-system-includedir preflight-pkg-default-path preflight-personality-path clean .PHONY: preflight preflight-system-libdir preflight-system-includedir preflight-pkg-default-path clean

View File

@ -18,7 +18,9 @@
#include <libpkgconf/libpkgconf.h> #include <libpkgconf/libpkgconf.h>
#include "libpkgconf/config.h" #include "libpkgconf/config.h"
#include "getopt_long.h" #include "getopt_long.h"
#ifndef PKGCONF_LITE
#include "renderer-msvc.h" #include "renderer-msvc.h"
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> /* for _setmode() */ #include <io.h> /* for _setmode() */
#include <fcntl.h> #include <fcntl.h>
@ -246,6 +248,7 @@ apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
return true; return true;
} }
#ifndef PKGCONF_LITE
static void static void
print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused) print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
{ {
@ -280,6 +283,7 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
printf("}\n"); printf("}\n");
return true; return true;
} }
#endif
static bool static bool
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth) apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
@ -638,9 +642,11 @@ usage(void)
printf(" --relocate=path relocates a path and exits (mostly for testsuite)\n"); printf(" --relocate=path relocates a path and exits (mostly for testsuite)\n");
printf(" --dont-relocate-paths disables path relocation support\n"); printf(" --dont-relocate-paths disables path relocation support\n");
#ifndef PKGCONF_LITE
printf("\ncross-compilation personality support:\n\n"); printf("\ncross-compilation personality support:\n\n");
printf(" --personality=triplet|filename sets the personality to 'triplet' or a file named 'filename'\n"); printf(" --personality=triplet|filename sets the personality to 'triplet' or a file named 'filename'\n");
printf(" --dump-personality dumps details concerning selected personality\n"); printf(" --dump-personality dumps details concerning selected personality\n");
#endif
printf("\nchecking specific pkg-config database entries:\n\n"); printf("\nchecking specific pkg-config database entries:\n\n");
@ -676,7 +682,9 @@ usage(void)
printf(" linking to stdout\n"); printf(" linking to stdout\n");
printf(" --print-provides print provided dependencies to stdout\n"); printf(" --print-provides print provided dependencies to stdout\n");
printf(" --print-variables print all known variables in module to stdout\n"); printf(" --print-variables print all known variables in module to stdout\n");
#ifndef PKGCONF_LITE
printf(" --digraph print entire dependency graph in graphviz 'dot' format\n"); printf(" --digraph print entire dependency graph in graphviz 'dot' format\n");
#endif
printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR); printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR);
printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR); printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR);
printf(" --path show the exact filenames for any matching .pc files\n"); printf(" --path show the exact filenames for any matching .pc files\n");
@ -684,7 +692,9 @@ usage(void)
printf(" --internal-cflags do not filter 'internal' cflags from output\n"); printf(" --internal-cflags do not filter 'internal' cflags from output\n");
printf("\nfiltering output:\n\n"); printf("\nfiltering output:\n\n");
#ifndef PKGCONF_LITE
printf(" --msvc-syntax print translatable fragments in MSVC syntax\n"); printf(" --msvc-syntax print translatable fragments in MSVC syntax\n");
#endif
printf(" --fragment-filter=types filter output fragments to the specified types\n"); printf(" --fragment-filter=types filter output fragments to the specified types\n");
printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT); printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT);
@ -701,6 +711,7 @@ relocate_path(const char *path)
printf("%s\n", buf); printf("%s\n", buf);
} }
#ifndef PKGCONF_LITE
static void static void
dump_personality(const pkgconf_cross_personality_t *p) dump_personality(const pkgconf_cross_personality_t *p)
{ {
@ -766,6 +777,7 @@ deduce_personality(char *argv[])
return out; return out;
} }
#endif
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -814,7 +826,9 @@ main(int argc, char *argv[])
{ "pure", no_argument, &want_flags, PKG_PURE, }, { "pure", no_argument, &want_flags, PKG_PURE, },
{ "print-requires", no_argument, &want_flags, PKG_REQUIRES, }, { "print-requires", no_argument, &want_flags, PKG_REQUIRES, },
{ "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, }, { "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, },
#ifndef PKGCONF_LITE
{ "digraph", no_argument, &want_flags, PKG_DIGRAPH, }, { "digraph", no_argument, &want_flags, PKG_DIGRAPH, },
#endif
{ "help", no_argument, &want_flags, PKG_HELP, }, { "help", no_argument, &want_flags, PKG_HELP, },
{ "env-only", no_argument, &want_flags, PKG_ENV_ONLY, }, { "env-only", no_argument, &want_flags, PKG_ENV_ONLY, },
{ "print-requires-private", no_argument, &want_flags, PKG_REQUIRES_PRIVATE, }, { "print-requires-private", no_argument, &want_flags, PKG_REQUIRES_PRIVATE, },
@ -850,11 +864,15 @@ main(int argc, char *argv[])
{ "dont-define-prefix", no_argument, &want_flags, PKG_DONT_DEFINE_PREFIX }, { "dont-define-prefix", no_argument, &want_flags, PKG_DONT_DEFINE_PREFIX },
{ "dont-relocate-paths", no_argument, &want_flags, PKG_DONT_RELOCATE_PATHS }, { "dont-relocate-paths", no_argument, &want_flags, PKG_DONT_RELOCATE_PATHS },
{ "env", required_argument, NULL, 48 }, { "env", required_argument, NULL, 48 },
#ifndef PKGCONF_LITE
{ "msvc-syntax", no_argument, &want_flags, PKG_MSVC_SYNTAX }, { "msvc-syntax", no_argument, &want_flags, PKG_MSVC_SYNTAX },
#endif
{ "fragment-filter", required_argument, NULL, 50 }, { "fragment-filter", required_argument, NULL, 50 },
{ "internal-cflags", no_argument, &want_flags, PKG_INTERNAL_CFLAGS }, { "internal-cflags", no_argument, &want_flags, PKG_INTERNAL_CFLAGS },
#ifndef PKGCONF_LITE
{ "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY }, { "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY },
{ "personality", required_argument, NULL, 53 }, { "personality", required_argument, NULL, 53 },
#endif
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -864,7 +882,11 @@ main(int argc, char *argv[])
pkgconf_client_set_trace_handler(&pkg_client, error_handler, NULL); pkgconf_client_set_trace_handler(&pkg_client, error_handler, NULL);
} }
#ifndef PKGCONF_LITE
personality = deduce_personality(argv); personality = deduce_personality(argv);
#else
personality = pkgconf_cross_personality_default();
#endif
while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1) while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
{ {
@ -909,9 +931,11 @@ main(int argc, char *argv[])
case 50: case 50:
want_fragment_filter = pkg_optarg; want_fragment_filter = pkg_optarg;
break; break;
#ifndef PKGCONF_LITE
case 53: case 53:
personality = pkgconf_cross_personality_find(pkg_optarg); personality = pkgconf_cross_personality_find(pkg_optarg);
break; break;
#endif
case '?': case '?':
case ':': case ':':
return EXIT_FAILURE; return EXIT_FAILURE;
@ -924,17 +948,21 @@ main(int argc, char *argv[])
pkgconf_path_copy_list(&personality->dir_list, &dir_list); pkgconf_path_copy_list(&personality->dir_list, &dir_list);
pkgconf_path_free(&dir_list); pkgconf_path_free(&dir_list);
#ifndef PKGCONF_LITE
if ((want_flags & PKG_DUMP_PERSONALITY) == PKG_DUMP_PERSONALITY) if ((want_flags & PKG_DUMP_PERSONALITY) == PKG_DUMP_PERSONALITY)
{ {
dump_personality(personality); dump_personality(personality);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif
/* now, bring up the client. settings are preserved since the client is prealloced */ /* now, bring up the client. settings are preserved since the client is prealloced */
pkgconf_client_init(&pkg_client, error_handler, NULL, personality); pkgconf_client_init(&pkg_client, error_handler, NULL, personality);
#ifndef PKGCONF_LITE
if ((want_flags & PKG_MSVC_SYNTAX) == PKG_MSVC_SYNTAX) if ((want_flags & PKG_MSVC_SYNTAX) == PKG_MSVC_SYNTAX)
want_render_ops = msvc_renderer_get(); want_render_ops = msvc_renderer_get();
#endif
if ((env_traverse_depth = getenv("PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH")) != NULL) if ((env_traverse_depth = getenv("PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH")) != NULL)
maximum_traverse_depth = atoi(env_traverse_depth); maximum_traverse_depth = atoi(env_traverse_depth);
@ -1291,6 +1319,7 @@ main(int argc, char *argv[])
} }
} }
#ifndef PKGCONF_LITE
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH) if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
{ {
want_flags &= ~(PKG_CFLAGS|PKG_LIBS); want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
@ -1301,6 +1330,7 @@ main(int argc, char *argv[])
goto out; goto out;
} }
} }
#endif
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION) if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
{ {

View File

@ -99,6 +99,7 @@ pkgconf_cross_personality_default(void)
return &default_personality; return &default_personality;
} }
#ifndef PKGCONF_LITE
static bool static bool
valid_triplet(const char *triplet) valid_triplet(const char *triplet)
{ {
@ -249,3 +250,4 @@ finish:
pkgconf_path_free(&plist); pkgconf_path_free(&plist);
return out; return out;
} }
#endif