Skip to content

Commit

Permalink
Merge pull request TritonDataCenter#12 from joyent/master
Browse files Browse the repository at this point in the history
update joyent commits
  • Loading branch information
plitc authored Nov 21, 2018
2 parents 1dddf7d + 38b3e67 commit 6193793
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 134 deletions.
46 changes: 30 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ DESTDIR = $(BASE)/proto
ifeq ($(STRAP),strap)

STRAPPROTO = $(DESTDIR)

COMMA=,
EXTRA_COMPILERS = $(subst $(COMMA), , $(SHADOW_COMPILERS))

SUBDIRS = \
cpp \
bzip2 \
Expand All @@ -36,17 +40,16 @@ SUBDIRS = \
node.js \
nss-nspr \
openssl1x \
perl
perl \
$(EXTRA_COMPILERS)

COMMA=,
EXTRA_COMPILERS = $(subst $(COMMA), , $(SHADOW_COMPILERS))
SUBDIRS += $(EXTRA_COMPILERS)
STRAPFIX += $(EXTRA_COMPILERS)
STRAPFIX += $(PRIMARY_COMPILER) $(EXTRA_COMPILERS)
STRAPFIX_SUBDIRS=$(STRAPFIX:%=%.strapfix)

else

STRAPPROTO = $(DESTDIR:proto=proto.strap)

SUBDIRS = \
bash \
bind \
Expand Down Expand Up @@ -89,6 +92,8 @@ SUBDIRS = \
wget \
xz

STRAPFIX_SUBDIRS =

endif

PATH = $(STRAPPROTO)/usr/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin
Expand Down Expand Up @@ -162,12 +167,14 @@ $(DESTDIR)/usr/gnu/bin/gas: FRC
ifeq ($(STRAP),strap)

$(DESTDIR)/usr/gcc/$(PRIMARY_COMPILER_VER)/bin/gcc: $(DESTDIR)/usr/gnu/bin/gas
@echo "========== building $@ =========="
(cd $(PRIMARY_COMPILER) && \
PKG_CONFIG_LIBDIR="" \
STRAP=$(STRAP) \
$(MAKE) DESTDIR=$(DESTDIR) install strapfix)

$(SUBDIRS): $(DESTDIR)/usr/gcc/$(PRIMARY_COMPILER_VER)/bin/gcc
@echo "========== strap building $@ =========="
(cd $@ && \
PKG_CONFIG_LIBDIR="" \
STRAP=$(STRAP) \
Expand All @@ -181,17 +188,28 @@ $(STRAPFIX_SUBDIRS): $(SUBDIRS)
(cd $$(basename $@ .strapfix) && \
PKG_CONFIG_LIBDIR="" \
STRAP=$(STRAP) \
PRIMARY_COMPILER=$(PRIMARY_COMPILER) \
$(MAKE) DESTDIR=$(DESTDIR) strapfix)

fixup_strap: $(STRAPFIX_SUBDIRS)

install_strap: binutils $(PRIMARY_COMPILER) $(SUBDIRS) fixup_strap

else

$(DESTDIR)/usr/bin/gcc: $(DESTDIR)/usr/gnu/bin/gas
#
# For the non-strap build, we just need the runtime libraries to be in place in
# the proto dir.
#
$(PRIMARY_COMPILER):
@echo "========== building $@ =========="
(cd $(PRIMARY_COMPILER) && \
PKG_CONFIG_LIBDIR="" \
STRAP=$(STRAP) \
$(MAKE) DESTDIR=$(DESTDIR) install strapfix)
$(MAKE) DESTDIR=$(DESTDIR) fixup)

$(SUBDIRS): $(DESTDIR)/usr/bin/gcc
$(SUBDIRS): $(PRIMARY_COMPILER)
@echo "========== building $@ =========="
(cd $@ && \
PKG_CONFIG_LIBDIR="" \
STRAP=$(STRAP) \
Expand All @@ -200,17 +218,13 @@ $(SUBDIRS): $(DESTDIR)/usr/bin/gcc
ALTCTFCONVERT=$(ALTCTFCONVERT) \
NATIVE_PERL=$(NATIVE_PERL) \
$(MAKE) DESTDIR=$(DESTDIR) install)
endif


install: $(SUBDIRS) $(PRIMARY_COMPILER) binutils
install: $(PRIMARY_COMPILER) $(SUBDIRS)

fixup_strap: $(STRAPFIX_SUBDIRS)

install_strap: $(SUBDIRS) $(PRIMARY_COMPILER) binutils fixup_strap
endif

clean:
-for dir in $(SUBDIRS) $(PRIMARY_COMPILER) binutils; \
-for dir in $(PRIMARY_COMPILER) $(SUBDIRS) binutils; \
do (cd $$dir; $(MAKE) DESTDIR=$(DESTDIR) clean); done
-rm -rf proto

Expand All @@ -226,4 +240,4 @@ tarball:

FRC:

.PHONY: manifest mancheck_conf
.PHONY: $(PRIMARY_COMPILER) $(SUBDIRS) binutils manifest mancheck_conf
4 changes: 2 additions & 2 deletions Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ GXX = $(DESTDIR)/usr/gcc/$(PRIMARY_COMPILER_VER)/bin/g++
LIBSTDCXX_RUNPATH = usr/gcc/$(PRIMARY_COMPILER_VER)/lib
else
STRAPPROTO = $(DESTDIR:proto=proto.strap)
GCC = $(DESTDIR)/usr/bin/gcc
GXX = $(DESTDIR)/usr/bin/g++
GCC = $(STRAPPROTO)/usr/bin/gcc
GXX = $(STRAPPROTO)/usr/bin/g++
endif

PATH = $(STRAPPROTO)/usr/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin
Expand Down
8 changes: 7 additions & 1 deletion binutils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
#
# CDDL HEADER END
#
# Copyright 2017, Joyent, Inc.
# Copyright 2018, Joyent, Inc.
#

VER = binutils-2.25.1

include ../Makefile.defs

#
# binutils configure ignores $CPPFLAGS, so pass our needed changes through
# $CFLAGS.
#
CFLAGS += $(CPPFLAGS)

TARBALL = $(VER).tar.bz2
TARBALL_COMPRESS = -j
AUTOCONF_OPTS = \
Expand Down
89 changes: 49 additions & 40 deletions gcc4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ GCC = /opt/local/bin/gcc
GXX = /bin/false
CFLAGS = -nostdinc -isystem /usr/include -g -O2

AUTOCONF_PREFIX = $(PREFIX)

AUTOCONF_OPTS += \
--with-ld=/usr/bin/ld \
--without-gnu-ld \
Expand All @@ -60,31 +62,6 @@ OVERRIDES += \
#
CLEANFILES += $(VER)-32.build $(VER)-32strap.build

#
# When building the strap code, it needs to exist in a different prefix.
#
ifeq ($(STRAP),strap)
AUTOCONF_PREFIX = $(PREFIX)
endif

#
# 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)/$(PREFIX)/lib/64
STRAPFIX_FILES_32 = \
$(DESTDIR)/$(PREFIX)/lib/libgcc_s.so.1 \
$(DESTDIR)/$(PREFIX)/lib/libstdc++.so.6
STRAPFIX_FILES_64 = \
$(DESTDIR)/$(PREFIX)/lib/64/libgcc_s.so.1 \
$(DESTDIR)/$(PREFIX)/lib/64/libstdc++.so.6
STRAPFIX_FILES = $(STRAPFIX_FILES_32) $(STRAPFIX_FILES_64)
STRAPFIX_BINS = gcc g++ cpp
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
Expand Down Expand Up @@ -141,23 +118,55 @@ $(VER.32)/gmp: $(GMP_VER).tar.bz2 | $(VER.32)
chmod 755 $@/configure
touch $@/configure

LIBTAR=$(STRAPPROTO)/gcclibs.tar.gz

ifeq ($(STRAP),strap)

#
# 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.
# (Currently, this is only relevant for libstdc++.)
#
# Before we do so, however, we'll keep copies for the non-strap build to pick
# up.
#
# We should also remove the "fixed" includes: they are just bad copies of the
# potentially old system headers.
#
FIXLIBS = libgcc_s.so libstdc++.so libssp.so
LIBDIR=$(DESTDIR)/$(PREFIX)/lib

.PHONY: strapfix
strapfix: $(STRAPFIX_LINKS) $(STRAPFIX_FILES) | install
for f in $(STRAPFIX_FILES_32); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/$(PREFIX)/lib' \
$$f; \
done
for f in $(STRAPFIX_FILES_64); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/$(PREFIX)/lib/64' \
$$f; \
done
strapfix:
[[ -h $(LIBDIR)/64 ]] || ln -s amd64 $(LIBDIR)/64
ifeq ($(PRIMARY_COMPILER),gcc4)
mkdir -p $(DESTDIR)/usr/bin
for f in $(STRAPFIX_BINS); do \
for f in gcc g++ cpp; do \
ln -sf $(DESTDIR)/$(PREFIX)/bin/$$f $(DESTDIR)/usr/bin/$$f; \
done
rm -f $(LIBTAR)
for lib in $(FIXLIBS); do \
(cd $(LIBDIR)/.. && gtar uvf $(LIBTAR) \
lib/$$lib.* lib/64/$$lib.*) ; \
done
endif
find $(LIBDIR) -name include-fixed | xargs rm -rf
for lib in $(FIXLIBS); do \
/usr/bin/elfedit -e 'dyn:runpath $(LIBDIR)' $(LIBDIR)/$$lib ; \
/usr/bin/elfedit -e 'dyn:runpath $(LIBDIR)/64' \
$(LIBDIR)/64/$$lib ; \
done


else

$(STRAPFIX_LINKS):
mkdir -p `dirname $@`
[[ -h $@ ]] || ln -s amd64 $@
#
# A non-strap build: do not install anything other than our saved copy of the
# runtime libraries. This should only happen for the primary compiler.
#
.PHONY: fixup
fixup:
cd $(DESTDIR)/usr && gtar xvf $(LIBTAR)

endif
94 changes: 58 additions & 36 deletions gcc7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
# modifications we need. We could probably do a git clone instead, but the
# tarball method is easier given these Makefiles.
#
# During a strap build, all compiler versions are built under
# proto.strap/usr/gcc/X. For the primary compiler, we symlink into
# proto.strap/usr/bin/gcc etc.
#
# For the non-strap build, we purposefully only install what the resulting
# platform builds: namely the gcc-derived runtime libraries. The shadow
# compilers are not relevant here.
#

VER = gcc-7.3.0-il-1
MPFR_VER = mpfr-3.1.6
Expand All @@ -34,6 +42,8 @@ GCC = /opt/local/bin/gcc
GXX = /opt/local/bin/g++
CFLAGS = -g -O2

AUTOCONF_PREFIX = $(PREFIX)

AUTOCONF_OPTS += \
--with-ld=/usr/bin/ld \
--without-gnu-ld \
Expand All @@ -58,30 +68,6 @@ OVERRIDES += \
#
CLEANFILES += $(VER)-32.build $(VER)-32strap.build

#
# When building the strap code, it needs to exist in a different prefix.
#
ifeq ($(STRAP),strap)
AUTOCONF_PREFIX = $(PREFIX)
endif

#
# 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)/$(PREFIX)/lib/64
STRAPFIX_FILES_32 = \
$(DESTDIR)/$(PREFIX)/lib/libgcc_s.so.1 \
$(DESTDIR)/$(PREFIX)/lib/libstdc++.so.6
STRAPFIX_FILES_64 = \
$(DESTDIR)/$(PREFIX)/lib/64/libgcc_s.so.1 \
$(DESTDIR)/$(PREFIX)/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
Expand Down Expand Up @@ -162,19 +148,55 @@ $(VER.32)/mpc: $(MPC_VER).tar.gz | $(VER.32)
chmod 755 $@/configure
touch $@/configure

LIBTAR=$(STRAPPROTO)/gcclibs.tar.gz

ifeq ($(STRAP),strap)

#
# 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.
# (Currently, this is only relevant for libstdc++.)
#
# Before we do so, however, we'll keep copies for the non-strap build to pick
# up.
#
# We should also remove the "fixed" includes: they are just bad copies of the
# potentially old system headers.
#
FIXLIBS = libgcc_s.so libstdc++.so libssp.so
LIBDIR=$(DESTDIR)/$(PREFIX)/lib

.PHONY: strapfix
strapfix: $(STRAPFIX_LINKS) $(STRAPFIX_FILES) | install
for f in $(STRAPFIX_FILES_32); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/$(PREFIX)/lib' \
$$f; \
strapfix:
ifeq ($(PRIMARY_COMPILER),gcc7)
[[ -h $(LIBDIR)/64 ]] || ln -s amd64 $(LIBDIR)/64
mkdir -p $(DESTDIR)/usr/bin
for f in gcc g++ cpp; do \
ln -sf $(DESTDIR)/$(PREFIX)/bin/$$f $(DESTDIR)/usr/bin/$$f; \
done
rm -f $(LIBTAR)
for lib in $(FIXLIBS); do \
(cd $(LIBDIR)/.. && gtar uvf $(LIBTAR) \
lib/$$lib.* lib/64/$$lib.*) ; \
done
for f in $(STRAPFIX_FILES_64); do \
/usr/bin/elfedit -e \
'dyn:runpath $(DESTDIR)/$(PREFIX)/lib/64' \
$$f; \
endif
find $(LIBDIR) -name include-fixed | xargs rm -rf
for lib in $(FIXLIBS); do \
/usr/bin/elfedit -e 'dyn:runpath $(LIBDIR)' $(LIBDIR)/$$lib ; \
/usr/bin/elfedit -e 'dyn:runpath $(LIBDIR)/64' \
$(LIBDIR)/64/$$lib ; \
done

$(STRAPFIX_LINKS):
mkdir -p `dirname $@`
[[ -h $@ ]] || ln -s amd64 $@

else

#
# A non-strap build: do not install anything other than our saved copy of the
# runtime libraries. This should only happen for the primary compiler.
#
.PHONY: fixup
fixup:
cd $(DESTDIR)/usr && gtar xvf $(LIBTAR)

endif
Loading

0 comments on commit 6193793

Please sign in to comment.