libstdc++-v3-3.3.6-r1.ebuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit eutils flag-o-matic libtool multilib
  4. transform_known_flags() {
  5. declare setting
  6. # and on x86, we just need to filter the 3.4 specific amd64 -marchs
  7. replace-cpu-flags k8 athlon64 opteron x86-64
  8. # gcc 3.3 doesn't support -march=pentium-m
  9. replace-cpu-flags pentium-m pentium3m pentium3
  10. #GCC 3.3 does not understand G3, G4, G5 on ppc
  11. replace-cpu-flags G3 750
  12. replace-cpu-flags G4 7400
  13. replace-cpu-flags G5 7400
  14. }
  15. is_arch_allowed() {
  16. i386_processor_table="i386 i486 i586 pentium pentium-mmx winchip-c6 \
  17. winchip2 c3 i686 pentiumpro pentium2 pentium3 pentium4 prescott \
  18. nocona k6 k6-2 k6-3 athlon athlon-tbird x86-64 athlon-4 athlon-xp \
  19. athlon-mp"
  20. for proc in ${i386_processor_table} ; do
  21. [ "${proc}" == "${1}" ] && return 0
  22. done
  23. mips_processor_table="mips1 mips2 mips3 mips4 mips32 mips64 r3000 r2000 \
  24. r3900 r6000 r4000 vr4100 vr4111 vr4120 vr4300 r4400 r4600 orion \
  25. r4650 r8000 vr5000 vr5400 vr5500 4kc 4kp 5kc 20kc sr71000 sb1"
  26. for proc in ${mips_processor_table} ; do
  27. [ "${proc}" == "${1}" ] && return 0
  28. done
  29. rs6000_processor_table="common power power2 power3 power4 powerpc \
  30. powerpc64 rios rios1 rsc rsc1 rios2 rs64a 401 403 405 505 601 602 \
  31. 603 603e ec603e 604 604e 620 630 740 750 7400 7450 8540 801 821 823 \
  32. 860"
  33. for proc in ${rs6000_processor_table} ; do
  34. [ "${proc}" == "${1}" ] && return 0
  35. done
  36. return 1
  37. }
  38. do_filter_flags() {
  39. declare setting
  40. # In general gcc does not like optimization, and add -O2 where
  41. # it is safe. This is especially true for gcc 3.3 + 3.4
  42. replace-flags -O? -O2
  43. # gcc 3.3 doesn't support -mtune on numerous archs, so xgcc will fail
  44. setting="`get-flag mtune`"
  45. [ ! -z "${setting}" ] && filter-flags -mtune="${setting}"
  46. # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used
  47. # the compiler incorrectly assumes the code you are about to build
  48. # is 32 bit
  49. use ppc64 && setting="`get-flag mcpu`"
  50. [ ! -z "${setting}" ] && filter-flags -mcpu="${setting}"
  51. # only allow the flags that we -know- are supported
  52. transform_known_flags
  53. setting="`get-flag march`"
  54. if [ ! -z "${setting}" ] ; then
  55. is_arch_allowed "${setting}" || filter-flags -march="${setting}"
  56. fi
  57. setting="`get-flag mcpu`"
  58. if [ ! -z "${setting}" ] ; then
  59. is_arch_allowed "${setting}" || filter-flags -mcpu="${setting}"
  60. fi
  61. # xgcc wont understand gcc 3.4 flags...
  62. filter-flags -fno-unit-at-a-time
  63. filter-flags -funit-at-a-time
  64. filter-flags -fweb
  65. filter-flags -fno-web
  66. filter-flags -mno-tls-direct-seg-refs
  67. # xgcc isnt patched with propolice
  68. filter-flags -fstack-protector-all
  69. filter-flags -fno-stack-protector-all
  70. filter-flags -fstack-protector
  71. filter-flags -fno-stack-protector
  72. # xgcc isnt patched with the gcc symbol visibility patch
  73. filter-flags -fvisibility-inlines-hidden
  74. filter-flags -fvisibility=hidden
  75. # Bug #269433 & #290202
  76. filter-flags -fno-strict-overflow
  77. filter-flags -fstrict-overflow
  78. # Bug #442784
  79. filter-flags '-W*'
  80. filter-flags -frecord-gcc-switches
  81. # ...sure, why not?
  82. strip-unsupported-flags
  83. strip-flags
  84. }
  85. PATCH_VER="1.9"
  86. DESCRIPTION="Compatibility package for running binaries linked against a pre gcc 3.4 libstdc++"
  87. HOMEPAGE="https://gcc.gnu.org/libstdc++/"
  88. SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-${PV}.tar.bz2
  89. mirror://gentoo/gcc-${PV}-patches-${PATCH_VER}.tar.bz2"
  90. LICENSE="GPL-2 LGPL-2.1"
  91. SLOT="5"
  92. KEYWORDS="amd64 ~mips ppc -ppc64 sparc x86 ~x86-fbsd"
  93. IUSE="multilib nls"
  94. DEPEND="sys-devel/bison"
  95. RDEPEND=""
  96. S=${WORKDIR}/gcc-${PV}
  97. src_unpack() {
  98. unpack ${A}
  99. cd "${S}"
  100. EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
  101. elibtoolize --portage --shallow
  102. ./contrib/gcc_update --touch
  103. mkdir -p "${WORKDIR}"/build
  104. if use multilib && [[ ${SYMLINK_LIB} == "yes" ]] ; then
  105. # ugh, this shit has to match the way we've hacked gcc else
  106. # the build falls apart #259215
  107. sed -i \
  108. -e 's:\(MULTILIB_OSDIRNAMES = \).*:\1../lib64 ../lib32:' \
  109. "${S}"/gcc/config/i386/t-linux64 \
  110. || die "sed failed!"
  111. fi
  112. }
  113. src_compile() {
  114. cd "${WORKDIR}"/build
  115. do_filter_flags
  116. ECONF_SOURCE=${S} \
  117. econf \
  118. --enable-shared \
  119. --with-system-zlib \
  120. --enable-languages=c++ \
  121. --enable-threads=posix \
  122. --enable-long-long \
  123. --disable-checking \
  124. --enable-cstdio=stdio \
  125. --enable-__cxa_atexit \
  126. $(use_enable multilib) \
  127. $(use_enable nls) \
  128. $(use_with !nls included-gettext)
  129. touch "${S}"/gcc/c-gperf.h
  130. emake all-target-libstdc++-v3 || die
  131. }
  132. src_install() {
  133. emake -j1 \
  134. -C "${WORKDIR}"/build \
  135. DESTDIR="${D}" \
  136. install-target-libstdc++-v3 || die
  137. # scrub everything but the library we care about
  138. pushd "${D}" >/dev/null
  139. mv usr/lib* . || die
  140. rm -rf usr
  141. rm -f lib*/*.{a,la,so} || die
  142. dodir /usr
  143. mv lib* usr/ || die
  144. }