Output -L Libs flags before other Libs flags

Outputting other Libs flags such as -Wl,foo just prior to the -l Libs
flags gives a better chance the --libs output will be correct. This
should be no change in the usage of the output since pkg-config
currently groups all flag types together.
This commit is contained in:
Dan Nicholson 2012-11-19 10:41:20 -08:00
parent 28c6468405
commit 05f319d3e5
7 changed files with 26 additions and 26 deletions

View file

@ -8,7 +8,7 @@ RESULT="-DPATH2 -DPATH1 -DFOO -I/path/include"
run_test --cflags flag-dup-1 flag-dup-2
run_test --cflags flag-dup-2 flag-dup-1
RESULT="-Wl,--whole-archive --Wl,--no-whole-archive -R -Xlinker /path/lib \
-L/path/lib -lpath2 -lpath1 -lm"
RESULT="-L/path/lib -Wl,--whole-archive --Wl,--no-whole-archive -R -Xlinker \
/path/lib -lpath2 -lpath1 -lm"
run_test --libs flag-dup-1 flag-dup-2
run_test --libs flag-dup-2 flag-dup-1

View file

@ -26,7 +26,7 @@ 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 -lgdk-3 -lpangocairo-1.0 -latk-1.0 \
RESULT="-L/gtk/lib -pthread -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"
@ -47,7 +47,7 @@ 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 -lgdk-3 -lpangocairo-1.0 -latk-1.0 \
RESULT="-L/gtk/lib -pthread -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 \

View file

@ -18,7 +18,7 @@ run_test --libs --static simple
RESULT=""
run_test --libs fields-blank
RESULT="-Wl,--as-needed -L/other/lib -lother"
RESULT="-L/other/lib -Wl,--as-needed -lother"
run_test --libs other
RESULT="-lother"
@ -39,11 +39,11 @@ RESULT="-Wl,--as-needed -lother"
run_test --libs-only-l --libs-only-other other
run_test --libs-only-other --libs-only-l other
RESULT="-Wl,--as-needed -L/other/lib"
RESULT="-L/other/lib -Wl,--as-needed"
run_test --libs-only-L --libs-only-other other
run_test --libs-only-other --libs-only-L other
RESULT="-Wl,--as-needed -L/other/lib -lother"
RESULT="-L/other/lib -Wl,--as-needed -lother"
run_test --libs-only-l --libs-only-L --libs-only-other other
run_test --libs --libs-only-l --libs-only-L --libs-only-other other
run_test --libs --libs-only-l other

View file

@ -4,7 +4,7 @@ set -e
. ${srcdir}/common
RESULT="-DOTHER -I/other/include -Wl,--as-needed -L/other/lib -lother"
RESULT="-DOTHER -I/other/include -L/other/lib -Wl,--as-needed -lother"
run_test --cflags --libs other
run_test --libs --cflags other
run_test --cflags-only-I --cflags-only-other --libs-only-l --libs-only-L \
@ -50,11 +50,11 @@ RESULT="-DOTHER -Wl,--as-needed -lother"
run_test --cflags-only-other --libs-only-other --libs-only-l other
run_test --libs-only-l --libs-only-other --cflags-only-other other
RESULT="-I/other/include -Wl,--as-needed -L/other/lib"
RESULT="-I/other/include -L/other/lib -Wl,--as-needed"
run_test --cflags-only-I --libs-only-other --libs-only-L other
run_test --libs-only-L --libs-only-other --cflags-only-I other
RESULT="-DOTHER -Wl,--as-needed -L/other/lib"
RESULT="-DOTHER -L/other/lib -Wl,--as-needed"
run_test --cflags-only-other --libs-only-other --libs-only-L other
run_test --libs-only-L --libs-only-other --cflags-only-other other
@ -70,10 +70,10 @@ RESULT="-DOTHER -I/other/include -Wl,--as-needed"
run_test --cflags --libs-only-other other
run_test --cflags-only-I --cflags-only-other --libs-only-other other
RESULT="-I/other/include -Wl,--as-needed -L/other/lib -lother"
RESULT="-I/other/include -L/other/lib -Wl,--as-needed -lother"
run_test --cflags-only-I --libs other
run_test --cflags-only-I --libs-only-l --libs-only-L --libs-only-other other
RESULT="-DOTHER -Wl,--as-needed -L/other/lib -lother"
RESULT="-DOTHER -L/other/lib -Wl,--as-needed -lother"
run_test --cflags-only-other --libs other
run_test --cflags-only-other --libs-only-l --libs-only-L --libs-only-other other

View file

@ -53,7 +53,7 @@ run_test --cflags sort-order-2-1 sort-order-1-1 sort-order-3-1
run_test --cflags sort-order-1-1 sort-order-3-1 sort-order-2-1
run_test --cflags sort-order-1-1 sort-order-2-1 sort-order-3-1
RESULT="-Wl,-O3 -Wl,-O2 -Wl,-O1 -L/path3/lib -L/path2/lib -L/path1/lib \
RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \
-lpath3 -lpath2 -lpath1"
run_test --libs sort-order-3-1
run_test --libs sort-order-3-1 sort-order-2-1
@ -78,7 +78,7 @@ run_test --cflags sort-order-2-2 sort-order-1-2 sort-order-3-2
run_test --cflags sort-order-1-2 sort-order-3-2 sort-order-2-2
run_test --cflags sort-order-1-2 sort-order-2-2 sort-order-3-2
RESULT="-Wl,-O3 -Wl,-O2 -Wl,-O1 -L/path3/lib -L/path2/lib -L/path1/lib \
RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \
-lpath3 -lpath2 -lpath1"
run_test --libs sort-order-3-2
run_test --libs sort-order-3-2 sort-order-2-2
@ -103,7 +103,7 @@ run_test --cflags sort-order-2-3 sort-order-1-3 sort-order-3-3
run_test --cflags sort-order-1-3 sort-order-3-3 sort-order-2-3
run_test --cflags sort-order-1-3 sort-order-2-3 sort-order-3-3
RESULT="-Wl,-O1 -Wl,-O2 -Wl,-O3 -L/path3/lib -L/path2/lib -L/path1/lib \
RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O1 -Wl,-O2 -Wl,-O3 \
-lpath1 -lpath2 -lpath3"
run_test --libs sort-order-1-3
run_test --libs sort-order-1-3 sort-order-2-3
@ -131,7 +131,7 @@ run_test --cflags sort-order-2-1 sort-order-1-1 sort-order-3-1
run_test --cflags sort-order-1-1 sort-order-3-1 sort-order-2-1
run_test --cflags sort-order-1-1 sort-order-2-1 sort-order-3-1
RESULT="-Wl,-O3 -Wl,-O2 -Wl,-O1 -L/path2/lib -L/path3/lib -L/path1/lib \
RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \
-lpath3 -lpath2 -lpath1"
run_test --libs sort-order-3-1
run_test --libs sort-order-3-1 sort-order-2-1
@ -156,7 +156,7 @@ run_test --cflags sort-order-2-2 sort-order-1-2 sort-order-3-2
run_test --cflags sort-order-1-2 sort-order-3-2 sort-order-2-2
run_test --cflags sort-order-1-2 sort-order-2-2 sort-order-3-2
RESULT="-Wl,-O3 -Wl,-O2 -Wl,-O1 -L/path2/lib -L/path3/lib -L/path1/lib \
RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \
-lpath3 -lpath2 -lpath1"
run_test --libs sort-order-3-2
run_test --libs sort-order-3-2 sort-order-2-2
@ -181,7 +181,7 @@ run_test --cflags sort-order-2-3 sort-order-1-3 sort-order-3-3
run_test --cflags sort-order-1-3 sort-order-3-3 sort-order-2-3
run_test --cflags sort-order-1-3 sort-order-2-3 sort-order-3-3
RESULT="-Wl,-O1 -Wl,-O2 -Wl,-O3 -L/path2/lib -L/path3/lib -L/path1/lib \
RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O1 -Wl,-O2 -Wl,-O3 \
-lpath1 -lpath2 -lpath3"
run_test --libs sort-order-1-3
run_test --libs sort-order-1-3 sort-order-2-3

View file

@ -9,5 +9,5 @@ RESULT='-Dlala=misc -I/usr/white\ space/include -I$(top_builddir) -Iinclude\ dir
run_test --cflags whitespace
# expect libs from whitespace
RESULT="-r:foo -L/usr/white\\ space/lib -lfoo\\ bar -lbar\\ baz"
RESULT="-L/usr/white\\ space/lib -r:foo -lfoo\\ bar -lbar\\ baz"
run_test --libs whitespace

14
pkg.c
View file

@ -998,13 +998,6 @@ packages_get_flags (GList *pkgs, FlagType flags)
g_string_append (str, cur);
g_free (cur);
}
if (flags & LIBS_OTHER)
{
cur = get_multi_merged (pkgs, LIBS_OTHER, FALSE, !ignore_private_libs);
debug_spew ("adding LIBS_OTHER string \"%s\"\n", cur);
g_string_append (str, cur);
g_free (cur);
}
if (flags & LIBS_L)
{
cur = get_multi_merged (pkgs, LIBS_L, TRUE, !ignore_private_libs);
@ -1012,6 +1005,13 @@ packages_get_flags (GList *pkgs, FlagType flags)
g_string_append (str, cur);
g_free (cur);
}
if (flags & LIBS_OTHER)
{
cur = get_multi_merged (pkgs, LIBS_OTHER, FALSE, !ignore_private_libs);
debug_spew ("adding LIBS_OTHER string \"%s\"\n", cur);
g_string_append (str, cur);
g_free (cur);
}
if (flags & LIBS_l)
{
cur = get_multi_merged (pkgs, LIBS_l, FALSE, !ignore_private_libs);