2013-05-17 15:38:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This script is run by the jenkins autobuilder, in a mingw environment,
|
|
|
|
# to build git-annex for Windows.
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
2013-12-05 23:15:23 +00:00
|
|
|
# Path to the Haskell Platform.
|
2013-12-06 15:34:27 +00:00
|
|
|
HP="/c/Program Files (x86)/Haskell Platform/2013.2.0.0"
|
2013-12-04 21:11:49 +00:00
|
|
|
|
2013-05-17 18:06:47 +00:00
|
|
|
PATH="$HP/bin:$HP/lib/extralibs/bin:/c/Program Files (x86)/NSIS:$PATH"
|
2013-05-17 15:38:29 +00:00
|
|
|
|
2013-12-05 23:15:23 +00:00
|
|
|
# This tells git-annex where to upgrade itself from.
|
2013-11-22 19:25:15 +00:00
|
|
|
UPGRADE_LOCATION=http://downloads.kitenet.net/git-annex/windows/current/git-annex-installer.exe
|
|
|
|
|
2013-05-17 20:56:00 +00:00
|
|
|
# Run a command with the cygwin environment available.
|
|
|
|
# However, programs not from cygwin are preferred.
|
|
|
|
withcyg () {
|
|
|
|
PATH="$PATH:/c/cygwin/bin" "$@"
|
2013-05-17 15:38:29 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 22:07:44 +00:00
|
|
|
# Uncomment to get rid of cabal installed libraries.
|
2013-12-06 15:34:27 +00:00
|
|
|
rm -rf /c/Users/jenkins/AppData/Roaming/cabal /c/Users/jenkins/AppData/Roaming/ghc
|
2013-12-05 22:07:44 +00:00
|
|
|
|
2013-06-22 17:47:19 +00:00
|
|
|
# Don't allow build artifact from a past successful build to be extracted
|
2013-05-17 20:35:35 +00:00
|
|
|
# if we fail.
|
2013-12-05 22:07:44 +00:00
|
|
|
#rm -f git-annex-installer.exe
|
2013-05-17 20:35:35 +00:00
|
|
|
|
2013-05-17 16:31:19 +00:00
|
|
|
# Install haskell dependencies.
|
2013-05-17 15:38:29 +00:00
|
|
|
# cabal install is not run in cygwin, because we don't want configure scripts
|
|
|
|
# for haskell libraries to link them with the cygwin library.
|
2013-05-20 01:12:46 +00:00
|
|
|
cabal update || true
|
2013-05-17 17:10:41 +00:00
|
|
|
|
2013-12-05 23:07:45 +00:00
|
|
|
cabal install --only-dependencies
|
2013-05-17 16:31:19 +00:00
|
|
|
|
2013-05-20 01:02:50 +00:00
|
|
|
# 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
|
2013-05-20 00:45:54 +00:00
|
|
|
fi
|
|
|
|
touch last-incremental-failed
|
2013-05-20 00:41:44 +00:00
|
|
|
|
2013-05-20 00:45:54 +00:00
|
|
|
# Build git-annex
|
2013-12-05 17:55:01 +00:00
|
|
|
withcyg cabal configure
|
2013-12-05 21:17:35 +00:00
|
|
|
withcyg cabal build || true
|
|
|
|
|
|
|
|
# Works around link failure https://ghc.haskell.org/trac/ghc/ticket/8596
|
|
|
|
# using a response file.
|
|
|
|
rm -f build.log gcc.opt
|
2013-12-06 01:28:34 +00:00
|
|
|
withcyg cabal build --ghc-options='-v -keep-tmp-files' > build.log 2>&1 || true
|
2013-12-05 21:17:35 +00:00
|
|
|
grep '"dist\\build\\git-annex\\git-annex.exe"' build.log | sed -e 's/^"[^"]*" //' -e 's/\\/\//g' > gcc.opt
|
2013-12-05 21:29:21 +00:00
|
|
|
"$HP/mingw/bin/gcc.exe" @gcc.opt
|
2013-12-05 21:17:35 +00:00
|
|
|
|
2013-05-20 00:45:54 +00:00
|
|
|
# Build the installer
|
|
|
|
cabal install nsis
|
|
|
|
ghc --make Build/NullSoftInstaller.hs
|
|
|
|
withcyg Build/NullSoftInstaller.exe
|
2013-05-20 00:35:33 +00:00
|
|
|
|
2013-05-20 00:45:54 +00:00
|
|
|
rm -f last-incremental-failed
|
2013-05-17 20:34:19 +00:00
|
|
|
|
|
|
|
# Test git-annex
|
2013-12-04 21:11:49 +00:00
|
|
|
# (doesn't currently work well on autobuilder, reason unknown)
|
2013-05-17 21:01:20 +00:00
|
|
|
rm -rf .t
|
2013-06-21 15:42:43 +00:00
|
|
|
withcyg dist/build/git-annex/git-annex.exe test || true
|