summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabs <abs>2001-01-29 10:25:07 +0000
committerabs <abs>2001-01-29 10:25:07 +0000
commit210767ad8c8a528f1023be5515a9d2e5401ceb96 (patch)
tree508046d31410a1714b8dd502771e3e0c7ba9e6e6
parentc83a8a8a8f81caf7c56d97e90fdcaa0346f73f2e (diff)
downloadpkgsrc-210767ad8c8a528f1023be5515a9d2e5401ceb96.tar.gz
Add a 'cross-env' script which helps set up the environment for cross
compiling or similar. Based on various postings and notes from the site.
-rw-r--r--cross/COMMON/cross.mk4
-rw-r--r--cross/binutils/Makefile12
-rwxr-xr-xcross/binutils/files/cross-env61
-rw-r--r--cross/binutils/pkg/PLIST5
4 files changed, 77 insertions, 5 deletions
diff --git a/cross/COMMON/cross.mk b/cross/COMMON/cross.mk
index 26d3c666aec..83388f4243a 100644
--- a/cross/COMMON/cross.mk
+++ b/cross/COMMON/cross.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cross.mk,v 1.17 2001/01/09 13:24:46 itojun Exp $
+# $NetBSD: cross.mk,v 1.18 2001/01/29 10:25:07 abs Exp $
# Shared definitions for building a cross-compile environment.
@@ -30,7 +30,7 @@ BINUTILS_WRKSRC= ${WRKDIR}/${BINUTILS_DISTNAME}
CROSS_DISTFILES+= ${BINUTILS_DISTNAME}.tar.gz
MASTER_SITES+= ${MASTER_SITE_GNU:=binutils/}
CONFIGURE_ARGS+= --with-gnu-as --with-gnu-ld
-DEPENDS+= cross-binutils-2.9.1.1:../../cross/binutils
+DEPENDS+= cross-binutils>=2.9.1.1:../../cross/binutils
PLIST_PRE+= ${COMMON_DIR}/PLIST-binutils
AS_FOR_TARGET= ${BINUTILS_WRKSRC}/gas/as-new
diff --git a/cross/binutils/Makefile b/cross/binutils/Makefile
index 5f1b96246a3..6ad6e82cccc 100644
--- a/cross/binutils/Makefile
+++ b/cross/binutils/Makefile
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.21 2001/01/24 12:13:26 tsutsui Exp $
+# $NetBSD: Makefile,v 1.22 2001/01/29 10:25:07 abs Exp $
#
# GNU binutils configured to hold `as many targets as the cross system is
# capable of using'. Configures and builds everything except gas, which
# gets built at cross-pkg build time (it's target specific).
DISTNAME= binutils-2.9.1
-PKGNAME= cross-binutils-2.9.1.1
+PKGNAME= cross-binutils-2.9.1.2
CATEGORIES= cross lang
MASTER_SITES= ${MASTER_SITE_GNU:=binutils/}
@@ -24,6 +24,8 @@ CONFIGURE_ARGS+= --enable-targets=${ENABLE_TARGETS_LIST} \
MAKE_ARGS+= CFLAGS="${CFLAGS}"
ALL_TARGET= all-binutils all-ld
+PLIST_SUBST= LOCALBASE=${LOCALBASE}
+
BINDIR= ${PREFIX}/libexec/binutils
# due to /bin/sh restriction, we can accomodate no more archs
@@ -67,6 +69,12 @@ do-install:
${INSTALL_DATA} ${WRKSRC}/include/ansidecl.h ${PREFIX}/include
${INSTALL_DATA} ${WRKSRC}/bfd/bfd.h ${PREFIX}/include
${INSTALL_DATA} ${WRKSRC}/ld/ldscripts/* ${PREFIX}/lib/ldscripts
+ ${INSTALL_SCRIPT} ${WRKSRC}/cross-env ${BINDIR}
+ ${LN} -s ${BINDIR}/cross-env ${LOCALBASE}/bin/cross-env
+
+post-build:
+ ${SED} -e 's|@@PREFIX@@|${PREFIX}|' < ${FILESDIR}/cross-env > \
+ ${WRKSRC}/cross-env
.include "../../mk/bsd.pkg.mk"
diff --git a/cross/binutils/files/cross-env b/cross/binutils/files/cross-env
new file mode 100755
index 00000000000..6dd4ced2152
--- /dev/null
+++ b/cross/binutils/files/cross-env
@@ -0,0 +1,61 @@
+#! /bin/sh
+# $NetBSD: cross-env,v 1.1 2001/01/29 10:25:07 abs Exp $
+
+PREFIX=@@PREFIX@@
+
+if [ -z "$CROSS_PKG" ] ;then
+ cat <<END
+You should set 'CROSS_PKG' to the name of the cross compile package, eg:
+'sparc-netbsdelf'. If MACHINE_ARCH is not already set it will be set to
+the part before the '-' (eg: 'sparc'). You may find it useful to also set
+MACHINE.
+END
+exit 1
+fi
+
+if [ -z "$MACHINE_ARCH" ];then
+ export MACHINE_ARCH=`echo $CROSS_PKG| sed 's:-.*::'`
+fi
+
+BINDIR=$PREFIX/$CROSS_PKG/bin
+echo $BINDIR
+
+if [ ! -d $BINDIR ];then
+ echo "Unable to locate $MACHINE_ARCH cross compiler in $BINDIR"
+ echo "Have you installed the appropriate pkgsrc/cross/$CROSS_PKG package?"
+ exit 3
+fi
+
+export PATH=$BINDIR:$PATH
+
+GCC_EXEC_PREFIX=$CROSS_PKG
+
+export ADDR2LINE=$BINDIR/addr2line
+export AR=$BINDIR/ar
+export AS=$BINDIR/as
+export CC=$BINDIR/gcc
+export CPP=`$CC -print-prog-name=cpp`
+export CXX=$BINDIR/c++
+export FC=$BINDIR/f77
+export GASP=$BINDIR/gasp
+export LD=$BINDIR/ld
+export NM=$BINDIR/nm
+export OBJCOPY=$BINDIR/objcopy
+export OBJDUMP=$BINDIR/objdump
+export RANLIB=$BINDIR/ranlib
+export SIZE=$BINDIR/size
+export STRINGS=$BINDIR/strings
+export STRIP=$BINDIR/strip
+
+export MKPROFILE=no
+export MKLINT=no
+#export MKMAN=no
+
+export HOSTED_CC=cc
+
+export MAKE=make
+#export MAKE="make -f ${DESTDIR}/usr/share/mk/sys.mk -f Makefile"
+#export MAKEFLAGS="-I ${DESTDIR}/usr/share/mk"
+
+set -x
+exec $@
diff --git a/cross/binutils/pkg/PLIST b/cross/binutils/pkg/PLIST
index 8b0929aa0d4..57bc6cc6595 100644
--- a/cross/binutils/pkg/PLIST
+++ b/cross/binutils/pkg/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.8 2001/01/24 11:24:12 tsutsui Exp $
+@comment $NetBSD: PLIST,v 1.9 2001/01/29 10:25:08 abs Exp $
lib/ldscripts/armnbsd.x
lib/ldscripts/armnbsd.xbn
lib/ldscripts/armnbsd.xn
@@ -117,6 +117,7 @@ lib/libiberty.a
@unexec rm -f %D/lib/libbfd.so %D/lib/libopcodes.so 2> /dev/null || true
libexec/binutils/addr2line
libexec/binutils/ar
+libexec/binutils/cross-env
libexec/binutils/dlltool
libexec/binutils/ld
libexec/binutils/nlmconv
@@ -129,3 +130,5 @@ libexec/binutils/strings
libexec/binutils/strip
libexec/binutils/windres
@dirrm libexec/binutils
+@exec ln -s %D/libexec/binutils/cross-env ${LOCALBASE}/bin/cross-env
+@unexec rm ${LOCALBASE}/bin/cross-env