+++ /dev/null
-unable to pass -X main.buildDate as ldflags if it contains space
-
-likely go link command lacks proper argument passing that it loses spaces
-
-so patch the source directly
-
---- caddy-0.8.3/main.go~ 2016-04-26 18:28:05.000000000 +0300
-+++ caddy-0.8.3/main.go 2016-05-22 14:13:18.927407255 +0300
-@@ -233,7 +233,7 @@
- appVersion = "(untracked dev build)" // inferred at startup
- devBuild = true // inferred at startup
-
-- buildDate string // date -u
-+ buildDate = "(unknown)" // date -u
- gitTag string // git describe --exact-match HEAD 2> /dev/null
- gitNearestTag string // git describe --abbrev=0 --tags HEAD
- gitCommit string // git rev-parse HEAD
Group: Networking/Daemons/HTTP
Source0: https://github.com/mholt/caddy/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 2d08bf70a7ad4255513bf1e0df174e98
-Patch0: build-date.patch
URL: https://caddyserver.com/
BuildRequires: golang >= 1.6
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%prep
%setup -q
-%patch0 -p1
GOPATH=$(pwd)/vendor
install -d $GOPATH/src/github.com/mholt
ln -s ../../../.. $GOPATH/src/github.com/mholt/caddy
-date=$(date -u +"%%a %%b %%d %%H:%%M:%%S %%Z %%Y")
-%{__sed} -i -e "/buildDate/ s/(unknown)/$date/" main.go
-
%build
export GOPATH=$(pwd)/vendor
# command extraced by running "build.bash" from git tree
-LDFLAGS="\
--X main.gitTag=v%{version} \
--X main.gitNearestTag=v%{version} \
--X main.gitCommit= \
--X main.gitShortStat= \
--X main.gitFilesModified= \
-"
+# however only gitTag is relevant for release build
+LDFLAGS="-X main.gitTag=v%{version}"
test -d vendor/src/golang.org || go get ./... || :
%gobuild -o caddy.bin