summaryrefslogtreecommitdiffstats
path: root/misc/packaging
diff options
context:
space:
mode:
authorMaxim Kalaev <maximk@il.ibm.com>2012-09-14 10:46:01 (GMT)
committerMaxim Kalaev <maximk@il.ibm.com>2012-09-23 12:37:11 (GMT)
commit1cdfae5a8824cbe7cb583599c92e9d385d5501e4 (patch)
tree5a668656a560868fa912fb549c92cf0a71cd1914 /misc/packaging
parente4eef72db86cc321a73da03bd7b7a9b2df83b1af (diff)
downloadNinja-1cdfae5a8824cbe7cb583599c92e9d385d5501e4.zip
Ninja-1cdfae5a8824cbe7cb583599c92e9d385d5501e4.tar.gz
Ninja-1cdfae5a8824cbe7cb583599c92e9d385d5501e4.tar.bz2
packaging: refactored rpm building
Now passing through a valid SRPM, working in a standard way.
Diffstat (limited to 'misc/packaging')
-rw-r--r--misc/packaging/ninja.spec21
-rwxr-xr-xmisc/packaging/rpmbuild.sh29
2 files changed, 43 insertions, 7 deletions
diff --git a/misc/packaging/ninja.spec b/misc/packaging/ninja.spec
index d513c6d..2f009f6 100644
--- a/misc/packaging/ninja.spec
+++ b/misc/packaging/ninja.spec
@@ -5,6 +5,8 @@ Release: %{rel}%{?dist}
Group: Development/Tools
License: Apache 2.0
URL: https://github.com/martine/ninja
+Source0: %{name}-%{version}-%{release}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
%description
Ninja is yet another build system. It takes as input the interdependencies of files (typically source code and output executables) and
@@ -14,20 +16,25 @@ Ninja joins a sea of other build systems. Its distinguishing goal is to be fast.
which has over 30,000 source files and whose other build systems (including one built from custom non-recursive Makefiles) can take ten
seconds to start building after changing one file. Ninja is under a second.
+%prep
+%setup -q -n %{name}-%{version}-%{release}
+
%build
-# Assuming we've bootstrapped already..
-../ninja manual ninja -C ..
+echo Building..
+./bootstrap.py
+./ninja manual
%install
mkdir -p %{buildroot}%{_bindir} %{buildroot}%{_docdir}
-cp -p ../ninja %{buildroot}%{_bindir}/
-git log --oneline --pretty=format:'%h: %s (%an, %cd)' --abbrev-commit --all > GITLOG
+cp -p ninja %{buildroot}%{_bindir}/
%files
%defattr(-, root, root)
-%doc GITLOG ../COPYING ../README ../doc/manual.html
+%doc COPYING README doc/manual.html
%{_bindir}/*
%clean
-mv %{_topdir}/*.rpm ..
-rm -rf %{_topdir}
+rm -rf %{buildroot}
+
+#The changelog is built automatically from Git history
+%changelog
diff --git a/misc/packaging/rpmbuild.sh b/misc/packaging/rpmbuild.sh
new file mode 100755
index 0000000..9b74c65
--- /dev/null
+++ b/misc/packaging/rpmbuild.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+echo Building ninja RPMs..
+GITROOT=$(git rev-parse --show-toplevel)
+cd $GITROOT
+
+VER=1.0
+REL=$(git rev-parse --short HEAD)git
+RPMTOPDIR=$GITROOT/rpm-build
+echo "Ver: $VER, Release: $REL"
+
+# Create tarball
+mkdir -p $RPMTOPDIR/{SOURCES,SPECS}
+git archive --format=tar --prefix=ninja-${VER}-${REL}/ HEAD | gzip -c > $RPMTOPDIR/SOURCES/ninja-${VER}-${REL}.tar.gz
+
+# Convert git log to RPM's ChangeLog format (shown with rpm -qp --changelog <rpm file>)
+sed -e "s/%{ver}/$VER/" -e "s/%{rel}/$REL/" misc/packaging/ninja.spec > $RPMTOPDIR/SPECS/ninja.spec
+git log --format="* %cd %aN%n- (%h) %s%d%n" --date=local | sed -r 's/[0-9]+:[0-9]+:[0-9]+ //' >> $RPMTOPDIR/SPECS/ninja.spec
+
+# Build SRC and binary RPMs
+rpmbuild --quiet \
+ --define "_topdir $RPMTOPDIR" \
+ --define "_rpmdir $PWD" \
+ --define "_srcrpmdir $PWD" \
+ --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
+ -ba $RPMTOPDIR/SPECS/ninja.spec &&
+
+rm -rf $RPMTOPDIR &&
+echo Done