Skip to content
This repository
Browse code

Added OPENSCAD_COMMIT define to show which git commit a binary actual…

…ly is built from in the about box. Pass -c to release_common.sh to turn this on. Please use this for development builds, see publish-macosx.sh for how development vs. release is handled
  • Loading branch information...
commit 2217eff627443bcedb14441c9ae58fb62a4b52d5 1 parent 0e9274a
Marius Kintel authored January 14, 2012
9  scripts/publish-macosx.sh
... ...
@@ -1,15 +1,20 @@
1 1
 #!/bin/sh
2 2
 
3  
-VERSION=`date "+%Y.%m.%d"`
  3
+# Set this if we're doing a release build. Comment it out for development builds
4 4
 #VERSION=2011.12
5 5
 
  6
+if test -z "$VERSION"; then
  7
+  VERSION=`date "+%Y.%m.%d"`
  8
+  COMMIT=-c
  9
+fi
  10
+
6 11
 # Turn off ccache, just for safety
7 12
 PATH=${PATH//\/opt\/local\/libexec\/ccache:}
8 13
 
9 14
 # This is the same location as DEPLOYDIR in macosx-build-dependencies.sh
10 15
 export OPENSCAD_LIBRARIES=$PWD/../libraries/install
11 16
 
12  
-`dirname $0`/release-common.sh -v $VERSION
  17
+`dirname $0`/release-common.sh -v $VERSION $COMMIT
13 18
 if [[ $? != 0 ]]; then
14 19
   exit 1
15 20
 fi
14  scripts/release-common.sh
@@ -7,16 +7,19 @@
7 7
 # The script will create a file called openscad-<versionstring>.zip
8 8
 # in the current directory.
9 9
 # 
10  
-# Usage: release-common.sh [-v <versionstring>]
  10
+# Usage: release-common.sh [-v <versionstring>] [-c]
11 11
 #  -v   Version string (e.g. -v 2010.01)
  12
+#  -c   Build with commit info
12 13
 #
13 14
 # If no version string is given, todays date will be used (YYYY-MM-DD)
14 15
 # If no make target is given, release will be used on Windows, none one Mac OS X
15 16
 #
  17
+# The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT
  18
+# to identify a build in the about box.
16 19
 
17 20
 printUsage()
18 21
 {
19  
-  echo "Usage: $0 -v <versionstring>
  22
+  echo "Usage: $0 -v <versionstring> -c
20 23
   echo
21 24
   echo "  Example: $0 -v 2010.01
22 25
 }
@@ -29,10 +32,11 @@ fi
29 32
 
30 33
 echo "Detected OS: $OS"
31 34
 
32  
-while getopts 'v:' c
  35
+while getopts 'v:c' c
33 36
 do
34 37
   case $c in
35 38
     v) VERSION=$OPTARG;;
  39
+    c) OPENSCAD_COMMIT=`git log -1 --pretty=format:"%h"`
36 40
   esac
37 41
 done
38 42
 
@@ -66,10 +70,10 @@ esac
66 70
 
67 71
 case $OS in
68 72
     LINXWIN)
69  
-        i686-pc-mingw32-qmake VERSION=$VERSION CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug openscad.pro
  73
+        i686-pc-mingw32-qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug openscad.pro
70 74
     ;;
71 75
     *)
72  
-        qmake VERSION=$VERSION CONFIG+=$CONFIG CONFIG-=debug openscad.pro
  76
+        qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG-=debug openscad.pro
73 77
     ;;
74 78
 esac
75 79
 
6  src/mainwin.cc
@@ -101,7 +101,11 @@ unsigned int GuiLocker::gui_locked = 0;
101 101
 #define QUOTED(x__) QUOTE(x__)
102 102
 
103 103
 static char helptitle[] =
104  
-	"OpenSCAD " QUOTED(OPENSCAD_VERSION) " (www.openscad.org)\n\n";
  104
+	"OpenSCAD " QUOTED(OPENSCAD_VERSION)
  105
+#ifdef OPENSCAD_COMMIT
  106
+	" (git " QUOTED(OPENSCAD_COMMIT) ")"
  107
+#endif
  108
+	"\nhttp://www.openscad.org\n\n";
105 109
 static char copyrighttext[] =
106 110
 	"Copyright (C) 2009-2011 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>\n"
107 111
 	"\n"
4  version.pri
@@ -66,3 +66,7 @@ VERSION_DAY=$${VERSION_DAY}.0
66 66
 
67 67
 DEFINES += OPENSCAD_VERSION=$$VERSION OPENSCAD_YEAR=$$VERSION_YEAR OPENSCAD_MONTH=$$VERSION_MONTH
68 68
 !isEmpty(VERSION_DAY): DEFINES += OPENSCAD_DAY=$$VERSION_DAY
  69
+
  70
+!isEmpty(OPENSCAD_COMMIT) {
  71
+  DEFINES += OPENSCAD_COMMIT=$$OPENSCAD_COMMIT
  72
+}

0 notes on commit 2217eff

Please sign in to comment.
Something went wrong with that request. Please try again.