view mk-dist @ 2954:f0fe5698ee67

also strip exe files
author John W. Eaton <jwe@octave.org>
date Fri, 11 Jan 2013 12:57:08 -0500
parents 1afd21db3bf1
children dfa81fbfc1f5
line wrap: on
line source

#! /bin/bash

set -e

jobs=9

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
    ;;
    *)
      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

echo "deleting previous dist directory..."
rm -rf dist
mkdir -p dist/octave

echo "building octave and dependencies..."
make octave native-gcc native-binutils JOBS=$jobs

echo "copying files..."
cd $TOPDIR/cross-tools/$TOPDIR/$PREFIX/$TARGET
find . -type f -o -type l | sed "s,./,," > $TOPDIR/excluded-gcc-files
cd $TOPDIR/usr/$TARGET
tar -c -h -X $TOPDIR/excluded-gcc-files -f - . | ( cd $TOPDIR/dist/octave ; tar xpf - )

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

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

echo "making all files writable by user..."
chmod -R u+w $TOPDIR/dist/octave

echo "stripping files..."
cd $TOPDIR/dist/octave
for f in $(find . -name '*.dll' -o -name '*.exe'); do
  echo "  $f"
  $STRIP $f
done

echo "creating tar file..."
cd $TOPDIR/dist
#tar -c -j -f octave.tar.bz2 octave
zip -q -9 -r octave.zip octave