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

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