000-relocatable.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. From ca10caa502f971f90d8c041aa2476de54ef0ce2b Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <cotequeiroz@gmail.com>
  3. Date: Tue, 20 Jul 2021 16:41:11 -0300
  4. Subject: librecmc: make relocatable, search resources relative to STAGING_DIR
  5. This was originally commited to librecmc by Jo-Philipp Wich
  6. <jow@openwrt.org>.
  7. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
  8. --- a/libtoolize.in
  9. +++ b/libtoolize.in
  10. @@ -38,14 +38,23 @@
  11. # with bootstrap, so set those here where they can still be over-
  12. # ridden by the user, but otherwise take precedence.
  13. -: ${AUTOCONF="autoconf"}
  14. -: ${AUTOMAKE="automake"}
  15. -: ${EGREP="@EGREP@"}
  16. -: ${FGREP="@FGREP@"}
  17. -: ${GREP="@GREP@"}
  18. : ${LN_S="@LN_S@"}
  19. -: ${SED="@SED@"}
  20. +if test -n "$STAGING_DIR_HOST"; then
  21. + : ${AUTOCONF="$STAGING_DIR_HOST/bin/autoconf"}
  22. + : ${AUTOMAKE="$STAGING_DIR_HOST/bin/automake"}
  23. + : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"}
  24. + : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"}
  25. + : ${GREP="$STAGING_DIR_HOST/bin/grep"}
  26. + : ${SED="$STAGING_DIR_HOST/bin/sed"}
  27. +else
  28. + : ${AUTOCONF="autoconf"}
  29. + : ${AUTOMAKE="automake"}
  30. + : ${EGREP="@EGREP@"}
  31. + : ${FGREP="@FGREP@"}
  32. + : ${GREP="@GREP@"}
  33. + : ${SED="@SED@"}
  34. +fi
  35. ## -------------------------- ##
  36. ## Source external libraries. ##
  37. @@ -1903,11 +1912,21 @@ func_require_seen_libtool ()
  38. pkgmacro_files="@pkgmacro_files@"
  39. # Locations for important files:
  40. - prefix="@prefix@"
  41. - datadir="@datadir@"
  42. - pkgauxdir="@pkgauxdir@"
  43. - pkgltdldir="@pkgdatadir@"
  44. - aclocaldir="@aclocaldir@"
  45. + if test -n "$STAGING_DIR_HOST"; then
  46. + prefix="$STAGING_DIR_HOST"
  47. + datadir="$STAGING_DIR_HOST/share"
  48. + pkgauxdir="$STAGING_DIR_HOST/share/libtool/build-aux"
  49. + pkgdatadir="$STAGING_DIR_HOST/share/libtool"
  50. + pkgltdldir="$STAGING_DIR_HOST/share/libtool"
  51. + aclocaldir="$STAGING_DIR_HOST/share/aclocal"
  52. + else
  53. + prefix="@prefix@"
  54. + datadir="@datadir@"
  55. + pkgauxdir="@pkgauxdir@"
  56. + pkgdatadir="@pkgdatadir@"
  57. + pkgltdldir="@pkgdatadir@"
  58. + aclocaldir="@aclocaldir@"
  59. + fi
  60. # Allow the user to override the master libtoolize repository:
  61. if test -n "$_lt_pkgdatadir"; then
  62. --- a/m4/libtool.m4
  63. +++ b/m4/libtool.m4
  64. @@ -933,7 +933,7 @@ m4_defun([_LT_TAG_COMPILER],
  65. [AC_REQUIRE([AC_PROG_CC])dnl
  66. _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
  67. -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
  68. +_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/include"], [LTCC compiler flags])dnl
  69. _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
  70. _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
  71. @@ -8183,9 +8183,9 @@ m4_defun([_LT_DECL_EGREP],
  72. [AC_REQUIRE([AC_PROG_EGREP])dnl
  73. AC_REQUIRE([AC_PROG_FGREP])dnl
  74. test -z "$GREP" && GREP=grep
  75. -_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
  76. -_LT_DECL([], [EGREP], [1], [An ERE matcher])
  77. -_LT_DECL([], [FGREP], [1], [A literal string matcher])
  78. +_LT_DECL([], [GREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep"], [A grep program that handles long lines])
  79. +_LT_DECL([], [EGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -E"], [An ERE matcher])
  80. +_LT_DECL([], [FGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -F"], [A literal string matcher])
  81. dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
  82. AC_SUBST([GREP])
  83. ])
  84. @@ -8226,9 +8226,8 @@ _LT_DECL([], [FILECMD], [1], [A file(cmd
  85. # as few characters as possible. Prefer GNU sed if found.
  86. m4_defun([_LT_DECL_SED],
  87. [AC_PROG_SED
  88. -test -z "$SED" && SED=sed
  89. Xsed="$SED -e 1s/^X//"
  90. -_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
  91. +_LT_DECL([], [SED], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/sed"], [A sed program that does not truncate output])
  92. _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
  93. [Sed that helps us avoid accidentally triggering echo(1) options like -n])
  94. ])# _LT_DECL_SED