source: projects/specs/trunk/g/golang-github-lestrrat-go-pdebug/golang-github-lestrrat-go-pdebug-vl.spec @ 11108

Revision 11108, 4.1 KB checked in by iwaim, 7 years ago (diff)

new: golang-github-lestrrat-go-pdebug

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         lestrrat
24%global repo            go-pdebug
25# https://github.com/lestrrat/go-pdebug
26%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
27%global import_path     %{provider_prefix}
28%global commit          2e6eaaa5717f81bda41d27070d3c966f40a1e75f
29%global shortcommit     %(c=%{commit}; echo ${c:0:7})
30
31Name:           golang-%{provider}-%{project}-%{repo}
32Version:        0
33Release:        1.git%{shortcommit}
34Summary:        Utilities for my print debugging fun. YMMV  for Go
35License:        MIT
36URL:            https://%{import_path}
37Source0:        https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
38
39BuildRequires:  golang
40
41Vendor: Project Vine
42Distribution: Vine Linux
43Packager: iwaim
44
45# If go_arches not defined fall through to implicit golang archs
46%if 0%{?go_arches:1}
47ExclusiveArch:  %{go_arches}
48%else
49ExclusiveArch:  %{ix86} x86_64 %{arm}
50%endif
51
52%description
53%{summary}.
54
55
56
57%if 0%{?with_devel}
58%package devel
59Summary:       %{summary}
60BuildArch:     noarch
61
62%if 0%{?with_check}
63%endif
64
65Provides:      golang(%{import_path}) = %{version}-%{release}
66
67%description devel
68%{summary}.
69
70This package contains library source intended for
71building other packages which use import path with
72%{import_path} prefix.
73%endif
74
75%if 0%{?with_unit_test}
76%package unit-test
77Summary:         Unit tests for %{name} package
78# If go_arches not defined fall through to implicit golang archs
79%if 0%{?go_arches:1}
80ExclusiveArch:  %{go_arches}
81%else
82ExclusiveArch:   %{ix86} x86_64 %{arm}
83%endif
84# If gccgo_arches does not fit or is not defined fall through to golang
85%ifarch 0%{?gccgo_arches}
86BuildRequires:   gcc-go >= %{gccgo_min_vers}
87%else
88BuildRequires:   golang
89%endif
90
91%if 0%{?with_check}
92#Here comes all BuildRequires: PACKAGE the unit tests
93#in %%check section need for running
94%endif
95
96# test subpackage tests code from devel subpackage
97Requires:        %{name}-devel = %{version}-%{release}
98
99%description unit-test
100%{summary}.
101
102This package contains unit tests for project
103providing packages with %{import_path} prefix.
104%endif
105
106%prep
107%setup -q -n %{repo}-%{commit}
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
153%doc README.md
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
161%doc README.md
162%endif
163
164%changelog
165* Wed Jun  7 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 0-1.git2e6eaaa5
166- initial build for Vine Linux
167
Note: See TracBrowser for help on using the repository browser.