go-tools-9999.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. EGO_PN="golang.org/x/tools/..."
  5. EGO_SRC="golang.org/x/tools"
  6. if [[ ${PV} = *9999* ]]; then
  7. inherit golang-vcs
  8. else
  9. EGIT_COMMIT="6c9aff3"
  10. ARCHIVE_URI="https://github.com/golang/tools/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
  11. KEYWORDS="~amd64"
  12. inherit golang-vcs-snapshot
  13. fi
  14. inherit golang-build
  15. DESCRIPTION="Go Tools"
  16. HOMEPAGE="https://godoc.org/golang.org/x/tools"
  17. SRC_URI="${ARCHIVE_URI}
  18. http://golang.org/favicon.ico -> go-favicon.ico"
  19. LICENSE="BSD"
  20. SLOT="0/${PVR}"
  21. IUSE=""
  22. DEPEND="dev-go/go-net:="
  23. RDEPEND=""
  24. src_prepare() {
  25. # disable broken tests
  26. sed -e 's:TestWeb(:_\0:' \
  27. -i src/${EGO_SRC}/cmd/godoc/godoc_test.go || die
  28. sed -e 's:TestVet(:_\0:' \
  29. -i src/${EGO_SRC}/cmd/vet/vet_test.go || die
  30. sed -e 's:TestImport(:_\0:' \
  31. -i src/${EGO_SRC}/go/gcimporter/gcimporter_test.go || die
  32. sed -e 's:TestImportStdLib(:_\0:' \
  33. -i src/${EGO_SRC}/go/importer/import_test.go || die
  34. sed -e 's:TestStdlib(:_\0:' \
  35. -i src/${EGO_SRC}/go/loader/stdlib_test.go || die
  36. sed -e 's:TestStdlib(:_\0:' \
  37. -i src/${EGO_SRC}/go/ssa/stdlib_test.go || die
  38. sed -e 's:TestGorootTest(:_\0:' \
  39. -e 's:TestFoo(:_\0:' \
  40. -e 's:TestTestmainPackage(:_\0:' \
  41. -i src/${EGO_SRC}/go/ssa/interp/interp_test.go || die
  42. sed -e 's:TestBar(:_\0:' \
  43. -e 's:TestFoo(:_\0:' \
  44. -i src/${EGO_SRC}/go/ssa/interp/testdata/a_test.go || die
  45. sed -e 's:TestCheck(:_\0:' \
  46. -i src/${EGO_SRC}/go/types/check_test.go || die
  47. sed -e 's:TestStdlib(:_\0:' \
  48. -e 's:TestStdFixed(:_\0:' \
  49. -e 's:TestStdKen(:_\0:' \
  50. -i src/${EGO_SRC}/go/types/stdlib_test.go || die
  51. sed -e 's:TestRepoRootForImportPath(:_\0:' \
  52. -i src/${EGO_SRC}/go/vcs/vcs_test.go || die
  53. sed -e 's:TestStdlib(:_\0:' \
  54. -i src/${EGO_SRC}/refactor/lexical/lexical_test.go || die
  55. # Add favicon to the godoc web interface (bug 551030)
  56. cp "${DISTDIR}"/go-favicon.ico "src/${EGO_SRC}/godoc/static/favicon.ico" ||
  57. die
  58. sed -e 's:"example.html",:\0\n\t"favicon.ico",:' \
  59. -i src/${EGO_SRC}/godoc/static/makestatic.go || die
  60. sed -e 's:<link type="text/css":<link rel="icon" type="image/png" href="/lib/godoc/favicon.ico">\n\0:' \
  61. -i src/${EGO_SRC}/godoc/static/godoc.html || die
  62. }
  63. src_compile() {
  64. # Generate static.go with favicon included
  65. pushd src/golang.org/x/tools/godoc/static >/dev/null || die
  66. go run makestatic.go || die
  67. popd >/dev/null
  68. golang-build_src_compile
  69. }
  70. src_install() {
  71. # Create a writable GOROOT in order to avoid sandbox violations.
  72. cp -sR "$(go env GOROOT)" "${T}/goroot" || die
  73. GOROOT="${T}/goroot" golang-build_src_install
  74. # bug 558818: install binaries in $GOROOT/bin to avoid file collisions
  75. exeinto "$(go env GOROOT)/bin"
  76. doexe bin/* "${T}/goroot/bin/godoc"
  77. dodir /usr/bin
  78. ln "${ED}$(go env GOROOT)/bin/godoc" "${ED}usr/bin/godoc" || die
  79. if has_version '<dev-lang/go-1.5'; then
  80. exeinto "$(go env GOTOOLDIR)"
  81. exeopts -m0755 -p # preserve timestamps for bug 551486
  82. doexe "${T}/goroot/pkg/tool/$(go env GOOS)_$(go env GOARCH)/cover"
  83. doexe "${T}/goroot/pkg/tool/$(go env GOOS)_$(go env GOARCH)/vet"
  84. else
  85. rm "${D}"$(go env GOROOT)/bin/{cover,vet} ||
  86. die "unable to remove cover and vet"
  87. fi
  88. }