From 2427bc5bc76b00cfe790e1f370113f5b4199e8fa Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 18 Sep 2014 16:00:34 +0200 Subject: [PATCH] speedo: Autodetect sha1sum tools. * build-aux/getswdb.sh: Add option --find-sha1sum. * build-aux/speedo.mk (check-tools): New phony target. Not yet used. (SHA1SUM): New var. Use it instead of sha1sum. --- build-aux/getswdb.sh | 20 +++++++++++++++++++- build-aux/speedo.mk | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/build-aux/getswdb.sh b/build-aux/getswdb.sh index aa889ee79..cef6c463a 100755 --- a/build-aux/getswdb.sh +++ b/build-aux/getswdb.sh @@ -32,6 +32,7 @@ Usage: $(basename $0) [OPTIONS] Get the online version of the GnuPG software version database Options: --skip-download Assume download has already been done. + --find-sha1sum Print the name of the sha1sum utility --help Print this help. EOF exit $1 @@ -41,6 +42,7 @@ EOF # Parse options # skip_download=no +find_sha1sum=no while test $# -gt 0; do case "$1" in # Set up `optarg'. @@ -59,6 +61,9 @@ while test $# -gt 0; do --skip-download) skip_download=yes ;; + --find-sha1sum) + find_sha1sum=yes + ;; *) usage 1 1>&2 ;; @@ -66,7 +71,20 @@ while test $# -gt 0; do shift done -# Get GnuPG version from VERSIOn file. For a GIT checkout this means +# Mac OSX has only a shasum and not sha1sum +if [ ${find_sha1sum} = yes ]; then + for i in sha1sum shasum ; do + tmp=$($i /dev/null | cut -d ' ' -f1) + if [ x"$tmp" = x"da39a3ee5e6b4b0d3255bfef95601890afd80709" ]; then + echo "$i" + exit 0 + fi + done + echo "false" + exit 1 +fi + +# Get GnuPG version from VERSION file. For a GIT checkout this means # that ./autogen.sh must have been run first. For a regular tarball # VERSION is always available. if [ ! -f "$srcdir/../VERSION" ]; then diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk index 3c7ce7221..a9ba6d4c7 100644 --- a/build-aux/speedo.mk +++ b/build-aux/speedo.mk @@ -63,40 +63,40 @@ help: SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1 -native: +native: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=0 all -git-native: +git-native: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=git WITH_GUI=0 all -this-native: +this-native: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=this WITH_GUI=0 all -native-gui: +native-gui: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=1 all -git-native-gui: +git-native-gui: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=git WITH_GUI=1 all -this-native-gui: +this-native-gui: check-tools $(SPEEDOMAKE) TARGETOS=native WHAT=this WITH_GUI=1 all -w32-installer: +w32-installer: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=release WITH_GUI=1 installer -git-w32-installer: +git-w32-installer: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=1 installer -this-w32-installer: +this-w32-installer: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=this WITH_GUI=1 installer -w32-source: +w32-source: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=release WITH_GUI=1 dist-source -git-w32-source: +git-w32-source: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=1 dist-source -this-w32-source: +this-w32-source: check-tools $(SPEEDOMAKE) TARGETOS=w32 WHAT=git WITH_GUI=1 dist-source @@ -548,6 +548,12 @@ W32CC = i686-w64-mingw32-gcc MKDIR=mkdir MAKENSIS=makensis +SHA1SUM := $(shell $(topsrc)/build-aux/getswdb.sh --find-sha1sum) +ifeq ($(SHA1SUM),false) +$(error The sha1sum tool is missing) +endif + + BUILD_ISODATE=$(shell date -u +%Y-%m-%d) # The next two macros will work only after gnupg has been build. @@ -583,7 +589,6 @@ endif - # The playground area is our scratch area, where we unpack, build and # install the packages. $(stampdir)/stamp-directories: @@ -723,7 +728,7 @@ $(stampdir)/stamp-$(1)-00-unpack: $(stampdir)/stamp-directories esac; \ if [ -f tmp.tgz ]; then \ if [ -n "$$$${sha1}" ]; then \ - tmp=$$$$(sha1sum