build for windows with forked win32 package that has terminateProcessId

Get ugly reversion out of CHANGELOG.

Also, relocated the windows stack.yaml to top, and updated windows build
instructions.

This commit was sponsored by Henrik Riomar on Patreon.
This commit is contained in:
Joey Hess 2017-10-25 14:45:23 -04:00
parent 9f2b7dfc3e
commit 833b3f06cd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 22 additions and 38 deletions

View file

@ -27,7 +27,7 @@ import Control.Concurrent
#ifndef mingw32_HOST_OS
import System.Posix (signalProcess, sigTERM)
#else
import Utility.WinProcess
import System.Win32.Process (terminateProcessId)
#endif
import Network.URI
@ -59,7 +59,7 @@ terminateSelf =
#ifndef mingw32_HOST_OS
signalProcess sigTERM =<< getPID
#else
terminatePID =<< getPID
terminateProcessId =<< getPID
#endif
runRestart :: Assistant URLString

View file

@ -41,7 +41,7 @@ import qualified Control.Concurrent.MSemN as MSemN
import System.Posix.Process (getProcessGroupIDOf)
import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
#else
import Utility.WinProcess
import System.Win32.Process (terminateProcessId)
#endif
type TransferGenerator = Assistant (Maybe (Transfer, TransferInfo, Transferrer -> Assistant ()))
@ -270,7 +270,7 @@ cancelTransfer pause t = do
threadDelay 50000 -- 0.05 second grace period
signal sigKILL
#else
terminatePID pid
terminateProcessId pid
#endif
{- Start or resume a transfer. -}

View file

@ -2,9 +2,6 @@ git-annex (6.20171019) UNRELEASED; urgency=medium
* Windows build fixed, and changed to use stack for more relaiable build
environment.
* Code for terminating processes on Windows is not linking anymore;
made a warning be displayed instead. This breaks restarting the
assistant and git annex assistant --stop.
* Windows: Remove wget from bundle; it needs libraries that are not
included, and git for windows includes curl which git-annex will use
instead.

View file

@ -14,7 +14,7 @@ import Utility.PID
#ifndef mingw32_HOST_OS
import Utility.LogFile
#else
import Utility.WinProcess
import System.Win32.Process (terminateProcessId)
import Utility.LockFile
#endif
@ -162,7 +162,7 @@ stopDaemon pidfile = go =<< checkDaemon pidfile
#ifndef mingw32_HOST_OS
signalProcess sigTERM pid
#else
terminatePID pid
terminateProcessId pid
#endif
{- Windows locks a lock file that corresponds with the pid of the process.

View file

@ -1,15 +0,0 @@
{- Windows processes
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
module Utility.WinProcess where
import Utility.PID
import System.IO
terminatePID :: PID -> IO ()
terminatePID p = hPutStrLn stderr "terminating processes on windows is not currently working"

View file

@ -32,15 +32,16 @@ To build git-annex from source on Windows, you need to install
[Git for Windows](http://git-scm.com/downloads), and
[Stack](http://haskellstack.org/).
You also need to install rsync and wget for windows.
They need to be linked with the same MINGW32 libraries that come with Git
for Windows. One way is to download them from
You also need to install rsync for windows.
It needs to be linked with the same MINGW32 libraries that come with Git
for Windows. One way is to download it from
<https://downloads.kitenet.net/git-annex/windows/assets/>.
Put them somewhere in PATH.
Put it somewhere in PATH.
Then open Git Bash, [[clone git-annex|download]], and in
git-annex's source tree, run "stack build" to download and build
all dependencies and git-annex. "stack install" will install git-annex.
Then open Git Bash, [[clone git-annex|download]], and in git-annex's source
tree, run "stack build --stack-yaml stack-windows.yaml" to download and
build all dependencies and git-annex. "stack install --stack-yaml
stack-windows.yaml" will install git-annex.
(To build the git-annex installer, you also need to install the NullSoft
installer system. The script `standalone/windows/build.sh` is

View file

@ -1061,7 +1061,6 @@ Executable git-annex
Other-Modules:
Utility.LockFile.Windows
Utility.LockPool.Windows
Utility.WinProcess
else
Other-Modules:
Utility.LockFile.Posix

View file

@ -16,6 +16,9 @@ flags:
androidsplice: false
packages:
- '../..'
- location:
git: https://github.com/joeyh/win32
commit: f41d9e1cc60f225bc4ef4bbd7ec0bac43b61b982
extra-deps:
- aws-0.17.1
- bloomfilter-2.0.1.0

View file

@ -59,21 +59,20 @@ getextra rsync.exe 85cb7a4d16d274fcf8069b39042965ad26abd6aa
# Deps are not built with cygwin environment, because we don't want
# configure scripts for haskell libraries to link them with the cygwin
# libraries.
stack setup --stack-yaml standalone/windows/stack.yaml
stack build -j 1 --stack-yaml standalone/windows/stack.yaml --no-haddock --dependencies-only
stack setup --stack-yaml stack-windows.yaml
stack build -j 1 --stack-yaml stack-windows.yaml --no-haddock --dependencies-only
# Build git-annex
withcyg stack build --stack-yaml standalone/windows/stack.yaml
withcyg stack build --stack-yaml stack-windows.yaml
# Build the installer
withcygpreferred stack ghc --stack-yaml standalone/windows/stack.yaml --no-haddock \
withcygpreferred stack ghc --stack-yaml stack-windows.yaml --no-haddock \
--package nsis Build/NullSoftInstaller.hs
./Build/NullSoftInstaller
rm -f dist/build-version
mkdir -p dist
stack ghc --stack-yaml standalone/windows/stack.yaml --no-haddock \
Build/BuildVersion.hs
stack ghc --stack-yaml stack-windows.yaml --no-haddock Build/BuildVersion.hs
./Build/BuildVersion > dist/build-version
# Test git-annex