source: projects/specs/trunk/g/golang-github-google-btree/golang-github-google-btree-vl.spec @ 10751

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

golang-github-google-btree 0-0.3.gitcc6329d

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