%define debug_package %{nil}

Name		: remark42
Version		: 1.8.1
Release		: 1%{?dist}
Summary		: comment engine
Group		: System/Web
License		: MIT
URL		: https://remark42.com/
#Source0	:
BuildRequires	: golang
BuildRequires	: git
Requires	: git


%description


%prep
%setup -T -q -c %{name}-%{version}
mkdir go
export GOPATH=`pwd`/go
export GO111MODULE=on
mkdir -p go/src/github.com/imputun/
cd go/src/github.com/imputun/
git clone https://github.com/umputun/remark42
cd remark42
git checkout tags/v%{version}


%build
export GOPATH=`pwd`/go
export GO111MODULE=on
cd go/src/github.com/imputun/remark42
git checkout tags/v%{version}
### backend - golang
pushd backend
%ifarch ppc64
export CGO_ENABLED=1
%endif
go build -v -trimpath -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}" -X main.revision="%{version}" -s -w" -o remark42 ./app
popd
### frontend - npm
pushd frontend
npm install
npm run build
popd


%install
mkdir -p %{buildroot}/var/lib/remark42/
install -p -D -m 0555 go/src/github.com/imputun/remark42/backend/remark42 %{buildroot}/var/lib/remark42/remark42
cp -rv go/src/github.com/imputun/remark42/backend/templates/ %{buildroot}/var/lib/remark42/
cp -rv go/src/github.com/imputun/remark42/frontend/public/ %{buildroot}/var/lib/remark42/web/



%files
%doc
/var/lib/remark42/remark42
/var/lib/remark42/templates/
/var/lib/remark42/web/


%changelog
