extras/makedist.sh
author Ryan C. Gordon <icculus@icculus.org>
Tue, 03 Apr 2007 01:48:09 +0000
changeset 885 e1fe7fe85939
child 891 473312ef9130
permissions -rwxr-xr-x
Added a hack for "make dist" functionality.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
885
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#!/bin/sh
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
# This shell script is roughly equivalent to what "make dist" did in the
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
#  autotools build system and is called from a custom CMake target.
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
# !!! FIXME: This code sort of sucks. Consider using CPack instead...
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
if [ ! -f ./CMakeLists.txt ]; then
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
    echo "you are in the wrong place."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
    exit 1
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
fi
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
if [ -z "$1" ]; then
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
    echo "Wrong arguments."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
    exit 2
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
fi
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
set -e
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
VERSION="$1"
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
BASENAME="physfs-$VERSION"
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
TARBALL="$BASENAME.tar.gz"
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
TMPCPDIR="../9sdkujy75jv932-physfstmp-$VERSION"
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
CPDIR="$TMPCPDIR/$BASENAME"
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
echo "Packing PhysicsFS $VERSION source tarball..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
echo " + Setting up scratch dir..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
rm -rf $TMPCPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
mkdir $TMPCPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
echo " + Making copy of source tree in scratch dir..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
cp -R . $CPDIR/
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
echo " + Deleting cruft..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
pushd $CPDIR >/dev/null && rm -rf `svn propget svn:ignore .` && popd >/dev/null
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
rm -rf `find $CPDIR -type d -name '.svn'`
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
echo " + Deleting Subversion metadata..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
rm -rf `find $CPDIR -type d -name '.svn'`
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
echo " + Fixing up permissions..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
chmod -R a+rw $CPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
chmod a+x `find $CPDIR -type d`
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
echo " + Building final tarball..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
rm -f $TARBALL
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
tar -czf $TARBALL -C $TMPCPDIR $BASENAME
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
echo " + Cleaning up..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
rm -rf $TMPCPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
echo " + All done! Packed to '$TARBALL' ..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
set +e
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
exit 0
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50