Added a hack for "make dist" functionality.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 03 Apr 2007 01:48:09 +0000
changeset 885 e1fe7fe85939
parent 884 4337d1e9b266
child 886 d5a00434305c
Added a hack for "make dist" functionality.
CMakeLists.txt
extras/makedist.sh
--- a/CMakeLists.txt	Tue Apr 03 01:08:50 2007 +0000
+++ b/CMakeLists.txt	Tue Apr 03 01:48:09 2007 +0000
@@ -348,6 +348,9 @@
     MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.")
 ENDIF(DOXYGEN_FOUND)
 
+IF(UNIX)
+    ADD_CUSTOM_TARGET(dist ./extras/makedist.sh ${PHYSFS_VERSION} COMMENT "Building source tarball")
+ENDIF(UNIX)
 
 MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)
     IF(${_VALUE})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/makedist.sh	Tue Apr 03 01:48:09 2007 +0000
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# This shell script is roughly equivalent to what "make dist" did in the
+#  autotools build system and is called from a custom CMake target.
+
+# !!! FIXME: This code sort of sucks. Consider using CPack instead...
+
+if [ ! -f ./CMakeLists.txt ]; then
+    echo "you are in the wrong place."
+    exit 1
+fi
+
+if [ -z "$1" ]; then
+    echo "Wrong arguments."
+    exit 2
+fi
+
+set -e
+
+VERSION="$1"
+BASENAME="physfs-$VERSION"
+TARBALL="$BASENAME.tar.gz"
+TMPCPDIR="../9sdkujy75jv932-physfstmp-$VERSION"
+CPDIR="$TMPCPDIR/$BASENAME"
+
+echo "Packing PhysicsFS $VERSION source tarball..."
+echo " + Setting up scratch dir..."
+rm -rf $TMPCPDIR
+mkdir $TMPCPDIR
+
+echo " + Making copy of source tree in scratch dir..."
+cp -R . $CPDIR/
+echo " + Deleting cruft..."
+pushd $CPDIR >/dev/null && rm -rf `svn propget svn:ignore .` && popd >/dev/null
+rm -rf `find $CPDIR -type d -name '.svn'`
+echo " + Deleting Subversion metadata..."
+rm -rf `find $CPDIR -type d -name '.svn'`
+echo " + Fixing up permissions..."
+chmod -R a+rw $CPDIR
+chmod a+x `find $CPDIR -type d`
+echo " + Building final tarball..."
+rm -f $TARBALL
+tar -czf $TARBALL -C $TMPCPDIR $BASENAME
+echo " + Cleaning up..."
+rm -rf $TMPCPDIR
+echo " + All done! Packed to '$TARBALL' ..."
+set +e
+
+exit 0
+