diff --git a/fedora/SPECS/echoip.spec b/fedora/SPECS/echoip.spec new file mode 100644 index 0000000..28c57a0 --- /dev/null +++ b/fedora/SPECS/echoip.spec @@ -0,0 +1,61 @@ +# You can get the latest commit using this commands: +# git pull +# git log --oneline | head -n 1 | awk '{print $1}' +%define gitv 58fd8a6 +%define webd %{_var}/www +Name: echoip +Version: 1.0 +Release: 1.%{gitv}%{?dist} +Summary: A simple service for looking up your IP address. + + +Group: Applications/System +License: BSD 3-Clause license +URL: https://github.com/mpolden/%{name} +Source0: %name-%{version}.%{gitv}.tgz + +BuildRequires: golang +BuildRequires: go-compilers-golang-compiler +BuildRequires: go-srpm-macros +Requires: httpd >=2.4.0 +Requires: httpd-filesystem + +%description +A simple service for looking up your IP address. This is the code that powers https://ifconfig.co. + + +%prep +%setup -q -n %{name}-%{version}.%{gitv} + +%build +# save system PATH environment: +SAVEPATH=$PATH +# prepare go environment: +export GOPATH=$(pwd)/go +export GOPATH=$(go env GOPATH) +export PATH=$PATH:$(go env GOPATH)/bin +# build go project: +go get ./... +# bash -c "diff --line-format='%L' <(echo -n) <(gofmt -d -s .)" +# test fails with exit code 1! +# go test ./... +go install ./... +# restore system PATH environment: +export PATH=$SAVEPATH + +%install +%__install -d go/bin/echoip %{buildroot}%{_bindir}%{name} +%__install -d /go/src/github.com/mpolden/echoip/index.html %{buildroot}%{_webd}%{name}/index.html + + +%files +%defattr(-,root,root,-) +%doc README.md +%license LICENSE +%{_bindir}%{name} +%{_webd}%{name}/index.html + + +%changelog +* Sat Jan 19 2019 Daniel Steiner +- First build for Fedora 29 using git master commit 58fd8a6.