summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal/cabal06/Makefile
blob: 842378f64e00858840d1d46a128d252a3d1833f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk

SETUP=../Setup -v0

# This test is for packages whose package IDs overlap, but whose IPIDs
# do not.
#
#   1. install p-1.0
#   2. install q-1.0 (depending on p-1.0)
#   3. install p-1.1
#   4. install q-1.0, asking for p-1.1
#   5. install r-1.0 (depending on p-1.1, q-1.0)
#   6. install r-1.0 asking for p-1.0
#
# The notable steps are (4), which previously would have required a reinstall,
# and (6), where the dependency solver picks between two IPIDs with the
# same package ID based on their depenencies.
#
# ./Setup configure is pretty dumb, so we spoonfeed it precisely the
# dependencies it needs.

cabal06: clean
	$(MAKE) -s --no-print-directory clean
	'$(GHC_PKG)' init tmp.d
	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
	cd p-1.0 && $(SETUP) clean
	cd p-1.0 && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/inst-a' --ghc-pkg-options='--enable-multi-instance'
	cd p-1.0 && $(SETUP) build
	cd p-1.0 && $(SETUP) copy
	(cd p-1.0 && $(SETUP) register --print-ipid) > tmp_p_1_0
	cd q && $(SETUP) clean
	cd q && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/inst-b' --ghc-pkg-options='--enable-multi-instance'
	cd q && $(SETUP) build
	cd q && $(SETUP) copy
	(cd q && $(SETUP) register --print-ipid) > tmp_first_q
	cd p-1.1 && $(SETUP) clean
	cd p-1.1 && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/inst-c' --ghc-pkg-options='--enable-multi-instance'
	cd p-1.1 && $(SETUP) build
	cd p-1.1 && $(SETUP) copy
	(cd p-1.1 && $(SETUP) register --print-ipid) > tmp_p_1_1
	cd q && $(SETUP) clean
	cd q && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --constraint="p==1.1" --prefix='$(PWD)/inst-d' --ghc-pkg-options='--enable-multi-instance'
	cd q && $(SETUP) build
	cd q && $(SETUP) copy
	(cd q && $(SETUP) register --print-ipid) > tmp_second_q
	@echo "Does the first instance of q depend on p-1.0?"
	'$(GHC_PKG)' field --ipid `cat tmp_first_q` depends -f tmp.d | grep `cat tmp_p_1_0` | wc -l | sed 's/[[:space:]]//g'
	@echo "Does the second instance of q depend on p-1.0?"
	'$(GHC_PKG)' field --ipid `cat tmp_second_q` depends -f tmp.d | grep `cat tmp_p_1_1` | wc -l | sed 's/[[:space:]]//g'
	cd r && $(SETUP) clean
	cd r && ../Setup configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --dependency="q=`cat ../tmp_first_q`" --constraint="p==1.0" --prefix='$(PWD)/inst-e' --ghc-pkg-options='--enable-multi-instance'
	cd r && $(SETUP) build
	cd r && $(SETUP) copy
	cd r && $(SETUP) clean
	cd r && ../Setup configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --dependency="q=`cat ../tmp_second_q`" --constraint="p==1.1" --prefix='$(PWD)/inst-f' --ghc-pkg-options='--enable-multi-instance'
	cd r && $(SETUP) build
	cd r && $(SETUP) copy
	inst-e/bin/cabal06
	inst-f/bin/cabal06
ifneq "$(CLEANUP)" ""
	$(MAKE) -s --no-print-directory clean
endif

clean :
	'$(GHC_PKG)' unregister --force p >/dev/null 2>&1 || true
	'$(GHC_PKG)' unregister --force q >/dev/null 2>&1 || true
	'$(GHC_PKG)' unregister --force r >/dev/null 2>&1 || true
	$(RM) -r tmp.d inst-* *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)