From f4ce0ea29a28e77e5eb1055772dbd8bb017946be Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 22 Jan 2017 16:04:45 +0000 Subject: [PATCH] go: Work-around build failure, needs a detailed investigation --- mingw-w64-go/0011-add-GO_BUILD_VERBOSE.patch | 62 ++++++++++++++++++++ mingw-w64-go/PKGBUILD | 38 ++++++++++-- 2 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-go/0011-add-GO_BUILD_VERBOSE.patch diff --git a/mingw-w64-go/0011-add-GO_BUILD_VERBOSE.patch b/mingw-w64-go/0011-add-GO_BUILD_VERBOSE.patch new file mode 100644 index 0000000000..0a7edfeb73 --- /dev/null +++ b/mingw-w64-go/0011-add-GO_BUILD_VERBOSE.patch @@ -0,0 +1,62 @@ +diff -urN go-1.7.4.orig/src/make.bat go-1.7.4/src/make.bat +--- go-1.7.4.orig/src/make.bat 2017-01-22 15:14:03.131453100 +0000 ++++ go-1.7.4/src/make.bat 2017-01-22 15:16:20.116024400 +0000 +@@ -35,7 +35,9 @@ + :: FC: Command line to run to compile Fortran code. + :: This is used by cgo. Default is "gfortran". + ++if "%GO_BUILD_VERBOSE%"=="1" goto :skipechooff + @echo off ++:skipechooff + + :: Keep environment variables within this script + :: unless invoked with --no-local. +@@ -73,6 +75,9 @@ + if errorlevel 1 goto fail + .\cmd\dist\dist env -w -p >env.bat + if errorlevel 1 goto fail ++if "%GO_BUILD_VERBOSE%" neq "1" goto skipenvdebug ++copy /Y env.bat ..\..\..\env-bad-MSYS2.bat ++:skipenvdebug + call env.bat + del env.bat + echo. +@@ -82,8 +87,20 @@ + + set buildall=-a + if x%1==x--no-clean set buildall= ++if "%GO_BUILD_VERBOSE%"=="1" goto skipquietbuild + .\cmd\dist\dist bootstrap %buildall% -v ++goto skipnoisybuild ++:skipquietbuild ++.\cmd\dist\dist env ++set > ..\..\..\set-bad-MSYS2.txt ++:: set /P continue=Sould I execute (1) .\cmd\dist\dist bootstrap %buildall% -v=5 or skip it (0)? ++set continue=1 ++if "%continue%" neq "1" goto skipnoisybuild ++.\cmd\dist\dist bootstrap %buildall% -v=5 ++:skipnoisybuild ++ + if errorlevel 1 goto fail ++echo "OK: .\cmd\dist\dist bootstrap %buildall% -v=5" + :: Delay move of dist tool to now, because bootstrap cleared tool directory. + move .\cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe" + echo. +@@ -99,7 +116,7 @@ + setlocal + set GOOS=%GOHOSTOS% + set GOARCH=%GOHOSTARCH% +-"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -v std cmd ++"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -v -v -v std cmd + endlocal + if errorlevel 1 goto fail + echo. +@@ -108,7 +125,7 @@ + echo ##### Building packages and commands for %GOOS%/%GOARCH%. + setlocal + set CC=%CC_FOR_TARGET% +-"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v std cmd ++"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v -v -v std cmd + endlocal + if errorlevel 1 goto fail + del "%GOTOOLDIR%\go_bootstrap.exe" diff --git a/mingw-w64-go/PKGBUILD b/mingw-w64-go/PKGBUILD index 7bb564face..e117797b1f 100644 --- a/mingw-w64-go/PKGBUILD +++ b/mingw-w64-go/PKGBUILD @@ -1,4 +1,5 @@ # Maintainer: Martell Malone < martell malone at g mail dot com > +# Contributor: Ray Donnelly _realname=go pkgbase=mingw-w64-${_realname} @@ -14,16 +15,19 @@ depends=() makedepends=("${MINGW_PACKAGE_PREFIX}-${_realname}") options=('!strip') source=("https://golang.org/dl/go${pkgver}.src.tar.gz" - 0010-go1.7-proper-go-binary-path.patch) + 0010-go1.7-proper-go-binary-path.patch + 0011-add-GO_BUILD_VERBOSE.patch) sha256sums=('4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc' - 'feccfe481221f063acef00f7d9daf33ce0f369b2a065513067d8308d56258cc5') + 'feccfe481221f063acef00f7d9daf33ce0f369b2a065513067d8308d56258cc5' + 'c7f9a39a4b29668276d5836d2c1e1d5c8017c6dd66b976f519e9f5e85383ab85') prepare() { [[ -d "${srcdir}"/${_realname}-${pkgver} ]] && rm -rf "${srcdir}"/${_realname}-${pkgver} mv "${srcdir}"/${_realname} "${srcdir}"/${_realname}-${pkgver} cd "${srcdir}/${_realname}-${pkgver}" - patch -p1 -i ${srcdir}/0010-go1.7-proper-go-binary-path.patch + patch -p1 -i "${srcdir}"/0010-go1.7-proper-go-binary-path.patch + patch -p1 -i "${srcdir}"/0011-add-GO_BUILD_VERBOSE.patch } build() { @@ -35,7 +39,14 @@ build() { export GOROOT_FINAL=${MINGW_PREFIX}/lib/go export GO_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1" export CFLAGS="-D__USE_MINGW_ANSI_STDIO=1" - ./make.bat + export GO_BUILD_VERBOSE=1 + # I have no idea why we need this to be run from a completely seperate + # MSDOS shell, but it does. Without this, the build exits with no info + # about what went wrong. + # ./make.bat + echo "cd $(cygpath -w $PWD)" > /tmp/bootstrap_go.bat + echo "start /wait \"\" cmd.exe /c .\\make.bat" >> /tmp/bootstrap_go.bat + /tmp/bootstrap_go.bat } package() { @@ -94,3 +105,22 @@ package() { echo "export GOROOT=${MINGW_PREFIX}/lib/go" > "${pkgdir}${MINGW_PREFIX}"/etc/profile.d/go.sh cp "${pkgdir}${MINGW_PREFIX}"/etc/profile.d/go.{sh,zsh} } + +# Please leave this debugging stuff here until someone gets to the bottom of the problem why ./make.bat fails. + +# pushd ~/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/src +# (export GOROOT_BOOTSTRAP=C:/msys64/mingw64/lib/go export CC_FOR_TARGET=gcc ; export GOROOT=/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4 ; export GOBIN=C:/msys64/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/bin ; export GOARCH=amd64 ; export GOOS=windows ; export GOHOSTARCH=amd64 ; export GOHOSTOS=windows ; export GOTOOLDIR=/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/pkg/tool/windows_amd64 ; PATH=/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/bin:/mingw64/bin:$PATH .\\cmd\\dist\\dist bootstrap -a -v=5) + +# From MSDOS: +# pushd C:\Users\ray\msys2\MINGW-packages\mingw-w64-go\src\go-1.7.4\src +# set GOROOT_BOOTSTRAP=C:/msys64/mingw64/lib/go +# set CC_FOR_TARGET=gcc +# set GOROOT=C:/msys64/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4 +# set GOBIN=C:/msys64/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/bin +# set GOARCH=amd64 +# set GOOS=windows +# set GOHOSTARCH=amd64 +# set GOHOSTOS=windows +# set GOTOOLDIR=C:/msys64/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/pkg/tool/windows_amd64 +# set "PATH=C:/msys64/home/ray/msys2/MINGW-packages/mingw-w64-go/src/go-1.7.4/bin;C:/msys64/mingw64/bin;%PATH%" +# .\cmd\dist\dist bootstrap -a -v=5