golang-github-mattn-go-runewidth-vl.spec 4.1 KB

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