speedo: Autodetect sha1sum tools.
authorWerner Koch <wk@gnupg.org>
Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)
committerWerner Koch <wk@gnupg.org>
Mon, 22 Sep 2014 11:51:35 +0000 (13:51 +0200)
* 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
build-aux/speedo.mk

index aa889ee..cef6c46 100755 (executable)
@@ -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.
 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
     --help           Print this help.
 EOF
     exit $1
@@ -41,6 +42,7 @@ EOF
 # Parse options
 #
 skip_download=no
 # Parse options
 #
 skip_download=no
+find_sha1sum=no
 while test $# -gt 0; do
     case "$1" in
        # Set up `optarg'.
 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
             ;;
         --skip-download)
             skip_download=yes
             ;;
+        --find-sha1sum)
+            find_sha1sum=yes
+            ;;
        *)
            usage 1 1>&2
            ;;
        *)
            usage 1 1>&2
            ;;
@@ -66,7 +71,20 @@ while test $# -gt 0; do
     shift
 done
 
     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 2>/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
 # that ./autogen.sh must have been run first.  For a regular tarball
 # VERSION is always available.
 if [ ! -f "$srcdir/../VERSION" ]; then
index 3c7ce72..a9ba6d4 100644 (file)
@@ -63,40 +63,40 @@ help:
 
 SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1
 
 
 SPEEDOMAKE := $(MAKE) -f $(SPEEDO_MK) UPD_SWDB=1
 
-native:
+native: check-tools
        $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=0 all
 
        $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=0 all
 
-git-native:
+git-native: check-tools
        $(SPEEDOMAKE) TARGETOS=native WHAT=git     WITH_GUI=0 all
 
        $(SPEEDOMAKE) TARGETOS=native WHAT=git     WITH_GUI=0 all
 
-this-native:
+this-native: check-tools
        $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=0 all
 
        $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=0 all
 
-native-gui:
+native-gui: check-tools
        $(SPEEDOMAKE) TARGETOS=native WHAT=release WITH_GUI=1 all
 
        $(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
 
        $(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
 
        $(SPEEDOMAKE) TARGETOS=native WHAT=this    WITH_GUI=1 all
 
-w32-installer:
+w32-installer: check-tools
        $(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=1 installer
 
        $(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
 
        $(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
 
        $(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
 
        $(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
 
        $(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
 
 
        $(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=1 dist-source
 
 
@@ -548,6 +548,12 @@ W32CC = i686-w64-mingw32-gcc
 
 MKDIR=mkdir
 MAKENSIS=makensis
 
 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.
 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:
 # 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               \
           esac;                                        \
           if [ -f tmp.tgz ]; then                      \
             if [ -n "$$$${sha1}" ]; then               \
-               tmp=$$$$(sha1sum <tmp.tgz|cut -d' ' -f1);\
+               tmp=$$$$($(SHA1SUM) <tmp.tgz|cut -d' ' -f1);\
                if [ "$$$${tmp}" != "$$$${sha1}" ]; then \
                 echo "speedo:";                        \
                  echo "speedo: ERROR: checksum mismatch for $(1)";\
                if [ "$$$${tmp}" != "$$$${sha1}" ]; then \
                 echo "speedo:";                        \
                  echo "speedo: ERROR: checksum mismatch for $(1)";\
@@ -1015,7 +1020,13 @@ installer: all w32_insthelpers $(w32src)/inst-options.ini $(bdir)/README.txt
        @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)"
 
 #
        @echo "Ready: $(idir)/$(INST_NAME)-$(INST_VERSION)"
 
 #
+# Check availibility of standard tools
+#
+check-tools:
+
+
+#
 # Mark phony targets
 #
 .PHONY: all all-speedo report-speedo clean-stamps clean-speedo installer \
 # Mark phony targets
 #
 .PHONY: all all-speedo report-speedo clean-stamps clean-speedo installer \
-       w32_insthelpers
+       w32_insthelpers check-tools