%define debug_package %{nil}

Name		: caddy
Version		: 2.4.6
Release		: 1%{?dist}
Summary		: Fast, multi-platform web server with automatic HTTPS 
Group		: System/Web
License		: Apache License
URL		: https://caddyserver.com/
BuildRequires	: golang
BuildRequires	: git
Requires	: git


%description


%prep
%setup -T -q -c %{name}-%{version}
export GOPATH=`pwd`
export GO111MODULE=on
mkdir -p go/src/github.com/caddyserver/
cd go/src/github.com/caddyserver/
git clone https://github.com/caddyserver/caddy



%build
export GOPATH=`pwd`/go
export GO111MODULE=on
cd go/src/github.com/caddyserver/caddy/
git checkout tags/v%{version}
export SHORTCOMMIT=$(git rev-parse --short HEAD)
export BUILDDATE=$(date +%Y%m%d)
#go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}" -X 'github.com/gohugoio/hugo/common/hugo.buildDate="$BUILDDATE"' -X 'github.com/gohugoio/hugo/common/hugo.commitHash="$SHORTCOMMIT"'" -o caddyserver
go build -x -v -trimpath -ldflags "-extldflags" -o caddyserver ./cmd/caddy


%install
install -p -D -m 0555 go/src/github.com/caddyserver/caddy/caddyserver %{buildroot}%{_bindir}/caddy


%files
%doc
%{_bindir}/caddy


%changelog
