diff --git a/build/jam/FileRules b/build/jam/FileRules index f0c678a6a8..261e9fcb68 100644 --- a/build/jam/FileRules +++ b/build/jam/FileRules @@ -377,23 +377,29 @@ actions CopySetHaikuRevision1 rule DetermineHaikuRevision { - # If existing, make the target depend on the .git/index file in the - # root directory, so it gets updated when the revision changes due to - # commits or merges. - local gitIndex = index ; + # If existing, make the target depend on the $GIT_DIR/index file, + # so it gets updated when the revision changes due to commits or merges. + # If GIT_DIR is not set, fall back to .git/index. + local dotGit = .git ; local revisionFile = haiku-revision ; - if ! [ on $(gitIndex) return $(HAIKU_GIT_REVISION_DETERMINED) ] { - HAIKU_GIT_REVISION_DETERMINED on $(gitIndex) = 1 ; + if ! [ on $(dotGit) return $(HAIKU_GIT_REVISION_DETERMINED) ] { + HAIKU_GIT_REVISION_DETERMINED on $(dotGit) = 1 ; MakeLocate $(revisionFile) : $(HAIKU_BUILD_OUTPUT_DIR) ; LocalClean clean : $(revisionFile) ; if $(HAIKU_REVISION) { DetermineHaikuRevision2 $(revisionFile) ; + } else if $(GIT_DIR) && $(GIT_DIR) != ".git" { + local gitIndex = <$(GIT_DIR)>index ; + SEARCH on $(gitIndex) = [ FDirName $(GIT_DIR) ] ; + Depends $(revisionFile) : $(gitIndex) ; + DetermineHaikuRevision1 $(revisionFile) : $(gitIndex) ; } else if [ Glob [ FDirName $(HAIKU_TOP) .git ] : index ] { + local gitIndex = index ; SEARCH on $(gitIndex) = [ FDirName $(HAIKU_TOP) .git ] ; Depends $(revisionFile) : $(gitIndex) ; DetermineHaikuRevision1 $(revisionFile) : $(gitIndex) ; } else { - revisionFile = ; + Exit "ERROR: Haiku revision could not be determined." ; } } diff --git a/configure b/configure index fcabba206d..29d21a1574 100755 --- a/configure +++ b/configure @@ -565,6 +565,7 @@ fi # backup the passed arguments configureArgs="$@" configurePath=$0 +configureDir=`dirname $configurePath` # backup relevant environs configureEnvirons= @@ -635,6 +636,7 @@ fi # exported (BuildSetup) default parameter values # +GIT_DIR=`git -C "$configureDir" rev-parse --git-dir | sed 's/^gitdir: //'` HOST_GCC_RAW_VERSION=`$CC -dumpversion` HOST_CC_IS_LEGACY_GCC=`is_legacy_gcc $HOST_GCC_RAW_VERSION` HOST_GCC_MACHINE=`$CC -dumpmachine` @@ -1102,6 +1104,8 @@ cat << EOF > "$buildConfigFile" #e ${configureEnvirons} #a ${configureArgs} +GIT_DIR ?= "${GIT_DIR}" ; + HOST_PLATFORM ?= "${HOST_PLATFORM}" ; TARGET_PLATFORM ?= "${TARGET_PLATFORM}" ; HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ;