Use goversioninfo instead of windres to embed Windows resources

windres is not always present whereas goversioninfo is easy to install.

This also fixes the generation of resource.syso to be part of the
standard build script instead of only the AppVeyor CI build.

Finally, adapt update-version.sh to patch versioninfo.json.
This commit is contained in:
Sebastian Schuberth 2016-12-14 22:52:34 +01:00
parent b95bd408f6
commit a759a2fd05
7 changed files with 36 additions and 25 deletions

2
.gitignore vendored

@ -1,7 +1,7 @@
bin/
benchmark/
out/
resources.syso
resource.syso
# only allow man/*.\d.ronn files
man/*

@ -16,7 +16,6 @@ install:
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
build_script:
- C:\Ruby23\DevKit\mingw\bin\windres.exe script\windows-installer\resources.rc -o resources.syso
- bash --login -c 'GOARCH=386 script/bootstrap'
- mv bin\git-lfs.exe git-lfs-x86.exe
- bash --login -c 'GOARCH=amd64 script/bootstrap'

@ -1,3 +1,5 @@
//go:generate goversioninfo -icon=script/windows-installer/git-lfs-logo.ico
package main
import (

@ -14,6 +14,14 @@ if [ -z "$GOPATH" ]; then
ln -s "$GOPATH" src/github.com/git-lfs/git-lfs
fi
if uname -s | grep -q "_NT-"; then
echo "Installing goversioninfo to embed resources into Windows executables..."
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
export PATH=$PATH:$GOPATH/bin/windows_386
echo "Creating the resource.syso version information file..."
go generate
fi
script/fmt
rm -rf bin/*
GO15VENDOREXPERIMENT=1 go run script/*.go -cmd build "$@"

@ -1,20 +0,0 @@
main ICON "git-lfs-logo.ico"
1 VERSIONINFO
FILEVERSION 1,5,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */
BEGIN
VALUE "FileDescription", "Git LFS\0"
VALUE "ProductName", "Git Large File Storage (LFS)\0"
VALUE "ProductVersion", "1.5.0\0"
VALUE "LegalCopyright", "GitHub, Inc. and Git LFS contributors\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

@ -4,7 +4,8 @@ VERSION_STRING=$1
VERSION_ARRAY=( ${VERSION_STRING//./ } )
VERSION_MAJOR=${VERSION_ARRAY[0]}
VERSION_MINOR=${VERSION_ARRAY[1]}
VERSION_PATCH=${VERSION_ARRAY[2]}
VERSION_PATCH=${VERSION_ARRAY[2]:-0}
VERSION_BUILD=${VERSION_ARRAY[3]:-0}
# Update the version number git-lfs is reporting.
sed -i "s,\(Version = \"\).*\(\"\),\1$VERSION_STRING\2," config/version.go
@ -13,5 +14,8 @@ sed -i "s,\(Version = \"\).*\(\"\),\1$VERSION_STRING\2," config/version.go
sed -i "s,\(Version:[[:space:]]*\).*,\1$VERSION_STRING," rpm/SPECS/git-lfs.spec
# Update the version numbers in the Windows installer.
sed -i "s,\(FILEVERSION \).*,\1$VERSION_MAJOR\,$VERSION_MINOR\,$VERSION_PATCH\,0," script/windows-installer/resources.rc
sed -i "s,\([[:space:]]*VALUE \"ProductVersion\"\, \"\).*\(\\\\0\"\),\1$VERSION_STRING\2," script/windows-installer/resources.rc
sed -i "s,\(\"Major\": \).*\,,\1$VERSION_MAJOR\,," versioninfo.json
sed -i "s,\(\"Minor\": \).*\,,\1$VERSION_MINOR\,," versioninfo.json
sed -i "s,\(\"Patch\": \).*\,,\1$VERSION_PATCH\,," versioninfo.json
sed -i "s,\(\"Build\": \).*,\1$VERSION_BUILD," versioninfo.json
sed -i "s,\(\"ProductVersion\": \"\).*\(\"\),\1$VERSION_STRING\2," versioninfo.json

18
versioninfo.json Normal file

@ -0,0 +1,18 @@
{
"FixedFileInfo":
{
"FileVersion": {
"Major": 1,
"Minor": 5,
"Patch": 0,
"Build": 0
}
},
"StringFileInfo":
{
"FileDescription": "Git LFS",
"LegalCopyright": "GitHub, Inc. and Git LFS contributors",
"ProductName": "Git Large File Storage (LFS)",
"ProductVersion": "1.5.0"
}
}