Module reexports, fixing #8407.
[ghc.git] / testsuite / tests / cabal / cabal05 / Makefile
1 TOP=../../..
2 include $(TOP)/mk/boilerplate.mk
3 include $(TOP)/mk/test.mk
4
5 SETUP = ../Setup -v0
6
7 # This test is for package reexports
8 # 1. install p
9 # 2. install q (reexporting p modules)
10 # 3. install r (reexporting p and q modules)
11 # 4. configure and build s, using modules from q and r
12 #
13 # Here are the permutations we test for:
14 # - Package qualifier? (YES/NO)
15 # - Where is module? (defined in SELF /
16 # (ORIGinally defined/REEXported) in DEPendency)
17 # For deps, could be BOTH, if there is NO package qualifier
18 # - Renamed? (YES/NO)
19 # - Multiple modules with same name? (YES/NO)
20 #
21 # It's illegal for the module to be defined in SELF without renaming, or
22 # for a package to cause a conflict with itself. A reexport which does
23 # not rename definitionally "conflicts" with the original package's definition.
24 #
25 # Probably the trickiest bits are when we automatically pick out which package
26 # when the package qualifier is missing, and handling whether or not modules
27 # should be exposed or hidden.
28
29 cabal05: clean
30 $(MAKE) clean
31 '$(GHC_PKG)' init tmp.d
32 '$(TEST_HC)' -v0 --make Setup
33 # build p
34 cd p && $(SETUP) clean
35 cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/$$pkgid'
36 cd p && $(SETUP) build
37 cd p && $(SETUP) copy
38 cd p && $(SETUP) register
39 # build q
40 cd q && $(SETUP) clean
41 cd q && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/$$pkgid'
42 cd q && $(SETUP) build
43 cd q && $(SETUP) copy
44 cd q && $(SETUP) register
45 # build r
46 cd r && $(SETUP) clean
47 cd r && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --prefix='$(PWD)/$$pkgid'
48 cd r && $(SETUP) build
49 cd r && $(SETUP) copy
50 cd r && $(SETUP) register
51 # build s
52 cd s && $(SETUP) clean
53 cd s && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
54 cd s && $(SETUP) build
55 # now test that package recaching works
56 rm tmp.d/package.cache
57 '$(GHC_PKG)' --no-user-package-db --global-package-db=tmp.d recache
58 cd s && $(SETUP) clean
59 cd s && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
60 cd s && $(SETUP) build
61 ifneq "$(CLEANUP)" ""
62 $(MAKE) clean
63 endif
64
65 clean :
66 '$(GHC_PKG)' unregister --force p >/dev/null 2>&1 || true
67 '$(GHC_PKG)' unregister --force q >/dev/null 2>&1 || true
68 '$(GHC_PKG)' unregister --force r >/dev/null 2>&1 || true
69 $(RM) -r p-* q-* r-* tmp.d *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)