Skip to content

Commit

Permalink
Make windows_install build on Windows (#2994)
Browse files Browse the repository at this point in the history
* Make windows_install build on Windows
* Add script to install nsis on windows test runners
  • Loading branch information
rfay committed May 13, 2021
1 parent dd7177f commit 405c5c5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .buildkite/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ fi
echo "--- Running tests..."
make test
RV=$?
echo "build.sh completed with status=$RV"
echo "test.sh completed with status=$RV"
ddev poweroff || true
exit $RV
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ MKCERT_VERSION=v1.4.6

GOTESTSUM_FORMAT ?= short-verbose
TESTTMP=/tmp/testresults
DOWNLOADTMP=$(HOME)/tmp

# This repo's root import path (under GOPATH).
PKG := github.com/drud/ddev
Expand Down Expand Up @@ -104,7 +103,7 @@ linux_arm64: $(GOTMP)/bin/linux_arm64/ddev
linux_arm: $(GOTMP)/bin/linux_arm/ddev
darwin_amd64: $(GOTMP)/bin/darwin_amd64/ddev
darwin_arm64: $(GOTMP)/bin/darwin_arm64/ddev
windows_amd64: $(GOTMP)/bin/windows_amd64/ddev.exe
windows_amd64: windows_install
windows_arm64: $(GOTMP)/bin/windows_arm64/ddev.exe

TARGETS=$(GOTMP)/bin/linux_amd64/ddev $(GOTMP)/bin/linux_arm64/ddev $(GOTMP)/bin/linux_arm/ddev $(GOTMP)/bin/darwin_amd64/ddev $(GOTMP)/bin/darwin_arm64/ddev $(GOTMP)/bin/windows_amd64/ddev.exe
Expand All @@ -128,8 +127,10 @@ TEST_TIMEOUT=150m
BUILD_ARCH = $(shell go env GOARCH)

DDEVNAME=ddev
SHASUM=shasum -a 256
ifeq ($(BUILD_OS),windows)
DDEVNAME=ddev.exe
SHASUM=sha256sum
endif

DDEV_BINARY_FULLPATH=$(PWD)/$(GOTMP)/bin/$(BUILD_OS)_$(BUILD_ARCH)/$(DDEVNAME)
Expand All @@ -156,7 +157,6 @@ testfullsitesetup: $(DEFAULT_BUILD) setup
setup:
@mkdir -p $(GOTMP)/{src,pkg/mod/cache,.cache}
@mkdir -p $(TESTTMP)
@mkdir -p $(DOWNLOADTMP)

# Required static analysis targets used in circleci - these cause fail if they don't work
staticrequired: setup golangci-lint markdownlint mkdocs pyspelling
Expand Down Expand Up @@ -226,7 +226,7 @@ $(GOTMP)/bin/windows_amd64/ddev_windows_installer.$(VERSION).exe: $(GOTMP)/bin/

@makensis -DVERSION=$(VERSION) winpkg/ddev.nsi # brew install makensis, apt-get install nsis, or install on Windows
@if [ -z "$(DDEV_WINDOWS_SIGNING_PASSWORD)" ] ; then echo "Skipping signing ddev_windows_installer, no DDEV_WINDOWS_SIGNING_PASSWORD provided"; else echo "Signing windows installer binary..."&& mv $@ $@.unsigned && osslsigncode sign -pkcs12 certfiles/drud_cs.p12 -n "DDEV-Local Installer" -i https://ddev.com -in $@.unsigned -out $@ -t http://timestamp.digicert.com -pass $(DDEV_WINDOWS_SIGNING_PASSWORD); fi
shasum -a 256 $@ >$@.sha256.txt
$(SHASUM) $@ >$@.sha256.txt

no_v_version:
@echo $(NO_V_VERSION)
Expand All @@ -244,11 +244,11 @@ $(GOTMP)/bin/windows_amd64/mkcert.exe $(GOTMP)/bin/windows_amd64/mkcert_license.
curl --fail -sSL -o $(GOTMP)/bin/windows_amd64/mkcert.exe https://github.com/drud/mkcert/releases/download/$(MKCERT_VERSION)/mkcert-$(MKCERT_VERSION)-windows-amd64.exe
curl --fail -sSL -o $(GOTMP)/bin/windows_amd64/mkcert_license.txt -O https://raw.githubusercontent.com/drud/mkcert/master/LICENSE

https://github.com/gerardog/gsudo/releases/download/v0.7.3/gsudo.v0.7.3.zip
$(GOTMP)/bin/windows_amd64/sudo.exe $(GOTMP)/bin/windows_amd64/sudo_license.txt:
curl -sSL --create-dirs -o $(DOWNLOADTMP)/gsudo.zip https://github.com/gerardog/gsudo/releases/download/$(WINDOWS_GSUDO_VERSION)/gsudo.$(WINDOWS_GSUDO_VERSION).zip
unzip -o -d $(GOTMP)/bin/windows_amd64 $(DOWNLOADTMP)/gsudo.zip && mv $(GOTMP)/bin/windows_amd64/gsudo.exe $(GOTMP)/bin/windows_amd64/sudo.exe
curl --fail -sSL -o $(GOTMP)/bin/windows_amd64/sudo_license.txt https://raw.githubusercontent.com/gerardog/gsudo/master/LICENSE.txt
set -x
curl -sSL --create-dirs -o "$(GOTMP)/bin/windows_amd64/gsudo.zip" https://github.com/gerardog/gsudo/releases/download/$(WINDOWS_GSUDO_VERSION)/gsudo.$(WINDOWS_GSUDO_VERSION).zip
unzip -o -d "$(GOTMP)/bin/windows_amd64" "$(GOTMP)/bin/windows_amd64/gsudo.zip" gsudo.exe && mv "$(GOTMP)/bin/windows_amd64/gsudo.exe" "$(GOTMP)/bin/windows_amd64/sudo.exe"
curl --fail -sSL -o "$(GOTMP)/bin/windows_amd64/sudo_license.txt" "https://raw.githubusercontent.com/gerardog/gsudo/master/LICENSE.txt"

$(GOTMP)/bin/windows_amd64/nssm.exe $(GOTMP)/bin/windows_amd64/winnfsd_license.txt $(GOTMP)/bin/windows_amd64/winnfsd.exe :
curl --fail -sSL -o $(GOTMP)/bin/windows_amd64/winnfsd.exe https://github.com/winnfsd/winnfsd/releases/download/$(WINNFSD_VERSION)/WinNFSd.exe
Expand Down
2 changes: 2 additions & 0 deletions docs/developers/scripts/windows_buildkite_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ nssm.exe status buildkite-agent || true
winpty docker run -it --rm -p 80 busybox ls

bash "/c/Program Files/ddev/windows_ddev_nfs_setup.sh"

bash "scripts/windows_postinstall.sh"
21 changes: 21 additions & 0 deletions docs/developers/scripts/windows_postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Install NSIS on test machines, any other post-install
# This should be run with administrative privileges.

set -eu -o pipefail
set -x

NSIS_VERSION=3.06.1
NSIS_HOME="/c/Program Files (x86)/NSIS"

# Note that this is not a silent NSIS install because the silent install
# does not install the default Plugins and Stubs
curl -sSL -o /tmp/nsis-setup.exe https://prdownloads.sourceforge.net/nsis/nsis-${NSIS_VERSION}-setup.exe?download && chmod +x /tmp/nsis-setup.exe
/tmp/nsis-setup.exe

# Get the Plugins for NSIS
curl -fsSL -o /tmp/EnVar-Plugin.zip https://github.com/GsNSIS/EnVar/releases/latest/download/EnVar-Plugin.zip && unzip -o -d "${NSIS_HOME}" /tmp/EnVar-Plugin.zip
curl -fsSL -o /tmp/INetC.zip https://github.com/DigitalMediaServer/NSIS-INetC-plugin/releases/latest/download/INetC.zip && unzip -o -d "${NSIS_HOME}/Plugins" /tmp/INetC.zip

echo "You must now add to the system path C:\Program Files (x86)\NSIS\bin, which for some reason is not added by the installer"

0 comments on commit 405c5c5

Please sign in to comment.