golang.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. # build ids are not currently generated:
  2. # https://code.google.com/p/go/issues/detail?id=5238
  3. #
  4. # also, debuginfo extraction currently fails with
  5. # "Failed to write file: invalid section alignment"
  6. %global debug_package %{nil}
  7. # we are shipping the full contents of src in the data subpackage, which
  8. # contains binary-like things (ELF data for tests, etc)
  9. %global _binaries_in_noarch_packages_terminate_build 0
  10. # Do not check any files in doc or src for requires
  11. %global __requires_exclude_from ^(%{_datadir}|%{_libdir})/%{name}/(doc|src)/.*$
  12. # Don't alter timestamps of especially the .a files (or else go will rebuild later)
  13. # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
  14. %global __strip /bin/true
  15. # rpmbuild magic to keep from having meta dependency on libc.so.6
  16. %define _use_internal_dependency_generator 0
  17. %define __find_requires %{nil}
  18. %global debug_package %{nil}
  19. %global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \
  20. /usr/lib/rpm/brp-compress
  21. Name: golang
  22. Version: 1.2
  23. Release: 4%{?dist}
  24. Summary: The Go Programming Language
  25. License: BSD
  26. URL: http://golang.org/
  27. Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz
  28. # this command moved places
  29. %if 0%{?fedora} >= 21
  30. BuildRequires: /usr/bin/hostname
  31. Patch1: golang-f21-hostname.patch
  32. %else
  33. BuildRequires: /bin/hostname
  34. %endif
  35. BuildRequires: emacs
  36. # xemacs on fedora only
  37. %if 0%{?fedora}
  38. BuildRequires: xemacs xemacs-packages-extra
  39. %endif
  40. # We strip the meta dependency, but go does require glibc.
  41. # This is an odd issue, still looking for a better fix.
  42. Requires: glibc
  43. Patch0: golang-1.2-verbose-build.patch
  44. # https://bugzilla.redhat.com/show_bug.cgi?id=1038683
  45. Patch2: golang-1.2-remove-ECC-p224.patch
  46. # disable flaky test for now
  47. # http://code.google.com/p/go/issues/detail?id=6522
  48. Patch3: ./golang-1.2-skipCpuProfileTest.patch
  49. # Having documentation separate was broken
  50. Obsoletes: %{name}-docs < 1.1-4
  51. # RPM can't handle symlink -> dir with subpackages, so merge back
  52. Obsoletes: %{name}-data < 1.1.1-4
  53. ExclusiveArch: %{ix86} x86_64 %{arm}
  54. Source100: golang-gdbinit
  55. Source101: golang-prelink.conf
  56. %description
  57. %{summary}.
  58. # Restore this package if RPM gets fixed (bug #975909)
  59. #%package data
  60. #Summary: Required architecture-independent files for Go
  61. #Requires: %{name} = %{version}-%{release}
  62. #BuildArch: noarch
  63. #Obsoletes: %{name}-docs < 1.1-4
  64. #
  65. #%description data
  66. #%{summary}.
  67. %package vim
  68. Summary: Vim plugins for Go
  69. # xemacs on fedora only
  70. %if 0%{?fedora}
  71. Requires: vim-filesystem
  72. %endif
  73. BuildArch: noarch
  74. %description vim
  75. %{summary}.
  76. %package -n emacs-%{name}
  77. Summary: Emacs add-on package for Go
  78. Requires: emacs(bin) >= %{_emacs_version}
  79. BuildArch: noarch
  80. %description -n emacs-%{name}
  81. %{summary}.
  82. # xemacs on fedora only
  83. %if 0%{?fedora}
  84. %package -n xemacs-%{name}
  85. Summary: XEmacs add-on package for Go
  86. Requires: xemacs(bin) >= %{_xemacs_version}
  87. Requires: xemacs-packages-extra
  88. BuildArch: noarch
  89. %description -n xemacs-%{name}
  90. %{summary}.
  91. %endif
  92. # Workaround old RPM bug of symlink-replaced-with-dir failure
  93. %pretrans -p <lua>
  94. for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
  95. path = "%{_libdir}/%{name}/" .. d
  96. if posix.stat(path, "type") == "link" then
  97. os.remove(path)
  98. posix.mkdir(path)
  99. end
  100. end
  101. %prep
  102. %setup -q -n go
  103. # increase verbosity of build
  104. %patch0 -p1
  105. # remove the P224 curve
  106. %patch2 -p1
  107. # skip flaky test
  108. %patch3 -p1
  109. # create a [dirty] gcc wrapper to allow us to build with our own flags
  110. # (dirty because it is spoofing 'gcc' since CC value is stored in the go tool)
  111. # TODO: remove this and just set CFLAGS/LDFLAGS once upstream supports it
  112. # https://code.google.com/p/go/issues/detail?id=6882
  113. mkdir -p zz
  114. echo -e "#!/bin/sh\n/usr/bin/gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS \"\$@\"" > ./zz/gcc
  115. chmod +x ./zz/gcc
  116. %build
  117. # set up final install location
  118. export GOROOT_FINAL=%{_libdir}/%{name}
  119. # TODO use the system linker to get the system link flags and build-id
  120. # when https://code.google.com/p/go/issues/detail?id=5221 is solved
  121. #export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS"
  122. # build
  123. cd src
  124. # use our gcc wrapper
  125. PATH="$(pwd -P)/../zz:$PATH" CC="gcc" ./make.bash
  126. cd ..
  127. # compile for emacs and xemacs
  128. cd misc
  129. mv emacs/go-mode-load.el emacs/%{name}-init.el
  130. # xemacs on fedora only
  131. %if 0%{?fedora}
  132. cp -av emacs xemacs
  133. %{_xemacs_bytecompile} xemacs/go-mode.el
  134. %endif
  135. %{_emacs_bytecompile} emacs/go-mode.el
  136. cd ..
  137. %check
  138. export GOROOT=$(pwd -P)
  139. export PATH="$PATH":"$GOROOT"/bin
  140. cd src
  141. # not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables
  142. # https://code.google.com/p/go/issues/detail?id=6883
  143. ./run.bash --no-rebuild
  144. cd ..
  145. %install
  146. rm -rf $RPM_BUILD_ROOT
  147. # create the top level directories
  148. mkdir -p $RPM_BUILD_ROOT%{_bindir}
  149. mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}
  150. # install everything into libdir (until symlink problems are fixed)
  151. # https://code.google.com/p/go/issues/detail?id=5830
  152. cp -av api bin doc favicon.ico include lib pkg robots.txt src \
  153. $RPM_BUILD_ROOT%{_libdir}/%{name}
  154. # remove the unnecessary zoneinfo file (Go will always use the system one first)
  155. rm -rfv $RPM_BUILD_ROOT%{_libdir}/%{name}/lib/time
  156. # remove the doc Makefile
  157. rm -rfv $RPM_BUILD_ROOT%{_libdir}/%{name}/doc/Makefile
  158. # put binaries to bindir
  159. pushd $RPM_BUILD_ROOT%{_bindir}
  160. for z in $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/*
  161. do mv $RPM_BUILD_ROOT%{_libdir}/%{name}/bin/$(basename $z) .
  162. done
  163. popd
  164. # misc/bash
  165. mkdir -p $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions
  166. cp -av misc/bash/go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions
  167. for z in 8l 6l 5l 8g 6g 5g gofmt gccgo
  168. do ln -s go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/$z
  169. done
  170. # misc/emacs
  171. mkdir -p $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
  172. mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir}
  173. cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
  174. cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir}
  175. # xemacs on fedora only
  176. %if 0%{?fedora}
  177. # misc/xemacs
  178. mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name}
  179. mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitestartdir}
  180. cp -av misc/xemacs/go-mode.* $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name}
  181. cp -av misc/xemacs/%{name}-init.el $RPM_BUILD_ROOT%{_xemacs_sitestartdir}
  182. %endif
  183. # misc/vim
  184. mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles
  185. cp -av misc/vim/* $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles
  186. rm $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/readme.txt
  187. # misc/zsh
  188. mkdir -p $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
  189. cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
  190. # gdbinit
  191. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
  192. cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang
  193. # prelink blacklist
  194. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d
  195. cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
  196. %files
  197. %doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION
  198. # go files
  199. %{_libdir}/%{name}
  200. # binary executables
  201. %{_bindir}/go
  202. %{_bindir}/gofmt
  203. # autocomplete
  204. %{_datadir}/bash-completion
  205. %{_datadir}/zsh
  206. # gdbinit (for gdb debugging)
  207. %{_sysconfdir}/gdbinit.d
  208. # prelink blacklist
  209. %{_sysconfdir}/prelink.conf.d
  210. %files vim
  211. %doc AUTHORS CONTRIBUTORS LICENSE PATENTS
  212. %{_datadir}/vim/vimfiles/*
  213. %files -n emacs-%{name}
  214. %doc AUTHORS CONTRIBUTORS LICENSE PATENTS
  215. %{_emacs_sitelispdir}/%{name}
  216. %{_emacs_sitestartdir}/*.el
  217. # xemacs on fedora only
  218. %if 0%{?fedora}
  219. %files -n xemacs-%{name}
  220. %doc AUTHORS CONTRIBUTORS LICENSE PATENTS
  221. %{_xemacs_sitelispdir}/%{name}
  222. %{_xemacs_sitestartdir}/*.el
  223. %endif
  224. %changelog
  225. * Thu Jan 24 2014 Vincent Batts <vbatts@redhat.com> 1.2-4
  226. - skip a flaky test that is sporadically failing on the build server
  227. * Thu Jan 16 2014 Vincent Batts <vbatts@redhat.com> 1.2-3
  228. - remove golang-godoc dependency. cyclic dependency on compiling godoc
  229. * Wed Dec 18 2013 Vincent Batts <vbatts@redhat.com> - 1.2-2
  230. - removing P224 ECC curve
  231. * Mon Dec 2 2013 Vincent Batts <vbatts@fedoraproject.org> - 1.2-1
  232. - Update to upstream 1.2 release
  233. - remove the pax tar patches
  234. * Tue Nov 26 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-8
  235. - fix the rpmspec conditional for rhel and fedora
  236. * Thu Nov 21 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-7
  237. - patch tests for testing on rawhide
  238. - let the same spec work for rhel and fedora
  239. * Wed Nov 20 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-6
  240. - don't symlink /usr/bin out to ../lib..., move the file
  241. - seperate out godoc, to accomodate the go.tools godoc
  242. * Fri Sep 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-5
  243. - Pull upstream patches for BZ#1010271
  244. - Add glibc requirement that got dropped because of meta dep fix
  245. * Fri Aug 30 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-4
  246. - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix)
  247. * Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-3
  248. - Revert incorrect merged changelog
  249. * Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-2
  250. - This was reverted, just a placeholder changelog entry for bad merge
  251. * Tue Aug 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-1
  252. - Update to latest upstream
  253. * Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-7
  254. - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
  255. * Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.1.1-6
  256. - Perl 5.18 rebuild
  257. * Wed Jul 10 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-5
  258. - Blacklist testdata files from prelink
  259. - Again try to fix #973842
  260. * Fri Jul 5 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-4
  261. - Move src to libdir for now (#973842) (upstream issue https://code.google.com/p/go/issues/detail?id=5830)
  262. - Eliminate noarch data package to work around RPM bug (#975909)
  263. - Try to add runtime-gdb.py to the gdb safe-path (#981356)
  264. * Wed Jun 19 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-3
  265. - Use lua for pretrans (http://fedoraproject.org/wiki/Packaging:Guidelines#The_.25pretrans_scriptlet)
  266. * Mon Jun 17 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-2
  267. - Hopefully really fix #973842
  268. - Fix update from pre-1.1.1 (#974840)
  269. * Thu Jun 13 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-1
  270. - Update to 1.1.1
  271. - Fix basically useless package (#973842)
  272. * Sat May 25 2013 Dan Horák <dan[at]danny.cz> - 1.1-3
  273. - set ExclusiveArch
  274. * Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-2
  275. - Fix noarch package discrepancies
  276. * Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-1
  277. - Initial Fedora release.
  278. - Update to 1.1
  279. * Thu May 9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.3.rc3
  280. - Update to rc3
  281. * Thu Apr 11 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.2.beta2
  282. - Update to beta2
  283. * Tue Apr 9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.1.beta1
  284. - Initial packaging.