update windows build scripts to use stack

Not tested yet.

The EvilLinker workaround is removed. That got fixed in ghc 8.0.1,
(per https://ghc.haskell.org/trac/ghc/ticket/8596)
which will finally be used by the windows autobuilder now.

I have not deleted the EvilLinker yet (or closed its bugs).

This commit was sponsored by John Peloquin on Patreon.
This commit is contained in:
Joey Hess 2017-10-17 13:00:29 -04:00
parent 193b5f4ca4
commit 59a0308f5f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 29 additions and 69 deletions

View file

@ -1,17 +1,16 @@
{- Generates a NullSoft installer program for git-annex on Windows. {- Generates a NullSoft installer program for git-annex on Windows.
- -
- This uses the Haskell nsis package (cabal install nsis) - This uses the Haskell nsis package to generate a .nsi file,
- to generate a .nsi file, which is then used to produce - which is then used to produce git-annex-installer.exe
- git-annex-installer.exe
- -
- The installer includes git-annex, and utilities it uses, with the - The installer includes git-annex, and utilities it uses, with the
- exception of git and some utilities that are bundled with git. - exception of git and some utilities that are bundled with git.
- The user needs to install git separately, and the installer checks - The user needs to install git separately, and the installer checks
- for that. - for that.
- -
- To build the installer, git-annex should already be built by cabal, - To build the installer, git-annex should already be built using
- and the necessary utility programs (rsync and wget) already installed - stack and the necessary utility programs (rsync and wget) already
- in PATH from msys32. - installed in PATH from msys32.
- -
- Copyright 2013-2015 Joey Hess <id@joeyh.name> - Copyright 2013-2015 Joey Hess <id@joeyh.name>
- -
@ -41,7 +40,7 @@ import Build.BundledPrograms
main = do main = do
withTmpDir "nsis-build" $ \tmpdir -> do withTmpDir "nsis-build" $ \tmpdir -> do
let gitannex = tmpdir </> gitannexprogram let gitannex = tmpdir </> gitannexprogram
mustSucceed "ln" [File "dist/build/git-annex/git-annex.exe", File gitannex] mustSucceed "stack" [Param "--local-bin-path", File ".", Param "install"]
let license = tmpdir </> licensefile let license = tmpdir </> licensefile
mustSucceed "sh" [Param "-c", Param $ "zcat standalone/licences.gz > '" ++ license ++ "'"] mustSucceed "sh" [Param "-c", Param $ "zcat standalone/licences.gz > '" ++ license ++ "'"]
webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git annex webapp" webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git annex webapp"

View file

@ -11,28 +11,20 @@ PATH="/c/Program Files/Git/cmd:/c/Program Files/NSIS:$PATH"
withcyg () { withcyg () {
PATH="$PATH:/c/cygwin/bin" "$@" PATH="$PATH:/c/cygwin/bin" "$@"
} }
# Prefer programs from cygwin.
withcygpreferred () { withcygpreferred () {
PATH="/c/cygwin/bin:$PATH" "$@" PATH="/c/cygwin/bin:$PATH" "$@"
} }
# Install haskell dependencies. # Deps are not built with cygwin environment, because we don't want
# cabal install is not run in cygwin, because we don't want configure scripts # configure scripts for haskell libraries to link them with the cygwin
# for haskell libraries to link them with the cygwin library. # libraries.
if ! cabal install --only-dependencies; then stack setup
cabal update || true stack build --dependencies-only
cabal install --only-dependencies
fi
# Build git-annex # Build git-annex
if [ ! -e "dist/setup-config" ]; then withcyg stack build
withcyg cabal configure
fi
if ! withcyg cabal build; then
ghc --make Build/EvilLinker -fno-warn-tabs
withcyg Build/EvilLinker
fi
# Build the installer # Build the installer
cabal install nsis withcygpreferred stack runghc --package nsis Build/NullSoftInstaller.hs
ghc --make Build/NullSoftInstaller.hs -fno-warn-tabs
PATH="$PATH:/cygdrive/c/Program Files/NSIS" Build/NullSoftInstaller.exe

View file

@ -19,6 +19,11 @@ withcyg () {
PATH="$PATH:/c/cygwin/bin" "$@" PATH="$PATH:/c/cygwin/bin" "$@"
} }
# Prefer programs from cygwin.
withcygpreferred () {
PATH="/c/cygwin/bin:$PATH" "$@"
}
# This tells git-annex where to upgrade itself from. # This tells git-annex where to upgrade itself from.
UPGRADE_LOCATION=http://downloads.kitenet.net/git-annex/windows/current/git-annex-installer.exe UPGRADE_LOCATION=http://downloads.kitenet.net/git-annex/windows/current/git-annex-installer.exe
export UPGRADE_LOCATION export UPGRADE_LOCATION
@ -28,49 +33,18 @@ export UPGRADE_LOCATION
#FORCE_GIT_VERSION=1.9.5 #FORCE_GIT_VERSION=1.9.5
#export FORCE_GIT_VERSION #export FORCE_GIT_VERSION
# Uncomment to get rid of cabal installed libraries.
#cabal list --installed
#rm -rf /c/Users/jenkins/AppData/Roaming/cabal /c/Users/jenkins/AppData/Roaming/ghc
# Don't allow build artifact from a past successful build to be extracted # Don't allow build artifact from a past successful build to be extracted
# if we fail. # if we fail.
rm -f git-annex-installer.exe rm -f git-annex-installer.exe
# Install haskell dependencies. # Deps are not built with cygwin environment, because we don't want
# cabal install is not run in cygwin, because we don't want configure scripts # configure scripts for haskell libraries to link them with the cygwin
# for haskell libraries to link them with the cygwin library. # libraries.
cabal update || true stack setup
stack build --dependencies-only
# workaround strange cabal install bug for xss-sanitize
if [ ! -d xss-sanitize ]; then
git clone https://github.com/yesodweb/haskell-xss-sanitize xss-sanitize
(cd xss-sanitize && cabal install)
fi
cabal install --only-dependencies \
--constraint='persistent-sqlite ==2.2' \
--constraint='cryptonite ==0.7' \
--constraint='mwc-random ==0.13.3.2' \
--force-reinstalls \
|| true
# Detect when the last build was an incremental build and failed,
# and try a full build. Done this way because this shell seems a bit
# broken.
if [ -e last-incremental-failed ]; then
cabal clean || true
# windows breakage..
rm -rf dist dist.old || mv -v dist dist.old
fi
touch last-incremental-failed
# Build git-annex # Build git-annex
withcyg cabal configure withcyg stack build
if ! withcyg cabal build; then
rm -f Build/EvilLinker.exe
ghc --make Build/EvilLinker -fno-warn-tabs
Build/EvilLinker
fi
# Get extra programs to bundle with git-annex. # Get extra programs to bundle with git-annex.
# These are msys2 programs, from https://msys2.github.io/. # These are msys2 programs, from https://msys2.github.io/.
@ -96,15 +70,10 @@ getextra rsync.exe 85cb7a4d16d274fcf8069b39042965ad26abd6aa
getextra wget.exe 044380729200d5762965b10123a4f134806b01cf getextra wget.exe 044380729200d5762965b10123a4f134806b01cf
# Build the installer # Build the installer
cabal install nsis withcygpreferred stack runghc --package nsis Build/NullSoftInstaller.hs
ghc -fforce-recomp --make Build/NullSoftInstaller.hs -fno-warn-tabs
PATH=".:/c/cygwin/bin:$PATH" Build/NullSoftInstaller.exe
rm -f last-incremental-failed
rm -f dist/build-version rm -f dist/build-version
ghc --make Build/BuildVersion.hs stack runghc Build/BuildVersion.hs > dist/build-version
Build/BuildVersion > dist/build-version
# Test git-annex # Test git-annex
# The test is run in c:/WINDOWS/Temp, because running it in the autobuilder # The test is run in c:/WINDOWS/Temp, because running it in the autobuilder