diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2012-11-19 10:43:23 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2012-12-04 13:04:57 -0800 |
commit | 5b6ec1b6e92b9de070a36df11eb123338228a85b (patch) | |
tree | 96e95f098e7f84d5d61df01fac028c1d28edecab | |
parent | 9bf6277b9c4f1980e3449ddc164e748d9b762200 (diff) | |
download | pkg-config-5b6ec1b6e92b9de070a36df11eb123338228a85b.tar.gz |
Output -l and other Libs flags in the order they appear
Often other Libs flags have semantics that are based on their context
with -l arguments. For example, the GNU linker options
-Bdynamic/-Bstatic pertain only to the objects or link options that
follow them. So, a valid link command containing these options would get
mangled by pkg-config since it separates -l flags from others..
-Bdynamic -la -Bstatic -lb -> -Bdynamic -Bstatic -la -lb
Instead, output -l and other Libs flags in a single pass so they mantain
their ordering.
Freedesktop #19950 (https://bugs.freedesktop.org/show_bug.cgi?id=19950)
-rwxr-xr-x | check/check-duplicate-flags | 4 | ||||
-rwxr-xr-x | check/check-gtk | 17 | ||||
-rwxr-xr-x | check/check-sort-order | 24 | ||||
-rwxr-xr-x | check/check-whitespace | 2 | ||||
-rw-r--r-- | pkg.c | 14 |
5 files changed, 27 insertions, 34 deletions
diff --git a/check/check-duplicate-flags b/check/check-duplicate-flags index f6f577d..4e0bcab 100755 --- a/check/check-duplicate-flags +++ b/check/check-duplicate-flags @@ -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="-L/path/lib -Wl,--whole-archive --Wl,--no-whole-archive -R -Xlinker \ -/path/lib -lpath2 -lpath1 -lm" +RESULT="-L/path/lib -lpath2 -lpath1 -Wl,--whole-archive -lm \ +--Wl,--no-whole-archive -R -Xlinker /path/lib" run_test --libs flag-dup-1 flag-dup-2 run_test --libs flag-dup-2 flag-dup-1 diff --git a/check/check-gtk b/check/check-gtk index 1d6a13d..e42892b 100755 --- a/check/check-gtk +++ b/check/check-gtk @@ -26,10 +26,9 @@ 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="-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" +RESULT="-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 -pthread -lrt -lglib-2.0 -lfreetype -lfontconfig" if [ "$list_indirect_deps" = no ]; then run_test --libs gtk+-3.0 fi @@ -47,11 +46,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="-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 \ --lrt -lfontconfig -lexpat -lfreetype" +RESULT="-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 -pthread -ldl -lglib-2.0 -lrt -lfontconfig \ +-lexpat -lfreetype" if [ "$list_indirect_deps" = yes ]; then run_test --libs gtk+-3.0 fi diff --git a/check/check-sort-order b/check/check-sort-order index dfcd1a0..77c0806 100755 --- a/check/check-sort-order +++ b/check/check-sort-order @@ -53,8 +53,8 @@ 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="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \ --lpath3 -lpath2 -lpath1" +RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -lpath3 -Wl,-O2 \ +-lpath2 -Wl,-O1 -lpath1" run_test --libs sort-order-3-1 run_test --libs sort-order-3-1 sort-order-2-1 run_test --libs sort-order-2-1 sort-order-3-1 @@ -78,8 +78,8 @@ 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="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \ --lpath3 -lpath2 -lpath1" +RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O3 -lpath3 -Wl,-O2 \ +-lpath2 -Wl,-O1 -lpath1" run_test --libs sort-order-3-2 run_test --libs sort-order-3-2 sort-order-2-2 run_test --libs sort-order-2-2 sort-order-3-2 @@ -103,8 +103,8 @@ 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="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O1 -Wl,-O2 -Wl,-O3 \ --lpath1 -lpath2 -lpath3" +RESULT="-L/path3/lib -L/path2/lib -L/path1/lib -Wl,-O1 -lpath1 -Wl,-O2 \ +-lpath2 -Wl,-O3 -lpath3" run_test --libs sort-order-1-3 run_test --libs sort-order-1-3 sort-order-2-3 run_test --libs sort-order-2-3 sort-order-1-3 @@ -131,8 +131,8 @@ 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="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \ --lpath3 -lpath2 -lpath1" +RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -lpath3 -Wl,-O2 \ +-lpath2 -Wl,-O1 -lpath1" run_test --libs sort-order-3-1 run_test --libs sort-order-3-1 sort-order-2-1 run_test --libs sort-order-2-1 sort-order-3-1 @@ -156,8 +156,8 @@ 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="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -Wl,-O2 -Wl,-O1 \ --lpath3 -lpath2 -lpath1" +RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O3 -lpath3 -Wl,-O2 \ +-lpath2 -Wl,-O1 -lpath1" run_test --libs sort-order-3-2 run_test --libs sort-order-3-2 sort-order-2-2 run_test --libs sort-order-2-2 sort-order-3-2 @@ -181,8 +181,8 @@ 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="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O1 -Wl,-O2 -Wl,-O3 \ --lpath1 -lpath2 -lpath3" +RESULT="-L/path2/lib -L/path3/lib -L/path1/lib -Wl,-O1 -lpath1 -Wl,-O2 \ +-lpath2 -Wl,-O3 -lpath3" run_test --libs sort-order-1-3 run_test --libs sort-order-1-3 sort-order-2-3 run_test --libs sort-order-2-3 sort-order-1-3 diff --git a/check/check-whitespace b/check/check-whitespace index 1b3d87a..e4388ba 100755 --- a/check/check-whitespace +++ b/check/check-whitespace @@ -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="-L/usr/white\\ space/lib -r:foo -lfoo\\ bar -lbar\\ baz" +RESULT="-L/usr/white\\ space/lib -lfoo\\ bar -lbar\\ baz -r:foo" run_test --libs whitespace @@ -997,17 +997,11 @@ packages_get_flags (GList *pkgs, FlagType flags) g_string_append (str, cur); g_free (cur); } - if (flags & LIBS_OTHER) + if (flags & (LIBS_OTHER | LIBS_l)) { - 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); - debug_spew ("adding LIBS_l string \"%s\"\n", cur); + cur = get_multi_merged (pkgs, flags & (LIBS_OTHER | LIBS_l), FALSE, + !ignore_private_libs); + debug_spew ("adding LIBS_OTHER | LIBS_l string \"%s\"\n", cur); g_string_append (str, cur); g_free (cur); } |