go-tools-0_pre20160121.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Copyright 1999-2016 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. if [[ ${PV} = *9999* ]]; then
  6. inherit golang-vcs
  7. else
  8. EGIT_COMMIT="f3a63969dd29f8cfa913fdaea22f30c1ed537cb3"
  9. ARCHIVE_URI="https://github.com/golang/tools/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
  10. KEYWORDS="~amd64"
  11. inherit golang-vcs-snapshot
  12. fi
  13. inherit golang-build
  14. DESCRIPTION="Go Tools"
  15. HOMEPAGE="https://godoc.org/golang.org/x/tools"
  16. SRC_URI="${ARCHIVE_URI}
  17. http://golang.org/favicon.ico -> go-favicon.ico"
  18. LICENSE="BSD"
  19. SLOT="0/${PVR}"
  20. IUSE=""
  21. DEPEND="dev-go/go-net:=
  22. >=dev-lang/go-1.5"
  23. RDEPEND="!<dev-lang/go-1.5"
  24. src_prepare() {
  25. local go_src="${EGO_PN%/...}"
  26. # disable broken tests
  27. sed -e 's:TestWeb(:_\0:' \
  28. -e 's:TestWebIndex(:_\0:' \
  29. -i src/${go_src}/cmd/godoc/godoc_test.go || die
  30. sed -e 's:TestVet(:_\0:' \
  31. -e 's:TestDivergentPackagesExamples(:_\0:' \
  32. -e 's:TestIncompleteExamples(:_\0:' \
  33. -i src/${go_src}/cmd/vet/vet_test.go || die
  34. sed -e 's:TestImport(:_\0:' \
  35. -i src/${go_src}/go/gcimporter/gcimporter_test.go || die
  36. sed -e 's:TestImportStdLib(:_\0:' \
  37. -i src/${go_src}/go/gcimporter15/gcimporter_test.go || die
  38. sed -e 's:TestImportStdLib(:_\0:' \
  39. -i src/${go_src}/go/importer/import_test.go || die
  40. sed -e 's:TestStdlib(:_\0:' \
  41. -i src/${go_src}/go/loader/stdlib_test.go || die
  42. sed -e 's:TestStdlib(:_\0:' \
  43. -i src/${go_src}/go/ssa/stdlib_test.go || die
  44. sed -e 's:TestGorootTest(:_\0:' \
  45. -e 's:TestFoo(:_\0:' \
  46. -e 's:TestTestmainPackage(:_\0:' \
  47. -i src/${go_src}/go/ssa/interp/interp_test.go || die
  48. sed -e 's:TestBar(:_\0:' \
  49. -e 's:TestFoo(:_\0:' \
  50. -i src/${go_src}/go/ssa/interp/testdata/a_test.go || die
  51. sed -e 's:TestCheck(:_\0:' \
  52. -i src/${go_src}/go/types/check_test.go || die
  53. sed -e 's:TestStdlib(:_\0:' \
  54. -e 's:TestStdFixed(:_\0:' \
  55. -e 's:TestStdKen(:_\0:' \
  56. -i src/${go_src}/go/types/stdlib_test.go || die
  57. sed -e 's:TestRepoRootForImportPath(:_\0:' \
  58. -i src/${go_src}/go/vcs/vcs_test.go || die
  59. # Add favicon to the godoc web interface (bug 551030)
  60. cp "${DISTDIR}"/go-favicon.ico "src/${go_src}/godoc/static/favicon.ico" ||
  61. die
  62. sed -e 's:"example.html",:\0\n\t"favicon.ico",:' \
  63. -i src/${go_src}/godoc/static/makestatic.go || die
  64. sed -e 's:<link type="text/css":<link rel="icon" type="image/png" href="/lib/godoc/favicon.ico">\n\0:' \
  65. -i src/${go_src}/godoc/static/godoc.html || die
  66. }
  67. src_compile() {
  68. # Generate static.go with favicon included
  69. pushd src/golang.org/x/tools/godoc/static >/dev/null || die
  70. go run makestatic.go || die
  71. popd >/dev/null
  72. golang-build_src_compile
  73. }
  74. src_test() {
  75. # Create a writable GOROOT in order to avoid sandbox violations.
  76. cp -sR "$(go env GOROOT)" "${T}/goroot" || die
  77. mkdir -p "${T}/goroot/test" || die
  78. GOROOT="${T}/goroot" golang-build_src_test
  79. rm -rf "${T}/goroot"
  80. }
  81. src_install() {
  82. # Create a writable GOROOT in order to avoid sandbox violations.
  83. cp -sR "$(go env GOROOT)" "${T}/goroot" || die
  84. cp -sR "$(get_golibdir_gopath)" "${T}/gopath" || die
  85. GOROOT="${T}/goroot" GOPATH="${WORKDIR}/${P}:${T}/gopath" go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
  86. golang_install_pkgs
  87. # bug 558818: install binaries in $GOROOT/bin to avoid file collisions
  88. exeinto "$(go env GOROOT)/bin"
  89. doexe bin/* "${T}/goroot/bin/godoc"
  90. dodir /usr/bin
  91. ln "${ED}$(go env GOROOT)/bin/godoc" "${ED}usr/bin/godoc" || die
  92. rm "${D}"$(go env GOROOT)/bin/{cover,vet} || die
  93. }