Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Templates / cygwin-package.sh.in
blob989446c581217a334a1f41efb566152b13e477a4
1 # this is a sample shell script used for building a cmake
2 # based project for a cygwin setup package.
4 # get the current directory
5 TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd`
7 # create build directory
8 mkdirs()
11 mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build"
15 # cd into
16 # untar source tree and apply patch
17 prep()
20 cd "$TOP_DIR" &&
21 tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2
22 patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" &&
23 mkdirs
27 # configure the build tree in .build directory
28 # of the source tree
29 conf()
32 cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
33 cmake ..
37 # build the package in the .build directory
38 build()
41 cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
42 make &&
43 make test
47 # clean the build tree
48 clean()
51 cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
52 make clean
56 # create the package
57 pkg()
60 cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
61 cpack &&
62 mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR"
66 # create the source package
67 spkg()
70 cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
71 cpack --config CPackSourceConfig.cmake &&
72 mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR"
76 # clean up
77 finish()
80 rm -rf "@CPACK_PACKAGE_FILE_NAME@"
84 case $1 in
85 prep) prep ; STATUS=$? ;;
86 mkdirs) mkdirs ; STATUS=$? ;;
87 conf) conf ; STATUS=$? ;;
88 build) build ; STATUS=$? ;;
89 clean) clean ; STATUS=$? ;;
90 package) pkg ; STATUS=$? ;;
91 pkg) pkg ; STATUS=$? ;;
92 src-package) spkg ; STATUS=$? ;;
93 spkg) spkg ; STATUS=$? ;;
94 finish) finish ; STATUS=$? ;;
95 all) (
96 prep && conf && build && pkg && spkg && finish ;
97 STATUS=$?
98 ) ;;
99 *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;;
100 esac
101 exit ${STATUS}