]> git.saurik.com Git - wxWidgets.git/blame - distrib/msw/makeinno.sh
Fix for probably rare but potential refcount leak.
[wxWidgets.git] / distrib / msw / makeinno.sh
CommitLineData
2ce79e48
JS
1#! /bin/sh
2# Make an Inno Setup distribution list, where files and dirs are represented by
3# sections like this:
4# [Dirs]
5# Name: {app}\backgrounds
6#
7# [Files]
8# Source: C:\program\setup\about.htm; DestDir: {app}\; DestName: about.htm
9#
10#
11# Usage: makeinno.sh sourcedir inno-topfile inno-bottomfile destfile
12# For example: makeinno.sh c:/project/allfiles c:/project/innotop.txt c:/project/innobott.txt c:/project/project.iss
13#
14
15PROGNAME=$0
16SOURCEDIR=$1
17TOPFILE=$2
18BOTTOMFILE=$3
19INNOFILE=$4
20TEMPDIR=/tmp
21
22dochecks()
23{
24 if [ "$SOURCEDIR" = "" ] || [ "$TOPFILE" = "" ] || [ "$BOTTOMFILE" = "" ] || [ "$INNOFILE" = "" ] ; then
25 usage
26 fi
27
28 if [ ! -d $SOURCEDIR ]; then
29 echo "Sorry, the source directory $SOURCEDIR does not exist."
30 usage
31 fi
32
33 if [ ! -f $TOPFILE ]; then
34 echo "Sorry, the Inno Setup header $TOPFILE does not exist."
35 usage
36 fi
37
38 if [ ! -f $BOTTOMFILE ]; then
39 echo "Sorry, the Inno Setup header $BOTTOMFILE does not exist."
40 usage
41 fi
42
43 if [ ! -d $TEMPDIR ]; then
44 mkdir $TEMPDIR
45 fi
46}
47
48doreplace()
49{
50 thefile=$1
51 theexpr=$2
52
53 if [ -f $thefile ]; then
54 sed -e "$theexpr" < $thefile > $thefile.tmp
55 mv $thefile.tmp $thefile
56 else
57 echo "*** $thefile not found."
58 fi
59}
60
61generateinno()
62{
63 # SRCDIR=`cygpath -u $SRCDIR`
64 # DESTDIR=`cygpath -u $DESTDIR`
65 # TEMPDIR=`cygpath -u $TEMP`
66
67
68 # Generate a list of all files in the distribution.
69 # We pass the output through sed in order to remove the preceding "./"
70 cd $SOURCEDIR
71 find . -print | sed -e "s/\.\\///g" > $TEMPDIR/files1.tmp
72
73 echo "[Dirs]" > $TEMPDIR/files2.tmp
74
75 for line in `cat $TEMPDIR/files1.tmp` ; do
76
77 # If a directory, add to file
78 if [ -d $line ] ; then
79 # The relative path
80 # TODO: make into DOS filename form
81 #line2=`cygpath -w $line`
82 line2=$line
83
84 echo " Name: {app}\\"$line2 >> $TEMPDIR/files2.tmp
85 fi
86 done
87
88 echo "" >> $TEMPDIR/files2.tmp
89 echo "[Files]" >> $TEMPDIR/files2.tmp
90
91 for line in `cat $TEMPDIR/files1.tmp` ; do
92
93 # If not a directory, add to file
94 if [ ! -d $line ] ; then
95 # The relative path
96 # TODO: make into DOS filename form
97 #line2=`cygpath -w $line`
98 line2=$line
99
100 # The absolute path
101 # TODO: make into DOS filename form
102 #line1=`cygpath -w $SOURCEDIR`"\\"$line2
103 line1=$SOURCEDIR"\\"$line2
104 #pathonly=`find $line -printf "%h"`
105 pathonly=`dirname $line`
106
107 echo " Source: "$line1"; DestDir: {app}\\"$pathonly >> $TEMPDIR/files2.tmp
108 fi
109 done
110
111 echo "" >> $TEMPDIR/files2.tmp
112
113 doreplace $TEMPDIR/files2.tmp "s/\//\\\/g"
114
115 # Concatenate the 3 sections
116 cat $TOPFILE $TEMPDIR/files2.tmp $BOTTOMFILE > $INNOFILE
117
118 rm -f $TEMPDIR/files1.tmp
119}
120
121usage()
122{
123 echo Usage: $PROGNAME sourcedir inno-topfile inno-bottomfile destfile
124 echo For example: $PROGNAME c:/project/allfiles c:/project/innotop.txt c:/project/innobott.txt c:/project/project.iss
125 echo Remember to use paths of the form c:/thing rather than /c/thing.
126 exit 1
127}
128
129dochecks
130generateinno
131
132