golang-vl.spec 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. # temporalily ignore test failures
  2. %ifarch %{ix86} x86_64
  3. %bcond_without ignore_tests
  4. %else
  5. %bcond_with ignore_tests
  6. %endif
  7. # Define arches for PA and SA
  8. %global golang_arches %{ix86} x86_64
  9. %global go_arches %{golang_arches}
  10. # Where to set GOPATH for builds
  11. %global gopath %{_datadir}/gocode
  12. # build ids are not currently generated:
  13. # https://code.google.com/p/go/issues/detail?id=5238
  14. #
  15. # also, debuginfo extraction currently fails with
  16. # "Failed to write file: invalid section alignment"
  17. %global debug_package %{nil}
  18. # we are shipping the full contents of src in the data subpackage, which
  19. # contains binary-like things (ELF data for tests, etc)
  20. %global _binaries_in_noarch_packages_terminate_build 0
  21. # Do not check any files in doc or src for requires
  22. #global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$
  23. # Don't alter timestamps of especially the .a files (or else go will rebuild later)
  24. # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
  25. %global __strip /bin/true
  26. # rpmbuild magic to keep from having meta dependency on libc.so.6
  27. %global __requires_exclude_from ^.*$
  28. %global __spec_install_post /usr/lib/rpm/check-rpaths \
  29. /usr/lib/rpm/check-buildroot \
  30. /usr/lib/rpm/brp-compress
  31. # Golang build options.
  32. # Buid golang using external/internal(close to cgo disabled) linking.
  33. %global external_linker 1
  34. # Build golang with cgo enabled/disabled(later equals more or less to internal linking).
  35. %global cgo_enabled 1
  36. # Use golang/gcc-go as bootstrap compiler
  37. %global golang_bootstrap 1
  38. # boostrap(with internal linking) using gcc-go fails due to bug in tests(https://github.com/golang/go/issues/12629)
  39. # make check not to fail due to it
  40. # Controls what ever we fail on failed tests
  41. %if %{with ignore_tests}
  42. %global fail_on_tests 0
  43. %else
  44. %global fail_on_tests 1
  45. %endif
  46. # TODO get more support for shared objects
  47. # Build golang shared objects for stdlib
  48. %ifarch x86_64
  49. %global shared 1
  50. %else
  51. %global shared 0
  52. %endif
  53. # Fedora GOROOT
  54. %global goroot /usr/lib/%{name}
  55. %ifarch x86_64
  56. %global gohostarch amd64
  57. %endif
  58. %ifarch %{ix86}
  59. %global gohostarch 386
  60. %endif
  61. %global go_api 1.14
  62. %global go_version 1.14.1
  63. Name: golang
  64. Version: %{go_version}
  65. Release: 1%{?_dist_release}
  66. Summary: The Go Programming Language
  67. Summary(ja): プログラミング言語 Go
  68. Group: Development/Languages
  69. Vendor: Project Vine
  70. Distribution: Vine Linux
  71. # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
  72. License: BSD and Public Domain
  73. URL: http://golang.org/
  74. # pre-processed by source.sh to make Mark.Twain-Tom.Sawyer.txt free again
  75. Source0: https://dl.google.com/go/go%{go_version}.src.tar.gz
  76. # The compiler is written in Go. Needs go(1.4+) compiler for build.
  77. BuildRequires: golang > 1.4
  78. BuildRequires: net-tools
  79. # for tests
  80. BuildRequires: pcre-devel, glibc-static
  81. Provides: go = %{version}-%{release}
  82. Requires: %{name}-bin
  83. Requires: %{name}-src = %{version}-%{release}
  84. # These are the only RHEL/Fedora architectures that we compile this package for
  85. ExclusiveArch: %{golang_arches}
  86. Source100: golang-gdbinit
  87. Source101: golang-prelink.conf
  88. Source102: macros.golang
  89. %description
  90. %{summary}.
  91. %package docs
  92. Summary: Golang compiler docs
  93. Requires: %{name} = %{version}-%{release}
  94. #BuildArch: noarch
  95. Obsoletes: %{name}-docs < 1.1-4
  96. %description docs
  97. %{summary}.
  98. %package misc
  99. Summary: Golang compiler miscellaneous sources
  100. Requires: %{name} = %{version}-%{release}
  101. #BuildArch: noarch
  102. %description misc
  103. %{summary}.
  104. %package tests
  105. Summary: Golang compiler tests for stdlib
  106. Requires: %{name} = %{version}-%{release}
  107. #BuildArch: noarch
  108. %description tests
  109. %{summary}.
  110. %package src
  111. Summary: Golang compiler source tree
  112. #BuildArch: noarch
  113. %description src
  114. %{summary}
  115. %package bin
  116. Summary: Golang core compiler tools
  117. Requires: go = %{version}-%{release}
  118. Requires(post): %{_sbindir}/update-alternatives
  119. Requires(postun): %{_sbindir}/update-alternatives
  120. # We strip the meta dependency, but go does require glibc.
  121. # This is an odd issue, still looking for a better fix.
  122. Requires: glibc
  123. Requires: gcc
  124. %description bin
  125. %{summary}
  126. # Workaround old RPM bug of symlink-replaced-with-dir failure
  127. %pretrans -p <lua>
  128. for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
  129. path = "%{goroot}/" .. d
  130. if posix.stat(path, "type") == "link" then
  131. os.remove(path)
  132. posix.mkdir(path)
  133. end
  134. end
  135. %if %{shared}
  136. %package shared
  137. Summary: Golang shared object libraries
  138. %description shared
  139. %{summary}.
  140. %endif
  141. %prep
  142. %setup -q -n go
  143. %build
  144. # bootstrap compiler GOROOT
  145. %if !%{golang_bootstrap}
  146. export GOROOT_BOOTSTRAP=/
  147. %else
  148. export GOROOT_BOOTSTRAP=%{goroot}
  149. %endif
  150. # set up final install location
  151. export GOROOT_FINAL=%{goroot}
  152. export GOHOSTOS=linux
  153. export GOHOSTARCH=%{gohostarch}
  154. pushd src
  155. # use our gcc options for this build, but store gcc as default for compiler
  156. export CFLAGS="$RPM_OPT_FLAGS"
  157. export LDFLAGS="$RPM_LD_FLAGS"
  158. export CC="gcc"
  159. export CC_FOR_TARGET="gcc"
  160. export GOOS=linux
  161. export GOARCH=%{gohostarch}
  162. %if !%{external_linker}
  163. export GO_LDFLAGS="-linkmode internal"
  164. %endif
  165. %if !%{cgo_enabled}
  166. export CGO_ENABLED=0
  167. %endif
  168. ./make.bash --no-clean
  169. popd
  170. # build shared std lib
  171. %if %{shared}
  172. GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
  173. %endif
  174. %install
  175. rm -rf $RPM_BUILD_ROOT
  176. # create the top level directories
  177. mkdir -p $RPM_BUILD_ROOT%{_bindir}
  178. mkdir -p $RPM_BUILD_ROOT%{goroot}
  179. # install everything into libdir (until symlink problems are fixed)
  180. # https://code.google.com/p/go/issues/detail?id=5830
  181. cp -apv api bin doc favicon.ico lib pkg robots.txt src misc test VERSION \
  182. $RPM_BUILD_ROOT%{goroot}
  183. # bz1099206
  184. find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \;
  185. # and level out all the built archives
  186. touch $RPM_BUILD_ROOT%{goroot}/pkg
  187. find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \;
  188. # generate the spec file ownership of this source tree and packages
  189. cwd=$(pwd)
  190. src_list=$cwd/go-src.list
  191. pkg_list=$cwd/go-pkg.list
  192. shared_list=$cwd/go-shared.list
  193. misc_list=$cwd/go-misc.list
  194. docs_list=$cwd/go-docs.list
  195. tests_list=$cwd/go-tests.list
  196. rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
  197. touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
  198. pushd $RPM_BUILD_ROOT%{goroot}
  199. find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
  200. find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test*.go' \) -printf '%{goroot}/%p\n' >> $src_list
  201. find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
  202. find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -printf '%{goroot}/%p\n' >> $pkg_list
  203. find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
  204. find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
  205. find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
  206. find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
  207. %if %{shared}
  208. find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list
  209. find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
  210. %endif
  211. find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
  212. find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
  213. find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
  214. find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test*.go' \) -printf '%{goroot}/%p\n' >> $tests_list
  215. # this is only the zoneinfo.zip
  216. find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
  217. find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
  218. popd
  219. # remove the doc Makefile
  220. rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
  221. # put binaries to bindir, linked to the arch we're building,
  222. # leave the arch independent pieces in %{goroot}
  223. mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}
  224. ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go
  225. ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt
  226. # ensure these exist and are owned
  227. mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com
  228. mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org
  229. mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p
  230. mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x
  231. # make sure these files exist and point to alternatives
  232. rm -f $RPM_BUILD_ROOT%{_bindir}/go
  233. ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go
  234. rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt
  235. ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
  236. # gdbinit
  237. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
  238. cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb
  239. # prelink blacklist
  240. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d
  241. cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
  242. # rpm macros
  243. mkdir -p %{buildroot}
  244. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
  245. cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang
  246. %check
  247. export GOROOT=$(pwd -P)
  248. export PATH="$GOROOT"/bin:"$PATH"
  249. cd src
  250. export CC="gcc"
  251. export CFLAGS="$RPM_OPT_FLAGS"
  252. export LDFLAGS="$RPM_LD_FLAGS"
  253. %if !%{external_linker}
  254. export GO_LDFLAGS="-linkmode internal"
  255. %endif
  256. %if !%{cgo_enabled} || !%{external_linker}
  257. export CGO_ENABLED=0
  258. %endif
  259. # make sure to not timeout
  260. export GO_TEST_TIMEOUT_SCALE=2
  261. %if %{fail_on_tests}
  262. ./run.bash --no-rebuild -v -v -v -k
  263. %else
  264. ./run.bash --no-rebuild -v -v -v -k || :
  265. %endif
  266. cd ..
  267. %post bin
  268. %{_sbindir}/update-alternatives --install %{_bindir}/go \
  269. go %{goroot}/bin/go 90 \
  270. --slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
  271. %preun bin
  272. if [ $1 = 0 ]; then
  273. %{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
  274. fi
  275. %files
  276. %license LICENSE
  277. %doc AUTHORS CONTRIBUTORS PATENTS
  278. # VERSION has to be present in the GOROOT, for `go install std` to work
  279. %doc %{goroot}/VERSION
  280. %dir %{goroot}/doc
  281. %doc %{goroot}/doc/*
  282. # go files
  283. %dir %{goroot}
  284. %exclude %{goroot}/bin/
  285. %exclude %{goroot}/pkg/
  286. %exclude %{goroot}/src/
  287. %exclude %{goroot}/doc/
  288. %exclude %{goroot}/misc/
  289. %{goroot}/*
  290. # ensure directory ownership, so they are cleaned up if empty
  291. %dir %{gopath}
  292. %dir %{gopath}/src
  293. %dir %{gopath}/src/github.com/
  294. %dir %{gopath}/src/bitbucket.org/
  295. %dir %{gopath}/src/code.google.com/
  296. %dir %{gopath}/src/code.google.com/p/
  297. %dir %{gopath}/src/golang.org
  298. %dir %{gopath}/src/golang.org/x
  299. # gdbinit (for gdb debugging)
  300. %{_sysconfdir}/gdbinit.d
  301. # prelink blacklist
  302. %{_sysconfdir}/prelink.conf.d
  303. %{_sysconfdir}/rpm/macros.golang
  304. %files -f go-src.list src
  305. %files -f go-docs.list docs
  306. %files -f go-misc.list misc
  307. %files -f go-tests.list tests
  308. %files -f go-pkg.list bin
  309. %{_bindir}/go
  310. %{_bindir}/gofmt
  311. %if %{shared}
  312. %files -f go-shared.list shared
  313. %endif
  314. %changelog
  315. * Sat Mar 21 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.14.1-1
  316. - new upstream release.
  317. * Sun Dec 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.13.5-1
  318. - new upstream release.
  319. * Sat Nov 02 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.13.4-1
  320. - new upstream release.
  321. * Tue Jun 26 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 1.10.3-1
  322. - update to 1.10.3
  323. - drop patches (Patch0, 212, 215)
  324. - export 'GO_TEST_TIMEOUT_SCALE=2' in %%check
  325. - add bcond for tests
  326. * Tue Jun 06 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 1.8.3-1
  327. - update to 1.8.3
  328. * Mon Jun 5 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 1.8.1-1
  329. - update to 1.8.1
  330. - remove BuildArch tags
  331. - drop Source1
  332. - drop patches
  333. - remove ECC p224 patch (Patch1)
  334. - X.509 patch (Patch2): upstream merged
  335. - disable TestGdbPython patch (Patch213)
  336. - disable TestCloneNEWUSERAndRemapNoRootDisableSetgroups patch (Patch214)
  337. - drop Patch216: upstream fixed
  338. - update bootstrap binary path patch (Patch212)
  339. * Mon Dec 21 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.2-1
  340. - new upstream release.
  341. * Sun Mar 8 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.2-1
  342. - new upstream release.
  343. * Mon Dec 15 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.2-2
  344. - added Group tag
  345. * Sat Feb 1 2014 IWAI, Masaharu <iwaim.sub@gmail.com> 1.2
  346. - initial build for Vine Linux
  347. - drop emacs and vim package
  348. * Fri Jan 24 2014 Vincent Batts <vbatts@redhat.com> 1.2-4
  349. - skip a flaky test that is sporadically failing on the build server
  350. * Thu Jan 16 2014 Vincent Batts <vbatts@redhat.com> 1.2-3
  351. - remove golang-godoc dependency. cyclic dependency on compiling godoc
  352. * Wed Dec 18 2013 Vincent Batts <vbatts@redhat.com> - 1.2-2
  353. - removing P224 ECC curve
  354. * Mon Dec 2 2013 Vincent Batts <vbatts@fedoraproject.org> - 1.2-1
  355. - Update to upstream 1.2 release
  356. - remove the pax tar patches
  357. * Tue Nov 26 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-8
  358. - fix the rpmspec conditional for rhel and fedora
  359. * Thu Nov 21 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-7
  360. - patch tests for testing on rawhide
  361. - let the same spec work for rhel and fedora
  362. * Wed Nov 20 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-6
  363. - don't symlink /usr/bin out to ../lib..., move the file
  364. - seperate out godoc, to accomodate the go.tools godoc
  365. * Fri Sep 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-5
  366. - Pull upstream patches for BZ#1010271
  367. - Add glibc requirement that got dropped because of meta dep fix
  368. * Fri Aug 30 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-4
  369. - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix)
  370. * Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-3
  371. - Revert incorrect merged changelog
  372. * Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-2
  373. - This was reverted, just a placeholder changelog entry for bad merge
  374. * Tue Aug 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-1
  375. - Update to latest upstream
  376. * Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-7
  377. - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
  378. * Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.1.1-6
  379. - Perl 5.18 rebuild
  380. * Wed Jul 10 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-5
  381. - Blacklist testdata files from prelink
  382. - Again try to fix #973842
  383. * Fri Jul 5 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-4
  384. - Move src to libdir for now (#973842) (upstream issue https://code.google.com/p/go/issues/detail?id=5830)
  385. - Eliminate noarch data package to work around RPM bug (#975909)
  386. - Try to add runtime-gdb.py to the gdb safe-path (#981356)
  387. * Wed Jun 19 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-3
  388. - Use lua for pretrans (http://fedoraproject.org/wiki/Packaging:Guidelines#The_.25pretrans_scriptlet)
  389. * Mon Jun 17 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-2
  390. - Hopefully really fix #973842
  391. - Fix update from pre-1.1.1 (#974840)
  392. * Thu Jun 13 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-1
  393. - Update to 1.1.1
  394. - Fix basically useless package (#973842)
  395. * Sat May 25 2013 Dan Horák <dan[at]danny.cz> - 1.1-3
  396. - set ExclusiveArch
  397. * Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-2
  398. - Fix noarch package discrepancies
  399. * Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-1
  400. - Initial Fedora release.
  401. - Update to 1.1
  402. * Thu May 9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.3.rc3
  403. - Update to rc3
  404. * Thu Apr 11 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.2.beta2
  405. - Update to beta2
  406. * Tue Apr 9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.1.beta1
  407. - Initial packaging.