aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-13 10:01:13 +0100
committerThomas White <taw@physics.org>2018-03-13 10:26:44 +0100
commitea8e7bc35e5c09096c04f5c269451a330d59c49b (patch)
treeed8fac715b989597e4f2815e5946eced89405a44
parent279ae2e0836a91f8bff0a225ceaf733d4e072aa7 (diff)
Nicer way of getting Git revision
This will need a separate way to create the official releases (which shouldn't have Git revisions attached)
-rw-r--r--CMake/GetGitRevisionDescription.cmake168
-rw-r--r--CMake/GetGitRevisionDescription.cmake.in41
-rw-r--r--CMake/LICENSE_1_0.txt25
-rw-r--r--CMakeLists.txt13
-rw-r--r--config.h.cmake.in7
-rw-r--r--libcrystfel/CMakeLists.txt1
-rw-r--r--libcrystfel/src/reflist-utils.c6
-rw-r--r--libcrystfel/src/stream.c1
-rw-r--r--src/ambigator.c1
-rw-r--r--src/cell_explorer.c1
-rw-r--r--src/check_hkl.c1
-rw-r--r--src/compare_hkl.c1
-rw-r--r--src/geoptimiser.c1
-rw-r--r--src/get_hkl.c1
-rw-r--r--src/hdfsee.c1
-rw-r--r--src/indexamajig.c1
-rw-r--r--src/list_events.c1
-rw-r--r--src/partial_sim.c1
-rw-r--r--src/partialator.c1
-rw-r--r--src/pattern_sim.c1
-rw-r--r--src/process_hkl.c1
-rw-r--r--src/render_hkl.c1
-rw-r--r--src/whirligig.c1
-rw-r--r--version.h.in33
-rwxr-xr-xversion.sh30
25 files changed, 250 insertions, 90 deletions
diff --git a/CMake/GetGitRevisionDescription.cmake b/CMake/GetGitRevisionDescription.cmake
new file mode 100644
index 00000000..8ab03bc5
--- /dev/null
+++ b/CMake/GetGitRevisionDescription.cmake
@@ -0,0 +1,168 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+# git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+# git_local_changes(<var>)
+#
+# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
+# Uses the return code of "git diff-index --quiet HEAD --".
+# Does not regard untracked files.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+ return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(get_git_head_revision _refspecvar _hashvar)
+ set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
+ set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+ get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+ if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+ # We have reached the root directory, we are not in git
+ set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ endwhile()
+ # check if this is a submodule
+ if(NOT IS_DIRECTORY ${GIT_DIR})
+ file(READ ${GIT_DIR} submodule)
+ string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
+ get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+ get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
+ endif()
+ set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+ if(NOT EXISTS "${GIT_DATA}")
+ file(MAKE_DIRECTORY "${GIT_DATA}")
+ endif()
+
+ if(NOT EXISTS "${GIT_DIR}/HEAD")
+ return()
+ endif()
+ set(HEAD_FILE "${GIT_DATA}/HEAD")
+ configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+
+ configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+ "${GIT_DATA}/grabRef.cmake"
+ @ONLY)
+ include("${GIT_DATA}/grabRef.cmake")
+
+ set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+ set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+endfunction()
+
+function(git_describe _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT hash)
+ set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+
+ # TODO sanitize
+ #if((${ARGN}" MATCHES "&&") OR
+ # (ARGN MATCHES "||") OR
+ # (ARGN MATCHES "\\;"))
+ # message("Please report the following error to the project!")
+ # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+ #endif()
+
+ #message(STATUS "Arguments to execute_process: ${ARGN}")
+
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}"
+ describe
+ ${hash}
+ ${ARGN}
+ WORKING_DIRECTORY
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE
+ res
+ OUTPUT_VARIABLE
+ out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "${out}-${res}-NOTFOUND")
+ endif()
+
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+ git_describe(out --exact-match ${ARGN})
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_local_changes _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT hash)
+ set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}"
+ diff-index --quiet HEAD --
+ WORKING_DIRECTORY
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE
+ res
+ OUTPUT_VARIABLE
+ out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(res EQUAL 0)
+ set(${_var} "CLEAN" PARENT_SCOPE)
+ else()
+ set(${_var} "DIRTY" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/CMake/GetGitRevisionDescription.cmake.in b/CMake/GetGitRevisionDescription.cmake.in
new file mode 100644
index 00000000..6d8b708e
--- /dev/null
+++ b/CMake/GetGitRevisionDescription.cmake.in
@@ -0,0 +1,41 @@
+#
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+ # named branch
+ string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+ if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+ configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+ else()
+ configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
+ file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
+ if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
+ set(HEAD_HASH "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+else()
+ # detached HEAD
+ configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+ file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+ string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()
diff --git a/CMake/LICENSE_1_0.txt b/CMake/LICENSE_1_0.txt
new file mode 100644
index 00000000..93f82505
--- /dev/null
+++ b/CMake/LICENSE_1_0.txt
@@ -0,0 +1,25 @@
+This license applies to GetGitRevisionDescription.cmake and GetGitRevisionDescription.cmake.in.
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b5717b9..4b1fd2c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,6 @@ find_package(NBP)
find_package(FDIP)
find_package(OpenCL)
-include(config)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -52,13 +51,11 @@ set(COMMON_LIBRARIES
# Add the libcrystfel target
add_subdirectory(libcrystfel)
-add_custom_target(
- versionh
- BYPRODUCTS ${CMAKE_SOURCE_DIR}/version.h
- COMMAND ${CMAKE_SOURCE_DIR}/version.sh ${CMAKE_SOURCE_DIR}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- )
-add_dependencies(libcrystfel versionh)
+
+include(GetGitRevisionDescription)
+get_git_head_revision(GIT_REFSPEC GIT_SHA1)
+
+include(config)
# ----------------------------------------------------------------------
# Build Target
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 11e0a87c..e56aeab6 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -60,3 +60,10 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.6.3"
+#define CRYSTFEL_VERSIONSTRING "+@GIT_SHA1@"
+
+#define CRYSTFEL_BOILERPLATE "License GPLv3+: GNU GPL version 3 or later"\
+ " <http://gnu.org/licenses/gpl.html>.\n"\
+ "This is free software: you are free to change and redistribute it.\n"\
+ "There is NO WARRANTY, to the extent permitted by law.\n\n"\
+ "Written by Thomas White and others."
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt
index ade08ed9..5b3fc14c 100644
--- a/libcrystfel/CMakeLists.txt
+++ b/libcrystfel/CMakeLists.txt
@@ -41,7 +41,6 @@ if(HAVE_FFTW)
endif(HAVE_FFTW)
set(LIBCRYSTFEL_HEADER
- ../version.h
src/hdf5-file.h
src/reflist.h
src/symmetry.h
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index 7ff78f52..54c467b3 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -27,18 +27,20 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <math.h>
#include <stdio.h>
#include <assert.h>
-
#include "reflist.h"
#include "cell.h"
#include "cell-utils.h"
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
-#include "version.h"
/**
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index d7d997cf..0f4dcd6b 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -44,7 +44,6 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include "version.h"
#include "cell.h"
#include "cell-utils.h"
#include "utils.h"
diff --git a/src/ambigator.c b/src/ambigator.c
index 3df66f3b..ba7629ab 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -44,7 +44,6 @@
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_randist.h>
-#include "version.h"
#include <image.h>
#include <utils.h>
#include <symmetry.h>
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index f3ec7cb7..94e7e985 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -40,7 +40,6 @@
#include <gdk/gdkkeysyms.h>
#include <gsl/gsl_multifit_nlin.h>
-#include "version.h"
#include "stream.h"
#include "image.h"
#include "utils.h"
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 1657eb6f..018200cf 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -40,7 +40,6 @@
#include <gsl/gsl_fit.h>
#include <assert.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index fd988b89..feb79879 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -43,7 +43,6 @@
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_fit.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "symmetry.h"
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index 36124e57..3d859a61 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -53,7 +53,6 @@
#include "detector.h"
#include "stream.h"
-#include "version.h"
#include "crystal.h"
#include "image.h"
#include "utils.h"
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 5dddc5be..efd06c94 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -38,7 +38,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
diff --git a/src/hdfsee.c b/src/hdfsee.c
index aa8dfc8e..954eb762 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -37,7 +37,6 @@
#include <gtk/gtk.h>
#include <getopt.h>
-#include "version.h"
#include "dw-hdfsee.h"
#include "utils.h"
#include "render.h"
diff --git a/src/indexamajig.c b/src/indexamajig.c
index a6651497..bac1ee04 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -49,7 +49,6 @@
#include <sys/stat.h>
#include <fcntl.h>
-#include "version.h"
#include "utils.h"
#include "hdf5-file.h"
#include "index.h"
diff --git a/src/list_events.c b/src/list_events.c
index 44087233..ce48478b 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -38,7 +38,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "detector.h"
#include "hdf5-file.h"
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 4a348742..5926043f 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -42,7 +42,6 @@
#include <pthread.h>
#include <gsl/gsl_rng.h>
-#include "version.h"
#include "image.h"
#include "utils.h"
#include "reflist-utils.h"
diff --git a/src/partialator.c b/src/partialator.c
index 428b0d68..2540521d 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -53,7 +53,6 @@
#include <cell.h>
#include <cell-utils.h>
-#include "version.h"
#include "scaling.h"
#include "post-refinement.h"
#include "merge.h"
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 52ed6d48..6c9eb880 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -42,7 +42,6 @@
#include <getopt.h>
#include <hdf5.h>
-#include "version.h"
#include "image.h"
#include "diffraction.h"
#include "diffraction-gpu.h"
diff --git a/src/process_hkl.c b/src/process_hkl.c
index 301bc6e4..5930c189 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -43,7 +43,6 @@
#include <unistd.h>
#include <getopt.h>
-#include "version.h"
#include "utils.h"
#include "statistics.h"
#include "reflist-utils.h"
diff --git a/src/render_hkl.c b/src/render_hkl.c
index 3952940e..a8fc852e 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -45,7 +45,6 @@
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
-#include "version.h"
#include "utils.h"
#include "symmetry.h"
#include "render.h"
diff --git a/src/whirligig.c b/src/whirligig.c
index e8829880..f5a435c2 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -43,7 +43,6 @@
#include <utils.h>
#include <stream.h>
-#include "version.h"
#include "cell-utils.h"
#include "integer_matrix.h"
#include "reflist.h"
diff --git a/version.h.in b/version.h.in
deleted file mode 100644
index 6451a0d9..00000000
--- a/version.h.in
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * CrystFEL version header
- *
- * Copyright © 2014 Deutsches Elektronen-Synchrotron DESY,
- * a research centre of the Helmholtz Association.
- *
- * Author:
- * 2014 Valerio Mariani <valerio.mariani@desy.de>
- *
- * This file is part of CrystFEL.
- *
- * CrystFEL is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * CrystFEL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#define CRYSTFEL_VERSIONSTRING "$u$$e$"
-#define CRYSTFEL_BOILERPLATE \
-"License GPLv3+: GNU GPL version 3 or later"\
-" <http://gnu.org/licenses/gpl.html>.\n"\
-"This is free software: you are free to change and redistribute it.\n"\
-"There is NO WARRANTY, to the extent permitted by law.\n\n"\
-"Written by Thomas White and others."
diff --git a/version.sh b/version.sh
deleted file mode 100755
index ce74e37e..00000000
--- a/version.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-top_srcdir=$1
-
-CRYSTFEL_BASE_VERSION=$( cf=( `grep PACKAGE_VERSION config.h` ); echo ${cf[2]} | sed -n 's/"//gp' )
-sed 's/\$u\$/'${CRYSTFEL_BASE_VERSION}'/g' $top_srcdir/version.h.in > version1.tmp
-command -v git > /dev/null 2>&1
-if [ $? -eq 0 ]; then
- if [ -d ".git" ]; then
- git log -1 --pretty=%B | grep 'This is CrystFEL' > /dev/null
- if [ $? -eq 0 ]; then
- CRYSTFEL_GIT_COMMIT=""
- else
- CRYSTFEL_GIT_COMMIT="+"`git rev-parse HEAD`
- fi
- fi
-fi
-sed 's/\$e\$/'${CRYSTFEL_GIT_COMMIT}'/g' version1.tmp > version2.tmp
-if [ -f version.h ]; then
- diff version.h version2.tmp > /dev/null
- if [ $? -ne 0 ]; then
- mv version2.tmp version.h
- rm version1.tmp
- else
- rm version1.tmp version2.tmp
- fi
-else
- mv version2.tmp version.h
- rm version1.tmp
-fi