From cd53fca4d134b194275a3704ffcac24cf358b62d Mon Sep 17 00:00:00 2001
From: Pete Fritchman <petef@databits.net>
Date: Wed, 19 Oct 2011 11:07:08 -0700
Subject: [PATCH] rpmbuild script & spec file to produce a browserid-server RPM
 (closes #478)

Signed-off-by: Lloyd Hilaiel <lloyd@hilaiel.com>
---
 browserid.spec | 45 +++++++++++++++++++++++++++++++++++++++++++++
 rpmbuild.sh    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)
 create mode 100644 browserid.spec
 create mode 100755 rpmbuild.sh

diff --git a/browserid.spec b/browserid.spec
new file mode 100644
index 000000000..368194a57
--- /dev/null
+++ b/browserid.spec
@@ -0,0 +1,45 @@
+%define _rootdir /opt/browserid
+
+Name:          browserid-server
+Version:       0.2011.10.13
+Release:       1%{?dist}
+Summary:       BrowserID server
+Packager:      Pete Fritchman <petef@mozilla.com>
+Group:         Development/Libraries
+License:       MPL 1.1+/GPL 2.0+/LGPL 2.1+
+URL:           https://github.com/mozilla/browserid
+Source0:       %{name}.tar.gz
+BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
+AutoReqProv:   no
+Requires:      openssl nodejs
+BuildRequires: gcc-c++ git jre make npm openssl-devel
+
+%description
+browserid server & web home for browserid.org
+
+%prep
+%setup -q -n browserid
+
+%build
+npm install
+export PATH=$PWD/node_modules/.bin:$PATH
+(cd browserid && ./compress.sh)
+git log -1 --oneline > browserid/static/ver.txt
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_rootdir}
+for f in browserid libs node_modules verifier *.json *.js; do
+    cp -rp $f %{buildroot}%{_rootdir}/$dir
+done
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{_rootdir}
+
+%changelog
+* Tue Oct 18 2011 Pete Fritchman <petef@mozilla.com>
+- Initial version
diff --git a/rpmbuild.sh b/rpmbuild.sh
new file mode 100755
index 000000000..51cfacbb5
--- /dev/null
+++ b/rpmbuild.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -e
+
+progname=$(basename $0)
+
+cd $(dirname $0)    # top level of the checkout
+
+curdir=$(basename $PWD)
+if [ "$curdir" != "browserid" ]; then  
+    echo "$progname: git checkout must be in a dir named 'browserid'" >&2
+    exit 1
+fi
+
+mkdir -p rpmbuild/SOURCES rpmbuild/SPECS
+rm -rf rpmbuild/RPMS
+
+tar -C .. --exclude rpmbuild -czf \
+    $PWD/rpmbuild/SOURCES/browserid-server.tar.gz browserid
+
+set +e
+
+rpmbuild --define "_topdir $PWD/rpmbuild" -ba browserid.spec
+rc=$?
+if [ $rc -eq 0 ]; then
+    ls -l $PWD/rpmbuild/RPMS/*/*.rpm   
+else
+    echo "$progname: failed to build browserid RPM (rpmbuild rc=$rc)" >&2
+fi
+
+exit $rc
-- 
GitLab