Pārlūkot izejas kodu

* build.sh cleanups/updates

Bryan Drewery 17 gadi atpakaļ
vecāks
revīzija
67c2fed739
3 mainītis faili ar 25 papildinājumiem un 125 dzēšanām
  1. 25 96
      build.sh
  2. 0 26
      private/buildall
  3. 0 3
      private/buildpack

+ 25 - 96
build.sh

@@ -9,42 +9,36 @@ fi
 
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:${HOME}/bin
-# Awk out the version from source
+# Prefer gawk
 AWK="`which awk`"
 if test -z "${AWK}"; then
  AWK="`which gawk`"
 fi
 
-ver="?.?.?"
-ver=`grep "char" src/main.c | $AWK '/egg_version/ {print $5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
-echo $ver | grep "devel" > /dev/null 2>&1
-if [ $? -eq 0 ]; then
-  devel="1"
-else
-  devel="0"
-fi
-rm -f ts ts.exe
-gcc -o ts src/timestamp.c > /dev/null 2>&1
 if [ -d .git ]; then
   BUILDTS=$(git log -1 --pretty=format:%ct HEAD)
+  ver=$(git describe)
 else
-  BUILDTS=`grep -m 1 "BUILDTS = " Makefile.in | ${AWK} '{print $3}'` 
+  ver=$($AWK '/^VERSION/ {print $3}' Makefile.in)
+  BUILDTS=`grep -m 1 "BUILDTS = " Makefile.in | ${AWK} '{print $3}'`
 fi
+
+# Convert timestamp into readable format
+rm -f ts ts.exe > /dev/null 2>&1
+gcc -o ts src/timestamp.c > /dev/null 2>&1
 builddate=`./ts ${BUILDTS}`
-rm -f ts ts.exe
+rm -f ts ts.exe > /dev/null 2>&1
+
+#Display banner
 clear
-#Display a banner
-#bt=`grep -A 5 "char \*wbanner(void) {" src/misc.c | grep "switch" | sed -e "s/.*switch (randint(\(.\))) {/\1/"`
-#bn=$[($RANDOM % ${bt})]
-bn=0
-banner=`grep -A 15 "char \*wbanner(void) {" src/misc.c | grep "case ${bn}:" | sed -e "s/.*case ${bn}: return STR(\"\(.*\)\");/\1/"`
-echo -e "${banner}"
+head -n 8 README
+
 echo -e "Version:   ${ver}\nBuild:     ${builddate}"
+echo ""
 
-usage() 
+usage()
 {
-    echo
-    echo "Usage: $0 [-bcCdnP] [-q FILE]"
+    echo "Usage: $0 [-bcCdnP] pack.cfg"
     echo
     echo "    The options are as follows:"
     echo "    -b        Use bzip2 instead of gzip when packaging."
@@ -52,9 +46,7 @@ usage()
     echo "    -C        Preforms a distclean before making."
     echo "    -d        Builds a debug package."
     echo "    -n        Do not package the binaries."
-    echo "    -q  FILE  What file to use as the cfg file."
     echo "    -P        For development (Don't compile/rm binaries)"
-    echo "    -s        scp target."
 }
 
 debug=0
@@ -62,11 +54,8 @@ clean=0
 nopkg=0
 bzip=0
 pkg=0
-scp=0
-nightly=0
-pack=pack/pack.cfg
 
-while getopts bCcdhnNPq:s: opt ; do
+while getopts bCcdhnP: opt ; do
         case "$opt" in
         b) bzip=1 ;;
 	c) clean=1 ;;
@@ -74,10 +63,7 @@ while getopts bCcdhnNPq:s: opt ; do
         d) debug=1 ;;
 	h) usage; exit 0 ;;
         n) nopkg=1 ;;
-	N) nightly=1 ;;
-	q) pack="$OPTARG" ;;
         P) pkg=1 ;;
-	s) scp="$OPTARG" ;;
         *) usage; exit 1 ;;
 
         esac
@@ -85,16 +71,20 @@ done
 
 shift $(($OPTIND - 1))
 
-PACKNAME=`grep "PACKNAME " ${pack} | $AWK '/PACKNAME/ {print $2}'`
-echo "Packname:  ${PACKNAME} (${pack})"
-echo -e `grep -m 1 "http://" src/misc.c | sed -e "s/.*\- \(.*\) \-.*/\1/"`
-echo
+pack=$1
+if ! [ -f $pack ]; then
+  echo "Cannot read $pack" >&2
+  exit 1
+fi
 
 if test -z "$1"; then
  usage
  exit 1
 fi
 
+
+PACKNAME=`grep "PACKNAME " ${pack} | $AWK '/PACKNAME/ {print $2}'`
+
 rm=1
 compile=1
 if [ $pkg = "1" ]; then
@@ -130,15 +120,6 @@ then
   echo "[!] Automated packaging disabled, `uname` isn't recognized"
 fi
 
-if [ $nightly = "1" ]; then
-  chmod 0700 private/id_dsa
-  remotedate="`ssh -q -i private/id_dsa bdrewery@endurance.quadspeedi.net ls -al public_html/nightly/${os}-stable.tar.gz | \
-             sed -e 's/.*\-> \([0-1][0-2]\.[0-3][0-9]\.[0-9][0-9][0-9][0-9]\)\-.*/\1/'`"
-  if [ "${remotedate}" = "${builddate}" ]; then
-    exit 0
-  fi
-fi
-
 if [ $compile = "1" ]; then
 
  echo "[*] Building ${PACKNAME} for $os"
@@ -201,62 +182,10 @@ fi
 # Wrap it nicely up into an archive
 if [ $nopkg = "0" -o $pkg = "1" ]; then
   echo "[*] Packaging..."
-  #This MALLOC business is to not Abort 'tar' due to some bug it has.
-  tmp=${MALLOC_CHECK_}
-  unset MALLOC_CHECK_
   tar -c${zip}f ${PACKNAME}.$os-$ver${d}.tar.${ext} wraith.$os-$ver${d}
   chmod 0644 ${PACKNAME}.$os-$ver${d}.tar.${ext}
-  if test -n "$tmp"; then
-    declare -x MALLOC_CHECK_=$tmp
-  fi
   if [ $rm = "1" ]; then
     rm -f *$os-$ver${d}
   fi
   echo "Binaries are now in '${PACKNAME}.$os-$ver${d}.tar.${ext}'."
- 
-  if ! [ $scp = 0 ]; then
-    chmod 0700 private/id_dsa
-    scp -i private/id_dsa -B -p -C ${PACKNAME}.$os-$ver${d}.tar.${ext} $scp
-
-    scp_target=`echo $scp | cut -d : -f 1`
-    dir=`echo $scp | cut -d : -f 2`
-    if [ "$devel" = "1" ]; then
-      ssh -i private/id_dsa $scp_target ln -fs ${PACKNAME}.$os-$ver${d}.tar.${ext} ${dir}/${PACKNAME}.${os}-devel.tar.gz
-    else
-      ssh -i private/id_dsa $scp_target ln -fs ${PACKNAME}.$os-$ver${d}.tar.${ext} ${dir}/${PACKNAME}.${os}-stable.tar.gz
-      ssh -i private/id_dsa $scp_target ln -fs ${PACKNAME}.$os-$ver${d}.tar.${ext} ${dir}/${PACKNAME}.${os}-base.tar.gz
-    fi
-
-  fi
-elif ! [ $scp = "0" ]; then
-  cp wraith wraith.$os-$ver${d} > /dev/null 2>&1
-  cp ChangeLog ChangeLog-${builddate}
-  gzip -9 ChangeLog-${builddate}
-  #This MALLOC business is to not Abort 'tar' due to some bug it has.
-  tmp=${MALLOC_CHECK_}
-  unset MALLOC_CHECK_
-
-  cp ${extras} .
-  for file in $extras
-  do
-    extras_local="${extras_local} `basename $file`"
-  done
-
-  tar -c${zip}f ${builddate}-$os-$ver${d}.tar.${ext} wraith.$os-$ver${d}${exe} ChangeLog-${builddate}.gz ${extras_local}
-  chmod 0644 ${builddate}-$os-$ver${d}.tar.${ext}
-  if test -n "$tmp"; then
-    declare -x MALLOC_CHECK_=$tmp
-  fi
-  chmod 0700 private/id_dsa
-  scp -i private/id_dsa -B -p -C ${builddate}-$os-$ver${d}.tar.${ext} $scp
-  rm -rf ${builddate}-$os-$ver${d}.tar.${ext} wraith.$os-$ver${d}${exe} ChangeLog-${builddate}.gz ${extras_local}
-  if [ "$devel" = "1" ]; then
-    ssh -i private/id_dsa shatow@wraith.shatow.net ln -fs ${builddate}-$os-$ver${d}.tar.${ext} public_html/nightly/${os}-devel.tar.gz
-  else
-    ssh -i private/id_dsa shatow@wraith.shatow.net ln -fs ${builddate}-$os-$ver${d}.tar.${ext} public_html/nightly/${os}-stable.tar.gz
-    ssh -i private/id_dsa shatow@wraith.shatow.net ln -fs ${builddate}-$os-$ver${d}.tar.${ext} public_html/nightly/${os}.tar.gz
-  fi
 fi
-
-
-exit 0

+ 0 - 26
private/buildall

@@ -1,26 +0,0 @@
-#!/bin/sh
-
-scp_target="shatow@wraith.shatow.net"
-dir="public_html/builds"
-
-if test $# -lt 1; then
- echo "Usage: $0 directory"
- exit 1
-fi
-
-#Build hub/leaf
-./build.sh -C -n all
-
-#Then package up each cfg
-cfgs="`find \"$@\" -name \"*.cfg\" | grep -v \"disabled\"`"
-for cfg in $cfgs
-do
- if test "`grep 'PACKNAME' $cfg`x" != "x"; then
-  #Dont compile, just package up and dont rm old binaries.
-  ./build.sh -n -P -q $cfg -s $scp_target:${dir}/ all
- fi
-done
-chmod 0700 private/id_dsa
-ssh -i private/id_dsa $scp_target chmod 0644 ${dir}/*.tar.gz
-rm *.tar.gz
-

+ 0 - 3
private/buildpack

@@ -1,3 +0,0 @@
-#!/bin/sh
-
-./build.sh -C -q $1 -s shatow@wraith.shatow.net:public_html/builds/ all