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

Revision 10752, 4.3 KB checked in by iwaim, 8 years ago (diff)

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