Skip to content

Commit

Permalink
Packaging/windows (#64)
Browse files Browse the repository at this point in the history
* MSI and DMG packages built
  • Loading branch information
Bekreth authored Apr 13, 2024
1 parent 283dfc7 commit 18ab884
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ lfs-s3
lfs-s3.sh
.envrc
.aws-config

*.swp
*.swo

output/
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include makefiles/common.mk
include makefiles/windows.mk

clean:
rm -rf ${OUTPUT}

${OUTPUT}/:
@mkdir $@

msi: ${WINDOWS}/${PROJECT}_${TAG}.msi
16 changes: 16 additions & 0 deletions makefiles/common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROJECT=lfs-s3
GO_FILE=$(shell find . -type f -name "*.go")
TAG=$(shell git describe --tags | sed 's|^v||' | sed 's|\(\.*\)-.*|\1|')
COMPILE_COMMAND=go build -ldflags="-X main.Version=${TAG}"

OUTPUT=output
PACKAGE_FILES=package_files

.variables:
@echo PROJECT : ${PROJECT}
@echo GO_FILE : ${GO_FILE}
@echo TAG : ${TAG}
@echo COMPILE_COMMAND : ${COMPILE_COMMAND}
@echo OUTPUT : ${OUTPUT}
@echo WINDOWS : ${WINDOWS}

28 changes: 28 additions & 0 deletions makefiles/windows.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
WINDOWS=${OUTPUT}/windows
MSI_PACKAGER=windows_msi.xml

## Windows Packing
${WINDOWS}/: | ${OUTPUT}/
@mkdir $@

${WINDOWS}/${PROJECT}.exe: ${GO_FILES} | ${WINDOWS}/
@GOOS=windows GOARCH=amd64 ${COMPILE_COMMAND} -o $@ .

${WINDOWS}/${PROJECT}.wxs: packaging/windows/windows_msi.xml | ${WINDOWS}/
@cat $< | sed 's|$$VERSION|${TAG}|' > $@

${WINDOWS}/${PROJECT}.wixobj: ${WINDOWS}/${PROJECT}.wxs ${WINDOWS}/${PROJECT}.exe
@echo Building wixobj
@docker run --rm \
-v $(shell pwd)/output/windows:/wix dactiv/wix candle \
${PROJECT}.wxs

${WINDOWS}/${PROJECT}_${TAG}.msi: ${WINDOWS}/${PROJECT}.wixobj
@echo Building msi
@docker run --rm \
-v $(shell pwd)/output/windows:/wix \
dactiv/wix light \
${<F} -sval -out ${@F}



67 changes: 67 additions & 0 deletions packaging/windows/windows_msi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Name='lfs-s3'
Manufacturer='Nicolas Graves'
Id='3f3987e3-b185-429a-86b3-00dd0ad27df1'
UpgradeCode='98543bff-32f7-4ee9-ad4f-47697e2723b2'
Language='4105'
Codepage='1252'
Version='$VERSION'
>
<Package
Id='*'
Keywords='Installer'
Description="An additional plugin for git-lfs to put lfs tracked files into an s3 bucket"
Comments='comments'
Manufacturer='Nicolas Graves'
InstallerVersion='100'
Languages='4105'
Compressed='yes'
SummaryCodepage='1252'
/>

<Media
Id='1'
Cabinet='Sample.cab'
EmbedCab='yes'
DiskPrompt="CD-ROM #1"
/>
<Property
Id='DiskPrompt'
Value="Installation for lfs-s3 $VERSION"
/>

<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='INSTALLDIR' Name='lfs-s3'>

<Component Id='MainExecutable' Guid='c3ad1815-0a99-4fa3-bc84-1ff2c03922ff'>
<File
Id='lfs_s3'
Name='lfs-s3.exe'
DiskId='1'
Source='lfs-s3.exe'
KeyPath='yes'
>
</File>
<Environment
Id="PATH"
Name="PATH"
Value="[INSTALLDIR]"
Permanent="yes"
Action="create"
System="yes"
/>
</Component>

</Directory>
</Directory>
</Directory>

<Feature Id='Complete' Level='1'>
<ComponentRef Id='MainExecutable' />
</Feature>
</Product>
</Wix>

0 comments on commit 18ab884

Please sign in to comment.