%global goipath         github.com/cpuguy83/go-md2man

Name:           golang-github-cpuguy83-go-md2man
Version:        1.0.10
Release:        1%{?dist}
Summary:        Process markdown into manpages
License:        MIT
URL:            https://github.com/cpuguy83/go-md2man/
#Source0:        https://github.com/cpuguy83/go-md2man/v%{version}.tar.gz
Provides:       go-md2man = %{version}-%{release}


%description
go-md2man is a golang tool using blackfriday to process markdown into
manpages.


%package devel
Summary:        A golang registry for global request variables
BuildArch:      noarch
%description devel
%{goipath} is a golang tool using blackfriday to process markdown into
manpages.
This package contains library source intended for building other packages
which use %{goipath}.


%prep
%setup -T -q -c %{name}-%{version}
export GOPATH=`pwd`
go get -u -v %{goipath}
cd src/%{goipath}
git checkout tags/v%{version}


%build
export GOPATH=`pwd`
export CGO_ENABLED=1
%gobuild -o bin/go-md2man %{goipath}


%install
# install go-md2man binary
install -d %{buildroot}%{_bindir}
install -p -m 755 bin/go-md2man %{buildroot}%{_bindir}
# generate man page
install -d -p %{buildroot}%{_mandir}/man1
bin/go-md2man -in=src/%{goipath}/go-md2man.1.md -out=go-md2man.1
install -p -m 644 go-md2man.1 %{buildroot}%{_mandir}/man1


%files
%{_bindir}/go-md2man
%{_mandir}/man1/go-md2man.1*

%changelog
