| 1 | #!/bin/sh |
| 2 | |
| 3 | # Make a distribution of Tex2RTF for Unix |
| 4 | # Julian Smart 2002-08-07 |
| 5 | # Usage: maketarball.sh wx-dir bin-file deliver-dir version-no [ options ] |
| 6 | # For example: maketarball.sh ~/wx2dev/wxWindows /bin/tex2rtf /tmp/tex2rtf-deliver |
| 7 | # Where: |
| 8 | # wx-dir is the wxWindows source tree |
| 9 | # bin-file is the Tex2RTF binary, already compiled |
| 10 | # deliver-dir is the directory the distribution will be put in |
| 11 | # version-no is the version, e.g. 2.01 |
| 12 | |
| 13 | TEX2RTFDIR=$1/utils/tex2rtf |
| 14 | SRC=$TEX2RTFDIR/src |
| 15 | BINARYSRC=$2 |
| 16 | DEST=$3 |
| 17 | BUILD=0 |
| 18 | UPX=0 |
| 19 | PROGNAME=$0 |
| 20 | VERSION=$4 |
| 21 | |
| 22 | dotar() |
| 23 | { |
| 24 | # Make the documentation first |
| 25 | cd $TEX2RTFDIR/docs |
| 26 | make htb |
| 27 | |
| 28 | rm -f -r $DEST/tex2rtf-*.* |
| 29 | |
| 30 | mkdir -p $DEST/tex2rtf-$VERSION |
| 31 | mkdir -p $DEST/tex2rtf-$VERSION/tools |
| 32 | mkdir -p $DEST/tex2rtf-$VERSION/docs |
| 33 | mkdir -p $DEST/tex2rtf-$VERSION/html |
| 34 | |
| 35 | # Make the source archive |
| 36 | cd $TEX2RTFDIR |
| 37 | ls `cat $TEX2RTFDIR/distrib/src.rsp` > /tmp/tex2rtf.txt |
| 38 | tar cvf $DEST/tex2rtf-$VERSION/tex2rtf-$VERSION-source.tar -T /tmp/tex2rtf.txt |
| 39 | gzip $DEST/tex2rtf-$VERSION/tex2rtf-$VERSION-source.tar |
| 40 | rm /tmp/tex2rtf.txt |
| 41 | |
| 42 | cd $DEST/tex2rtf-$VERSION |
| 43 | |
| 44 | # Copy the binary and other files |
| 45 | cp $BINARYSRC tex2rtf |
| 46 | cp $TEX2RTFDIR/docs/readme.txt readme.txt |
| 47 | cp $TEX2RTFDIR/docs/licence.txt . |
| 48 | cp $TEX2RTFDIR/docs/gpl.txt . |
| 49 | cp $TEX2RTFDIR/docs/lgpl.txt . |
| 50 | cp $TEX2RTFDIR/docs/*.html $TEX2RTFDIR/docs/*.gif html |
| 51 | cp $TEX2RTFDIR/docs/tex2rtf.htb . |
| 52 | |
| 53 | # Copy all the doc sources, so that the user can experiment |
| 54 | # on the Tex2RTF docs |
| 55 | cp $TEX2RTFDIR/docs/*.tex $TEX2RTFDIR/docs/*.ini $TEX2RTFDIR/docs/*.sty $TEX2RTFDIR/docs/*.bib $TEX2RTFDIR/docs/*.gif $TEX2RTFDIR/docs/*.tex docs |
| 56 | |
| 57 | strip tex2rtf |
| 58 | |
| 59 | if [ "$UPX" != "0" ]; then |
| 60 | upx tex2rtf |
| 61 | fi |
| 62 | |
| 63 | cd .. |
| 64 | |
| 65 | tar cvf $DEST/tex2rtf-$VERSION-i386.tar tex2rtf-$VERSION/* |
| 66 | gzip -c $DEST/tex2rtf-$VERSION-i386.tar > $DEST/tex2rtf-$VERSION-i386.tar.gz |
| 67 | bzip2 -c $DEST/tex2rtf-$VERSION-i386.tar > $DEST/tex2rtf-$VERSION-i386.tar.bz2 |
| 68 | } |
| 69 | |
| 70 | usage() |
| 71 | { |
| 72 | echo Usage: $PROGNAME "wx-dir bin-file deliver-dir version-no [ options ]" |
| 73 | echo Options: |
| 74 | echo " --help Display this help message" |
| 75 | echo " --upx Compress executable with UPX" |
| 76 | echo For example: $PROGNAME ~/wx2dev/wxWindows /tmp/tex2rtf /tmp/tex2rtf-deliver 2.0 |
| 77 | exit 1 |
| 78 | } |
| 79 | |
| 80 | # Process command line options. |
| 81 | shift 4 |
| 82 | for i in "$@"; do |
| 83 | case "$i" in |
| 84 | --upx) UPX=1 ;; |
| 85 | *) |
| 86 | usage |
| 87 | exit |
| 88 | ;; |
| 89 | esac |
| 90 | done |
| 91 | |
| 92 | if [ ! -d "$DEST" ]; then |
| 93 | mkdir -p $DEST |
| 94 | fi |
| 95 | |
| 96 | if [ ! -d "$SRC" ]; then |
| 97 | echo Source directory $SRC not found. |
| 98 | usage |
| 99 | exit 1 |
| 100 | fi |
| 101 | |
| 102 | if [ ! -f "$BINARYSRC" ]; then |
| 103 | echo tex2rtf binary $BINARYSRC not found. |
| 104 | usage |
| 105 | exit 1 |
| 106 | fi |
| 107 | |
| 108 | if [ "$VERSION" = "" ]; then |
| 109 | echo Pass the version number as the fourth argument. |
| 110 | usage |
| 111 | exit 1 |
| 112 | fi |
| 113 | |
| 114 | echo Creating Version $VERSION distribution in $DEST, using source directory $SRC and tex2rtf binary $BINARYSRC. |
| 115 | |
| 116 | dotar |
| 117 | |
| 118 | echo Tex2RTF archived. |
| 119 | |