diff --git a/.builds/autoconf-fedora-rawhide.yml b/.builds/autoconf-fedora-rawhide.yml deleted file mode 100644 index 22b3e92..0000000 --- a/.builds/autoconf-fedora-rawhide.yml +++ /dev/null @@ -1,25 +0,0 @@ -image: fedora/rawhide -packages: - - make - - kernel-devel - - gcc - - gcc-c++ - - autoconf - - automake - - libtool - - kyua - - libatf-sh - - xz - - gzip -sources: - - https://git.sr.ht/~kaniini/pkgconf -tasks: - - autogen: | - cd ~/pkgconf - sh autogen.sh - - configure: | - cd ~/pkgconf - ./configure - - distcheck: | - cd ~/pkgconf - make distcheck diff --git a/.builds/meson-fedora-rawhide.yml b/.builds/meson-fedora-rawhide.yml deleted file mode 100644 index 37f9d84..0000000 --- a/.builds/meson-fedora-rawhide.yml +++ /dev/null @@ -1,16 +0,0 @@ -image: fedora/rawhide -packages: - - meson - - ninja-build - - kyua - - libatf-sh -sources: - - https://git.sr.ht/~kaniini/pkgconf -tasks: - - configure: | - cd ~/pkgconf - meson build - - distcheck: | - cd ~/pkgconf - ninja -C build - ninja -C build test diff --git a/Makefile.am b/Makefile.am index 3999bdd..e1d4cb3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,6 @@ bin_PROGRAMS = pkgconf lib_LTLIBRARIES = libpkgconf.la EXTRA_DIST = pkg.m4 \ - meson.build \ libpkgconf/win-dirent.h \ tests/lib-relocatable/lib/pkgconfig/foo.pc \ tests/lib1/argv-parse-2.pc \ @@ -94,6 +93,7 @@ EXTRA_DIST = pkg.m4 \ tests/lib1/tuple-quoting.pc \ tests/lib1/empty-tuple.pc \ tests/lib1/orphaned-requires-private.pc \ + tests/test_env.sh \ $(test_scripts) \ doc/conf.py \ doc/extract.py \ @@ -110,7 +110,7 @@ EXTRA_DIST = pkg.m4 \ doc/libpkgconf-queue.rst \ doc/libpkgconf-tuple.rst -test_scripts= tests/meson.build \ +test_scripts= \ tests/basic.sh \ tests/builtins.sh \ tests/conflicts.sh \ diff --git a/NEWS b/NEWS index 79a233c..9f8fe5f 100644 --- a/NEWS +++ b/NEWS @@ -1,32 +1,6 @@ Changes from previous version of pkgconf ======================================== -Changes from 1.6.3 to 1.7.0: ----------------------------- - -* Bug fixes: - - Fix a possible buffer overflow involving newline escaping. - Patch by Tobias Stöckmann. - - Fix an out of boundary access in the parser. - Patch by Tobias Stöckmann. - - Fix leakage of strcmp() result value in pkgconf_compare_version() - responses. - - Return the default personality if loading a cross-compile - personality file failed. - - Do not complain about newlines when validating package versions. - - Properly detect strndup() on Windows when building with Meson. - -* Enhancements: - - A new --shared option and WantDefaultStatic cross-compile - configuration option have been added. This allows for toolchains - to specify that static linking should be used by default. - - Support for the PKG_CONFIG_MSVC_SYNTAX environment variable has - been added. Patch by Dan Kegel. - - Support for the PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS - client flag which disables emulation of freedesktop.org pkg-config - fragment merging semantics has been added. - Patch by Karen Arutyunov. - Changes from 1.6.2 to 1.6.3: ---------------------------- diff --git a/cli/main.c b/cli/main.c index f198f3b..3627818 100644 --- a/cli/main.c +++ b/cli/main.c @@ -69,7 +69,6 @@ #define PKG_MSVC_SYNTAX (((uint64_t) 1) << 41) #define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42) #define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43) -#define PKG_SHARED (((uint64_t) 1) << 44) static pkgconf_client_t pkg_client; static const pkgconf_fragment_render_ops_t *want_render_ops = NULL; @@ -665,7 +664,6 @@ usage(void) printf(" --maximum-traverse-depth maximum allowed depth for dependency graph\n"); printf(" --static be more aggressive when computing dependency graph\n"); printf(" (for static linking)\n"); - printf(" --shared use a simplified dependency graph (usually default)\n"); printf(" --pure optimize a static dependency graph as if it were a normal\n"); printf(" dependency graph\n"); printf(" --env-only look only for package entries in PKG_CONFIG_PATH\n"); @@ -829,7 +827,6 @@ main(int argc, char *argv[]) { "short-errors", no_argument, &want_flags, PKG_SHORT_ERRORS, }, { "maximum-traverse-depth", required_argument, NULL, 11, }, { "static", no_argument, &want_flags, PKG_STATIC, }, - { "shared", no_argument, &want_flags, PKG_SHARED, }, { "pure", no_argument, &want_flags, PKG_PURE, }, { "print-requires", no_argument, &want_flags, PKG_REQUIRES, }, { "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, }, @@ -971,7 +968,7 @@ main(int argc, char *argv[]) pkgconf_client_init(&pkg_client, error_handler, NULL, personality); #ifndef PKGCONF_LITE - if ((want_flags & PKG_MSVC_SYNTAX) == PKG_MSVC_SYNTAX || getenv("PKG_CONFIG_MSVC_SYNTAX") != NULL) + if ((want_flags & PKG_MSVC_SYNTAX) == PKG_MSVC_SYNTAX) want_render_ops = msvc_renderer_get(); #endif @@ -1005,8 +1002,18 @@ main(int argc, char *argv[]) if ((want_flags & PKG_VERSION) == PKG_VERSION) { - version(); - return EXIT_SUCCESS; + if (argc > 2) + { + fprintf(stderr, "%s: --version specified with other options or module names, assuming --modversion.\n", argv[0]); + + want_flags &= ~PKG_VERSION; + want_flags |= PKG_MODVERSION; + } + else + { + version(); + return EXIT_SUCCESS; + } } if ((want_flags & PKG_HELP) == PKG_HELP) @@ -1030,12 +1037,9 @@ main(int argc, char *argv[]) if ((want_flags & PKG_IGNORE_CONFLICTS) == PKG_IGNORE_CONFLICTS || getenv("PKG_CONFIG_IGNORE_CONFLICTS") != NULL) want_client_flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS; - if ((want_flags & PKG_STATIC) == PKG_STATIC || personality->want_default_static) + if ((want_flags & PKG_STATIC) == PKG_STATIC) want_client_flags |= (PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS); - if ((want_flags & PKG_SHARED) == PKG_SHARED) - want_client_flags &= ~(PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS); - /* if --static and --pure are both specified, then disable merge-back. * this allows for a --static which searches private modules, but has the same fragment behaviour as if * --static were disabled. see for rationale. diff --git a/configure.ac b/configure.ac index b0a0779..b6096ab 100644 --- a/configure.ac +++ b/configure.ac @@ -12,9 +12,9 @@ dnl implied. In no event shall the authors be liable for any damages arising dnl from the use of this software. AC_PREREQ([2.68]) -AC_INIT([pkgconf], [1.7.0], [https://todo.sr.ht/~kaniini/pkgconf]) +AC_INIT([pkgconf], [1.6.3], [https://todo.sr.ht/~kaniini/pkgconf]) AC_CONFIG_SRCDIR([cli/main.c]) -AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_MACRO_DIRS([m4]) AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"]) diff --git a/libpkgconf/fileio.c b/libpkgconf/fileio.c index 22281f2..b64205d 100644 --- a/libpkgconf/fileio.c +++ b/libpkgconf/fileio.c @@ -20,7 +20,7 @@ char * pkgconf_fgetline(char *line, size_t size, FILE *stream) { char *s = line; - char *end = line + size - 2; + char *end = line + size - 1; bool quoted = false; int c = '\0', c2; diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 37830c8..b431694 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -150,8 +150,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const { char mungebuf[PKGCONF_ITEM_SIZE]; - if (list->tail != NULL && list->tail->data != NULL && - !(client->flags & PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS)) + if (list->tail != NULL && list->tail->data != NULL) { pkgconf_fragment_t *parent = list->tail->data; diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index ca448eb..44a9e7f 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -78,8 +78,8 @@ typedef struct pkgconf_cross_personality_ pkgconf_cross_personality_t; #define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \ for ((value) = (tail); (value) != NULL; (value) = (value)->prev) -#define LIBPKGCONF_VERSION 10700 -#define LIBPKGCONF_VERSION_STR "1.7.0" +#define LIBPKGCONF_VERSION 10603 +#define LIBPKGCONF_VERSION_STR "1.6.3" struct pkgconf_fragment_ { pkgconf_node_t iter; @@ -202,8 +202,6 @@ struct pkgconf_cross_personality_ { pkgconf_list_t filter_includedirs; char *sysroot_dir; - - bool want_default_static; }; /* client.c */ @@ -249,7 +247,6 @@ PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const ch #define PKGCONF_PKG_PKGF_DONT_RELOCATE_PATHS 0x0800 #define PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS 0x1000 #define PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS 0x2000 -#define PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS 0x4000 #define PKGCONF_PKG_DEPF_INTERNAL 0x1 diff --git a/libpkgconf/parser.c b/libpkgconf/parser.c index 7ac9362..17aa697 100644 --- a/libpkgconf/parser.c +++ b/libpkgconf/parser.c @@ -66,11 +66,8 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o } op = *p; - if (*p != '\0') - { - *p = '\0'; - p++; - } + *p = '\0'; + p++; while (*p && isspace((unsigned int)*p)) p++; diff --git a/libpkgconf/personality.c b/libpkgconf/personality.c index f5ca367..a39d2fd 100644 --- a/libpkgconf/personality.c +++ b/libpkgconf/personality.c @@ -119,16 +119,6 @@ typedef struct { const ptrdiff_t offset; } personality_keyword_pair_t; -static void -personality_bool_func(pkgconf_cross_personality_t *p, const char *keyword, const size_t lineno, const ptrdiff_t offset, char *value) -{ - (void) keyword; - (void) lineno; - - bool *dest = (bool *)((char *) p + offset); - *dest = strcasecmp(value, "true") || strcasecmp(value, "yes") || *value == '1'; -} - static void personality_copy_func(pkgconf_cross_personality_t *p, const char *keyword, const size_t lineno, const ptrdiff_t offset, char *value) { @@ -156,7 +146,6 @@ static const personality_keyword_pair_t personality_keyword_pairs[] = { {"SystemIncludePaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_includedirs)}, {"SystemLibraryPaths", personality_fragment_func, offsetof(pkgconf_cross_personality_t, filter_libdirs)}, {"Triplet", personality_copy_func, offsetof(pkgconf_cross_personality_t, name)}, - {"WantDefaultStatic", personality_bool_func, offsetof(pkgconf_cross_personality_t, want_default_static)}, }; static int @@ -179,7 +168,7 @@ personality_keyword_set(pkgconf_cross_personality_t *p, const size_t lineno, con pair->func(p, keyword, lineno, pair->offset, value); } -static const pkgconf_parser_operand_func_t personality_parser_ops[] = { +static const pkgconf_parser_operand_func_t personality_parser_ops[256] = { [':'] = (pkgconf_parser_operand_func_t) personality_keyword_set }; @@ -259,6 +248,6 @@ pkgconf_cross_personality_find(const char *triplet) finish: pkgconf_path_free(&plist); - return out != NULL ? out : pkgconf_cross_personality_default(); + return out; } #endif diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index fd85ec8..d91ccde 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -99,7 +99,7 @@ pkgconf_pkg_parser_version_func(const pkgconf_client_t *client, pkgconf_pkg_t *p /* cut at any detected whitespace */ p = pkgconf_tuple_parse(client, &pkg->vars, value); - len = strcspn(p, " \t"); + len = strcspn(p, " \t\r\n"); if (len) { i = p + (ptrdiff_t) len; @@ -860,8 +860,8 @@ pkgconf_compare_version(const char *a, const char *b) } ret = strcmp(one, two); - if (ret != 0) - return ret < 0 ? -1 : 1; + if (ret) + return ret; *str1 = oldch1; *str2 = oldch2; diff --git a/man/pkg.m4.7 b/man/pkg.m4.7 index f921070..448dda8 100644 --- a/man/pkg.m4.7 +++ b/man/pkg.m4.7 @@ -87,7 +87,7 @@ be changed by passing the .Nm DIRECTORY parameter. .Pp -This value can be overridden with the +This value can be overriden with the .Fl -with-pkgconfigdir configure parameter. .Ss "PKG_NOARCH_INSTALLDIR(DIRECTORY)" @@ -99,7 +99,7 @@ be changed by passing the .Nm DIRECTORY parameter. .Pp -This value can be overridden with the +This value can be overriden with the .Fl -with-noarch-pkgconfigdir configure parameter. .Ss "PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])" diff --git a/man/pkgconf-personality.5 b/man/pkgconf-personality.5 index 7941d9e..5815948 100644 --- a/man/pkgconf-personality.5 +++ b/man/pkgconf-personality.5 @@ -47,11 +47,6 @@ The property will be set to the text of the value. The property will be set to a list of fragments parsed from the text. The input text must be in a format that is suitable for passing to a POSIX shell without any shell expansions after variable substitution has been done. -Elements are delimited with a colon. -.\" -.It Boolean -The property will be set to true if the value is one of: true, yes or 1. -Otherwise it will be set to false. .\" .El .Ss PROPERTY KEYWORDS @@ -76,18 +71,15 @@ include files. A list of directories that are included by default in the search path for libraries. (mandatory; fragment list) -.It WantDefaultStatic -If true, pkgconf will default to operating in static linking mode. -(optional; boolean; default is false) .\" -.El .Sh EXAMPLES An example .personality file: .Bd -literal # This is a comment Triplet: x86_64-pc-linux-gnu SysrootDir: /home/kaniini/sysroot/x86_64-pc-linux-gnu -DefaultSearchPaths: /home/kaniini/sysroot/x86_64-pc-linux-gnu/lib/pkgconfig:/home/kaniini/sysroot/x86_64-pc-linux-gnu/share/pkgconfig +DefaultSearchPaths: /home/kaniini/sysroot/x86_64-pc-linux-gnu/lib/pkgconfig \\ + /home/kaniini/sysroot/x86_64-pc-linux-gnu/share/pkgconfig SystemIncludePaths: /home/kaniini/sysroot/x86_64-pc-linux-gnu/include SystemLibraryPaths: /home/kaniini/sysroot/x86_64-pc-linux-gnu/lib .Ed diff --git a/man/pkgconf.1 b/man/pkgconf.1 index d5488a1..78d29ae 100644 --- a/man/pkgconf.1 +++ b/man/pkgconf.1 @@ -58,8 +58,6 @@ dependencies of modules added to the resolver's solution. .It Fl -static Compute a deeper dependency graph and use compiler/linker flags intended for static linking. -.It Fl -shared -Compute a simple dependency graph that is only suitable for shared linking. .It Fl -pure Treats the computed dependency graph as if it were pure. This is mainly intended for use with the @@ -211,8 +209,6 @@ If set, enables additional debug logging. The format of the debug log messages is implementation-specific. .It Va PKG_CONFIG_DONT_RELOCATE_PATHS If set, disables the path relocation feature. -.It Va PKG_CONFIG_MSVC_SYNTAX -If set, uses MSVC syntax for fragments. .El .Sh EXAMPLES Displaying the CFLAGS of a package: diff --git a/meson.build b/meson.build index dcc7fa2..77c37cd 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('pkgconf', 'c', - version : '1.7.0', + version : '1.6.3', license : 'ISC', - meson_version : '>=0.47') + meson_version : '>=0.40') cc = meson.get_compiler('c') @@ -28,14 +28,14 @@ foreach h : check_headers endforeach check_functions = [ - ['HAVE_CYGWIN_CONV_PATH', 'cygwin_conv_path', 'sys/cygwin.h'], - ['HAVE_STRLCAT', 'strlcat', 'string.h'], - ['HAVE_STRLCPY', 'strlcpy', 'string.h'], - ['HAVE_STRNDUP', 'strndup', 'string.h'], + ['HAVE_CYGWIN_CONV_PATH', 'cygwin_conv_path', '#include'], + ['HAVE_STRLCAT', 'strlcat', '#include'], + ['HAVE_STRLCPY', 'strlcpy', '#include'], + ['HAVE_STRNDUP', 'strndup', '#include'], ] foreach f : check_functions - if cc.has_function(f.get(1), prefix : '#include <' + f.get(2) + '>') and cc.has_header_symbol(f.get(2), f.get(1)) + if cc.has_function(f.get(1), prefix : f.get(2)) cdata.set(f.get(0), 1) endif endforeach diff --git a/tests/meson.build b/tests/meson.build index 1f21e04..e8ef6c4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -18,6 +18,6 @@ tests = [ # yuck foreach test : tests - configure_file(input: test + '.sh', output: test, copy: true) + configure_file(input: test + '.sh', output: test, configuration: configuration_data()) run_command('chmod', '755', join_paths(meson.build_root(), 'tests', test)) endforeach