golang-github-nsf-termbox-go-vl.spec 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. %global with_devel 1
  2. %global with_bundled 0
  3. %global with_debug 0
  4. %global with_check 1
  5. %if 0%{?with_debug}
  6. %global _dwz_low_mem_die_limit 0
  7. %else
  8. %global debug_package %{nil}
  9. %endif
  10. %global gopath %{_datadir}/gocode
  11. %define copying() \
  12. %if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
  13. %license %{*} \
  14. %else \
  15. %doc %{*} \
  16. %endif
  17. %global provider github
  18. %global provider_tld com
  19. %global project nsf
  20. %global repo termbox-go
  21. # https://github.com/nsf/termbox-go
  22. %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
  23. %global import_path %{provider_prefix}
  24. %global commit 362329b0aa6447eadd52edd8d660ec1dff470295
  25. %global shortcommit %(c=%{commit}; echo ${c:0:7})
  26. Name: golang-%{provider}-%{project}-%{repo}
  27. Version: 0
  28. Release: 0.2.git%{shortcommit}%{?dist}
  29. Summary: a library that provides a minimalistic API which allows the programmer to write text-based user interfaces
  30. License: MIT
  31. URL: https://%{import_path}
  32. Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
  33. BuildRequires: golang
  34. Vendor: Project Vine
  35. Distribution: Vine Linux
  36. Packager: iwaim
  37. # If go_arches not defined fall through to implicit golang archs
  38. %if 0%{?go_arches:1}
  39. ExclusiveArch: %{go_arches}
  40. %else
  41. ExclusiveArch: %{ix86} x86_64 %{arm}
  42. %endif
  43. %description
  44. %{summary}.
  45. %if 0%{?with_devel}
  46. %package devel
  47. Summary: %{summary}
  48. BuildArch: noarch
  49. %if 0%{?with_check}
  50. %endif
  51. Provides: golang(%{import_path}) = %{version}-%{release}
  52. %description devel
  53. %{summary}.
  54. This package contains library source intended for
  55. building other packages which use import path with
  56. %{import_path} prefix.
  57. %endif
  58. %if 0%{?with_unit_test}
  59. %package unit-test
  60. Summary: Unit tests for %{name} package
  61. # If go_arches not defined fall through to implicit golang archs
  62. %if 0%{?go_arches:1}
  63. ExclusiveArch: %{go_arches}
  64. %else
  65. ExclusiveArch: %{ix86} x86_64 %{arm}
  66. %endif
  67. # If gccgo_arches does not fit or is not defined fall through to golang
  68. %ifarch 0%{?gccgo_arches}
  69. BuildRequires: gcc-go >= %{gccgo_min_vers}
  70. %else
  71. BuildRequires: golang
  72. %endif
  73. %if 0%{?with_check}
  74. #Here comes all BuildRequires: PACKAGE the unit tests
  75. #in %%check section need for running
  76. %endif
  77. # test subpackage tests code from devel subpackage
  78. Requires: %{name}-devel = %{version}-%{release}
  79. %description unit-test
  80. %{summary}.
  81. This package contains unit tests for project
  82. providing packages with %{import_path} prefix.
  83. %endif
  84. %prep
  85. %setup -q -n %{repo}-%{commit}
  86. %build
  87. %install
  88. # source codes for building projects
  89. %if 0%{?with_devel}
  90. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  91. # find all *.go but no *_test.go files and generate unit-test.file-list
  92. for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
  93. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  94. cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  95. echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
  96. done
  97. %endif
  98. # testing files for this project
  99. %if 0%{?with_unit_test}
  100. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
  101. # find all *_test.go files and generate unit-test.file-list
  102. for file in $(find . -iname "*_test.go"); do
  103. install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
  104. cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
  105. echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
  106. done
  107. %endif
  108. %check
  109. %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
  110. %ifarch 0%{?gccgo_arches}
  111. function gotest { %{gcc_go_test} "$@"; }
  112. %else
  113. %if 0%{?golang_test:1}
  114. function gotest { %{golang_test} "$@"; }
  115. %else
  116. function gotest { go test "$@"; }
  117. %endif
  118. %endif
  119. export GOPATH=%{buildroot}/%{gopath}:%{gopath}
  120. gotest %{import_path}
  121. %endif
  122. %if 0%{?with_devel}
  123. %files devel -f devel.file-list
  124. %copying LICENSE
  125. %doc README.md AUTHORS _demos
  126. %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
  127. %dir %{gopath}/src/%{import_path}
  128. %endif
  129. %if 0%{?with_unit_test}
  130. %files unit-test -f unit-test.file-list
  131. %copying LICENSE
  132. %doc README.md AUTHORS
  133. %endif
  134. %changelog
  135. * Tue Jan 26 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 0-0.2.git362329b
  136. - define %%{gopath}
  137. * Sun Jan 24 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 0-0.1.git362329b
  138. - initial build for Vine Linux