From 4759c7e6bc3310f42e13450e1b0257ec231e200e Mon Sep 17 00:00:00 2001 From: Carl George Date: Sep 07 2019 04:01:45 +0000 Subject: Switch to new go macros --- diff --git a/caddy.spec b/caddy.spec index 128ee63..f424f12 100644 --- a/caddy.spec +++ b/caddy.spec @@ -10,36 +10,27 @@ %bcond_without rackspace %bcond_without route53 -%bcond_with debug +# https://github.com/caddyserver/caddy +%global goipath github.com/caddyserver/caddy +Version: 1.0.3 -%if %{with debug} -%global _dwz_low_mem_die_limit 0 -%else -%global debug_package %{nil} -%endif +%gometa -%if %{undefined gobuild} -%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; -%endif +%global golicenses LICENSE.txt +%global godocs dist/README.txt dist/CHANGES.txt Name: caddy -Version: 1.0.3 Release: 1%{?dist} Summary: HTTP/2 web server with automatic HTTPS License: ASL 2.0 URL: https://caddyserver.com -ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm} aarch64 ppc64le s390x %{mips}} - -# caddy -%global import_path github.com/mholt/caddy -Source0: https://%{import_path}/archive/v%{version}/caddy-%{version}.tar.gz -Source1: caddy.conf -Source2: caddy.service -Source3: index.html +Source0: %{gosource} +Source1: caddy.conf +Source2: caddy.service +Source3: index.html # https://github.com/mholt/caddy/commit/80dfb8b2a7f89b120a627bc4d866a1dc5ed3d92f#diff-04c6e90faac2675aa89e2176d2eec7d8 BuildRequires: golang >= 1.12 -%{?go_compiler:BuildRequires: compiler(go-compiler)} BuildRequires: golang(github.com/dustin/go-humanize) BuildRequires: golang(github.com/flynn/go-shlex) BuildRequires: golang(github.com/go-acme/lego/certcrypto) @@ -123,12 +114,7 @@ package is an unofficial build with the following plugins: %prep -%setup -q -c - -cp caddy-%{version}/LICENSE.txt LICENSE.txt -cp caddy-%{version}/dist/README.txt README.txt -mkdir -p $(dirname _build/src/%{import_path}) -mv caddy-%{version} _build/src/%{import_path} +%goprep sed -e '/where other plugins get plugged in/ a \\t// plugins added during rpmbuild' \ %{?with_geoip: -e '/where other plugins get plugged in/ a \\t_ "github.com/aablinov/caddy-geoip"'} \ @@ -140,17 +126,16 @@ sed -e '/where other plugins get plugged in/ a \\t// plugins %{?with_pdns: -e '/where other plugins get plugged in/ a \\t_ "github.com/caddyserver/dnsproviders/pdns"'} \ %{?with_rackspace: -e '/where other plugins get plugged in/ a \\t_ "github.com/caddyserver/dnsproviders/rackspace"'} \ %{?with_route53: -e '/where other plugins get plugged in/ a \\t_ "github.com/caddyserver/dnsproviders/route53"'} \ - -i _build/src/%{import_path}/caddy/caddymain/run.go + -i caddy/caddymain/run.go %build -export GOPATH="$PWD/_build:%{gopath}" -export LDFLAGS="${LDFLAGS:-} -X %{import_path}/caddy/caddymain.appVersion=%{version}" -%gobuild -o _bin/caddy %{import_path}/caddy +export LDFLAGS="${LDFLAGS:-} -X %{goipath}/caddy/caddymain.appVersion=%{version}" +%gobuild -o %{gobuilddir}/bin/caddy %{goipath}/caddy %install -install -D -m 0755 _bin/caddy %{buildroot}%{_bindir}/caddy +install -D -m 0755 %{gobuilddir}/bin/caddy %{buildroot}%{_bindir}/caddy install -D -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/caddy/caddy.conf install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/caddy.service install -D -m 0644 %{S:3} %{buildroot}%{_datadir}/caddy/index.html @@ -218,8 +203,8 @@ fi %files -%license LICENSE.txt -%doc README.txt +%license %{golicenses} +%doc %{godocs} %{_bindir}/caddy %{_datadir}/caddy %{_unitdir}/caddy.service