Print this page
OS-2559 illumos-extra should provide native node in proto.strap
Split |
Close |
Expand all |
Collapse all |
--- old/gcc4/Makefile
+++ new/gcc4/Makefile
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
22 22 # Use is subject to license terms.
23 23 # Copyright (c) 2013, Joyent, Inc. All rights reserved.
24 24 #
25 25
26 26 VER = gcc-4.4.4
27 27 MPFR_VER = mpfr-3.1.2
28 28 GMP_VER = gmp-5.1.1
29 29
30 30 include ../Makefile.defs
31 31
32 32 SEPARATE_BUILD = yes
33 33
34 34 GCC = /opt/local/bin/gcc
35 35 GXX = /bin/false
36 36 CFLAGS = -nostdinc -isystem /usr/include -g -O2
37 37
38 38 AUTOCONF_OPTS += \
39 39 --with-ld=/usr/bin/ld \
40 40 --without-gnu-ld \
41 41 --with-gnu-as \
42 42 --with-as=$(DESTDIR)/usr/gnu/bin/gas \
43 43 --enable-languages="c,c++" \
44 44 --enable-shared \
45 45 --disable-nls
46 46
↓ open down ↓ |
46 lines elided |
↑ open up ↑ |
47 47 AUTOCONF_ENV += \
48 48 DESTDIR=$(DESTDIR) \
49 49 MAKE=$(MAKE)
50 50
51 51 OVERRIDES += \
52 52 $(AUTOCONF_CFLAGS) \
53 53 STAGE1_CFLAGS="$(CFLAGS)" \
54 54 CFLAGS_FOR_TARGET="$(CFLAGS)"
55 55
56 56 #
57 +# The runtime libraries that we build into proto.strap should be made to search
58 +# for their dependencies there as well, so that programs built to run on the
59 +# build machine (from proto.strap) find the correct copies of these libraries.
60 +#
61 +ifeq ($(STRAP),strap)
62 + STRAPFIX_LINKS= \
63 + $(DESTDIR)/lib/64 \
64 + $(DESTDIR)/usr/lib/64
65 + STRAPFIX_FILES_32 = \
66 + $(DESTDIR)/usr/lib/libgcc_s.so.1 \
67 + $(DESTDIR)/usr/lib/libstdc++.so.6
68 + STRAPFIX_FILES_64 = \
69 + $(DESTDIR)/usr/lib/64/libgcc_s.so.1 \
70 + $(DESTDIR)/usr/lib/64/libstdc++.so.6
71 + STRAPFIX_FILES = $(STRAPFIX_FILES_32) $(STRAPFIX_FILES_64)
72 +endif
73 +
74 +#
57 75 # Unlike everything else, gcc is built to be a cross-compiler, really. It
58 76 # never runs on the target system, only the build system. So it should not
59 77 # be using the proto area's headers or libraries. Its own libraries will be
60 78 # built by the new compiler, and generally aren't using system headers anyway.
61 79 # This is not really completely true; for example, libstdc++, and this will
62 80 # need more work to be really right. We only deliver the libraries.
63 81 #
64 82 AUTOCONF_CPPFLAGS =
65 83 AUTOCONF_LIBS =
66 84 GENLDFLAGS =
67 85
68 86 PATCHES = Patches/*
69 87 ALL_TGT = bootstrap
70 88
71 89 include ../Makefile.targ
72 90 include ../Makefile.targ.autoconf
73 91
74 92 #
75 93 # We could use the mpfr and gmp from the build system (since the compiler will
76 94 # be run here), but there's no good way to make gcc build itself correctly if
77 95 # we do. There are two main problems:
78 96 #
79 97 # 1. Stage2 and later cc1 and company don't honour any combination of LDFLAGS,
80 98 # LDFLAGS_FOR_TARGET, BOOT_LDFLAGS, STAGE2_LDFLAGS, etc. So the only ways to
81 99 # get these things built with -R/opt/local/lib are to use LD_OPTIONS which will
82 100 # yield the wrong results for libraries or to hack configure.
83 101 #
84 102 # 2. Even if we could get -R/opt/local/lib into these programs without building
85 103 # the libraries incorrectly, it would still be wrong. The pkgsrc lib directory
86 104 # on many systems contains libgcc_s.so.1; however, cc1 was built by the stage2
87 105 # compiler and should find the libgcc that matches that compiler. That happens
88 106 # to be the one we just built, not the pkgsrc one.
89 107 #
90 108 # So Instead we have mpfr and gmp built as part of the gcc build itself.
91 109 #
92 110 $(AUTOCONF_OUT.32): | $(VER.32)/mpfr $(VER.32)/gmp
93 111
94 112 $(VER.32)/mpfr: $(MPFR_VER).tar.gz | $(VER.32)
95 113 -rm -rf $@
96 114 mkdir -p .unpack32
97 115 gtar x -C .unpack32 -z --no-same-owner -f $(MPFR_VER).tar.gz
98 116 mv -f .unpack32/$(MPFR_VER) ./$@
99 117 -rmdir .unpack32
100 118 chmod 755 $@/configure
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
101 119 touch $@/configure
102 120
103 121 $(VER.32)/gmp: $(GMP_VER).tar.bz2 | $(VER.32)
104 122 -rm -rf $@
105 123 mkdir -p .unpack32
106 124 gtar x -C .unpack32 -j --no-same-owner -f $(GMP_VER).tar.bz2
107 125 mv -f .unpack32/$(GMP_VER) ./$@
108 126 -rmdir .unpack32
109 127 chmod 755 $@/configure
110 128 touch $@/configure
129 +
130 +.PHONY: strapfix
131 +strapfix: $(STRAPFIX_LINKS) $(STRAPFIX_FILES) | install
132 + for f in $(STRAPFIX_FILES_32); do \
133 + /usr/bin/elfedit -e \
134 + 'dyn:runpath $(DESTDIR)/lib:$(DESTDIR)/usr/lib' \
135 + $$f; \
136 + done
137 + for f in $(STRAPFIX_FILES_64); do \
138 + /usr/bin/elfedit -e \
139 + 'dyn:runpath $(DESTDIR)/lib/64:$(DESTDIR)/usr/lib/64' \
140 + $$f; \
141 + done
142 +
143 +$(STRAPFIX_LINKS):
144 + ln -s amd64 $@
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX