|
@@ -1,67 +1,106 @@
|
|
|
#!/bin/sh
|
|
|
#
|
|
|
# Shell script to make a FPC .tar package for Linux
|
|
|
-# Copyright 1996-2000 Michael Van Canneyt and Peter Vreman
|
|
|
+# Copyright 1996-2004 Michael Van Canneyt and Peter Vreman
|
|
|
#
|
|
|
|
|
|
-# Version
|
|
|
-VERSION=1.9.4
|
|
|
-RELEASE=i386
|
|
|
+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 ..
|
|
|
|
|
|
-make linuxzip
|
|
|
+# 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.
|
|
|
+ echo "Failed to make distribution archive."
|
|
|
exit 1
|
|
|
fi
|
|
|
-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
|
|
|
+
|
|
|
+# 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
|
|
|
-make demozip
|
|
|
-if [ $? != 0 ]; then
|
|
|
- echo Failed to make demo source archive.
|
|
|
- exit 1
|
|
|
+
|
|
|
+# 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 *exm.tar.gz`
|
|
|
-RELFILES="binary.tar sources.tar demo.tar.gz docs.tar.gz install.sh"
|
|
|
+FILES=`/bin/ls *linux.tar.gz`
|
|
|
+RELFILES="binary.$FULLTARGET.tar sources.tar demo.tar.gz docs.tar.gz install.sh"
|
|
|
|
|
|
-echo Creating binary.tar
|
|
|
-tar cf binary.tar $FILES
|
|
|
+echo "Creating $BINARYTAR"
|
|
|
+tar cf $BINARYTAR $FILES
|
|
|
if [ $? != 0 ]; then
|
|
|
- echo Failed to create binary.tar
|
|
|
+ echo "Failed to create $BINARYTAR"
|
|
|
exit 1
|
|
|
fi
|
|
|
-echo Creating sources.tar
|
|
|
+echo "Creating sources.tar"
|
|
|
tar cf sources.tar $SOURCES
|
|
|
if [ $? != 0 ]; then
|
|
|
- echo Failed to create sources.tar
|
|
|
+ echo "Failed to create sources.tar"
|
|
|
exit 1
|
|
|
fi
|
|
|
-echo Copying install.sh
|
|
|
-cp install/install.sh .
|
|
|
+echo "Copying install.sh"
|
|
|
+sed s+%version%+$VERSION+ install/install.sh > install.sh
|
|
|
chmod 755 install.sh
|
|
|
|
|
|
-echo Creating fpc-$VERSION.$RELEASE.tar
|
|
|
-tar cf fpc-$VERSION.$RELEASE.tar $RELFILES
|
|
|
+echo "Creating $TARNAME"
|
|
|
+tar cf $TARNAME $RELFILES
|
|
|
if [ $? != 0 ]; then
|
|
|
- echo Failed to create fpc-$VERSION.$RELEASE.tar
|
|
|
+ echo "Failed to create $TARNAME"
|
|
|
exit 1
|
|
|
fi
|