]> git.saurik.com Git - wxWidgets.git/blob - utils/configtool/scripts/maketarball.sh
glibc's vswprintf doesn't nul terminate on truncation.
[wxWidgets.git] / utils / configtool / scripts / maketarball.sh
1 #!/bin/sh
2
3 # Make a distribution of ConfigTool for Linux
4 # Usage: maketarball.sh wxconfigtool-dir bin-dir deliver-dir version [ options ]
5 # For example: maketarball.sh ~/wxconfigtool /tmp/build-wxconfigtool /tmp/wxconfigtool-deliver 1.40
6
7 APPDIR=$1
8 SRC=$APPDIR/src
9 BINARYSRC=$2
10 DEST=$3
11 BUILD=0
12 UPX=0
13 PROGNAME=$0
14
15 # Set this to the required version
16 VERSION=$4
17
18 dotar()
19 {
20 rm -f -r $DEST/wxconfigtool*
21 rm -f $DEST/wxconfigtool-*.*
22
23 mkdir -p $DEST/wxconfigtool-$VERSION
24 mkdir -p $DEST/wxconfigtool-$VERSION/resources
25 mkdir -p $DEST/wxconfigtool-$VERSION/Sample
26 cd $DEST/wxconfigtool-$VERSION
27
28 # Copy readme files
29 cp $APPDIR/docs/readme.txt readme.txt
30 cp $APPDIR/docs/license.txt .
31
32 # Copy the application binary
33 cp $BINARYSRC/wxconfigtool .
34
35 # Copy the wxHTML Help manual file
36 cp $APPDIR/manual/configtool.htb .
37
38 # Copy the sample
39 cp -r $APPDIR/sample Sample
40 cp $APPDIR/resources/* resources
41
42 echo Removing junk from the samples folder...
43 rm -f -r Sample/CVS
44
45 # Copy the resources file
46 rm -f configtool.bin
47 zip configtool.bin -j resources/*
48
49 rm -f -r resources
50
51 # Remove any debug info from wxconfigtool
52 strip wxconfigtool
53
54 # Maybe compress the binary
55 if [ "$UPX" != "0" ]; then
56 upx wxconfigtool
57 fi
58
59 cd ..
60
61 # Make .tar.gz and .tar.bz2 archives
62 tar cvf $DEST/wxconfigtool-$VERSION-i386.tar wxconfigtool-$VERSION/*
63 gzip -c $DEST/wxconfigtool-$VERSION-i386.tar > $DEST/wxconfigtool-$VERSION-i386.tar.gz
64 bzip2 -c $DEST/wxconfigtool-$VERSION-i386.tar > $DEST/wxconfigtool-$VERSION-i386.tar.bz2
65 }
66
67 dobuild()
68 {
69 makeapp release full
70 }
71
72 usage()
73 {
74 echo Usage: $PROGNAME "cvs-dir bin-dir deliver-dir version-number [ options ]"
75 echo Options:
76 echo " --help Display this help message"
77 echo " --upx Compress executable with UPX"
78 echo " --build Invoke 'maketarball.sh release full' first"
79 echo For example: maketarball.sh ~/wxconfigtool /tmp/build-app /tmp/wxconfigtool-deliver 1.20
80 exit 1
81 }
82
83 # Process command line options.
84 shift 4
85 for i in "$@"; do
86 case "$i" in
87 --build) BUILD=1 ;;
88 --upx) UPX=1 ;;
89 *)
90 usage
91 exit
92 ;;
93 esac
94 done
95
96 if [ ! -d "$DEST" ]; then
97 mkdir -p $DEST
98 fi
99
100 if [ ! -d "$SRC" ]; then
101 echo Source directory $SRC not found.
102 usage
103 exit 1
104 fi
105
106 if [ ! -d "$BINARYSRC" ]; then
107 echo Location of wxconfigtool binary $BINARYSRC not found.
108 usage
109 exit 1
110 fi
111
112 if [ "$VERSION" = "" ]; then
113 echo Pass the version number as the fourth argument.
114 usage
115 exit 1
116 fi
117
118 echo Creating Version $VERSION distribution in $DEST, using source directory $SRC and wxconfigtool binary in $BINARYSRC.
119 #echo Press return to continue.
120 #read dummy
121
122 # Remove all existing files
123 if [ ! -d "$DEST/wxconfigtool" ]; then
124 rm -f -r $DEST/wxconfigtool
125 fi
126
127 # Skip INNO setup if INNO is 0.
128 if [ "$BUILD" = "1" ]; then
129 dobuild
130 fi
131
132 dotar
133
134 echo ConfigTool archived.
135