Build improvements
[sxemacs] / autogen.sh
index bc39a4c..3876839 100755 (executable)
@@ -17,40 +17,32 @@ if test -d "/usr/xpg4/bin"; then
     export PATH
 fi
 
-type tla >/dev/null 2>&1 && TLA=tla
+type git >/dev/null 2>&1 && GIT=git
 olddir=$(pwd)
 srcdir=$(dirname $0)
 cd "$srcdir"
 
 emacs_is_beta=t
-if test -n "$TLA" -a -n "$($TLA tree-version | grep '/sxemacs')"; then
-       TREE_VERSION="$($TLA tree-version)"
-       ARCH_VERSION="$($TLA logs -f|tail -n1)"
-       MAIN_VERSION="$($TLA log-versions|grep -- '--main--'|tail -n1)"
-       MAIN_ARCH_VERSION="$(tla logs -f $MAIN_VERSION|tail -n1)"
-elif test -d "{arch}" -a -s "{arch}/++default-version"; then
-       TREE_VERSION=$(cat "{arch}/++default-version")
-       ARCH_VERSION="$TREE_VERSION--version-X"
-       CURDIR=$(pwd)
-       cd "{arch}/sxemacs/sxemacs--main"
-       MAIN_VERSION="$(/bin/ls|tail -n1)"
-       cd "$MAIN_VERSION"
-       MAIN_VERSION="$(/bin/ls)/$MAIN_VERSION"
-       cd "$(/bin/ls)/patch-log"
-       MAIN_ARCH_VERSION="$MAIN_VERSION--$(/bin/ls|grep -v base|sort -k1.7|tail -n1)"
-       cd "$CURDIR"
-else
-       TREE_VERSION="--22.1.12"
-       ARCH_VERSION="no_arch_version"
-       MAIN_ARCH_VERSION="no_arch_version"
+if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
+       TREE_VERSION="$($GIT tag|tail -n1|tr -d v)"
+       GIT_VERSION="$($GIT describe)"
+       IN_GIT="1"
+fi
+if test -z "$TREE_VERSION"; then
+       TREE_VERSION="22.1.14"
+        if test -n "$IN_GIT"; then
+           echo "If you cloned this branch into your own you should issue: git tag -s v${TREE_VERSION}.<your branch_name>"
+       fi
+fi
+if test -z "$GIT_VERSION"; then
+       GIT_VERSION="${TREE_VERSION}-no_git_version"
 fi
 
-emacs_major_version="$(echo $TREE_VERSION|sed -e s/"^.*--"//|cut -d . -f1)"
-emacs_minor_version="$(echo $TREE_VERSION|sed -e s/"^.*--"//|cut -d . -f2)"
-emacs_beta_version="$(echo $TREE_VERSION|sed -e s/"^.*--"//|cut -d . -f3)"
-sxemacs_codename="Fiat"
-sxemacs_arch_version="$ARCH_VERSION"
-sxemacs_main_arch_version="$MAIN_ARCH_VERSION"
+emacs_major_version="$(echo $TREE_VERSION|cut -d. -f1)"
+emacs_minor_version="$(echo $TREE_VERSION|cut -d. -f2)"
+emacs_beta_version="$(echo $TREE_VERSION|cut -d. -f3)"
+sxemacs_codename="Geo"
+sxemacs_git_version="$GIT_VERSION"
 
 autoconf_ver=$(autoconf --version 2>/dev/null | head -n1)
 autoheader_ver=$(autoheader --version 2>/dev/null | head -n1)
@@ -60,31 +52,21 @@ libtool_ver=$(libtool --version 2>/dev/null | head -n1)
 
 
 # When things go wrong... get a bigger hammer!
-_regexp='++log\|=b\(ui\)*ld'
-
 if test -n "$PHAMMER"; then
     HAMMER=$PHAMMER
 fi
 
-if test -n "$HAMMER" -o -n "$REGEXP"; then
-    if test -n "$TLA" -a -n "$($TLA tree-version | grep '/sxemacs')"; then
-       if test -n "$REGEXP" -a "$HAMMER" != "BHFH"; then
-           $TLA inventory -pbB|grep -v "$_regexp\|$REGEXP"|xargs rm -vrf
-           unset REGEXP
+if test -n "$HAMMER"; then
+       if test -n "$GIT" -a -n "$($GIT symbolic-ref HEAD 2>/dev/null)"; then
+               $GIT clean -fxd
        else
-           if test "$HAMMER" = "BHFH"; then
-               $TLA inventory -pjubB|xargs rm -vrf
-           else
-               $TLA inventory -pbB|grep -v "$_regexp"|xargs rm -vrf
-           fi
+               echo "ERROR: Not a git workspace, or you don't have git" >&2
+               exit 1
        fi
-    else
-       echo "ERROR: Could not HAMMER=$HAMMER because we are not inside a tla controled workspace"
-       exit 1
-    fi
-    unset HAMMER
+       unset HAMMER
 fi
 
+
 cat>sxemacs_version.m4<<EOF
 dnl autogenerated version number
 m4_define([SXEM4CS_VERSION], [$emacs_major_version.$emacs_minor_version.$emacs_beta_version])
@@ -92,8 +74,7 @@ m4_define([SXEM4CS_MAJOR_VERSION], [$emacs_major_version])
 m4_define([SXEM4CS_MINOR_VERSION], [$emacs_minor_version])
 m4_define([SXEM4CS_BETA_VERSION], [$emacs_beta_version])
 m4_define([SXEM4CS_BETA_P], [$emacs_is_beta])
-m4_define([SXEM4CS_ARCH_VERSION], [$sxemacs_arch_version])
-m4_define([SXEM4CS_MAIN_ARCH_VERSION], [$sxemacs_main_arch_version])
+m4_define([SXEM4CS_GIT_VERSION], [$sxemacs_git_version])
 m4_define([SXEM4CS_CODENAME], [$sxemacs_codename])
 m4_define([4UTOCONF_VERSION], [$autoconf_ver])
 m4_define([4UTOHEADER_VERSION], [$autoheader_ver])