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

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