summaryrefslogtreecommitdiff
path: root/cross/COMMON
diff options
context:
space:
mode:
authortv <tv>1999-01-04 22:37:29 +0000
committertv <tv>1999-01-04 22:37:29 +0000
commit1ac8c0ae893cce269b1164bb0d5d075a4e36279b (patch)
treef6d6b811a4c9cc20cd3b49a70a233e6958d1095b /cross/COMMON
parent531eb73376adf514ac2b79ec993c9774230ed45b (diff)
downloadpkgsrc-1ac8c0ae893cce269b1164bb0d5d075a4e36279b.tar.gz
Major `cross' category overhaul. Clean up the shared Makefiles; move all
binutils stuff (except gas) to a shared, multiple-target binutils build; reduce extract and compile times by being more specific with files and targets; update to egcs 1.1.1 with a diffball from NetBSD's src/gnu/dist tree; add 4.4BSD a.out archive support to binutils.
Diffstat (limited to 'cross/COMMON')
-rw-r--r--cross/COMMON/PLIST-binutils26
-rw-r--r--cross/COMMON/PLIST-egcs (renamed from cross/COMMON/PLIST-egcs-ss)16
-rw-r--r--cross/COMMON/buwrapper.c50
-rw-r--r--cross/COMMON/cross.mk216
-rw-r--r--cross/COMMON/exclude11
-rw-r--r--cross/COMMON/patches-binutils/patch-aa21
-rw-r--r--cross/COMMON/patches-binutils/patch-arrays22
-rw-r--r--cross/COMMON/patches-egcs-ss/patch-ab10
-rw-r--r--cross/COMMON/patches-egcs/patch-aa (renamed from cross/COMMON/patches-egcs-ss/patch-aa)2
9 files changed, 265 insertions, 109 deletions
diff --git a/cross/COMMON/PLIST-binutils b/cross/COMMON/PLIST-binutils
index ad65a1000b3..48e750e7a33 100644
--- a/cross/COMMON/PLIST-binutils
+++ b/cross/COMMON/PLIST-binutils
@@ -1,20 +1,7 @@
-@comment $NetBSD: PLIST-binutils,v 1.1 1998/08/12 02:42:28 tv Exp $
-${TARGET_ARCH}/bin/addr2line
-${TARGET_ARCH}/bin/ar
-${TARGET_ARCH}/bin/as
-${TARGET_ARCH}/bin/gasp
-${TARGET_ARCH}/bin/ld
-${TARGET_ARCH}/bin/nm
-${TARGET_ARCH}/bin/objcopy
-${TARGET_ARCH}/bin/objdump
-${TARGET_ARCH}/bin/ranlib
-${TARGET_ARCH}/bin/size
-${TARGET_ARCH}/bin/strings
-${TARGET_ARCH}/bin/strip
+@comment $NetBSD: PLIST-binutils,v 1.2 1999/01/04 22:37:30 tv Exp $
bin/${TARGET_ARCH}-addr2line
bin/${TARGET_ARCH}-ar
bin/${TARGET_ARCH}-as
-bin/${TARGET_ARCH}-gasp
bin/${TARGET_ARCH}-ld
bin/${TARGET_ARCH}-nm
bin/${TARGET_ARCH}-objcopy
@@ -23,3 +10,14 @@ bin/${TARGET_ARCH}-ranlib
bin/${TARGET_ARCH}-size
bin/${TARGET_ARCH}-strings
bin/${TARGET_ARCH}-strip
+${TARGET_ARCH}/bin/addr2line
+${TARGET_ARCH}/bin/ar
+${TARGET_ARCH}/bin/as
+${TARGET_ARCH}/bin/ld
+${TARGET_ARCH}/bin/nm
+${TARGET_ARCH}/bin/objcopy
+${TARGET_ARCH}/bin/objdump
+${TARGET_ARCH}/bin/ranlib
+${TARGET_ARCH}/bin/size
+${TARGET_ARCH}/bin/strings
+${TARGET_ARCH}/bin/strip
diff --git a/cross/COMMON/PLIST-egcs-ss b/cross/COMMON/PLIST-egcs
index 079cdf41c68..65e49831f63 100644
--- a/cross/COMMON/PLIST-egcs-ss
+++ b/cross/COMMON/PLIST-egcs
@@ -1,8 +1,9 @@
-@comment $NetBSD: PLIST-egcs-ss,v 1.1 1998/08/12 02:42:28 tv Exp $
+@comment $NetBSD: PLIST-egcs,v 1.1 1999/01/04 22:37:30 tv Exp $
${TARGET_ARCH}/bin/c++
${TARGET_ARCH}/bin/c++filt
${TARGET_ARCH}/bin/cc
${TARGET_ARCH}/bin/f77
+${TARGET_ARCH}/bin/fort77
${TARGET_ARCH}/bin/g++
${TARGET_ARCH}/bin/g77
${TARGET_ARCH}/bin/gcc
@@ -11,6 +12,7 @@ bin/${TARGET_ARCH}-c++
bin/${TARGET_ARCH}-c++filt
bin/${TARGET_ARCH}-cc
bin/${TARGET_ARCH}-f77
+bin/${TARGET_ARCH}-fort77
bin/${TARGET_ARCH}-g++
bin/${TARGET_ARCH}-g77
bin/${TARGET_ARCH}-gcc
@@ -179,9 +181,9 @@ lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include/varargs.h
lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/libg2c.a
lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/libgcc.a
lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/specs
-@dirrm lib/gcc-lib/i386-linuxglibc1/egcs-2.91.53/include/objc
-@dirrm lib/gcc-lib/i386-linuxglibc1/egcs-2.91.53/include/g++/std
-@dirrm lib/gcc-lib/i386-linuxglibc1/egcs-2.91.53/include/g++
-@dirrm lib/gcc-lib/i386-linuxglibc1/egcs-2.91.53/include
-@dirrm lib/gcc-lib/i386-linuxglibc1/egcs-2.91.53
-@dirrm lib/gcc-lib/i386-linuxglibc1
+@dirrm lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include/objc
+@dirrm lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include/g++/std
+@dirrm lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include/g++
+@dirrm lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include
+@dirrm lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}
+@dirrm lib/gcc-lib/${TARGET_ARCH}
diff --git a/cross/COMMON/buwrapper.c b/cross/COMMON/buwrapper.c
new file mode 100644
index 00000000000..0617513a720
--- /dev/null
+++ b/cross/COMMON/buwrapper.c
@@ -0,0 +1,50 @@
+/* $NetBSD: buwrapper.c,v 1.1 1999/01/04 22:37:30 tv Exp $ */
+
+#include <err.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+/*
+ * Wrapper for binutils programs.
+ *
+ * This frontend sets the appropriate environment variables that tell
+ * binutils programs which target will be used.
+ */
+
+static const char binsubdir[] = "libexec/binutils";
+
+#define PATHLEN sizeof(PREFIX) + sizeof(binsubdir) + 20
+
+int main(int argc, char **argv) {
+ char path[PATHLEN], *p, *prog;
+
+ /* quickly find last part of path component */
+ if (p = strrchr(argv[0], '/'))
+ p++;
+ else
+ p = argv[0];
+ if (prog = strrchr(p, '-'))
+ prog++;
+ else
+ prog = p;
+
+ /* make program pathname */
+ snprintf(path, PATHLEN, "%s/%s/%s", PREFIX, binsubdir, prog);
+
+ /* set up environment */
+ setenv("GNUTARGET", GNUTARGET, 1);
+#ifdef LDEMULATION
+ setenv("LDEMULATION", LDEMULATION, 1);
+#endif
+#ifdef LD_RPATH_LINK
+ setenv("LD_RPATH_LINK", LD_RPATH_LINK, 1);
+#endif
+
+ /* run it! */
+ execv(path, argv);
+
+ /* we shouldn't get here. */
+ err(EX_OSERR, "(buwrapper): exec %s", path);
+}
diff --git a/cross/COMMON/cross.mk b/cross/COMMON/cross.mk
index 9a3cd147d17..b618c5e05a9 100644
--- a/cross/COMMON/cross.mk
+++ b/cross/COMMON/cross.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cross.mk,v 1.3 1998/08/20 15:16:44 tsarna Exp $
+# $NetBSD: cross.mk,v 1.4 1999/01/04 22:37:30 tv Exp $
# Shared definitions for building a cross-compile environment.
@@ -13,8 +13,8 @@ TARGET_DIR= ${PREFIX}/${TARGET_ARCH}
COMMON_DIR= ${PKGSRCDIR}/cross/COMMON
PLIST_PRE?= ${PKGDIR}/PLIST
-do-install: do-install-dirs
-do-install-dirs:
+pre-install: pre-install-dirs
+pre-install-dirs:
${INSTALL_DATA_DIR} ${PREFIX}
${INSTALL_DATA_DIR} ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/lib
@@ -23,67 +23,100 @@ do-install-dirs:
${INSTALL_DATA_DIR} ${TARGET_DIR}/include
${INSTALL_DATA_DIR} ${TARGET_DIR}/lib
-.if defined(USE_CROSS_GNU)
+.if defined(USE_CROSS_BINUTILS)
BINUTILS_DISTNAME= binutils-2.9.1
+BINUTILS_WRKSRC= ${WRKDIR}/${BINUTILS_DISTNAME}
+
CROSS_DISTFILES+= ${BINUTILS_DISTNAME}.tar.gz
MASTER_SITES+= ${MASTER_SITE_GNU}
CONFIGURE_ARGS+= --with-gnu-as --with-gnu-ld
+DEPENDS+= cross-binutils-2.9.1.0:../../cross/binutils
PLIST_PRE+= ${COMMON_DIR}/PLIST-binutils
-#CROSS_PATCHFILES+= ${COMMON_DIR}/patches-binutils/patch-*
-USE_CROSS_EGCS= yes
-
-post-extract: post-extract-binutils
-post-extract-binutils:
- @cd ${WRKSRC} && \
- ${LN} -sf ../${BINUTILS_DISTNAME}/bfd && \
- ${LN} -sf ../${BINUTILS_DISTNAME}/binutils && \
- ${LN} -sf ../${BINUTILS_DISTNAME}/gas && \
- ${LN} -sf ../${BINUTILS_DISTNAME}/ld && \
- ${LN} -sf ../${BINUTILS_DISTNAME}/opcodes && \
- ${LN} -sf ../gas/as-new gcc/as && \
- ${LN} -sf ../ld/ld-new gcc/ld
- @cd ${WRKDIR}/${BINUTILS_DISTNAME} && \
- ${RM} -rf libiberty texinfo && \
- ${LN} -sf ../${EGCS_DISTNAME}/libiberty
-
-do-install: do-install-binutils
-do-install-binutils:
- @cd ${WRKSRC}/binutils && ${GMAKE} install-exec
- @cd ${WRKSRC}/gas && ${GMAKE} install-exec
- @cd ${WRKSRC}/ld && ${GMAKE} install-exec
- for file in addr2line c++filt gasp objcopy objdump size strings; do \
- ${LN} -f ${PREFIX}/bin/${TARGET_ARCH}-$$file ${TARGET_DIR}/bin/$$file; \
+
+AS_FOR_TARGET= ${BINUTILS_WRKSRC}/gas/as-new
+AR_FOR_TARGET= ${WRKDIR}/ar
+NM_FOR_TARGET= ${WRKDIR}/nm
+RANLIB_FOR_TARGET= ${WRKDIR}/ranlib
+LD_FOR_TARGET= ${WRKDIR}/ld
+
+pre-patch: binutils-patch
+pre-configure: binutils-configure
+do-build: binutils-build
+do-install: binutils-install
+
+binutils-patch:
+ @for i in ${COMMON_DIR}/patches-binutils/patch-*; do \
+ ${PATCH} -d ${BINUTILS_WRKSRC} --forward --quiet -E < $$i; \
+ done
+
+binutils-configure:
+ @cd ${BINUTILS_WRKSRC} && ${SETENV} CC="${CC}" ac_cv_path_CC="${CC}" \
+ CFLAGS="${CFLAGS}" ${CONFIGURE_ENV} ./configure \
+ --prefix=${PREFIX} --host=${MACHINE_GNU_ARCH}--netbsd \
+ --target=${TARGET_ARCH}
+
+binutils-build:
+ @cd ${BINUTILS_WRKSRC}/bfd && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} bfd.h
+ @cd ${BINUTILS_WRKSRC}/libiberty && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} all
+ @cd ${BINUTILS_WRKSRC}/gas && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} as-new
+ ${LINK.c} -o ${WRKDIR}/ar \
+ -DPREFIX=\"${PREFIX}\" \
+ -DGNUTARGET=\"${BINUTILS_GNUTARGET}\" \
+ ${COMMON_DIR}/buwrapper.c
+ @cd ${WRKDIR} && \
+ ${LN} -f ar nm && \
+ ${LN} -f ar ranlib
+ ${LINK.c} -o ${WRKDIR}/ld \
+ -DPREFIX=\"${PREFIX}\" \
+ -DGNUTARGET=\"${BINUTILS_GNUTARGET}\" \
+ -DLDEMULATION=\"${BINUTILS_LDEMULATION}\" \
+ -DLD_RPATH_LINK=\"${TARGET_DIR}/lib\" \
+ ${COMMON_DIR}/buwrapper.c
+
+binutils-install:
+ ${INSTALL_PROGRAM} ${BINUTILS_WRKSRC}/gas/as-new ${TARGET_DIR}/bin/as
+ ${INSTALL_PROGRAM} ${WRKDIR}/ar ${TARGET_DIR}/bin/ar
+ ${INSTALL_PROGRAM} ${WRKDIR}/ld ${TARGET_DIR}/bin/ld
+ for i in addr2line nm objcopy objdump ranlib size strings strip ${BINUTILS_EXTRAS}; do \
+ ${LN} -f ${TARGET_DIR}/bin/ar ${TARGET_DIR}/bin/$$i; \
+ done
+ for i in addr2line ar as ld nm objcopy objdump ranlib size strings strip ${BINUTILS_EXTRAS}; do \
+ ${LN} -f ${TARGET_DIR}/bin/$$i ${PREFIX}/bin/${TARGET_ARCH}-$$i; \
done
.endif
.if defined(USE_CROSS_EGCS)
-#.if defined(USE_CROSS_EGCS_SNAPSHOT)
-EGCS_DISTNAME= egcs-19980803
-EGCS_DISTDIR= snapshots/1998-08-03
-EGCS_INTVERSION= egcs-2.91.53
-EGCS_PLIST_PRE= ${COMMON_DIR}/PLIST-egcs-ss
-CROSS_PATCHFILES+= ${COMMON_DIR}/patches-egcs-ss/patch-*
-#.else
-#EGCS_DISTNAME= egcs-1.1
-#EGCS_DISTDIR= releases/egcs-1.1
-#EGCS_INTVERSION= egcs-2.??.??
-#.endif
-
-CROSS_DISTFILES+= ${EGCS_DISTNAME}.tar.gz
-MASTER_SITES+= ftp://egcs.cygnus.com/pub/egcs/${EGCS_DISTDIR}/
-WRKSRC= ${WRKDIR}/${EGCS_DISTNAME}
-PLIST_PRE+= ${EGCS_PLIST_PRE}
-
-GNU_CONFIGURE= yes
-CONFIGURE_ARGS+= --target=${TARGET_ARCH} \
- --enable-version-specific-runtime-libs
-CONFIGURE_ENV+= CXXFLAGS="${CXXFLAGS}"
+EGCS_DISTNAME= egcs-1.1.1
+EGCS_DISTDIR= releases/${EGCS_DISTNAME}
+EGCS_INTVERSION= egcs-2.91.60
+EGCS_PATCHBUNDLE= ${EGCS_DISTNAME}-NetBSD-19980104.diff.gz
+EGCS_WRKSRC= ${WRKDIR}/${EGCS_DISTNAME}
+# XXX PLIST support for fewer languages not yet complete
+EGCS_LANGUAGES?= c c++ f77 objc
+
+CROSS_DISTFILES+= ${EGCS_DISTNAME}.tar.gz ${EGCS_PATCHBUNDLE}
+MASTER_SITES+= ftp://egcs.cygnus.com/pub/egcs/${EGCS_DISTDIR}/ \
+ ${MASTER_SITE_LOCAL}
+PLIST_PRE+= ${COMMON_DIR}/PLIST-egcs
USE_GMAKE= yes
-MAKE_FLAGS+= CC_FOR_TARGET="${WRKSRC}/gcc/xgcc -B${WRKSRC}/gcc/ ${CFLAGS_FOR_TARGET}" \
- GCC_FOR_TARGET='$${CC_FOR_TARGET}' \
- CXX_FOR_TARGET='$${CC_FOR_TARGET}' \
+
+CC_FOR_TARGET= ${EGCS_WRKSRC}/gcc/xgcc -B${EGCS_WRKSRC}/gcc/ ${CFLAGS_FOR_TARGET}
+CXX_FOR_TARGET= ${CC_FOR_TARGET}
+
+EGCS_MAKE_FLAGS= CC_FOR_TARGET="${CC_FOR_TARGET}" \
+ GCC_FOR_TARGET="${CC_FOR_TARGET}" \
+ CXX_FOR_TARGET="${CXX_FOR_TARGET}" \
+ AS_FOR_TARGET="${AS_FOR_TARGET}" \
+ AR_FOR_TARGET="${AR_FOR_TARGET}" \
+ NM_FOR_TARGET="${NM_FOR_TARGET}" \
+ RANLIB_FOR_TARGET="${RANLIB_FOR_TARGET}" \
LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}" \
- LANGUAGES="c c++ f77 objc"
+ LANGUAGES="${EGCS_LANGUAGES}" \
+ INSTALL="${INSTALL} -c -o ${BINOWN} -g ${BINGRP}" \
+ INSTALL_PROGRAM="${INSTALL_PROGRAM}"
.if defined(SYS_INCLUDE)
CFLAGS_FOR_TARGET+= -idirafter ${SYS_INCLUDE}
@@ -93,33 +126,72 @@ MAKE_FLAGS+= SYSTEM_HEADER_DIR="${SYS_INCLUDE}"
LDFLAGS_FOR_TARGET+= -L${SYS_LIB}
.endif
-post-extract: post-extract-egcs
-post-extract-egcs:
- @cd ${WRKSRC} && ${RM} -rf texinfo
+pre-patch: egcs-patch
+pre-configure: egcs-configure
+do-build: egcs-build
+do-install: egcs-install
-do-install: do-install-egcs
-do-install-egcs:
- @cd ${WRKSRC}/gcc && ${GMAKE} ${MAKE_FLAGS} install-common install-headers install-libgcc install-driver
+egcs-patch:
+ @${GZCAT} ${_DISTDIR}/${EGCS_PATCHBUNDLE} | \
+ ${PATCH} -d ${EGCS_WRKSRC} --forward --quiet -E
+ @for i in ${COMMON_DIR}/patches-egcs/patch-*; do \
+ ${PATCH} -d ${EGCS_WRKSRC} --forward --quiet -E < $$i; \
+ done
+
+egcs-configure:
+ @cd ${EGCS_WRKSRC} && ${SETENV} CC="${CC}" ac_cv_path_CC="${CC}" \
+ CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" \
+ INSTALL="${INSTALL} -c -o ${BINOWN} -g ${BINGRP}" \
+ INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
+ ./configure --prefix=${PREFIX} \
+ --host=${MACHINE_GNU_ARCH}--netbsd --target=${TARGET_ARCH} \
+ --enable-version-specific-runtime-libs
+
+egcs-build:
+ @${LN} -sf ${AS_FOR_TARGET} ${EGCS_WRKSRC}/gcc/as
+ @${LN} -sf ${LD_FOR_TARGET} ${EGCS_WRKSRC}/gcc/ld
+ @cd ${EGCS_WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${EGCS_MAKE_FLAGS} all
+
+egcs-install:
+ @cd ${EGCS_WRKSRC}/gcc && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${EGCS_MAKE_FLAGS} \
+ install-common install-headers install-libgcc install-driver
chown -R ${BINOWN}:${BINGRP} ${PREFIX}/lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}
- @cd ${WRKSRC} && ${GMAKE} ${MAKE_FLAGS} install-target-libf2c install-target-libstdc++
+ @cd ${EGCS_WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${EGCS_MAKE_FLAGS} install-target-libf2c
+ @${MKDIR} ${PREFIX}/lib/gcc-lib/${TARGET_ARCH}/${EGCS_INTVERSION}/include/g++/std
+ @cd ${EGCS_WRKSRC} && ${SETENV} ${MAKE_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} ${EGCS_MAKE_FLAGS} install-target-libstdc++
+ ${LN} -f ${TARGET_DIR}/bin/gcc ${TARGET_DIR}/bin/cc
${LN} -f ${PREFIX}/bin/${TARGET_ARCH}-gcc ${PREFIX}/bin/${TARGET_ARCH}-cc
${LN} -f ${PREFIX}/bin/${TARGET_ARCH}-g77 ${PREFIX}/bin/${TARGET_ARCH}-f77
- for file in cc c++ f77 g++ g77; do \
+ ${LN} -f ${PREFIX}/bin/${TARGET_ARCH}-g77 ${PREFIX}/bin/${TARGET_ARCH}-fort77
+ for file in cc c++ c++filt f77 fort77 g++ g77; do \
${LN} -f ${PREFIX}/bin/${TARGET_ARCH}-$$file ${TARGET_DIR}/bin/$$file; \
done
@${RMDIR} -p ${PREFIX}/info 2>/dev/null || ${TRUE}
@${RMDIR} -p ${PREFIX}/man/man1 2>/dev/null || ${TRUE}
.endif
+.if defined(CROSS_DISTFILES)
+DISTFILES+= ${CROSS_DISTFILES}
+.if defined(EXTRACT_ONLY)
+EXTRACT_ONLY+= ${CROSS_DISTFILES:N*.diff.gz}
+.else
+EXTRACT_ONLY= ${DISTFILES:N*.diff.gz}
+.endif
+.endif
+
.if defined(SYS_INCLUDE)
-do-install: do-install-includes
-do-install-includes:
+pre-install: pre-install-includes
+pre-install-includes:
cd ${SYS_INCLUDE} && pax -rw . ${TARGET_DIR}/include
.endif
.if defined(SYS_LIB)
-do-install: do-install-lib
-do-install-lib:
+pre-install: pre-install-lib
+pre-install-lib:
cd ${SYS_LIB} && pax -rw . ${TARGET_DIR}/lib
.endif
@@ -133,16 +205,6 @@ post-install-plist:
@${ECHO} '@dirrm ${TARGET_ARCH}/lib' >>${PLIST_SRC}
@${ECHO} '@dirrm ${TARGET_ARCH}' >>${PLIST_SRC}
-.if defined(CROSS_PATCHFILES)
-PATCHFILES+= ${CROSS_PATCHFILES}
-ALLFILES= ${DISTFILES} # don't checksum shared patches
-.endif
-
-.if defined(CROSS_DISTFILES)
-DISTFILES+= ${CROSS_DISTFILES}
-.if defined(EXTRACT_ONLY)
-EXTRACT_ONLY+= ${CROSS_DISTFILES}
-.endif
-.endif
-
.include "../../mk/bsd.pkg.mk"
+
+EXTRACT_BEFORE_ARGS:= -X ${COMMON_DIR}/exclude ${EXTRACT_BEFORE_ARGS}
diff --git a/cross/COMMON/exclude b/cross/COMMON/exclude
new file mode 100644
index 00000000000..a3be5a8c5ab
--- /dev/null
+++ b/cross/COMMON/exclude
@@ -0,0 +1,11 @@
+egcs-*/*/tests/*
+egcs-*/*/testsuite/*
+egcs-*/gcc/*/tests/*
+egcs-*/gcc/*/testsuite/*
+egcs-*/texinfo/*
+binutils-*/*/tests/*
+binutils-*/*/testsuite/*
+binutils-*/binutils/*
+binutils-*/etc/*
+binutils-*/gprof/*
+binutils-*/ld/*
diff --git a/cross/COMMON/patches-binutils/patch-aa b/cross/COMMON/patches-binutils/patch-aa
new file mode 100644
index 00000000000..6201c47aacc
--- /dev/null
+++ b/cross/COMMON/patches-binutils/patch-aa
@@ -0,0 +1,21 @@
+$NetBSD: patch-aa,v 1.1 1999/01/04 22:37:30 tv Exp $
+
+--- gas/Makefile.in.orig Mon Jan 4 00:34:23 1999
++++ gas/Makefile.in Mon Jan 4 00:37:14 1999
+@@ -452,14 +452,14 @@
+ # How to link with both our special library facilities
+ # and the system's installed libraries.
+
+-GASLIBS = @OPCODES_LIB@ @BFDLIB@ ../libiberty/libiberty.a
++GASLIBS = ../libiberty/libiberty.a
+
+ # Files to be copied away after each stage in building.
+ STAGESTUFF = *.o $(noinst_PROGRAMS)
+
+ as_new_SOURCES = $(GAS_CFILES)
+ as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
+- $(extra_objects) $(GASLIBS)
++ $(extra_objects) -Wl,-R${PREFIX}/lib -L${PREFIX}/lib -lopcodes-2.9.1 -lbfd-2.9.1 $(GASLIBS)
+ as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
+ $(extra_objects) $(GASLIBS)
+
diff --git a/cross/COMMON/patches-binutils/patch-arrays b/cross/COMMON/patches-binutils/patch-arrays
new file mode 100644
index 00000000000..f283f155c63
--- /dev/null
+++ b/cross/COMMON/patches-binutils/patch-arrays
@@ -0,0 +1,22 @@
+--- ./bfd/libbfd-in.h.orig Fri May 1 11:48:12 1998
++++ ./bfd/libbfd-in.h Mon Dec 28 17:43:21 1998
+@@ -496,7 +498,7 @@
+
+ /* List of supported target vectors, and the default vector (if
+ bfd_default_vector[0] is NULL, there is no default). */
+-extern const bfd_target * const bfd_target_vector[];
++extern const bfd_target * const *bfd_target_vector;
+ extern const bfd_target *bfd_default_vector[];
+
+ /* Functions shared by the ECOFF and MIPS ELF backends, which have no
+--- ./bfd/libbfd.h.orig Fri May 1 11:48:12 1998
++++ ./bfd/libbfd.h Mon Dec 28 17:43:21 1998
+@@ -496,7 +498,7 @@
+
+ /* List of supported target vectors, and the default vector (if
+ bfd_default_vector[0] is NULL, there is no default). */
+-extern const bfd_target * const bfd_target_vector[];
++extern const bfd_target * const *bfd_target_vector;
+ extern const bfd_target *bfd_default_vector[];
+
+ /* Functions shared by the ECOFF and MIPS ELF backends, which have no
diff --git a/cross/COMMON/patches-egcs-ss/patch-ab b/cross/COMMON/patches-egcs-ss/patch-ab
deleted file mode 100644
index 6ddc6a8e0f1..00000000000
--- a/cross/COMMON/patches-egcs-ss/patch-ab
+++ /dev/null
@@ -1,10 +0,0 @@
-$NetBSD: patch-ab,v 1.1 1998/08/12 17:12:09 tv Exp $
-
---- gcc/config/xm-netbsd.h.orig Wed Aug 12 10:36:54 1998
-+++ gcc/config/xm-netbsd.h Wed Aug 12 10:37:01 1998
-@@ -22,5 +22,3 @@
- running NetBSD. This file should not be specified as $xm_file itself;
- instead $xm_file should be CPU/xm-netbsd.h, which should include both
- CPU/xm-CPU.h and this file xm-netbsd.h. */
--
--#define HAVE_VPRINTF
diff --git a/cross/COMMON/patches-egcs-ss/patch-aa b/cross/COMMON/patches-egcs/patch-aa
index 5441504dfe8..59a1287551b 100644
--- a/cross/COMMON/patches-egcs-ss/patch-aa
+++ b/cross/COMMON/patches-egcs/patch-aa
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.2 1998/08/14 00:12:53 tv Exp $
+$NetBSD: patch-aa,v 1.1 1999/01/04 22:37:30 tv Exp $
--- Makefile.in.orig Sat Jun 27 18:08:28 1998
+++ Makefile.in Thu Aug 13 17:32:08 1998