| 1 | #!/bin/sh |
| 2 | |
| 3 | # Make a distribution of an application on MSW. |
| 4 | # Example: |
| 5 | # ../distrib/msw/makesetup.sh --wxmsw --verbose &> log |
| 6 | |
| 7 | # If your zip accepts Cygwin-style paths, then |
| 8 | # use cygpath, else substitute echo |
| 9 | CYGPATHPROG=cygpath |
| 10 | #CYGPATHPROG=echo |
| 11 | |
| 12 | SPINMSW=0 |
| 13 | SPINOS2=0 |
| 14 | SPINDOCS=0 |
| 15 | SPINALL=0 |
| 16 | SPINWXALL=0 |
| 17 | SPINBASE=0 |
| 18 | GETMAKEFILES=0 |
| 19 | VERBOSE=0 |
| 20 | ZIPFLAGS= |
| 21 | |
| 22 | PROGNAME=$0 |
| 23 | |
| 24 | . $SCRIPTDIR/utils.inc |
| 25 | |
| 26 | MANIFESTDIR=$WXWIN/distrib/scripts/manifests |
| 27 | WEBFILES=$WXWIN/../wxWebSite |
| 28 | if [ ! "$CYGPATH" = "" ]; then |
| 29 | WEBFILES=`$CYGPATH "$WEBFILES"` |
| 30 | fi |
| 31 | |
| 32 | # Set this to the required version |
| 33 | if [ "$VERSION" = "" ]; then |
| 34 | VERSION=2.9.0 |
| 35 | fi |
| 36 | |
| 37 | getfilelist(){ |
| 38 | port=$1 |
| 39 | outfile=$2 |
| 40 | |
| 41 | filelist="base.rsp" |
| 42 | utilsfiles="tex2rtf.rsp utils.rsp utilmake.rsp" |
| 43 | commonfiles="generic.rsp generic_samples.rsp stc.rsp jpeg.rsp tiff.rsp xml.rsp makefile.rsp $utilsfiles" |
| 44 | |
| 45 | if [ ! $port = "base" ]; then |
| 46 | filelist="$filelist $commonfiles" |
| 47 | fi |
| 48 | |
| 49 | if [ $port = "msw" ] || [ $port = "all" ]; then |
| 50 | filelist="$filelist msw.rsp univ.rsp vc.rsp wince.rsp dmc.rsp" |
| 51 | fi |
| 52 | |
| 53 | if [ $port = "os2" ] || [ $port = "all" ]; then |
| 54 | filelist="$filelist os2.rsp" |
| 55 | fi |
| 56 | |
| 57 | if [ $port = "x11" ] || [ $port = "all" ]; then |
| 58 | filelist="$filelist univ.rsp x11.rsp" |
| 59 | fi |
| 60 | |
| 61 | if [ $port = "mgl" ] || [ $port = "all" ]; then |
| 62 | filelist="$filelist univ.rsp mgl.rsp" |
| 63 | fi |
| 64 | |
| 65 | if [ $port = "dfb" ] || [ $port = "all" ]; then |
| 66 | filelist="$filelist univ.rsp dfb.rsp" |
| 67 | fi |
| 68 | |
| 69 | if [ $port = "gtk" ] || [ $port = "all" ]; then |
| 70 | filelist="$filelist gtk.rsp" |
| 71 | fi |
| 72 | |
| 73 | if [ $port = "motif" ] || [ $port = "all" ]; then |
| 74 | filelist="$filelist motif.rsp" |
| 75 | fi |
| 76 | |
| 77 | if [ $port = "mac" ] || [ $port = "all" ]; then |
| 78 | filelist="$filelist mac.rsp cocoa.rsp" |
| 79 | fi |
| 80 | |
| 81 | if [ $port = "all" ]; then |
| 82 | filelist="$filelist gtk1.rsp palmos.rsp docsrc.rsp" |
| 83 | fi |
| 84 | |
| 85 | tempfile="/tmp/wx$port.files.in" |
| 86 | rm -f $outfile |
| 87 | |
| 88 | olddir=$PWD |
| 89 | cd $MANIFESTDIR |
| 90 | |
| 91 | cat $filelist > $outfile |
| 92 | |
| 93 | cd $olddir |
| 94 | } |
| 95 | |
| 96 | copyfilelist(){ |
| 97 | FILELIST=$1 |
| 98 | APPDIR=$2 |
| 99 | DESTDIR=$3 |
| 100 | |
| 101 | for line in `cat $FILELIST` ; do |
| 102 | if [ "$line" != "" ]; then |
| 103 | subdir=`dirname $line` |
| 104 | mkdir -p $DESTDIR/$subdir |
| 105 | cp -rf $APPDIR/$line $DESTDIR/$subdir |
| 106 | fi |
| 107 | done |
| 108 | } |
| 109 | |
| 110 | doinit() |
| 111 | { |
| 112 | if [ "$VERBOSE" != "1" ]; then |
| 113 | ZIPFLAGS=-q |
| 114 | fi |
| 115 | } |
| 116 | |
| 117 | dospinport(){ |
| 118 | port=$1 |
| 119 | |
| 120 | case "$port" in |
| 121 | all) |
| 122 | portname="Widgets";; |
| 123 | base) |
| 124 | portname="Base";; |
| 125 | motif) |
| 126 | portname="Motif";; |
| 127 | mac) |
| 128 | portname="Mac";; |
| 129 | *) |
| 130 | # for all the others (DFB, GTK, MGL, DFB, MSW, X11) just use the |
| 131 | # upper-case version as they are abbreviations |
| 132 | portname=`echo $port | tr '[a-z]' '[A-Z]'`;; |
| 133 | esac |
| 134 | |
| 135 | echo "Creating wx$portname distribution..." |
| 136 | |
| 137 | cd $APPDIR |
| 138 | portfiles="/tmp/wx$port.files" |
| 139 | getfilelist "$port" "$portfiles" |
| 140 | |
| 141 | TMPFILESDIR=/tmp/wx$port/wx$portname-$VERSION |
| 142 | rm -rf $TMPFILESDIR |
| 143 | mkdir -p $TMPFILESDIR |
| 144 | |
| 145 | copyfilelist $portfiles $APPDIR $TMPFILESDIR |
| 146 | |
| 147 | if [ $port = "msw" ]; then |
| 148 | FILES=`find . -type f \( -path '*/.svn/*' -prune -o -exec ${SCRIPTDIR}/is_text.sh {} \; -print \)` |
| 149 | echo "$FILES" > /tmp/textfiles |
| 150 | fi |
| 151 | |
| 152 | pushd /tmp/wx$port |
| 153 | # use DOS line endings for text files for MSW archives. |
| 154 | if [ $port = "msw" ]; then |
| 155 | pushd /tmp/wx$port/wx$portname-$VERSION |
| 156 | for file in `cat /tmp/textfiles`; do |
| 157 | unix2dos $file |
| 158 | done |
| 159 | popd |
| 160 | fi |
| 161 | echo "Creating wx$portname-$VERSION.zip..." |
| 162 | zip $ZIPFLAGS -r -9 $DIST_DIR/wx$portname-$VERSION.zip . |
| 163 | echo "Creating wx$portname-$VERSION.tar.gz..." |
| 164 | tar czf $DIST_DIR/wx$portname-$VERSION.tar.gz wx$portname-$VERSION |
| 165 | echo "Creating wx$portname-$VERSION.tar.bz2..." |
| 166 | tar ch wx$portname-$VERSION | bzip2 -f9 > $DIST_DIR//wx$portname-$VERSION.tar.bz2 |
| 167 | popd |
| 168 | rm -rf /tmp/wx$port |
| 169 | rm ${portfiles} |
| 170 | rm /tmp/textfiles |
| 171 | } |
| 172 | |
| 173 | prepareforrelease() |
| 174 | { |
| 175 | pushd $APPDIR |
| 176 | echo Copying FAQ and other files from $WEBFILES |
| 177 | cp $WEBFILES/site/faq*.htm $APPDIR/docs/html |
| 178 | cp $WEBFILES/site/platform.htm $APPDIR/docs/html |
| 179 | cp $WEBFILES/site/i18n.htm $APPDIR/docs/html |
| 180 | |
| 181 | echo Copying readme files... |
| 182 | cp $APPDIR/docs/msw/readme.txt README-MSW.txt |
| 183 | cp $APPDIR/docs/msw/install.txt INSTALL-MSW.txt |
| 184 | cp $APPDIR/docs/os2/install.txt INSTALL-OS2.txt |
| 185 | cp $APPDIR/docs/licence.txt LICENCE.txt |
| 186 | cp $APPDIR/docs/lgpl.txt COPYING.LIB |
| 187 | cp $APPDIR/docs/changes.txt CHANGES.txt |
| 188 | cp $APPDIR/docs/readme.txt README.txt |
| 189 | |
| 190 | cp $APPDIR/docs/mgl/readme.txt $APPDIR/readme-mgl.txt |
| 191 | cp $APPDIR/docs/mgl/install.txt $APPDIR/install-mgl.txt |
| 192 | |
| 193 | cp $APPDIR/docs/dfb/install.txt $APPDIR/install-dfb.txt |
| 194 | |
| 195 | cp $APPDIR/docs/x11/readme.txt $APPDIR/readme-x11.txt |
| 196 | cp $APPDIR/docs/x11/install.txt $APPDIR/install-x11.txt |
| 197 | |
| 198 | cp $APPDIR/docs/motif/readme.txt $APPDIR/readme-motif.txt |
| 199 | cp $APPDIR/docs/motif/install.txt $APPDIR/install-motif.txt |
| 200 | |
| 201 | cp $APPDIR/docs/gtk/readme.txt $APPDIR/readme-gtk.txt |
| 202 | cp $APPDIR/docs/gtk/install.txt $APPDIR/install-gtk.txt |
| 203 | |
| 204 | cp $APPDIR/docs/mac/readme.txt $APPDIR/readme-mac.txt |
| 205 | cp $APPDIR/docs/mac/install.txt $APPDIR/install-mac.txt |
| 206 | |
| 207 | cp $APPDIR/docs/cocoa/readme.txt $APPDIR/readme-cocoa.txt |
| 208 | cp $APPDIR/docs/cocoa/install.txt $APPDIR/install-cocoa.txt |
| 209 | |
| 210 | # Now delete a few files that are unnecessary |
| 211 | rm -f BuildSVN.txt descrip.mms |
| 212 | rm -f setup.h_vms |
| 213 | rm -f docs/html/wxbook.htm docs/html/roadmap.htm |
| 214 | rm -f src/mingegcs.bat |
| 215 | rm -f src/gtk/descrip.mms src/motif/descrip.mms |
| 216 | |
| 217 | # Copy setup0.h files to setup.h |
| 218 | # OS/2 always built with configure now |
| 219 | # cp $APPDIR/include/wx/os2/setup0.h $APPDIR/include/wx/os2/setup.h |
| 220 | cp $APPDIR/include/wx/msw/setup0.h $APPDIR/include/wx/msw/setup.h |
| 221 | cp $APPDIR/include/wx/univ/setup0.h $APPDIR/include/wx/univ/setup.h |
| 222 | |
| 223 | # Make MSW project files always have DOS line endings. |
| 224 | unix2dos `cat $MANIFESTDIR/vc.rsp` |
| 225 | |
| 226 | popd |
| 227 | } |
| 228 | |
| 229 | usage() |
| 230 | { |
| 231 | echo "Usage: $PROGNAME [ options ]" 1>&2 |
| 232 | echo Options: |
| 233 | echo " --help Display this help message" |
| 234 | echo " --wxmac Build wxMac distribution" |
| 235 | echo " --wxmsw Build wxMSW distribution" |
| 236 | echo " --wxos2 Build wxOS2 distribution" |
| 237 | echo " --wxall Build wxAll zip distribution" |
| 238 | echo " --wxbase Build wxBase zip distribution" |
| 239 | echo " --all Build all distributions (the default)" |
| 240 | echo " --verbose Verbose zip operation" |
| 241 | exit 1 |
| 242 | } |
| 243 | |
| 244 | # Process command line options. |
| 245 | |
| 246 | for i in "$@"; do |
| 247 | |
| 248 | case "$i" in |
| 249 | --wxmac) SPINMAC=1; SPINALL=0 ;; |
| 250 | --wxmsw) SPINMSW=1; SPINALL=0 ;; |
| 251 | --wxos2) SPINOS2=1; SPINALL=0 ;; |
| 252 | --wxall) SPINWXALL=1; SPINALL=0 ;; |
| 253 | --wxbase) SPINBASE=1; SPINALL=0 ;; |
| 254 | --getmakefiles) GETMAKEFILES=1; SPINALL=0 ;; |
| 255 | --docs) SPINDOCS=1; SPINALL=0 ;; |
| 256 | --all) SPINALL=1 ;; |
| 257 | --verbose) VERBOSE=1 ;; |
| 258 | *) |
| 259 | usage |
| 260 | exit |
| 261 | ;; |
| 262 | esac |
| 263 | done |
| 264 | |
| 265 | |
| 266 | doinit |
| 267 | prepareforrelease |
| 268 | |
| 269 | # Do OS/2 spin |
| 270 | if [ "$SPINOS2" = "1" ] || [ "$SPINALL" = "1" ]; then |
| 271 | dospinport "os2" |
| 272 | fi |
| 273 | |
| 274 | # Do MSW spin |
| 275 | if [ "$SPINMSW" = "1" ] || [ "$SPINALL" = "1" ]; then |
| 276 | dospinport "msw" |
| 277 | fi |
| 278 | |
| 279 | # Do wxBase spin |
| 280 | if [ "$SPINBASE" = "1" ] || [ "$SPINALL" = "1" ]; then |
| 281 | dospinport "base" |
| 282 | fi |
| 283 | |
| 284 | # Do wxAll spin |
| 285 | if [ "$SPINWXALL" = "1" ] || [ "$SPINALL" = "1" ]; then |
| 286 | dospinport "all" |
| 287 | fi |
| 288 | |
| 289 | if [ "$SPINALL" = "1" ]; then |
| 290 | dospinport "mgl" |
| 291 | dospinport "dfb" |
| 292 | dospinport "gtk" |
| 293 | dospinport "x11" |
| 294 | dospinport "motif" |
| 295 | dospinport "mac" |
| 296 | fi |
| 297 | |