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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# -----------------------------------------------------------------------------
#
# (c) 2009-2012 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture
# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying
#
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Bootstrapping ghc-pkg
utils/ghc-pkg/dist/build/Version.hs \
utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
$(call removeFiles,$@)
echo "module Version where" >> $@
echo "version, targetOS, targetARCH :: String" >> $@
echo "version = \"$(ProjectVersion)\"" >> $@
echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
utils/ghc-pkg_PACKAGE = ghc-pkg
# Note [Why build certain utils twice?]
#
# We build certain utils twice: once with stage0, and once with stage1.
# Examples are ghc-pkg and hsc2hs.
#
# These tools are needed during the bootstrapping process, so we have to use
# stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
# also used later in the build process). We install them inplace.
#
# But we can't install these copies when you run 'make install'. The reason is
# that when DYNAMIC_GHC_PROGRAMS=YES, we want to install copies that are
# dynamically linked. But the stage0 copies are either statically linked, or
# linked against libraries on the build machine.
#
# Therefore we build fresh copies, using the stage1 compiler, and install them
# when you run 'make install'. They are not used for any other purpose.
# -----------------------------------------------------------------------------
# Build ghc-pkg with the stage0 compiler in the dist directory, and install
# inplace. This is the copy we use during in-tree development.
utils/ghc-pkg_dist_USES_CABAL = YES
utils/ghc-pkg_dist_PROGNAME = ghc-pkg
utils/ghc-pkg_dist_SHELL_WRAPPER = YES
utils/ghc-pkg_dist_INSTALL_INPLACE = YES
# When cross-built ghc-stage2 is installed 'make install' needs to call
# native ghc-pkg (not the cross-built one) to register installed packages
# 'ghc-pkg_DIST_BINARY' variable only refer to native binary.
ghc-pkg_DIST_BINARY_NAME = ghc-pkg$(exeext0)
ghc-pkg_DIST_BINARY = utils/ghc-pkg/dist/build/tmp/$(ghc-pkg_DIST_BINARY_NAME)
# See Note [Stage1Only vs stage=1] in mk/config.mk.in.
ifeq "$(Stage1Only)" "YES"
# Install the copy of ghc-pkg from the dist directory when running 'make
# install' (it's the only copy we have at this stage).
utils/ghc-pkg_dist_INSTALL = YES
utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
endif
ifeq "$(WITH_TERMINFO)" "NO"
utils/ghc-pkg_dist-install_CONFIGURE_OPTS += -f-terminfo
endif
$(eval $(call build-prog,utils/ghc-pkg,dist,0))
$(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/.
utils/ghc-pkg/dist/package-data.mk: \
utils/ghc-pkg/dist/build/Version.hs
# -----------------------------------------------------------------------------
# Build another copy of ghc-pkg with the stage1 compiler in the dist-install
# directory. Don't install it inplace (we use the dist copy there), but do
# install it when running 'make install'.
#
# See Note [Why build certain utils twice?].
# See Note [Stage1Only vs stage=1] in mk/config.mk.in.
ifneq "$(Stage1Only)" "YES"
utils/ghc-pkg_dist-install_USES_CABAL = YES
utils/ghc-pkg_dist-install_PROGNAME = ghc-pkg
utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO
utils/ghc-pkg_dist-install_INSTALL = YES
utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
$(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
utils/ghc-pkg/dist-install/package-data.mk: \
utils/ghc-pkg/dist-install/build/Version.hs
endif
# -----------------------------------------------------------------------------
# Link ghc-pkg to ghc-pkg-$(ProjectVersion) when installing
ifeq "$(Windows_Host)" "NO"
install: install_utils/ghc-pkg_link
.PHONY: install_utils/ghc-pkg_link
install_utils/ghc-pkg_link:
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
$(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg")
$(LN_S) $(CrossCompilePrefix)ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg"
endif
|