cabal install doesn't use PATH

Frederik Eaton frederik at a5.repetae.net
Wed Jul 26 14:44:49 EDT 2006


On Wed, Jul 26, 2006 at 09:25:49AM -0700, Isaac Jones wrote:
> CCing Ian, since I seem to remember that he hacked on the makefile.
> 
> Frederik Eaton <frederik at a5.repetae.net> writes:
> 
> > Hi,
> >
> > What's the reason for not resolving executables through PATH in the
> > cabal Makefile?
> 
> No particularly good reason, afaik.
> 
> > $ pwd
> > /home/frederik/cabal-1.1.4
> > $ which ghc      
> > /home/frederik/arch/i386/bin/ghc
> > $ make install   
> > mkdir -p dist/tmp
> > /usr/bin/ghc --make -Wall -fno-warn-unused-matches -cpp -i. -odir dist/tmp -hidir dist/tmp Setup.lhs -o setup
> > make: /usr/bin/ghc: Command not found
> > make: *** [setup] Error 127
> >
> > If I want to specify a different version of GHC than the one I
> > normally use, then I could do:
> >
> > $ PATH=special-version-dir:$PATH make install
> 
> similar to:
> > $ HCBASE=special-version-dir make install
> 
> which works now, right? 

Yes, that was my point. My suggestion is quite similar in the unusual
case where one needs to specify a different compiler from what one
normally uses, and in the default case it's much shorter.

> One disadvantage to using PATH is in the case
> where you want to use the GHC in /usr/local, but some other tool in
> /usr.

$ mkdir ghcbin
$ ln -s /usr/local/bin/ghc ghcbin/
$ PATH=$PWD/ghcbin:$PATH make install

> > Why the cabal makefile has to introduce a new variable HCBASE to
> > achieve this functionality, I don't understand. It makes the normal
> > user's life much harder by breaking a standard Unix abstraction layer;
> > and at the same time it barely makes anyone else's life any easier.
> 
> It's only been a few years without anyone complaining ;)
> 
> > Also, I think it is more standard to use PREFIX to refer to what
> > appears as PREF in the makefile.
> 
> If no one has any objections, I'd be happy to apply a tested patch for
> this.

I've attached a tested patch.

Thanks,

Frederik

-- 
http://ofb.net/~frederik/
-------------- next part --------------
Only in cabal-1.1.4: dist
Only in cabal-1.1.4: .installed-pkg-config
diff -ur tmp/cabal-1.1.4/Makefile cabal-1.1.4/Makefile
--- tmp/cabal-1.1.4/Makefile	2006-05-01 19:41:33.000000000 +0100
+++ cabal-1.1.4/Makefile	2006-07-26 19:37:47.000000000 +0100
@@ -9,13 +9,11 @@
 #KIND=latest
 GHCFLAGS= --make -Wall -fno-warn-unused-matches -cpp
 # later: -Wall
-PREF=/usr/local
+PREFIX=/usr/local
 USER_FLAG =
 GHCPKGFLAGS = 
-#HCBASE=/tmp/ghc/bin/
-HCBASE=/usr/bin/
-HC=$(HCBASE)ghc
-HC_PKG=$(HCBASE)/ghc-pkg
+HC=ghc
+HC_PKG=ghc-pkg
 # Comment out this line if your system doesn't have System.Posix.
 ISPOSIX=-DHAVE_UNIX_PACKAGE
 
@@ -40,7 +38,7 @@
 	hmake -nhc98 -package base -prelude Setup
 
 config: setup
-	./setup configure --ghc --prefix=$(PREF)
+	./setup configure --ghc --prefix=$(PREFIX)
 
 build: build-stamp
 build-stamp: config
@@ -95,16 +93,16 @@
 remove: remove-cabal remove-hunit
 remove-cabal:
 	-$(HC_PKG) $(GHCPKGFLAGS) -r Cabal
-	-rm -rf $(PREF)/lib/Cabal-0.1
+	-rm -rf $(PREFIX)/lib/Cabal-0.1
 remove-hunit:
 	-$(HC_PKG) $(GHCPKGFLAGS) -r HUnit
-	-rm -rf $(PREF)/lib/HUnit-1.0
+	-rm -rf $(PREFIX)/lib/HUnit-1.0
 
 # dependencies (included):
 
 hunit: hunit-stamp
 hunit-stamp:
-	cd tests/HUnit-1.0 && make && ./setup configure --prefix=$(PREF) && ./setup build
+	cd tests/HUnit-1.0 && make && ./setup configure --prefix=$(PREFIX) && ./setup build
 	touch $@
 
 hunitInstall: hunitInstall-stamp
Only in cabal-1.1.4: Makefile~
diff -ur tmp/cabal-1.1.4/runTests.sh cabal-1.1.4/runTests.sh
--- tmp/cabal-1.1.4/runTests.sh	2006-05-01 19:12:45.000000000 +0100
+++ cabal-1.1.4/runTests.sh	2006-07-26 19:35:09.000000000 +0100
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-HCBASE=/usr/bin/
-HC=$HCBASE/ghc
+HC=ghc
 GHCFLAGS='--make -Wall -fno-warn-unused-matches -cpp'
 ISPOSIX=-DHAVE_UNIX_PACKAGE
 
Only in cabal-1.1.4: runTests.sh~
Only in cabal-1.1.4: setup
Only in cabal-1.1.4: .setup-config


More information about the Libraries mailing list