Bryan Drewery пре 23 година
родитељ
комит
d16b5cd85b
2 измењених фајлова са 170 додато и 90 уклоњено
  1. 0 90
      bldall
  2. 170 0
      build

+ 0 - 90
bldall

@@ -1,90 +0,0 @@
-#!/bin/sh
-
-#edit this to your homedir (no trailing slash)
-
-TCLDIR="/home/wheel/bryan"
-
-
-#### DO NOT EDIT BELOW THIS LINE #####
-
-# Figure out whether to use default or a specified config file
-if test $1
-then
-  packname=$1
-else
-  packname=default
-fi
-
-# Verify we got the config file
-if ! test -f $packname.conf
-then
-  echo "Can't find pack configuration file $packname.conf"
-  exit 1
-fi
-
-# Figure what bins we're making
-case `uname` in
-  Linux) prefix=linux;;
-  FreeBSD) case `uname -r` in
-    4*) prefix=freebsd4;;
-    3*) prefix=freebsd3;;
-  esac;;
-  OpenBSD) prefix=openbsd;;
-esac
-if test -z $prefix
-then
-  echo "Automated packing disabled, `uname` isn't recognized"
-fi
-
-# Run ./configure, then verify it's ok
-echo "Configuring..."
-./configure --disable-tcl-threads --with-tcllib=${TCLDIR}/lib/libtcl8.4.a --with-tclinc=${TCLDIR}/include/tcl.h > /dev/null 2>configure.temp
-#if test "`cat configure.temp`"
-#then
-#  echo "Configure error'd"
-#  cat configure.temp
-#
-#  exit 1
-#fi
-#rm -f configure.temp
-
-# make clean, just in case
-echo "Cleaning up old binaries..."
-make clean > /dev/null
-
-
-# Read the config
-echo -n "Pack configuration:"
-for cnf in `cat $packname.conf | grep -v "^#"`
-do
-  defines="$defines -DS_$cnf"
-  echo -n "$cnf "
-done
-echo ""
-
-# Build utils and check we got the bins
-echo "Building utils..."
-make utils CFLGS="$defines" > /dev/null
-if ! test -f stringfix
-then
-  echo "Util build failed"
-  exit 1
-fi
-
-# Build leaf and check
-echo "Building leaf..."
-make leaf CFLGS="$defines" > /dev/null
-if ! test -f leaf
-then
-  echo "leaf build failed"
-  exit 1
-fi
-
-# Build hub and check
-echo "Building hub..."
-make hub CFLGS="$defines" > /dev/null
-if ! test -f hub
-then
-  echo "hub build failed"
-  exit 1
-fi

+ 170 - 0
build

@@ -0,0 +1,170 @@
+#!/bin/sh
+
+#edit this to your homedir (no trailing slash)
+
+TCLDIR="/home/wheel/bryan"
+
+
+#### DO NOT EDIT BELOW THIS LINE #####
+
+# Awk out the version from source
+ver=`cat src/main.c 2>&1 | grep "char" | awk '/egg_version/ {print $4}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
+if test -z "$ver"
+then
+  ver="?.?.?"
+fi
+echo "*** wraith v$ver builder ***"
+echo ""
+
+debug=0
+#if test $# -lt 1; then
+if test -z "$1"; then
+ echo "Usage: $0 -d all|leaf|hub pack.conf"
+ echo "   -d: Builds a debug package."
+ echo ""
+ exit 1
+elif [ $1 = "all" ]; then
+ all=1
+elif [ $1 = "leaf" ]; then
+ leaf=1
+elif [ $1 = "hub" ]; then
+ hub=1
+elif [ $1 = "-d" ]; then
+ debug=1
+ test=" "
+ if ! test $# -lt 2; then
+  if [ $2 = "all" ]; then
+   all=1
+  elif [ $2 = "leaf" ]; then
+   leaf=1
+  elif [ $2 = "hub" ]; then
+   hub=1
+  else
+   all=1
+   pack=$2
+  fi
+ else
+  all=1
+ fi
+else
+ all=1
+ pack=$1
+fi
+
+d=""
+if [ $debug = "1" ]; then
+ d="d"
+fi
+
+if ! test $pack
+ then
+ if [ $debug = "1" ]; then
+  pack=$3
+ else
+  pack=$2
+ fi
+fi
+
+if test $pack
+then
+  packname=$pack
+else
+  packname=default
+fi
+
+# Verify we got the config file
+origpack=$packname
+if ! test -f $packname; then
+  packname=$packname.conf
+fi
+if ! test -f $packname; then
+  echo "[!] Can't find pack configuration file $origpack"
+  exit 1
+else
+  echo "[*] Using pack configuration file: $packname"
+fi
+
+# Figure what bins we're making
+case `uname` in
+  Linux) os=Linux;;
+  FreeBSD) case `uname -r` in
+    5*) os=FreeBSD5;;
+    4*) os=FreeBSD4;;
+    3*) os=FreeBSD3;;
+  esac;;
+  OpenBSD) os=OpenBSD;;
+esac
+if test -z $os
+then
+  echo "[!] Automated packaging disabled, `uname` isn't recognized"
+fi
+
+echo "[*] Building pack for $os"
+
+# Run ./configure, then verify it's ok
+echo "[*] Configuring..."
+umask 077 >/dev/null
+./configure --disable-tcl-threads --with-tcllib=${TCLDIR}/lib/libtcl8.4.a --with-tclinc=${TCLDIR}/include/tcl.h > /dev/null 2>configure.temp
+#if test "`cat configure.temp`"
+#then
+#  echo "Configure error'd"
+#  cat configure.temp
+#
+#  exit 1
+#fi
+#rm -f configure.temp
+
+# make clean, just in case
+echo "[*] Cleaning up old binaries..."
+make clean > /dev/null
+
+
+# Read the config
+echo -n "[*] Compiling with:"
+for cnf in `cat $packname | grep -v "^#"`
+do
+  defines="$defines -DS_$cnf"
+  echo -n "$cnf "
+done
+echo ""
+
+# Build utils and check we got the bins
+echo "[*] Building utils..."
+make utils CFLGS="$defines" > /dev/null
+if ! test -f stringfix
+then
+  echo "[!] Util build failed"
+  exit 1
+fi
+
+# Build leaf and check
+echo "[*] Building ${d}leaf..."
+make ${d}leaf CFLGS="$defines" > /dev/null
+if ! test -f leaf
+then
+  echo "[!] ${d}leaf build failed"
+  exit 1
+fi
+
+# Build hub and check
+echo "[*] Building ${d}hub..."
+make ${d}hub CFLGS="$defines" > /dev/null
+if ! test -f hub
+then
+  echo "[!] ${d}hub build failed"
+  exit 1
+fi
+
+
+# Wrap it nicely up into an archive
+echo "[*] Packaging..."
+packname=`basename $packname .conf`
+for bin in leaf hub
+do
+  mv -f $bin $os.$bin
+done
+tar -zcf $packname.$os.tgz $os.*
+rm -f $os.*
+echo "Binaries are now in '$packname.$os.tgz'."
+exit 0
+