Skip to content
This repository
Browse code

Example Makefile for building an MSI package with WiX, loosely based …

…on examples found in various online sources
  • Loading branch information...
commit c959de7325596eb557fe515dc55d4391a1437b6f 1 parent 5d3d1a7
d_pocock authored

Showing 2 changed files with 260 additions and 0 deletions. Show diff stats Hide diff stats

  1. +66 0 Makefile.WiX
  2. +194 0 WiX/ganglia-gmond.wxs
66 Makefile.WiX
... ... @@ -0,0 +1,66 @@
  1 +
  2 +#
  3 +# Use this file for building a Windows (MSI) package
  4 +# after compiling the binaries in Cygwin
  5 +#
  6 +# The build machine must have WiX 3.0 installed
  7 +#
  8 +# Use the command:
  9 +#
  10 +# make -f Makefile.WiX
  11 +#
  12 +# and gmond.msi will be produced in the project root dir
  13 +#
  14 +
  15 +MSI=gmond
  16 +SRCS=WiX/ganglia-gmond.wxs
  17 +
  18 +WIX_IND=
  19 +#WIX_INC=-Ic:\\WiX\\Templates
  20 +
  21 +OBJS=$(SRCS:.wxs=.wixobj)
  22 +CANDLE=candle.exe
  23 +LIGHT=light.exe
  24 +srcdir?=
  25 +VPATH = $(srcdir).:.
  26 +RM ?= del
  27 +
  28 +# Uncomment this if you have a custom action script:
  29 +#CUST_VBS=WiX/gen_config.vbs
  30 +
  31 +# Uncomment these two lines if you want to try Python, although
  32 +# more stuff probably needs to be bundled in to make it work:
  33 +#PYTHON_DEP= /bin/cygcrypto-0.9.8.dll /bin/cygcurl-4.dll /bin/cygssh2-1.dll \
  34 +# /bin/cygssl-0.9.8.dll /bin/cygz.dll /bin/libpython2.5.dll
  35 +
  36 +DEPFILES= gmond/gmond.exe \
  37 + WiX/gmond.conf \
  38 + /bin/cygwin1.dll \
  39 + /bin/cygrunsrv.exe \
  40 + $(PYTHON_DEP) $(CUST_VBS)
  41 +
  42 +VERSION ?= unknown
  43 +MSIVERSION ?= 0.0.0.0
  44 +
  45 +WFLAGS= -dVERSION="$(VERSION)" -dMSIVERSION="$(MSIVERSION)" -dsrcdir="$(srcdir)" $(WIX_INC) -ext WixUtilExtension
  46 +
  47 +.SUFFIXES: .wxs .wixobj
  48 +
  49 +all: $(MSI).msi
  50 +
  51 +$(MSI).msi: $(OBJS) $(DEPFILES)
  52 + $(LIGHT) -nologo $(WFLAGS) -out $@ $(OBJS)
  53 +
  54 +.wxs.wixobj:
  55 + $(CANDLE) -nologo $(WFLAGS) -out $@ $^
  56 +
  57 +clean:
  58 + $(RM) $(MSI).msi $(OBJS)
  59 +
  60 +install: $(MSI).msi
  61 + $(RM) install.log
  62 + msiexec -i $(MSI).msi -l*v install.log
  63 +
  64 +uninstall:
  65 + msiexec -x $(MSI).msi
  66 +
194 WiX/ganglia-gmond.wxs
... ... @@ -0,0 +1,194 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Wix
  3 + xmlns="http://schemas.microsoft.com/wix/2006/wi"
  4 + xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
  5 + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
  6 + xmlns:cp="http://schemas.microsoft.com/wix/ComPlusExtension">
  7 +
  8 + <!-- This file is a sample, proper GUIDs must be inserted or it won't work
  9 + Just search for GUID or Guid, find every instance in the file, and insert
  10 + an appropriate value -->
  11 +
  12 + <?define upgradeCode= "GUID XXX" ?>
  13 +
  14 + <Product UpgradeCode="$(var.upgradeCode)" Manufacturer="Ganglia community" Id="GUID" Language="1033" Name="Ganglia gmond agent" Version="3.1.0">
  15 + <Package Keywords="Installer,MSI,Database" Description="Performance monitoring agent" Comments="Open source" Manufacturer="Ganglia community" InstallerVersion="200" Platform="intel" Languages="1033" Compressed="yes" SummaryCodepage="1252" ReadOnly="no" />
  16 +
  17 + <Upgrade Id="$(var.upgradeCode)">
  18 + <UpgradeVersion Property="OLDAPPFOUND" IncludeMinimum="yes" Minimum="0.0.0.0" IncludeMaximum="no" Maximum="3.1.0" MigrateFeatures="yes"/>
  19 + </Upgrade>
  20 + <!-- Repeat the code below for each old upgradecode you have used, if any -->
  21 + <!-- <Upgrade Id="OTHER - UPGRADECODE - HERE">
  22 + <UpgradeVersion Property="VERYOLDAPPFOUND" IncludeMinimum="yes" Minimum="0.0.0.0" IncludeMaximum="no" Maximum="3.1.0" MigrateFeatures="yes"/>
  23 + </Upgrade> -->
  24 +
  25 + <DirectoryRef Id="TARGETDIR">
  26 + <Component Id="REG_MACHINE" Guid="GUID HERE">
  27 + <RegistryKey Id="srvc1" Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\gmond\Parameters" Action="create">
  28 + <RegistryValue Type="expandable" Name="AppPath" Value="[#gmond.exe]"/>
  29 + <RegistryValue Type="string" Name="AppArgs" Value="-p '[$var]gmond.pid' -c '[#gmond.conf]'"/>
  30 + <RegistryValue Type="integer" Name="NeverExits" Value="1"/>
  31 + <RegistryValue Type="expandable" Name="PidFile" Value="[$var]gmond.pid"/>
  32 + </RegistryKey>
  33 + <!-- <RegistryKey Id="srvc2" Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\gmond\Parameters\Environment" Action="create">
  34 + <RegistryValue Type="string" Name="EXAMPLE_ENV" Value="[$var]example.txt"/>
  35 + </RegistryKey> -->
  36 + </Component>
  37 + </DirectoryRef>
  38 +
  39 + <DirectoryRef Id="INSTALLDIR">
  40 + <Component Id="FOLDER_INSTALLDIR" Guid="GUID HERE" KeyPath="yes">
  41 + <RemoveFolder Id="RemoveApplicationsFolder" Directory="Applications" On="uninstall" />
  42 + <RemoveFolder Id="RemoveAppDataFolder" Directory="AppDataFolder" On="uninstall" />
  43 + </Component>
  44 +
  45 + <Directory Id="GANGLIAHOME" Name="ganglia-3.1">
  46 +
  47 + <Directory Id="sbin" Name="sbin">
  48 + </Directory>
  49 +
  50 + <Directory Id="etc" Name="etc">
  51 + <Directory Id="conf.d" Name="conf.d">
  52 + </Directory>
  53 + </Directory>
  54 +
  55 + <Directory Id="var" Name="var">
  56 + </Directory>
  57 +
  58 + <Directory Id="lib" Name="lib">
  59 + <Directory Id="python_modules" Name="python_modules">
  60 + </Directory>
  61 + </Directory>
  62 +
  63 + </Directory>
  64 + </DirectoryRef>
  65 +
  66 + <DirectoryRef Id="sbin">
  67 + <Component Id="cygwin1.dll" Guid="GUID HERE">
  68 + <File Id="cygwin1.dll" Source="c:\cygwin17\bin\cygwin1.dll" KeyPath="yes" Checksum="yes"/>
  69 + </Component>
  70 + </DirectoryRef>
  71 +
  72 + <!-- for Python -->
  73 + <!-- <DirectoryRef Id="sbin">
  74 + <Component Id="cygcrypto_0.9.8.dll" Guid="GUID HERE">
  75 + <File Id="cygcrypto_0.9.8.dll" Source="c:\cygwin17\bin\cygcrypto-0.9.8.dll" KeyPath="yes" Checksum="yes"/>
  76 + </Component>
  77 + </DirectoryRef>
  78 +
  79 + <DirectoryRef Id="sbin">
  80 + <Component Id="cygcurl_4.dll" Guid="">
  81 + <File Id="cygcurl_4.dll" Source="c:\cygwin17\bin\cygcurl-4.dll" KeyPath="yes" Checksum="yes"/>
  82 + </Component>
  83 + </DirectoryRef>
  84 +
  85 + <DirectoryRef Id="sbin">
  86 + <Component Id="cygssh2_1.dll" Guid="">
  87 + <File Id="cygssh2_1.dll" Source="c:\cygwin17\bin\cygssh2-1.dll" KeyPath="yes" Checksum="yes"/>
  88 + </Component>
  89 + </DirectoryRef>
  90 +
  91 + <DirectoryRef Id="sbin">
  92 + <Component Id="cygssl_0.9.8.dll" Guid="">
  93 + <File Id="cygssl_0.9.8.dll" Source="c:\cygwin17\bin\cygssl-0.9.8.dll" KeyPath="yes" Checksum="yes"/>
  94 + </Component>
  95 + </DirectoryRef>
  96 +
  97 + <DirectoryRef Id="sbin">
  98 + <Component Id="cygz.dll" Guid="">
  99 + <File Id="cygz.dll" Source="c:\cygwin17\bin\cygz.dll" KeyPath="yes" Checksum="yes"/>
  100 + </Component>
  101 + </DirectoryRef>
  102 +
  103 + <DirectoryRef Id="sbin">
  104 + <Component Id="libpython2.5.dll" Guid="">
  105 + <File Id="libpython2.5.dll" Source="c:\cygwin17\bin\libpython2.5.dll" KeyPath="yes" Checksum="yes"/>
  106 + </Component>
  107 + </DirectoryRef> -->
  108 +
  109 + <DirectoryRef Id="sbin">
  110 + <Component Id="cygrunsrv.exe" Guid="">
  111 + <File Id="cygrunsrv.exe" Source="c:\cygwin\bin\cygrunsrv.exe" Name="cygrunsrv.exe" KeyPath="yes" Checksum="yes"/>
  112 + <ServiceInstall Id="cygrunsrv.exe" Name="gmond" DisplayName="gmond" ErrorControl="normal" Type="ownProcess" Start="auto" Interactive="no">
  113 + <ServiceDependency Id="LanmanWorkstation"/>
  114 + </ServiceInstall>
  115 + <ServiceControl Id="gmond1" Remove="uninstall" Stop="both" Name="gmond" Start="install" Wait="no"/>
  116 + <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" ResetPeriodInDays="1" RestartServiceDelayInSeconds="1" ServiceName="gmond"/>
  117 + </Component>
  118 + </DirectoryRef>
  119 +
  120 + <DirectoryRef Id="sbin">
  121 + <Component Id="gmond.exe" Guid="">
  122 + <File Id="gmond.exe" Source="gmond\gmond.exe" KeyPath="yes" Checksum="yes"/>
  123 + </Component>
  124 + </DirectoryRef>
  125 +
  126 + <DirectoryRef Id="etc">
  127 + <Component Id="gmond.conf" Guid="">
  128 + <File Id="gmond.conf" Source="WiX\gmond.conf" KeyPath="yes" Checksum="yes"/>
  129 + </Component>
  130 + </DirectoryRef>
  131 +
  132 + <DirectoryRef Id="conf.d">
  133 + <Component Id="modpython.conf" Guid="">
  134 + <File Id="modpython.conf" Source="WiX\modpython.conf" KeyPath="yes" Checksum="yes"/>
  135 + </Component>
  136 + </DirectoryRef>
  137 +
  138 + <DirectoryRef Id="var">
  139 + <Component Id="var" Guid="">
  140 + <CreateFolder/>
  141 + </Component>
  142 + <Component Id="gmond.pid" Guid="">
  143 + <RemoveFile Id="gmond.pid" Name="gmond.pid" On="both"/>
  144 + </Component>
  145 + </DirectoryRef>
  146 +
  147 + <DirectoryRef Id="lib">
  148 + <Component Id="lib" Guid="">
  149 + <CreateFolder/>
  150 + </Component>
  151 + </DirectoryRef>
  152 +
  153 + <DirectoryRef Id="python_modules">
  154 + <Component Id="python_modules" Guid="">
  155 + <CreateFolder/>
  156 + </Component>
  157 + </DirectoryRef>
  158 +
  159 + <!--FEATURES -->
  160 + <Feature Id="Complete" Title="Complete" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="system">
  161 + <Feature Id="Core" Title="Core Files" Description="Core files for Ganglia" Display="hidden" Level="1" ConfigurableDirectory="INSTALLDIR" InstallDefault="followParent" Absent="disallow" AllowAdvertise="system">
  162 + <ComponentRef Id="REG_MACHINE" />
  163 + <ComponentRef Id="FOLDER_INSTALLDIR" />
  164 + <ComponentRef Id="cygwin1.dll"/>
  165 + <!-- For Python
  166 + <ComponentRef Id="cygcrypto_0.9.8.dll"/>
  167 + <ComponentRef Id="cygcurl_4.dll"/>
  168 + <ComponentRef Id="cygssh2_1.dll"/>
  169 + <ComponentRef Id="cygssl_0.9.8.dll"/>
  170 + <ComponentRef Id="cygz.dll"/>
  171 + <ComponentRef Id="libpython2.5.dll"/> -->
  172 + <ComponentRef Id="cygrunsrv.exe"/>
  173 + <ComponentRef Id="gmond.exe"/>
  174 + <ComponentRef Id="gmond.conf"/>
  175 + <ComponentRef Id="modpython.conf"/>
  176 + <ComponentRef Id="var"/>
  177 + <ComponentRef Id="gmond.pid"/>
  178 + <ComponentRef Id="lib"/>
  179 + <ComponentRef Id="python_modules"/>
  180 + </Feature>
  181 + </Feature>
  182 +
  183 + <!-- Uncomment if using a custom action (e.g. to generate some config files)
  184 + <InstallExecuteSequence>
  185 + <Custom Action="gmond_SetPropertyForGenConfig" After="InstallFiles"/>
  186 + <Custom Action="gmond_gen_config" After="gmond_SetPropertyForGenConfig"/>
  187 + </InstallExecuteSequence>
  188 +
  189 + <Binary Id='gen_config.vbs' SourceFile='WiX\gen_config.vbs'/>
  190 + <CustomAction Id='gmond_SetPropertyForGenConfig' Property="gmond_gen_config" Value="[conf.d]"/>
  191 + <CustomAction Id='gmond_gen_config' BinaryKey='gen_config.vbs' VBScriptCall='gen' Return='check' Execute='deferred'/> -->
  192 +
  193 + </Product>
  194 +</Wix>

0 comments on commit c959de7

Please sign in to comment.
Something went wrong with that request. Please try again.