nwbootstrap 2.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
#! /bin/sh

# show executed commands
# set -x

# stop on errors
set -e

BD=`pwd`

build=0
build_debug=0
skip_linux=0

# parse arguments
for arg do
  case "$arg" in
    --build) build=1 ;;
    --build-debug) build_debug=1 ;;
    --skip-linux) skip_linux=1 ;;
    *) echo "$0: unrecognized option: $arg" ;;
  esac
done

# run the auto tools
autotools()
{
  for package in $BD $BD/innobase
  do
    echo "cd $package"
    cd $package
    rm -f config.cache
    echo "aclocal"
    aclocal
    echo "autoheader"
    autoheader
    echo "libtoolize --force"
    libtoolize --force
    echo "aclocal"
    aclocal
    echo "automake --add-missing --force-missing"
    automake --add-missing --force-missing
    echo "autoconf"
    autoconf
  done

  cd $BD
}

# check the source direcotry
echo "looking for \"$BD/sql/mysqld.cc\"..."
if test ! -r ./sql/mysqld.cc
then
  echo "./netware/nwbootstrap must be started from the top source directory"
  exit 1
fi

# clean
# make -j 2 -k distclean
rm -f NEW-RPMS/*
rm -f */.deps/*.P

# make files writeable
chmod -R u+rw,g+rw .

# skip linux?
if test $skip_linux -ne 1
then
  echo "starting linux build..."

  echo "autotools..."
  autotools

  echo "configuring for linux..."
  ./configure --without-docs --without-innodb

  echo "building for linux..."
  make clean all

  echo "copying required linux binaries..."
  rm -f */*.linux
  cp extra/comp_err extra/comp_err.linux
  cp libmysql/conf_to_src libmysql/conf_to_src.linux
  cp libmysql/conf_to_src libmysql_r/conf_to_src.linux
  cp sql/gen_lex_hash sql/gen_lex_hash.linux
  cp strings/conf_to_src strings/conf_to_src.linux

  echo "cleaning linux build..."
  make clean distclean
fi

echo "starting netware build..."

# remove stale Makefile.in.bk files
rm -rf Makefile.in.bk

# start mw enviornment
chmod +x ./netware/nwconfigure
chmod +x ./netware/mw/mwenv
chmod +x ./netware/mw/mwasmnlm
chmod +x ./netware/mw/mwccnlm
chmod +x ./netware/mw/mwldnlm

. ./netware/mw/mwenv

# link nwconfigure
rm -f ./nwconfigure
ln ./netware/nwconfigure ./nwconfigure

# save old builds from previous run
if test -e *.tar.gz
then
  rm -f *.tar.gz.old
  rename .tar.gz .tar.gz.old *.tar.gz
fi

echo "autotools..."
autotools

# debug build
if test $build_debug -eq 1
then
  echo "configuring for netware (debug)..."
  ./nwconfigure --with-debug=full

  echo "building for netware (debug)..."
  make clean bin-dist

  # mark the debug build
  rename .tar.gz -debug.tar.gz *.tar.gz
fi

# release build
if test $build -eq 1
then
  echo "configuring for netware..."
  ./nwconfigure

  echo "building for netware..."
  make clean bin-dist
fi

echo "done"