summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal/cabal05/Makefile
blob: 2651e35a67230c281a870ccd7b80ed49419de8bd (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
71
72
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk

SETUP = ../Setup -v0

# This test is for package reexports
#   1. install p
#   2. install q (reexporting p modules)
#   3. install r (reexporting p and q modules)
#   4. configure and build s, using modules from q and r
#
# Here are the permutations we test for:
#   - Package qualifier? (YES/NO)
#   - Where is module? (defined in SELF /
#         (ORIGinally defined/REEXported) in DEPendency)
#         For deps, could be BOTH, if there is NO package qualifier
#   - Renamed? (YES/NO)
#   - Multiple modules with same name? (YES/NO)
#
# It's illegal for the module to be defined in SELF without renaming, or
# for a package to cause a conflict with itself.  A reexport which does
# not rename definitionally "conflicts" with the original package's definition.
#
# Probably the trickiest bits are when we automatically pick out which package
# when the package qualifier is missing, and handling whether or not modules
# should be exposed or hidden.

cabal05: clean
	$(MAKE) -s --no-print-directory clean
	'$(GHC_PKG)' init tmp.d
	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
	# build p
	cd p && $(SETUP) clean
	cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/$$pkgid'
	cd p && $(SETUP) build
	cd p && $(SETUP) copy
	cd p && $(SETUP) register
	# build q
	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)/$$pkgid'
	cd q && $(SETUP) build
	cd q && $(SETUP) copy
	cd q && $(SETUP) register
	# build r
	cd r && $(SETUP) clean
	cd r && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/$$pkgid'
	cd r && $(SETUP) build
	cd r && $(SETUP) copy
	cd r && $(SETUP) register
	# build s
	cd s && $(SETUP) clean
	cd s && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
	cd s && $(SETUP) build
	# now test that package recaching works
	rm tmp.d/package.cache
	'$(GHC_PKG)' --no-user-package-db --global-package-db=tmp.d recache
	cd s && $(SETUP) clean
	cd s && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
	cd s && $(SETUP) build
	cd t && $(SETUP) clean
	cd t && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
	! (cd t && $(SETUP) build)
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 p-* q-* r-* s-* t-* tmp.d *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)