[9980] | 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 | |
---|
[10754] | 12 | %global gopath %{_datadir}/gocode |
---|
| 13 | |
---|
[9980] | 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 nsf |
---|
| 24 | %global repo termbox-go |
---|
| 25 | # https://github.com/nsf/termbox-go |
---|
| 26 | %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} |
---|
| 27 | %global import_path %{provider_prefix} |
---|
| 28 | %global commit 362329b0aa6447eadd52edd8d660ec1dff470295 |
---|
| 29 | %global shortcommit %(c=%{commit}; echo ${c:0:7}) |
---|
| 30 | |
---|
| 31 | Name: golang-%{provider}-%{project}-%{repo} |
---|
| 32 | Version: 0 |
---|
[10754] | 33 | Release: 0.2.git%{shortcommit}%{?dist} |
---|
[9980] | 34 | Summary: a library that provides a minimalistic API which allows the programmer to write text-based user interfaces |
---|
| 35 | License: MIT |
---|
| 36 | URL: https://%{import_path} |
---|
| 37 | Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz |
---|
| 38 | |
---|
| 39 | BuildRequires: golang |
---|
| 40 | |
---|
| 41 | Vendor: Project Vine |
---|
| 42 | Distribution: Vine Linux |
---|
| 43 | Packager: iwaim |
---|
| 44 | |
---|
| 45 | # If go_arches not defined fall through to implicit golang archs |
---|
| 46 | %if 0%{?go_arches:1} |
---|
| 47 | ExclusiveArch: %{go_arches} |
---|
| 48 | %else |
---|
| 49 | ExclusiveArch: %{ix86} x86_64 %{arm} |
---|
| 50 | %endif |
---|
| 51 | |
---|
| 52 | %description |
---|
| 53 | %{summary}. |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | %if 0%{?with_devel} |
---|
| 58 | %package devel |
---|
| 59 | Summary: %{summary} |
---|
| 60 | BuildArch: noarch |
---|
| 61 | |
---|
| 62 | %if 0%{?with_check} |
---|
| 63 | %endif |
---|
| 64 | |
---|
| 65 | Provides: golang(%{import_path}) = %{version}-%{release} |
---|
| 66 | |
---|
| 67 | %description devel |
---|
| 68 | %{summary}. |
---|
| 69 | |
---|
| 70 | This package contains library source intended for |
---|
| 71 | building other packages which use import path with |
---|
| 72 | %{import_path} prefix. |
---|
| 73 | %endif |
---|
| 74 | |
---|
| 75 | %if 0%{?with_unit_test} |
---|
| 76 | %package unit-test |
---|
| 77 | Summary: Unit tests for %{name} package |
---|
| 78 | # If go_arches not defined fall through to implicit golang archs |
---|
| 79 | %if 0%{?go_arches:1} |
---|
| 80 | ExclusiveArch: %{go_arches} |
---|
| 81 | %else |
---|
| 82 | ExclusiveArch: %{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} |
---|
| 86 | BuildRequires: gcc-go >= %{gccgo_min_vers} |
---|
| 87 | %else |
---|
| 88 | BuildRequires: 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 |
---|
| 97 | Requires: %{name}-devel = %{version}-%{release} |
---|
| 98 | |
---|
| 99 | %description unit-test |
---|
| 100 | %{summary}. |
---|
| 101 | |
---|
| 102 | This package contains unit tests for project |
---|
| 103 | providing 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} |
---|
| 114 | install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ |
---|
| 115 | # find all *.go but no *_test.go files and generate unit-test.file-list |
---|
| 116 | for 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 |
---|
| 120 | done |
---|
| 121 | %endif |
---|
| 122 | |
---|
| 123 | # testing files for this project |
---|
| 124 | %if 0%{?with_unit_test} |
---|
| 125 | install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ |
---|
| 126 | # find all *_test.go files and generate unit-test.file-list |
---|
| 127 | for 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 |
---|
| 131 | done |
---|
| 132 | %endif |
---|
| 133 | |
---|
| 134 | %check |
---|
| 135 | %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} |
---|
| 136 | %ifarch 0%{?gccgo_arches} |
---|
| 137 | function gotest { %{gcc_go_test} "$@"; } |
---|
| 138 | %else |
---|
| 139 | %if 0%{?golang_test:1} |
---|
| 140 | function gotest { %{golang_test} "$@"; } |
---|
| 141 | %else |
---|
| 142 | function gotest { go test "$@"; } |
---|
| 143 | %endif |
---|
| 144 | %endif |
---|
| 145 | |
---|
| 146 | export GOPATH=%{buildroot}/%{gopath}:%{gopath} |
---|
| 147 | gotest %{import_path} |
---|
| 148 | %endif |
---|
| 149 | |
---|
| 150 | %if 0%{?with_devel} |
---|
| 151 | %files devel -f devel.file-list |
---|
| 152 | %copying LICENSE |
---|
| 153 | %doc README.md AUTHORS _demos |
---|
| 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 AUTHORS |
---|
| 162 | %endif |
---|
| 163 | |
---|
| 164 | %changelog |
---|
[10754] | 165 | * Tue Jan 26 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 0-0.2.git362329b |
---|
| 166 | - define %%{gopath} |
---|
| 167 | |
---|
[9980] | 168 | * Sun Jan 24 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 0-0.1.git362329b |
---|
| 169 | - initial build for Vine Linux |
---|