Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.24 KB | None | 0 0
  1. ## Copyright 1999-2005 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: /etc/portage/bashrc$
  4. # Originally written by Ned Ludd (solar_at_gentoo.org)
  5. # modifications by Ryan McIntosh (thebigslide_at_gmail.com)
  6. # V1.0_rc1
  7. # - /etc/portage/bashrc
  8.  
  9. if [ "$0" = "/usr/lib/portage/bin/ebuild.sh" -o "$0" = "/usr/lib/portage/bin/ebuild-daemon.sh" ]; then
  10.  
  11.  
  12. append-cflags() {
  13. export CFLAGS="${CFLAGS} $*"
  14. return 0
  15. }
  16.  
  17. append-cxxflags() {
  18. export CXXFLAGS="${CXXFLAGS} $*"
  19. return 0
  20. }
  21.  
  22. append-features() {
  23. export FEATURES="${FEATURES} $*"
  24. return 0
  25. }
  26.  
  27. package-cflags() {
  28. # bail if file does not exist or is not readable.
  29. [ -r ${ROOT}/etc/portage/package.cflags ] || return 0
  30.  
  31. while read -a target; do
  32. if [ "${target}" = "${CATEGORY}" ]; then
  33. unset CFLAGS
  34. for i in `/bin/seq 20`; do #linelength
  35. if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then
  36. append-cflags $GLOBALCFLAGS
  37. else
  38. if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then
  39. append-cflags $GLOBALCXXFLAGS
  40. else
  41. append-cflags ${target[$i]}
  42. fi
  43. fi
  44. done
  45. export -n CFLAGS
  46. else
  47. if [ "${target}" = "${CATEGORY}/${PN}" ]; then
  48. unset CFLAGS
  49. for i in `/bin/seq 20`; do #linelength
  50. if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then
  51. append-cflags $GLOBALCFLAGS
  52. else
  53. if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then
  54. append-cflags $GLOBALCXXFLAGS
  55. else
  56. append-cflags ${target[$i]}
  57. fi
  58. fi
  59. done
  60. export -n CFLAGS
  61. fi
  62. fi
  63. done < ${ROOT}/etc/portage/package.cflags
  64. }
  65.  
  66. package-cxxflags() {
  67. # bail if file does not exist or is not readable.
  68. [ -r ${ROOT}/etc/portage/package.cxxflags ] || return 0
  69.  
  70. while read -a target; do
  71. if [ "${target}" = "${CATEGORY}" ]; then
  72. unset CXXFLAGS
  73. for i in `/bin/seq 20`; do #linelength
  74.  
  75. if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then
  76. append-cxxflags $GLOBALCXXFLAGS
  77. else
  78. if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then
  79. append-cxxflags $GLOBALCFLAGS
  80. else
  81. append-cxxflags ${target[$i]}
  82. fi
  83. fi
  84. done
  85. export -n CXXFLAGS
  86. else
  87.  
  88. if [ "${target}" = "${CATEGORY}/${PN}" ]; then
  89. unset CXXFLAGS
  90. for i in `/bin/seq 20`; do #linelength
  91. if [ "${target[$i]}" = "GLOBALCXXFLAGS" ]; then
  92. append-cxxflags $GLOBALCXXFLAGS
  93. else
  94. if [ "${target[$i]}" = "GLOBALCFLAGS" ]; then
  95. append-cxxflags $GLOBALCFLAGS
  96. else
  97. append-cxxflags ${target[$i]}
  98. fi
  99. fi
  100. done
  101. export -n CXXFLAGS
  102. fi
  103. fi
  104. done < $ROOT/etc/portage/package.cxxflags
  105. }
  106.  
  107. package-features() {
  108. # bail if file does not exist or is not readable.
  109. [ -r ${ROOT}/etc/portage/package.features ] || return 0
  110.  
  111. while read -a target; do
  112. if [ "${target}" = "${CATEGORY}" ]; then
  113. unset FEATURES
  114. for i in `/bin/seq 20`; do #linelength
  115. if [ "${target[$i]}" = "GLOBALFEATURES" ]; then
  116. append-features $GLOBALFEATURES
  117. else
  118. append-features ${target[$i]}
  119. fi
  120. done
  121. export -n FEATURES
  122. else
  123.  
  124. if [ "${target}" = "${CATEGORY}/${PN}" ]; then
  125. unset FEATURES
  126. for i in `/bin/seq 20`; do #linelength
  127. if [ "${target[$i]}" = "GLOBALFEATURES" ]; then
  128. append-features $GLOBALFEATURES
  129. else
  130. append-features ${target[$i]}
  131. fi
  132. done
  133. export -n FEATURES
  134. fi
  135. fi
  136. done < $ROOT/etc/portage/package.features
  137. }
  138.  
  139. export GLOBALCFLAGS=$CFLAGS
  140. export GLOBALCXXFLAGS=$CXXFLAGS
  141. export GLOBALFEATURES=$FEATURES
  142.  
  143. package-cflags
  144. package-cxxflags
  145. package-features
  146.  
  147. unset GLOBALCFLAGS
  148. unset GLOBALCXXFLAG
  149. unset GLOBALFEATURES
  150.  
  151. else
  152. echo "This bashrc does not know anything about $0"
  153. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement