extras/makedist.sh
author Ryan C. Gordon <icculus@icculus.org>
Sat, 28 Mar 2009 17:51:10 -0400
changeset 976 372a5232bc18
parent 891 473312ef9130
permissions -rwxr-xr-x
Updated some documentation, added a FIXME.
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
891
473312ef9130 Fixes to the makedist.sh script.
Ryan C. Gordon <icculus@icculus.org>
parents: 885
diff changeset
    30
mkdir $CPDIR
885
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
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
    33
cp -R . $CPDIR/
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
echo " + Deleting cruft..."
891
473312ef9130 Fixes to the makedist.sh script.
Ryan C. Gordon <icculus@icculus.org>
parents: 885
diff changeset
    35
pushd $CPDIR >/dev/null
473312ef9130 Fixes to the makedist.sh script.
Ryan C. Gordon <icculus@icculus.org>
parents: 885
diff changeset
    36
rm -rf `svn propget svn:ignore .`
473312ef9130 Fixes to the makedist.sh script.
Ryan C. Gordon <icculus@icculus.org>
parents: 885
diff changeset
    37
rm -rf `svn status |grep '?' |sed -s 's/\?//'`
473312ef9130 Fixes to the makedist.sh script.
Ryan C. Gordon <icculus@icculus.org>
parents: 885
diff changeset
    38
popd >/dev/null
885
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
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
    40
echo " + Deleting Subversion metadata..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
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
    42
echo " + Fixing up permissions..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
chmod -R a+rw $CPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
chmod a+x `find $CPDIR -type d`
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
echo " + Building final tarball..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
rm -f $TARBALL
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
tar -czf $TARBALL -C $TMPCPDIR $BASENAME
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
echo " + Cleaning up..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
rm -rf $TMPCPDIR
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
echo " + All done! Packed to '$TARBALL' ..."
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
set +e
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
exit 0
e1fe7fe85939 Added a hack for "make dist" functionality.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54