diff options
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | hash.sh | 24 |
2 files changed, 25 insertions, 3 deletions
@@ -1,7 +1,7 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html -CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) LDFLAGS!=echo `pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -pthread $(LDFLAGS) @@ -1,3 +1,25 @@ #!/bin/sh # script to determine git hash of current source tree -FROM_ARCHIVE=$Format:%H$ # set when running git --archive <hash/tag>
\ No newline at end of file + +# set a variable when running `git --archive <hash/tag>` (this is what github does) +# alternatively, you could also git get-tar-commit-id < tarball (but that's a bit dirtier) +FROM_ARCHIVE=$Format:%H$ + +# ... but try to use whatever git tells us if there is a .git folder +if [ -d .git -a -r .git ] +then + hash=$(git log 2>/dev/null | head -n1 2>/dev/null | sed "s/.* //" 2>/dev/null) +fi + +if [ x"$hash" != x ] +then + echo $hash +elif [ "$FROM_ARCHIVE" != ':%H$' ] +then + echo $FROM_ARCHIVE +else + echo "commit hash detection fail. Dear packager, please figure out what goes wrong or get in touch with us" >&2 + echo UNKNOWN + exit 2 +fi +exit 0 |