view mk-dist @ 3256:7fb479d0241c

Update build tools for native mingw * src/build-m4.mk: do nothing for native mingw build * Makefile.in: - add bison, m4 as natve mingw, and python as jit build requirements. - remove build-bison as a mingw build dependancy * index.html: Add msys-bison to mingw required packages and mention ghostscript and python.
author John Donoghue <john.donoghue@ieee.org>
date Thu, 26 Sep 2013 21:18:39 -0400
parents 100e618349f7
children e7cb2340feff
line wrap: on
line source

#! /bin/bash

set -e

jobs=9

OCTAVE_TARGET=octave

strip=yes
installer=no
while [ $# -gt 0 ]; do
  case "$1" in
    --jobs)
      shift
      if [ $# -gt 0 ]; then
        jobs=$1
        shift
      else
        echo "mk-dist: expecting argument for --jobs option" 1>&2
        exit 1
      fi
    ;;
    --stable)
      OCTAVE_TARGET=stable-octave
      shift
    ;;
    --no-strip)
      strip=no
      shift
    ;;
    --installer)
      installer=yes
      echo "making installer"
      shift
    ;;
    *)
      echo "mk-dist: unrecognized option: $1" 1>&2
      exit 1
    ;;
  esac
done

TOPDIR=$(pwd)
PATH=$TOPDIR/usr/bin:$PATH
TARGET=i686-pc-mingw32
PREFIX=/usr/$TARGET
STRIP=$TARGET-strip
DATE=$(date +%Y-%m-%d-%H-%M)
OCTAVE_DIST_DIR=$TOPDIR/dist/$OCTAVE_TARGET-$DATE
INSTALLER_PKG=

if [ $installer = "yes" ]; then
  echo "Adding installer to build dependancies"
  INSTALLER_PKG="nsis"
fi

echo "deleting previous dist directory..."
rm -rf $TOPDIR/dist
mkdir -p $OCTAVE_DIST_DIR

echo "building octave and dependencies..."
make $OCTAVE_TARGET $INSTALLER_PKG msys-base native-gcc native-binutils octave-forge-packages npp JOBS=$jobs

echo "generating lists of files to exclude..."

echo "  native files..."
cat > $TOPDIR/excluded-native-files << EOF
./$TARGET
./bin/$TARGET-*.exe
EOF

echo "  gcc cross compiler files..."
cd $TOPDIR/cross-tools/$TOPDIR/$PREFIX
find . -type f -o -type l | sed "s,./,," > $TOPDIR/excluded-gcc-files

echo "copying files..."

echo "  octave and dependencies..."
cd $TOPDIR/$PREFIX
tar -c -h -X $TOPDIR/excluded-gcc-files -f - . | ( cd $OCTAVE_DIST_DIR ; tar xpf - )
cp $TOPDIR/build_packages.m $OCTAVE_DIST_DIR/src

echo "  octaverc file..."
cp $TOPDIR/octaverc $OCTAVE_DIST_DIR/share/octave/site/m/startup/octaverc

echo "  native tools..."
cd $TOPDIR/native-tools/usr
tar -c -h -X $TOPDIR/excluded-native-files -f - . | ( cd $OCTAVE_DIST_DIR ; tar xpf - )

echo "  libgcc_s_dw2-1.dll to bin directory"
cd $OCTAVE_DIST_DIR
cp lib/gcc/i686-pc-mingw32/libgcc_s_dw2-1.dll bin

echo "  msys base files..."
cd $TOPDIR/msys-base
tar -c -h -f - . | ( cd $OCTAVE_DIST_DIR ; tar xpf - )

echo "  notepad++..."
cd $TOPDIR
tar -c -h -f - notepad++ | ( cd $OCTAVE_DIST_DIR ; tar xpf - )
cp $TOPDIR/build_packages.m $OCTAVE_DIST_DIR/src

echo "making all files writable by user..."
chmod -R u+w $OCTAVE_DIST_DIR

if [ $strip = "yes" ]; then
  echo "stripping files..."
  cd $OCTAVE_DIST_DIR
  for f in $(find . -name '*.dll' -o -name '*.exe'); do
    echo "  $f"
    $STRIP $f
  done
fi

#echo "creating tar file..."
#cd $TOPDIR/dist
#tar -c -j -f $OCTAVE_TARGET-$DATE.tar.bz2 $OCTAVE_TARGET-$DATE

cd $TOPDIR/dist

if [ $installer = "yes" ]; then
  $SHELL ../makeinst-script.sh $OCTAVE_TARGET-$DATE

  echo "Generating installer ..."
  $TOPDIR/usr/bin/$TARGET-makensis octave.nsi > /dev/null

  if [ -e Octave-Installer.exe ]; then
    echo "Installer created"
    rm octave.nsi
  fi

else
  echo "creating zip file..."
  zip -q -9 -r $OCTAVE_TARGET-$DATE.zip $OCTAVE_TARGET-$DATE
fi