summaryrefslogtreecommitdiffstats
path: root/Templates
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2007-10-30 01:10:49 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2007-10-30 01:10:49 (GMT)
commitbcfa890c024c6ebcf274e0e651e80a69f772c2a5 (patch)
treeed1cb0e104144c3669b2a54d38fc4cefcd77a557 /Templates
parent1904b3f86e2ee3cebda9e2deebcd8f75b9de079d (diff)
downloadCMake-bcfa890c024c6ebcf274e0e651e80a69f772c2a5.zip
CMake-bcfa890c024c6ebcf274e0e651e80a69f772c2a5.tar.gz
CMake-bcfa890c024c6ebcf274e0e651e80a69f772c2a5.tar.bz2
ENH: add package script for cmake project
Diffstat (limited to 'Templates')
-rwxr-xr-xTemplates/cygwin-package.sh.in101
1 files changed, 101 insertions, 0 deletions
diff --git a/Templates/cygwin-package.sh.in b/Templates/cygwin-package.sh.in
new file mode 100755
index 0000000..989446c
--- /dev/null
+++ b/Templates/cygwin-package.sh.in
@@ -0,0 +1,101 @@
+# this is a sample shell script used for building a cmake
+# based project for a cygwin setup package.
+
+# get the current directory
+TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd`
+
+# create build directory
+mkdirs()
+{
+ (
+ mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build"
+ )
+}
+
+# cd into
+# untar source tree and apply patch
+prep()
+{
+ (
+ cd "$TOP_DIR" &&
+ tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2
+ patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" &&
+ mkdirs
+ )
+}
+
+# configure the build tree in .build directory
+# of the source tree
+conf()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ cmake ..
+ )
+}
+
+# build the package in the .build directory
+build()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ make &&
+ make test
+ )
+}
+
+# clean the build tree
+clean()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ make clean
+ )
+}
+
+# create the package
+pkg()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ cpack &&
+ mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR"
+ )
+}
+
+# create the source package
+spkg()
+{
+ (
+ cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
+ cpack --config CPackSourceConfig.cmake &&
+ mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR"
+ )
+}
+
+# clean up
+finish()
+{
+ (
+ rm -rf "@CPACK_PACKAGE_FILE_NAME@"
+ )
+}
+
+case $1 in
+ prep) prep ; STATUS=$? ;;
+ mkdirs) mkdirs ; STATUS=$? ;;
+ conf) conf ; STATUS=$? ;;
+ build) build ; STATUS=$? ;;
+ clean) clean ; STATUS=$? ;;
+ package) pkg ; STATUS=$? ;;
+ pkg) pkg ; STATUS=$? ;;
+ src-package) spkg ; STATUS=$? ;;
+ spkg) spkg ; STATUS=$? ;;
+ finish) finish ; STATUS=$? ;;
+ all) (
+ prep && conf && build && pkg && spkg && finish ;
+ STATUS=$?
+ ) ;;
+ *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;;
+esac
+exit ${STATUS}