Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing wix implementation for MSI builds #1131

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/pkg.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Packages

on:
push:
pull_request:
release:
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -78,7 +81,7 @@ jobs:

name: Package (Windows, ${{ matrix.pkgarch }})

runs-on: windows-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -89,6 +92,9 @@ jobs:
with:
go-version: "1.20"

- name: Set up msitools
run: sudo apt-get install wixl --yes

- name: Build package
run: sh contrib/msi/build-msi.sh ${{ matrix.pkgarch }}

Expand Down
33 changes: 7 additions & 26 deletions contrib/msi/build-msi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,17 @@

# Get arch from command line if given
PKGARCH=$1
if [ "${PKGARCH}" == "" ];
if [ "${PKGARCH}" = "" ];
then
echo "tell me the architecture: x86, x64, arm or arm64"
exit 1
fi

# Download the wix tools!
if [ ! -d wixbin ];
then
curl -LO https://wixtoolset.org/downloads/v3.14.0.3910/wix314-binaries.zip
if [ `md5sum wix314-binaries.zip | cut -f 1 -d " "` != "34f655cf108086838dd5a76d4318063b" ];
then
echo "wix package didn't match expected checksum"
exit 1
fi
mkdir -p wixbin
unzip -o wix314-binaries.zip -d wixbin || (
echo "failed to unzip WiX"
exit 1
)
fi

# Build Yggdrasil!
[ "${PKGARCH}" == "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./build
[ "${PKGARCH}" == "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=0 ./build
[ "${PKGARCH}" == "arm" ] && GOOS=windows GOARCH=arm CGO_ENABLED=0 ./build
[ "${PKGARCH}" == "arm64" ] && GOOS=windows GOARCH=arm64 CGO_ENABLED=0 ./build
[ "${PKGARCH}" = "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./build
[ "${PKGARCH}" = "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=0 ./build
[ "${PKGARCH}" = "arm" ] && GOOS=windows GOARCH=arm CGO_ENABLED=0 ./build
[ "${PKGARCH}" = "arm64" ] && GOOS=windows GOARCH=arm64 CGO_ENABLED=0 ./build

# Create the postinstall script
cat > updateconfig.bat << EOF
Expand All @@ -53,7 +37,7 @@ EOF
PKGNAME=$(sh contrib/semver/name.sh)
PKGVERSION=$(sh contrib/msi/msversion.sh --bare)
PKGVERSIONMS=$(echo $PKGVERSION | tr - .)
([ "${PKGARCH}" == "x64" ] || [ "${PKGARCH}" == "arm64" ]) && \
([ "${PKGARCH}" = "x64" ] || [ "${PKGARCH}" = "arm64" ]) && \
PKGGUID="77757838-1a23-40a5-a720-c3b43e0260cc" PKGINSTFOLDER="ProgramFiles64Folder" || \
PKGGUID="54a3294e-a441-4322-aefb-3bb40dd022bb" PKGINSTFOLDER="ProgramFilesFolder"

Expand Down Expand Up @@ -203,7 +187,4 @@ cat > wix.xml << EOF
EOF

# Generate the MSI
CANDLEFLAGS="-nologo"
LIGHTFLAGS="-nologo -spdb -sice:ICE71 -sice:ICE61"
wixbin/candle $CANDLEFLAGS -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj -arch ${PKGARCH} wix.xml && \
wixbin/light $LIGHTFLAGS -ext WixUtilExtension.dll -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj
wixl --output ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi --arch ${PKGARCH} wix.xml
Loading