pkg-config-0.25-add-with-sysroot.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [PATCH] Add compiled in default sysroot
  2. Similar to the --with-pc-path option. It works just like the existing
  3. PKG_CONFIG_SYSROOT_DIR environment variable, but compiled in.
  4. The environment variable overrides this default setting if set.
  5. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
  6. ---
  7. Makefile.am | 6 +++++-
  8. configure.in | 6 ++++++
  9. main.c | 9 +++++++--
  10. 3 files changed, 18 insertions(+), 3 deletions(-)
  11. Index: pkg-config-0.25/Makefile.am
  12. ===================================================================
  13. --- pkg-config-0.25.orig/Makefile.am
  14. +++ pkg-config-0.25/Makefile.am
  15. @@ -28,8 +28,12 @@ EXTRA_DIST = $(m4_DATA) $(man_MANS) READ
  16. bin_PROGRAMS = pkg-config
  17. AM_CFLAGS=@WARN_CFLAGS@
  18. +if USE_SYSROOT
  19. +sysroot_includes = -DPKG_CONFIG_SYSROOT="\"$(sysroot)\""
  20. +endif
  21. +
  22. INCLUDES=-DPKG_CONFIG_PC_PATH="\"$(pc_path)\"" $(included_glib_includes) \
  23. - $(popt_includes)
  24. + $(popt_includes) $(sysroot_includes)
  25. pkg_config_SOURCES= \
  26. pkg.h \
  27. Index: pkg-config-0.25/configure.in
  28. ===================================================================
  29. --- pkg-config-0.25.orig/configure.in
  30. +++ pkg-config-0.25/configure.in
  31. @@ -32,6 +32,12 @@ fi
  32. PKG_CONFIG_FIND_PC_PATH
  33. +AC_ARG_WITH(sysroot,
  34. + [ --with-sysroot Use sysroot <dir> by default ],
  35. + [ sysroot="$withval" ])
  36. +
  37. +AC_SUBST([sysroot])
  38. +AM_CONDITIONAL(USE_SYSROOT, test "x$sysroot" != "x")
  39. #
  40. # Code taken from gtk+-2.0's configure.in.
  41. #
  42. Index: pkg-config-0.25/main.c
  43. ===================================================================
  44. --- pkg-config-0.25.orig/main.c
  45. +++ pkg-config-0.25/main.c
  46. @@ -36,10 +36,14 @@
  47. #undef STRICT
  48. #endif
  49. +#ifndef PKG_CONFIG_SYSROOT
  50. +#define PKG_CONFIG_SYSROOT NULL
  51. +#endif
  52. +
  53. static int want_debug_spew = 0;
  54. static int want_verbose_errors = 0;
  55. static int want_stdout_errors = 0;
  56. -char *pcsysrootdir = NULL;
  57. +char *pcsysrootdir = PKG_CONFIG_SYSROOT;
  58. void
  59. debug_spew (const char *format, ...)
  60. @@ -311,7 +315,8 @@ main (int argc, char **argv)
  61. add_search_dirs(PKG_CONFIG_PC_PATH, G_SEARCHPATH_SEPARATOR_S);
  62. }
  63. - pcsysrootdir = getenv ("PKG_CONFIG_SYSROOT_DIR");
  64. + if (getenv ("PKG_CONFIG_SYSROOT_DIR"))
  65. + pcsysrootdir = getenv ("PKG_CONFIG_SYSROOT_DIR");
  66. if (pcsysrootdir)
  67. {
  68. define_global_variable ("pc_sysrootdir", pcsysrootdir);