-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
makeMsi.sh
149 lines (135 loc) · 4.95 KB
/
makeMsi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Build an MSI installer from a compiled SciDAVis
# Must be run from the toplevel directory of SciDAVis
PATH=$PATH:/c/cygwin/bin
productId=`uuidgen`
componentId=`uuidgen`
version=`grep scidavis_version libscidavis/src/version.cpp|tail -1|cut -f5 -d' '|tr -d '";'`
if [ $version = '"unknown"' ]; then
version=0.0.0.0
fi
scidavisWxs=`pwd`/scidavis.wxs
msiVersion=`echo $version|tr -d D`
# determine release or beta depending of whether a D appears in the second field
upgradeId=d6f4ef98-3744-47a2-b581-d789db8a4d63
productName=SciDAVis
echo $version
cat >$scidavisWxs <<EOF
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='$productName' Id='$productId' UpgradeCode='$upgradeId'
Language='1033' Codepage='1252' Version='$msiVersion' Manufacturer='High Performance Coders'>
<Package Id='*' Keywords='Installer' Description="SciDAVis Installer"
Comments='SciDAVis is licensed under GPL2' Manufacturer='High Performance Coders'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Upgrade Id='$upgradeId'>
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.0' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='no' />
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts Before='InstallInitialize'/>
</InstallExecuteSequence>
<Media Id='1' Cabinet='scidavis.cab' EmbedCab='yes'/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder'>
<Directory Id='SciDAVis' Name='$productName'>
<Directory Id='INSTALLDIR'>
<Component Id='SciDAVisFiles' Guid='$componentId'>
<File Id='SciDAVisEXE' Name='scidavis.exe' Source='scidavis/scidavis.exe' KeyPath='yes'>
<Shortcut Id="startmenuSciDAVis" Directory="ProgramMenuDir" Name="$productName" WorkingDirectory='INSTALLDIR' Icon="scidavis.exe" IconIndex="0" Advertise="yes">
</Shortcut>
<Shortcut Id="desktopScidavis" Directory="DesktopFolder" Name="$productName" WorkingDirectory='INSTALLDIR' Icon="scidavis.exe" IconIndex="0" Advertise="yes" />
</File>
<ProgId Id='SciPrj' Description='SciDAVis Project File' Icon='SciDAVisEXE'>
<Extension Id='sciprj' ContentType='application/scidavis'>
<Verb Id='open' Command='Open' TargetFile='SciDAVisEXE' Argument='"%1"'/>
</Extension>
</ProgId>
EOF
pushd scidavis
id=0
fid=0
# add in plain files
for i in appicons.qrc icons.qrc scidavis.rc; do
if [ ! -d $i ]; then
let fid++
cat >>$scidavisWxs <<EOF
<File Id='fid$fid' Source='scidavis/$i' Name='$i' KeyPath='no' />
EOF
fi
done
echo " </Component>">> $scidavisWxs
builddir ()
{
dir=${1##*/}
pushd $dir
let d++
echo "<Directory Id='id$d' Name='$dir'>" >>$scidavisWxs
# first process files into a single component
j=0
for i in *; do
if [ -f $i ]; then
let fid++
if [ $j -eq 0 ]; then
let id++
echo "<Component Id='id$id' Guid='`uuidgen`'>">>$scidavisWxs
echo "<File Id='fid$fid' Source='scidavis/$1/$i' Name='$i' KeyPath='yes' />">>$scidavisWxs
else
echo "<File Id='fid$fid' Source='scidavis/$1/$i' Name='$i' KeyPath='no' />">>$scidavisWxs
fi
let j++
fi
done
if [ $j -gt 0 ]; then
echo "</Component>">>$scidavisWxs
fi
# then process subdirectories
for i in *; do
if [ -d $i ]; then
builddir $1/$i
fi
done
echo "</Directory>">>$scidavisWxs
popd
}
builddir translations
builddir icons
popd
cat >>$scidavisWxs <<EOF
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$productName">
<Component Id="ProgramMenuDir" Guid="40e1115c-9edf-4ae9-b4d3-6508f1921f51">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='SciDAVisFiles' />
<ComponentRef Id='ProgramMenuDir' />
EOF
i=0
while [ $i -lt $id ]; do
let i++
echo "<ComponentRef Id='id$i' />">>$scidavisWxs
done
cat >>$scidavisWxs <<EOF
</Feature>
<Icon Id="scidavis.exe" SourceFile="scidavis/scidavis.exe" />
<UI>
<UIRef Id='WixUI_InstallDir'/>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
</Product>
</Wix>
EOF
candle scidavis.wxs
echo "light scidavis.wixobj"
light -ext WixUIExtension -dWixUILicenseRtf=license.rtf scidavis.wixobj
signtool sign -t http://timestamp.sectigo.com scidavis.msi
mv scidavis.msi scidavis.$version-win-dist.msi