summaryrefslogtreecommitdiff
path: root/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
blob: 26382b3cf44c64413bf7febb2c086a3920f6ff7f (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
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
commit ff84d052850b637b03bbb98cf05202e44886257d
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date:   Sat Apr 8 10:02:34 2017 +0100

    cross-build 'unlit' and 'hp2ps' for stage2 install
    
    In navive build case it does not matter much if we build
    'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1:
    both GHCs are native compilers and both tools are written
    in C (have no haskell code).
    
    But in cross-case the difference is substantial:
    In Stag1Only=YES case we need to install native tools built
    by ghc-stage0/${host}-cc.
    In Stag1Only=NO  case we need to install cross-built tools
    built by ghc-stage1/${target}-cc.
    
    Before this change GHC did not have a rule to build cross-built
    'unlit' and 'hp2ps'.
    
    The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install'
    targets.
    
    'inplace/lib/bin/unlit.bin' target is unchanged and still contains
    native binary.
    
    As a result this change allows cross-building and packaging whole
    GHC for target platform!
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk
index f6e01ec6c1..21ce87dcfa 100644
--- a/utils/hp2ps/ghc.mk
+++ b/utils/hp2ps/ghc.mk
@@ -10,6 +10,7 @@
 #
 # -----------------------------------------------------------------------------
 
+# stage0
 utils/hp2ps_dist_C_SRCS          = AreaBelow.c Curves.c Error.c Main.c \
                                    Reorder.c TopTwenty.c AuxFile.c Deviation.c \
                                    HpFile.c Marks.c Scale.c TraceElement.c \
@@ -17,11 +18,27 @@ utils/hp2ps_dist_C_SRCS          = AreaBelow.c Curves.c Error.c Main.c \
                                    Utilities.c
 utils/hp2ps_dist_EXTRA_LIBRARIES = m
 utils/hp2ps_dist_PROGNAME        = hp2ps
-utils/hp2ps_dist_INSTALL         = YES
 utils/hp2ps_dist_INSTALL_INPLACE = YES
 utils/hp2ps_dist_SHELL_WRAPPER              = YES
 utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps
 
 utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
 
+# stage 1
+utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS)
+utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES)
+utils/hp2ps_dist-install_PROGNAME        = $(utils/hp2ps_dist_PROGNAME)
+utils/hp2ps_dist-install_INSTALL_INPLACE = NO
+utils/hp2ps_dist-install_SHELL_WRAPPER              = YES
+utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME)
+
+ifeq "$(Stage1Only)" "YES"
+utils/hp2ps_dist_INSTALL         = YES
+utils/hp2ps_dist-install_INSTALL = NO
+else
+utils/hp2ps_dist_INSTALL         = NO
+utils/hp2ps_dist-install_INSTALL = YES
+endif
+
 $(eval $(call build-prog,utils/hp2ps,dist,0))
+$(eval $(call build-prog,utils/hp2ps,dist-install,1))
diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk
index e947989b5e..8911f4e856 100644
--- a/utils/unlit/ghc.mk
+++ b/utils/unlit/ghc.mk
@@ -10,11 +10,25 @@
 #
 # -----------------------------------------------------------------------------
 
+# built by ghc-stage0
 utils/unlit_dist_C_SRCS  = unlit.c
 utils/unlit_dist_PROGNAME = unlit
 utils/unlit_dist_TOPDIR  = YES
-utils/unlit_dist_INSTALL = YES
 utils/unlit_dist_INSTALL_INPLACE = YES
 
-$(eval $(call build-prog,utils/unlit,dist,0))
+# built by ghc-stage1
+utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS)
+utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME)
+utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR)
+utils/unlit_dist-install_INSTALL_INPLACE = NO
+
+ifeq "$(Stage1Only)" "YES"
+utils/unlit_dist_INSTALL         = YES
+utils/unlit_dist-install_INSTALL = NO
+else
+utils/unlit_dist_INSTALL         = NO
+utils/unlit_dist-install_INSTALL = YES
+endif
 
+$(eval $(call build-prog,utils/unlit,dist,0))
+$(eval $(call build-prog,utils/unlit,dist-install,1))