source: projects/specs/trunk/g/golang-github-mattn-go-runewidth/golang-github-mattn-go-runewidth-vl.spec @ 9979

Revision 9979, 4.1 KB checked in by iwaim, 8 years ago (diff)

golang-github-mattn-go-runewidth 0-0.1.gite882a96

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