summaryrefslogtreecommitdiff
path: root/mk/flavor
diff options
context:
space:
mode:
authorjoerg <joerg>2007-08-02 18:19:31 +0000
committerjoerg <joerg>2007-08-02 18:19:31 +0000
commit237e684f9088ac28f03cbfff58e69bbedf2b596b (patch)
tree7eeb466964543e6a95e208d441bf203db2c07e58 /mk/flavor
parentdf71bfa7535ad4cb530714e0bb4ea105956a0d47 (diff)
downloadpkgsrc-237e684f9088ac28f03cbfff58e69bbedf2b596b.tar.gz
Add core of the infrastructure support for cross-compilation.
- USE_CROSS_COMPILATION activates it, CROSS_DESTDIR specifies root of the target filesystem - derive _CROSS_DESTDIR from CROSS_DESTDIR or MAKEOBJDIR - buildlink3.mk prefixes the files to symlink with _CROSS_DESTDIR - compiler/gcc.mk knows about the target prefix (e.g. i386--netbsdelf) - PKG_DBDIR is prefixed with _CROSS_DESTDIR - package-install and bin-install are not called with su - install and strip are redirected to the tool version - links for the target specific ar, as, ld, nm, objdump, ranlib and strip are added - compiler wrapper detect if linking is requested or not - special command sinks for CPP and CC/CXX add the cross-compile magic: - modify include dirs to get the target /usr/include - modify linker dirs and runpath to use target /usr/lib at link time, but keep correct rpath entries Supported-by: Google SoC 2007 Basic tests by he@ on Sparc. Review from jlam@.
Diffstat (limited to 'mk/flavor')
-rw-r--r--mk/flavor/pkg/flavor-vars.mk6
-rw-r--r--mk/flavor/pkg/package.mk14
2 files changed, 16 insertions, 4 deletions
diff --git a/mk/flavor/pkg/flavor-vars.mk b/mk/flavor/pkg/flavor-vars.mk
index a293620b9d4..cc18e6a373f 100644
--- a/mk/flavor/pkg/flavor-vars.mk
+++ b/mk/flavor/pkg/flavor-vars.mk
@@ -1,4 +1,4 @@
-# $NetBSD: flavor-vars.mk,v 1.3 2007/01/05 17:54:02 rillig Exp $
+# $NetBSD: flavor-vars.mk,v 1.4 2007/08/02 18:19:32 joerg Exp $
#
# This Makefile fragment is included indirectly by bsd.prefs.mk and
# defines some variables which must be defined earlier than where
@@ -22,9 +22,9 @@ PKG_DBDIR?= /var/db/pkg
# packages.
#
.if ${PKG_INSTALLATION_TYPE} == "overwrite"
-_PKG_DBDIR= ${PKG_DBDIR}
+_PKG_DBDIR= ${_CROSS_DESTDIR}${PKG_DBDIR}
.elif ${PKG_INSTALLATION_TYPE} == "pkgviews"
-_PKG_DBDIR= ${DEPOTBASE}
+_PKG_DBDIR= ${_CROSS_DESTDIR}${DEPOTBASE}
.endif
PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add
diff --git a/mk/flavor/pkg/package.mk b/mk/flavor/pkg/package.mk
index fe79404a1dd..0fc86cd9ab0 100644
--- a/mk/flavor/pkg/package.mk
+++ b/mk/flavor/pkg/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.7 2007/07/13 14:42:53 joerg Exp $
+# $NetBSD: package.mk,v 1.8 2007/08/02 18:19:32 joerg Exp $
PKG_SUFX?= .tgz
PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
@@ -128,7 +128,11 @@ package-install: barrier
.endif
.if ${_USE_DESTDIR} != "no"
+. if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+real-package-install: su-real-package-install
+. else
real-package-install: su-target
+. endif
.else
real-package-install:
@${DO_NADA}
@@ -136,4 +140,12 @@ real-package-install:
su-real-package-install:
@${PHASE_MSG} "Install binary package of "${PKGNAME:Q}
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+ @${MKDIR} ${_CROSS_DESTDIR}${PREFIX}
+ ${PKG_ADD} -f -I -p ${_CROSS_DESTDIR}${PREFIX} ${PKGFILE}
+ @${ECHO} "Fixing recorded cwd..."
+ @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp
+ @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS
+.else
${PKG_ADD} ${PKGFILE}
+.endif