forked from TritonDataCenter/illumos-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (129 loc) · 4.47 KB
/
Makefile
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
VER = gcc-4.4.4
MPFR_VER = mpfr-3.1.2
GMP_VER = gmp-5.1.1
include ../Makefile.defs
SEPARATE_BUILD = yes
GCC = /opt/local/bin/gcc
GXX = /bin/false
CFLAGS = -nostdinc -isystem /usr/include -g -O2
AUTOCONF_OPTS += \
--with-ld=/usr/bin/ld \
--without-gnu-ld \
--with-gnu-as \
--with-as=$(DESTDIR)/usr/gnu/bin/gas \
--enable-languages="c,c++" \
--enable-shared \
--disable-nls
AUTOCONF_ENV += \
DESTDIR=$(DESTDIR) \
MAKE=$(MAKE)
OVERRIDES += \
$(AUTOCONF_CFLAGS) \
STAGE1_CFLAGS="$(CFLAGS)" \
CFLAGS_FOR_TARGET="$(CFLAGS)"
#
# The runtime libraries that we build into proto.strap should be made to search
# for their dependencies there as well, so that programs built to run on the
# build machine (from proto.strap) find the correct copies of these libraries.
#
ifeq ($(STRAP),strap)
STRAPFIX_LINKS= \
$(DESTDIR)/lib/64 \
$(DESTDIR)/usr/lib/64
STRAPFIX_FILES_32 = \
$(DESTDIR)/usr/lib/libgcc_s.so.1 \
$(DESTDIR)/usr/lib/libstdc++.so.6
STRAPFIX_FILES_64 = \
$(DESTDIR)/usr/lib/64/libgcc_s.so.1 \
$(DESTDIR)/usr/lib/64/libstdc++.so.6
STRAPFIX_FILES = $(STRAPFIX_FILES_32) $(STRAPFIX_FILES_64)
endif
#
# Unlike everything else, gcc is built to be a cross-compiler, really. It
# never runs on the target system, only the build system. So it should not
# be using the proto area's headers or libraries. Its own libraries will be
# built by the new compiler, and generally aren't using system headers anyway.
# This is not really completely true; for example, libstdc++, and this will
# need more work to be really right. We only deliver the libraries.
#
AUTOCONF_CPPFLAGS =
AUTOCONF_LIBS =
GENLDFLAGS =
PATCHES = Patches/*
ALL_TGT = bootstrap
include ../Makefile.targ
include ../Makefile.targ.autoconf
#
# We could use the mpfr and gmp from the build system (since the compiler will
# be run here), but there's no good way to make gcc build itself correctly if
# we do. There are two main problems:
#
# 1. Stage2 and later cc1 and company don't honour any combination of LDFLAGS,
# LDFLAGS_FOR_TARGET, BOOT_LDFLAGS, STAGE2_LDFLAGS, etc. So the only ways to
# get these things built with -R/opt/local/lib are to use LD_OPTIONS which will
# yield the wrong results for libraries or to hack configure.
#
# 2. Even if we could get -R/opt/local/lib into these programs without building
# the libraries incorrectly, it would still be wrong. The pkgsrc lib directory
# on many systems contains libgcc_s.so.1; however, cc1 was built by the stage2
# compiler and should find the libgcc that matches that compiler. That happens
# to be the one we just built, not the pkgsrc one.
#
# So Instead we have mpfr and gmp built as part of the gcc build itself.
#
$(AUTOCONF_OUT.32): | $(VER.32)/mpfr $(VER.32)/gmp
$(VER.32)/mpfr: $(MPFR_VER).tar.gz | $(VER.32)
-rm -rf $@
mkdir -p .unpack32
gtar x -C .unpack32 -z --no-same-owner -f $(MPFR_VER).tar.gz
mv -f .unpack32/$(MPFR_VER) ./$@
-rmdir .unpack32
chmod 755 $@/configure
touch $@/configure
$(VER.32)/gmp: $(GMP_VER).tar.bz2 | $(VER.32)
-rm -rf $@
mkdir -p .unpack32
gtar x -C .unpack32 -j --no-same-owner -f $(GMP_VER).tar.bz2
mv -f .unpack32/$(GMP_VER) ./$@
-rmdir .unpack32
chmod 755 $@/configure
touch $@/configure
.PHONY: strapfix
strapfix: $(STRAPFIX_LINKS) $(STRAPFIX_FILES) | install
for f in $(STRAPFIX_FILES_32); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/lib:$(DESTDIR)/usr/lib' \
$$f; \
done
for f in $(STRAPFIX_FILES_64); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/lib/64:$(DESTDIR)/usr/lib/64' \
$$f; \
done
$(STRAPFIX_LINKS):
mkdir -p `dirname $@`
ln -s amd64 $@