]> err.no Git - pkg-config/commitdiff
2009-03-30 Tollef Fog Heen <tfheen@err.no>
authorTollef Fog Heen <tfheen@err.no>
Mon, 30 Mar 2009 18:49:17 +0000 (20:49 +0200)
committerTollef Fog Heen <tfheen@err.no>
Mon, 30 Mar 2009 18:49:17 +0000 (20:49 +0200)
* pkg.[ch], main.c, check/check-missing: Don't recurse Requires at
all unless we need to.  Add check.  Again, thanks to Loïc Minier
for most of the idea and the implementation.

ChangeLog
check/Makefile.am
check/check-missing
check/missing-requires.pc [new file with mode: 0644]
main.c
pkg.c
pkg.h

index 46a6603e95aa9a2ae0890224141b6d2b059d1b1f..cc54d4c92e49f38c537346939edc0e7524b9e3cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-03-30  Tollef Fog Heen  <tfheen@err.no>
 
+       * pkg.[ch], main.c, check/check-missing: Don't recurse Requires at
+       all unless we need to.  Add check.  Again, thanks to Loïc Minier
+       for most of the idea and the implementation.
+
        * pkg.[ch], parse.[ch], main.c, check/Makefile.am,
        check/check-missing, check/missing-requires-private.pc:
        Skip Requires.private unless we need to look at them for cflags.
index 355f1922ff7fb76d449a99334decae3d6ad59757..072851411a5a46a50b863b219713ef7645fee962 100644 (file)
@@ -4,5 +4,6 @@ TESTS = check-cflags check-libs check-define-variable   \
        check-conflicts check-missing
 
 EXTRA_DIST = $(TESTS) common simple.pc requires-test.pc public-dep.pc  \
-       private-dep.pc includedir.pc missing-requires-private.pc
+       private-dep.pc includedir.pc missing-requires-private.pc \
+       missing-requires.pc
 
index bd2650cbe16308e6fc9184c7cdea3a85695f27af..667de6cc4b9b76579f6e8e8d9a15a00bd8cacc60 100755 (executable)
@@ -50,3 +50,29 @@ ARGS="--variable includedir missing-requires-private"
 EXPECT_RETURN=0
 RESULT="/usr/include/somedir"
 run_test
+
+# tests below are on an existing package, but with missing Requires; when
+# pkg-config outputs error, the actual error text isn't checked
+# package exists
+ARGS="missing-requires"
+EXPECT_RETURN=0
+RESULT=""
+run_test
+
+# Libs should fail
+ARGS="--silence-errors --libs missing-requires"
+EXPECT_RETURN=1
+RESULT=""
+run_test
+
+# Cflags should fail
+ARGS="--silence-errors --cflags missing-requires"
+EXPECT_RETURN=1
+RESULT=""
+run_test
+
+# get includedir var
+ARGS="--variable includedir missing-requires"
+EXPECT_RETURN=0
+RESULT="/usr/include/somedir"
+run_test
diff --git a/check/missing-requires.pc b/check/missing-requires.pc
new file mode 100644 (file)
index 0000000..755feb7
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include/somedir
+
+Name: Missing Requires test package
+Description: Dummy pkgconfig test package for testing with a missing Requires
+Version: 1.0.0
+Requires: pkg-non-existent-dep
+Libs: -L/missing-requires/lib -lmissing-requires
+Cflags: -I/missing-requires/include
+foodir: bar
diff --git a/main.c b/main.c
index 568c171efeb901acc8a74332e748fe95f23d5160..640aad1726c1ccf15607a91ee0dfda1f3cd550c1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -391,6 +391,12 @@ main (int argc, char **argv)
       (want_static_lib_list && (want_libs || want_l_libs || want_L_libs)))
     enable_requires_private();
 
+  /* ignore Requires if no Cflags or Libs are requested */
+
+  if (!want_I_cflags && !want_other_cflags && !want_cflags &&
+      !want_libs && !want_l_libs && !want_L_libs)
+    disable_requires();
+
   if (want_my_version)
     {
       printf ("%s\n", VERSION);
diff --git a/pkg.c b/pkg.c
index 236462f2436fb96905a34c14487ff2fb9e2be7e8..1ee179e0511d5f91e22355f72acc6fad85a14945 100644 (file)
--- a/pkg.c
+++ b/pkg.c
@@ -1531,6 +1531,17 @@ disable_private_libs(void)
   ignore_private_libs = TRUE;
 }
 
+void
+enable_requires(void)
+{
+  ignore_requires = FALSE;
+}
+
+void
+disable_requires(void)
+{
+  ignore_requires = TRUE;
+}
 
 void
 enable_requires_private(void)
diff --git a/pkg.h b/pkg.h
index 97ea176963f294e18c2b6e266fa51e3f9124b363..2c552d36e71d84e5ef2f4a753c9da3042696ea33 100644 (file)
--- a/pkg.h
+++ b/pkg.h
@@ -119,6 +119,8 @@ gboolean name_ends_in_uninstalled (const char *str);
 
 void enable_private_libs(void);
 void disable_private_libs(void);
+void enable_requires(void);
+void disable_requires(void);
 void enable_requires_private(void);
 void disable_requires_private(void);