diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/bash-completion | 12 | ||||
-rw-r--r-- | misc/ninja-mode.el | 3 | ||||
-rw-r--r-- | misc/ninja.vim | 12 | ||||
-rw-r--r-- | misc/ninja_syntax.py | 16 | ||||
-rwxr-xr-x | misc/ninja_test.py | 6 | ||||
-rw-r--r-- | misc/packaging/ninja.spec | 21 | ||||
-rwxr-xr-x | misc/packaging/rpmbuild.sh | 29 |
7 files changed, 80 insertions, 19 deletions
diff --git a/misc/bash-completion b/misc/bash-completion index ac4d051..b40136e 100644 --- a/misc/bash-completion +++ b/misc/bash-completion @@ -16,9 +16,17 @@ # . path/to/ninja/misc/bash-completion _ninja_target() { - local cur targets + local cur targets dir line targets_command OPTIND cur="${COMP_WORDS[COMP_CWORD]}" - targets=$((ninja -t targets all 2>/dev/null) | awk -F: '{print $1}') + dir="." + line=$(echo ${COMP_LINE} | cut -d" " -f 2-) + while getopts C: opt "${line[@]}"; do + case $opt in + C) dir="$OPTARG" ;; + esac + done; + targets_command="ninja -C ${dir} -t targets all" + targets=$((${targets_command} 2>/dev/null) | awk -F: '{print $1}') COMPREPLY=($(compgen -W "$targets" -- "$cur")) return 0 } diff --git a/misc/ninja-mode.el b/misc/ninja-mode.el index 44fc82b..d939206 100644 --- a/misc/ninja-mode.el +++ b/misc/ninja-mode.el @@ -18,7 +18,8 @@ (setq ninja-keywords (list '("^#.*" . font-lock-comment-face) - (cons (concat "^" (regexp-opt '("rule" "build" "subninja" "include") + (cons (concat "^" (regexp-opt '("rule" "build" "subninja" "include" + "pool" "default") 'words)) font-lock-keyword-face) '("\\([[:alnum:]_]+\\) =" . (1 font-lock-variable-name-face)) diff --git a/misc/ninja.vim b/misc/ninja.vim index 6f0e48d..841902f 100644 --- a/misc/ninja.vim +++ b/misc/ninja.vim @@ -1,8 +1,8 @@ " ninja build file syntax. " Language: ninja build file as described at " http://martine.github.com/ninja/manual.html -" Version: 1.2 -" Last Change: 2012/06/01 +" Version: 1.3 +" Last Change: 2012/12/14 " Maintainer: Nicolas Weber <nicolasweber@gmx.de> " Version 1.2 of this script is in the upstream vim repository and will be " included in the next vim release. If you change this, please send your change @@ -25,6 +25,7 @@ syn match ninjaComment /#.*/ contains=@Spell " lexer.in.cc, ReadToken() and manifest_parser.cc, Parse() syn match ninjaKeyword "^build\>" syn match ninjaKeyword "^rule\>" +syn match ninjaKeyword "^pool\>" syn match ninjaKeyword "^default\>" syn match ninjaKeyword "^include\>" syn match ninjaKeyword "^subninja\>" @@ -35,7 +36,11 @@ syn match ninjaKeyword "^subninja\>" " let assignments. " manifest_parser.cc, ParseRule() syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent -syn keyword ninjaRuleCommand contained command depfile description generator restat +syn keyword ninjaRuleCommand contained command depfile description generator + \ pool restat rspfile rspfile_content + +syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent +syn keyword ninjaPoolCommand contained depth " Strings are parsed as follows: " lexer.in.cc, ReadEvalString() @@ -61,6 +66,7 @@ syn match ninjaOperator "\(=\|:\||\|||\)\ze\s" hi def link ninjaComment Comment hi def link ninjaKeyword Keyword hi def link ninjaRuleCommand Statement +hi def link ninjaPoolCommand Statement hi def link ninjaWrapLineOperator ninjaOperator hi def link ninjaOperator Operator hi def link ninjaSimpleVar ninjaVar diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index 66babbe..ece7eb5 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -32,8 +32,13 @@ class Writer(object): value = ' '.join(filter(None, value)) # Filter out empty strings. self._line('%s = %s' % (key, value), indent) + def pool(self, name, depth): + self._line('pool %s' % name) + self.variable('depth', depth, indent=1) + def rule(self, name, command, description=None, depfile=None, - generator=False, restat=False, rspfile=None, rspfile_content=None): + generator=False, pool=None, restat=False, rspfile=None, + rspfile_content=None): self._line('rule %s' % name) self.variable('command', command, indent=1) if description: @@ -42,6 +47,8 @@ class Writer(object): self.variable('depfile', depfile, indent=1) if generator: self.variable('generator', '1', indent=1) + if pool: + self.variable('pool', pool, indent=1) if restat: self.variable('restat', '1', indent=1) if rspfile: @@ -65,13 +72,12 @@ class Writer(object): all_inputs.append('||') all_inputs.extend(order_only) - self._line('build %s: %s %s' % (' '.join(out_outputs), - rule, - ' '.join(all_inputs))) + self._line('build %s: %s' % (' '.join(out_outputs), + ' '.join([rule] + all_inputs))) if variables: if isinstance(variables, dict): - iterator = variables.iteritems() + iterator = iter(variables.items()) else: iterator = iter(variables) diff --git a/misc/ninja_test.py b/misc/ninja_test.py index b56033e..2aef7ff 100755 --- a/misc/ninja_test.py +++ b/misc/ninja_test.py @@ -15,7 +15,11 @@ # limitations under the License. import unittest -from StringIO import StringIO + +try: + from StringIO import StringIO +except ImportError: + from io import StringIO import ninja_syntax 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 |