Makefile: Added install-home target which installs git-annex into the HOME directory
This commit is contained in:
parent
95e94b9d00
commit
6491b62614
7 changed files with 83 additions and 17 deletions
|
@ -29,12 +29,12 @@ import Prelude
|
|||
|
||||
systemwideInstall :: IO Bool
|
||||
#ifndef mingw32_HOST_OS
|
||||
systemwideInstall = isroot <||> destdirset
|
||||
systemwideInstall = isroot <||> (not <$> userdirset)
|
||||
where
|
||||
isroot = do
|
||||
uid <- fromIntegral <$> getRealUserID
|
||||
return $ uid == (0 :: Int)
|
||||
destdirset = isJust <$> catchMaybeIO (getEnv "DESTDIR")
|
||||
userdirset = isJust <$> catchMaybeIO (getEnv "USERDIR")
|
||||
#else
|
||||
systemwideInstall = return False
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,8 @@ git-annex (7.20190220) UNRELEASED; urgency=medium
|
|||
* S3: Support enabling bucket versioning when built with aws-0.21.1.
|
||||
* stack.yaml: Build with aws-0.21.1
|
||||
* Fix cleanup of git-annex:export.log after git-annex forget --drop-dead.
|
||||
* Makefile: Added install-home target which installs git-annex into
|
||||
the HOME directory.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Wed, 20 Feb 2019 14:20:59 -0400
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ removeAutoStartFile path = do
|
|||
modifyAutoStartFile $
|
||||
filter (not . equalFilePath path')
|
||||
|
||||
{- The path to git-annex is written here; which is useful when cabal
|
||||
{- The path to git-annex is written here; which is useful when something
|
||||
- has installed it to some awful non-PATH location. -}
|
||||
programFile :: IO FilePath
|
||||
programFile = userConfigFile "program"
|
||||
|
|
16
Makefile
16
Makefile
|
@ -18,6 +18,16 @@ endif
|
|||
|
||||
build: $(all)
|
||||
|
||||
# install system-wide
|
||||
# Set PREFIX and DESTDIR to configure where it is installed
|
||||
install: install-bins install-docs install-desktop
|
||||
|
||||
# installs into your home directory
|
||||
install-home:
|
||||
$(MAKE) install-bins PREFIX=$(HOME)/.local
|
||||
$(MAKE) install-mans PREFIX=$(HOME)/.local
|
||||
$(MAKE) install-desktop PREFIX=$(HOME)/.local USERDIR=1
|
||||
|
||||
tmp/configure-stamp: Build/TestConfig.hs Build/Configure.hs
|
||||
if [ "$(BUILDER)" = ./Setup ]; then ghc --make Setup; fi
|
||||
if [ "$(BUILDER)" != stack ]; then \
|
||||
|
@ -61,8 +71,10 @@ install-bins: build
|
|||
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
|
||||
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-remote-tor-annex
|
||||
|
||||
install-misc: build Build/InstallDesktopFile
|
||||
install-desktop: build Build/InstallDesktopFile
|
||||
./Build/InstallDesktopFile $(PREFIX)/bin/git-annex || true
|
||||
|
||||
install-completions:
|
||||
install -d $(DESTDIR)$(PREFIX)/$(SHAREDIR)/bash-completion/completions
|
||||
install -m 0644 bash-completion.bash $(DESTDIR)$(PREFIX)/$(SHAREDIR)/bash-completion/completions/git-annex
|
||||
install -d $(DESTDIR)$(PREFIX)/$(SHAREDIR)/zsh/vendor-completions
|
||||
|
@ -72,8 +84,6 @@ install-misc: build Build/InstallDesktopFile
|
|||
@./git-annex --fish-completion-script git-annex 2>/dev/null > $(DESTDIR)$(PREFIX)/$(SHAREDIR)/fish/completions/git-annex.fish || \
|
||||
echo "** fish completions not installed; built with too old version of optparse-applicative"
|
||||
|
||||
install: install-bins install-docs install-misc
|
||||
|
||||
test: git-annex git-annex-shell
|
||||
./git-annex test
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
git-annex uses copyHook in Setup.hs to create/install man pages, .desktop file and etc.
|
||||
|
||||
I'm using cabal new-build/new-install to install it, and these copyHooks don't get called. I reported it to Cabal, but they replied that this should be fixed on git-annex side: https://github.com/haskell/cabal/issues/5933
|
||||
|
||||
> [[done]], make install-home. Can't be done in Setup.hs for new-build so
|
||||
> this is the best that can be done. --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2019-03-18T15:22:46Z"
|
||||
content="""
|
||||
stack install also bypasses the custom postCopy. It's not been much of a
|
||||
problem. git-annex's Makefile can use either system to build, and does a
|
||||
much better job of installing all needed files.
|
||||
|
||||
I've updated the install/fromsource page to point the user toward
|
||||
`make install` more. Also added a `make install-home` target.
|
||||
|
||||
But I've kept support for using cabal install because users may be relying
|
||||
on that installation method. If cabal switches to new-build by default
|
||||
and it stops working, it can be removed then.
|
||||
"""]]
|
|
@ -3,6 +3,9 @@ users with experience building code from source. But the build may
|
|||
require some care and feeding. This page will start with the easy
|
||||
methods and work up to the harder ones.
|
||||
|
||||
This page also covers installing git-annex from source, but in many
|
||||
cases it's better to install it using your OS's package manager.
|
||||
|
||||
## downloading the source code
|
||||
|
||||
The easiest way is using git; see [[download]] or just run:
|
||||
|
@ -18,8 +21,17 @@ First, install everything git-annex needs to build:
|
|||
|
||||
sudo apt-get build-dep git-annex
|
||||
|
||||
Now you can build git-annex by running either `make` or `cabal build`
|
||||
inside the source tree.
|
||||
Now you can build git-annex by running `make` inside the source tree.
|
||||
|
||||
Then, to install the program and associated files system-wide in `/usr/local`,
|
||||
run:
|
||||
|
||||
sudo make install PREFIX=/usr/local
|
||||
|
||||
Or, to install the program into $HOME/.local/bin, and associated files
|
||||
into other parts of your HOME directory, run:
|
||||
|
||||
make install-home
|
||||
|
||||
## building from source with stack
|
||||
|
||||
|
@ -34,21 +46,28 @@ On Debian:
|
|||
Get the git-annex source code, and inside the source tree run:
|
||||
|
||||
stack setup
|
||||
stack install
|
||||
stack build
|
||||
|
||||
Move git-annex into some directory that is in your PATH:
|
||||
To install the program and all associated files system-wide
|
||||
in `/usr/local`, run:
|
||||
|
||||
mv ~/.local/bin/git-annex ~/bin # or /usr/local/bin/ or whatever
|
||||
sudo make install BUILDER=stack PREFIX=/usr/local
|
||||
|
||||
Or, to install the program into $HOME/.local/bin, and associated files
|
||||
into other parts of your HOME directory, run:
|
||||
|
||||
make install-home BUILDER=stack
|
||||
|
||||
(Why not run `stack install git-annex`? Because that causes stack to
|
||||
[ignore git-annex's stack.yaml file](https://github.com/commercialhaskell/stack/issues/2371),
|
||||
yielding a less reliable build.)
|
||||
yielding a less reliable build. Stack also only installs the binary,
|
||||
and not other files.)
|
||||
|
||||
Note that this build produces a git-annex without the build flags
|
||||
XMPP, DBUS, and MagicMime.
|
||||
These optional features require installing additional C libraries.
|
||||
To try to build with these features
|
||||
enabled, pass extra parameters when running stack install:
|
||||
enabled, pass extra parameters when running `stack build`:
|
||||
`--flag git-annex:XMPP --flag git-annex:DBUS --flag git-annex:MagicMime`
|
||||
|
||||
## minimal build from source with cabal
|
||||
|
@ -67,8 +86,16 @@ Get the git-annex source code, and inside the source tree, run:
|
|||
cabal install -j -f"-assistant -webapp -webdav -pairing -dbus -magicmime" --only-dependencies
|
||||
cabal configure -f"-assistant -webapp -webdav -pairing -dbus -magicmime"
|
||||
cabal build -j
|
||||
PATH=$HOME/bin:$PATH
|
||||
cabal install --bindir=$HOME/bin
|
||||
|
||||
To install the program and all associated files system-wide
|
||||
in `/usr/local`, run:
|
||||
|
||||
sudo make install BUILDER=cabal PREFIX=/usr/local
|
||||
|
||||
Or, to install the program into $HOME/.local/bin, and associated files
|
||||
into other parts of your HOME directory, run:
|
||||
|
||||
make install-home BUILDER=cabal
|
||||
|
||||
## full build from source with cabal
|
||||
|
||||
|
@ -82,5 +109,13 @@ Once the C libraries are installed, run inside the source tree:
|
|||
cabal install -j --only-dependencies
|
||||
cabal configure
|
||||
cabal build -j
|
||||
PATH=$HOME/bin:$PATH
|
||||
cabal install --bindir=$HOME/bin
|
||||
|
||||
To install the program and all associated files system-wide
|
||||
in `/usr/local`, run:
|
||||
|
||||
sudo make install BUILDER=cabal PREFIX=/usr/local
|
||||
|
||||
Or, to install the program into $HOME/.local/bin, and associated files
|
||||
into other parts of your HOME directory, run:
|
||||
|
||||
make install-home BUILDER=cabal
|
||||
|
|
Loading…
Add table
Reference in a new issue