| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #!/bin/sh
- #
- # Shell script to make a FPC .tar package for Linux
- # Copyright 1996-2004 Michael Van Canneyt and Peter Vreman
- #
- set -e
- # Retrieve current system info by calling FPC. We need
- # to use the | head -n1 to fix a bug in fpc 1.9.4 and earlier
- # that uses exitcode 1 also when printing info resulting in
- # fpc binary to print an error line (PFV)
- SOURCECPU=`fpc -iSP | head -n1`
- SOURCEOS=`fpc -iSO | head -n1`
- if [ $# -ne 0 ]; then
- if [ $# -ne 2 ]; then
- echo "Usage: makepack [<cpu> <os>]"
- exit 1
- fi
- TARGETCPU=$1
- TARGETOS=$2
- else
- TARGETCPU=$SOURCECPU
- TARGETOS=$SOURCEOS
- fi
- FULLTARGET=$TARGETCPU-$TARGETOS
- if [ "$TARGETCPU" != "$SOURCECPU" ] || [ "$TARGETOS" != "$SOURCEOS" ]; then
- CROSS="cross"
- fi
- unset FPCDIR
- # Goto the toplevel if necessary
- [ -d install ] || cd ..
- # Build everything using the makefiles
- make distclean CPU_TARGET=$TARGETCPU OS_TARGET=$TARGETOS
- make ${CROSS}zipinstall CPU_TARGET=$TARGETCPU OS_TARGET=$TARGETOS SNAPSHOT=1
- if [ $? != 0 ]; then
- echo "Failed to make distribution archive."
- exit 1
- fi
- # Retrieve version info before it gets cleaned below
- VERSION=`cd compiler && ./utils/fpc -iV`
- if [ "$CROSS" == "" ]; then
- make docs
- if [ $? != 0 ]; then
- echo "Failed to make documentation archive."
- exit 1
- fi
- make sourcezip
- if [ $? != 0 ]; then
- echo "Failed to make source archive."
- exit 1
- fi
- make docsrc
- if [ $? != 0 ]; then
- echo Failed to make documentation source archive.
- exit 1
- fi
- make demozip
- if [ $? != 0 ]; then
- echo Failed to make demo source archive.
- exit 1
- fi
- fi
- # Build filename
- if [ "$CROSS" == "" ]; then
- TARNAME=fpc-$VERSION.$FULLTARGET.tar
- else
- TARNAME=fpc-$FULLTARGET-$VERSION.$SOURCECPU-$SOURCEOS.tar
- fi
- BINARYTAR=binary-$FULLTARGET.tar
- SOURCES=`/bin/ls *src.tar.gz`
- FILES=`/bin/ls *linux.tar.gz`
- RELFILES="binary.$FULLTARGET.tar sources.tar demo.tar.gz docs.tar.gz install.sh"
- echo "Creating $BINARYTAR"
- tar cf $BINARYTAR $FILES
- if [ $? != 0 ]; then
- echo "Failed to create $BINARYTAR"
- exit 1
- fi
- echo "Creating sources.tar"
- tar cf sources.tar $SOURCES
- if [ $? != 0 ]; then
- echo "Failed to create sources.tar"
- exit 1
- fi
- echo "Copying install.sh"
- sed s+%version%+$VERSION+ install/install.sh > install.sh
- chmod 755 install.sh
- echo "Creating $TARNAME"
- tar cf $TARNAME $RELFILES
- if [ $? != 0 ]; then
- echo "Failed to create $TARNAME"
- exit 1
- fi
|