go-tools-0_pre20150902.ebuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. if [[ ${PV} = *9999* ]]; then
  6. inherit golang-vcs
  7. else
  8. EGIT_COMMIT="1330b28"
  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. -i src/${go_src}/cmd/godoc/godoc_test.go || die
  29. sed -e 's:TestVet(:_\0:' \
  30. -i src/${go_src}/cmd/vet/vet_test.go || die
  31. sed -e 's:TestImport(:_\0:' \
  32. -i src/${go_src}/go/gcimporter/gcimporter_test.go || die
  33. sed -e 's:TestImportStdLib(:_\0:' \
  34. -i src/${go_src}/go/importer/import_test.go || die
  35. sed -e 's:TestStdlib(:_\0:' \
  36. -i src/${go_src}/go/loader/stdlib_test.go || die
  37. sed -e 's:TestStdlib(:_\0:' \
  38. -i src/${go_src}/go/ssa/stdlib_test.go || die
  39. sed -e 's:TestGorootTest(:_\0:' \
  40. -e 's:TestFoo(:_\0:' \
  41. -e 's:TestTestmainPackage(:_\0:' \
  42. -i src/${go_src}/go/ssa/interp/interp_test.go || die
  43. sed -e 's:TestBar(:_\0:' \
  44. -e 's:TestFoo(:_\0:' \
  45. -i src/${go_src}/go/ssa/interp/testdata/a_test.go || die
  46. sed -e 's:TestCheck(:_\0:' \
  47. -i src/${go_src}/go/types/check_test.go || die
  48. sed -e 's:TestStdlib(:_\0:' \
  49. -e 's:TestStdFixed(:_\0:' \
  50. -e 's:TestStdKen(:_\0:' \
  51. -i src/${go_src}/go/types/stdlib_test.go || die
  52. sed -e 's:TestRepoRootForImportPath(:_\0:' \
  53. -i src/${go_src}/go/vcs/vcs_test.go || die
  54. # Add favicon to the godoc web interface (bug 551030)
  55. cp "${DISTDIR}"/go-favicon.ico "src/${go_src}/godoc/static/favicon.ico" ||
  56. die
  57. sed -e 's:"example.html",:\0\n\t"favicon.ico",:' \
  58. -i src/${go_src}/godoc/static/makestatic.go || die
  59. sed -e 's:<link type="text/css":<link rel="icon" type="image/png" href="/lib/godoc/favicon.ico">\n\0:' \
  60. -i src/${go_src}/godoc/static/godoc.html || die
  61. }
  62. src_compile() {
  63. # Generate static.go with favicon included
  64. pushd src/golang.org/x/tools/godoc/static >/dev/null || die
  65. go run makestatic.go || die
  66. popd >/dev/null
  67. golang-build_src_compile
  68. }
  69. src_test() {
  70. # Create a writable GOROOT in order to avoid sandbox violations.
  71. cp -sR "$(go env GOROOT)" "${T}/goroot" || die
  72. mkdir -p "${T}/goroot/test" || die
  73. GOROOT="${T}/goroot" golang-build_src_test
  74. rm -rf "${T}/goroot"
  75. }
  76. src_install() {
  77. # Create a writable GOROOT in order to avoid sandbox violations.
  78. cp -sR "$(go env GOROOT)" "${T}/goroot" || die
  79. GOROOT="${T}/goroot" golang-build_src_install
  80. # bug 558818: install binaries in $GOROOT/bin to avoid file collisions
  81. exeinto "$(go env GOROOT)/bin"
  82. doexe bin/* "${T}/goroot/bin/godoc"
  83. dodir /usr/bin
  84. ln "${ED}$(go env GOROOT)/bin/godoc" "${ED}usr/bin/godoc" || die
  85. rm "${D}"$(go env GOROOT)/bin/{cover,vet} || die
  86. }