view mk-dist @ 2988:aca8511e7751

qt.mk: link to correct files in bin directory
author John W. Eaton <jwe@octave.org>
date Thu, 16 May 2013 13:32:57 -0400
parents eb1643bd900c
children 4b450c162e39
line wrap: on
line source

#! /bin/bash

set -e

jobs=9

OCTAVE_TARGET=octave

strip=yes
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
    ;;
    *)
      echo "mk-dist: unrecognized option: $1" 1>&2
      exit 1
    ;;
  esac
done

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

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

echo "building octave and dependencies..."
make $OCTAVE_TARGET 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/$TARGET
find . -type f -o -type l | sed "s,./,," > $TOPDIR/excluded-gcc-files

echo "copying files..."

echo "  octave and dependencies..."
cd $TOPDIR/usr/$TARGET
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

echo "creating zip file..."
cd $TOPDIR/dist
zip -q -9 -r $OCTAVE_TARGET-$DATE.zip $OCTAVE_TARGET-$DATE