mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2025-12-20 05:30:03 +01:00
Start from end of package lists when processing Requires
Prior to commit6ecf318, the resolved list of required packages was built in an appending way where each package on the command line or in Requires would appear in the list in the order they appeared. With6ecf318, that list building was changed to prepending, which had a subtle change on the resolved order. For example, suppose package a has "Requires: b c d". Previously, the list would be built as a->b->c->d by appending each as they were encountered. Now, the list is built by walking all the way down the dependency chain for each package in a depth first manner and prepending packages while unwinding. This would result in the package ilst being a->d->c->b. This same effect happens with the command line packages where previously requesting packages x and y would create a package list of x->y and now produces a list of y->x. While technically these should be the same since there are no interdependencies, it's causes flags to be output in different order than previously in pkg-config. This can be seen most readily in the check-gtk test. Instead, operate on the package lists backwards when building the resolved package list.
This commit is contained in:
parent
be455b79fe
commit
360a614af8
4 changed files with 25 additions and 31 deletions
|
|
@ -15,8 +15,8 @@ PKG_CONFIG_LIBDIR=${srcdir}/gtk
|
|||
# -I/gtk/include -I/gtk/include/freetype2
|
||||
RESULT="-DGSEAL_ENABLE -pthread -I/gtk/include/gtk-3.0 \
|
||||
-I/gtk/include/pango-1.0 -I/gtk/include/atk-1.0 -I/gtk/include/cairo \
|
||||
-I/gtk/include/gdk-pixbuf-2.0 -I/gtk/include -I/gtk/include/freetype2 \
|
||||
-I/gtk/include/pixman-1 -I/gtk/include/glib-2.0 -I/gtk/lib/glib-2.0/include"
|
||||
-I/gtk/include/pixman-1 -I/gtk/include -I/gtk/include/gdk-pixbuf-2.0 \
|
||||
-I/gtk/include/glib-2.0 -I/gtk/lib/glib-2.0/include -I/gtk/include/freetype2"
|
||||
run_test --cflags gtk+-3.0
|
||||
run_test --cflags --static gtk+-3.0
|
||||
|
||||
|
|
@ -26,9 +26,10 @@ run_test --cflags --static gtk+-3.0
|
|||
# -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lpango-1.0 \
|
||||
# -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt \
|
||||
# -lglib-2.0
|
||||
RESULT="-pthread -L/gtk/lib -lgtk-3 -lpangoft2-1.0 -lfontconfig -lfreetype \
|
||||
-lgio-2.0 -latk-1.0 -lgdk-3 -lcairo-gobject -lgdk_pixbuf-2.0 -lpangocairo-1.0 \
|
||||
-lcairo -lpango-1.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0"
|
||||
RESULT="-pthread -L/gtk/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -latk-1.0 \
|
||||
-lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 \
|
||||
-lpango-1.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lrt -lglib-2.0 \
|
||||
-lfreetype -lfontconfig"
|
||||
if [ "$list_indirect_deps" = no ]; then
|
||||
run_test --libs gtk+-3.0
|
||||
fi
|
||||
|
|
@ -46,11 +47,11 @@ fi
|
|||
# -lpixman-1 -lXrender -lX11 -lpthread -lxcb -lXau -lpng12 -lz -lm \
|
||||
# -lpango-1.0 -lfontconfig -lexpat -lfreetype -lgobject-2.0 -lffi \
|
||||
# -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0 -lrt
|
||||
RESULT="-pthread -L/gtk/lib -lgtk-3 -lpangoft2-1.0 -lgio-2.0 -lresolv \
|
||||
-latk-1.0 -lgdk-3 -lcairo-gobject -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo \
|
||||
-lXrender -lX11 -lpthread -lxcb -lXau -lpng12 -lz -lm -lfontconfig -lexpat \
|
||||
-lfreetype -lpixman-1 -lpango-1.0 -lgmodule-2.0 -ldl -lgobject-2.0 -lffi \
|
||||
-lgthread-2.0 -lglib-2.0 -lrt"
|
||||
RESULT="-pthread -L/gtk/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -latk-1.0 \
|
||||
-lcairo-gobject -lcairo -lpixman-1 -lXrender -lX11 -lpthread -lxcb -lXau \
|
||||
-lgdk_pixbuf-2.0 -lpng12 -lm -lgio-2.0 -lz -lresolv -lpangoft2-1.0 \
|
||||
-lpango-1.0 -lgobject-2.0 -lffi -lgthread-2.0 -lgmodule-2.0 -ldl -lglib-2.0 \
|
||||
-lrt -lfontconfig -lexpat -lfreetype"
|
||||
if [ "$list_indirect_deps" = yes ]; then
|
||||
run_test --libs gtk+-3.0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ set -e
|
|||
|
||||
RESULT="-I/non-l/include -I/non-l-required/include"
|
||||
run_test --cflags non-l-required non-l
|
||||
|
||||
RESULT="-I/non-l/include -I/non-l-required/include"
|
||||
run_test --cflags --static non-l-required non-l
|
||||
|
||||
RESULT="/non-l.a /non-l-required.a -pthread"
|
||||
run_test --libs non-l-required non-l
|
||||
|
||||
RESULT="/non-l.a /non-l-required.a -pthread"
|
||||
run_test --libs --static non-l-required non-l
|
||||
|
|
|
|||
|
|
@ -5,11 +5,8 @@ set -e
|
|||
. ${srcdir}/common
|
||||
|
||||
# expect cflags from requires-test and public-dep
|
||||
RESULT="-I/requires-test/include -I/public-dep/include -I/private-dep/include"
|
||||
RESULT="-I/requires-test/include -I/private-dep/include -I/public-dep/include"
|
||||
run_test --cflags requires-test
|
||||
|
||||
# still expect those cflags for static linking case
|
||||
RESULT="-I/requires-test/include -I/public-dep/include -I/private-dep/include"
|
||||
run_test --static --cflags requires-test
|
||||
|
||||
# expect libs for just requires-test and public-dep
|
||||
|
|
@ -19,7 +16,8 @@ if [ "$list_indirect_deps" = no ]; then
|
|||
fi
|
||||
|
||||
# expect libs for requires-test, public-dep and private-dep in static case
|
||||
RESULT="-L/requires-test/lib -L/public-dep/lib -L/private-dep/lib -lrequires-test -lpublic-dep -lprivate-dep"
|
||||
RESULT="-L/requires-test/lib -L/private-dep/lib -L/public-dep/lib \
|
||||
-lrequires-test -lprivate-dep -lpublic-dep"
|
||||
if [ "$list_indirect_deps" = yes ]; then
|
||||
run_test --libs requires-test
|
||||
fi
|
||||
|
|
|
|||
23
pkg.c
23
pkg.c
|
|
@ -633,7 +633,10 @@ recursive_fill_list (Package *pkg, GetListFunc func, GList **listp)
|
|||
/* record this package in the dependency chain */
|
||||
chain = g_list_prepend (chain, pkg);
|
||||
|
||||
for (tmp = (*func) (pkg); tmp != NULL; tmp = g_list_next (tmp))
|
||||
/* Start from the end of the required package list to maintain order since
|
||||
* the recursive list is built by prepending. */
|
||||
for (tmp = g_list_last ((*func) (pkg)); tmp != NULL;
|
||||
tmp = g_list_previous (tmp))
|
||||
recursive_fill_list (tmp->data, func, listp);
|
||||
|
||||
*listp = g_list_prepend (*listp, pkg);
|
||||
|
|
@ -708,18 +711,14 @@ fill_list (GList *packages, GetListFunc func,
|
|||
GList **listp, gboolean in_path_order, gboolean include_private)
|
||||
{
|
||||
GList *tmp;
|
||||
GList *expanded;
|
||||
GList *expanded = NULL;
|
||||
|
||||
expanded = NULL;
|
||||
tmp = packages;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
recursive_fill_list (tmp->data,
|
||||
include_private ? get_requires_private : get_requires,
|
||||
&expanded);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
/* Start from the end of the requested package list to maintain order since
|
||||
* the recursive list is built by prepending. */
|
||||
for (tmp = g_list_last (packages); tmp != NULL; tmp = g_list_previous (tmp))
|
||||
recursive_fill_list (tmp->data,
|
||||
include_private ? get_requires_private : get_requires,
|
||||
&expanded);
|
||||
|
||||
/* Remove duplicate packages from the recursive list. This should provide a
|
||||
* serialized package list where all interdependencies are resolved
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue