pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc mk: Use CWRAPPERS_PREPEND for --sysroot.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d17e2834093e
branches:  trunk
changeset: 376650:d17e2834093e
user:      riastradh <riastradh%pkgsrc.org@localhost>
date:      Sun Apr 10 19:54:02 2022 +0000

description:
mk: Use CWRAPPERS_PREPEND for --sysroot.

Looks like maybe the -Wl,-rpath-link business isn't necessary after
all -- will leave this as is until I find evidence otherwise.  (joerg
says it was a workaround for NetBSD toolchain parts that weren't
properly adapted to use sysroot.)

With this, revert cwrappers version dependency to what it was before.
But keep it as TOOL_DEPENDS, not BUILD_DEPENDS.

diffstat:

 doc/HOWTO-use-crosscompile |  26 +++++++++++++++++++++-----
 mk/compiler.mk             |  11 ++++++++++-
 mk/cwrappers.mk            |   7 ++-----
 3 files changed, 33 insertions(+), 11 deletions(-)

diffs (99 lines):

diff -r 120babb058eb -r d17e2834093e doc/HOWTO-use-crosscompile
--- a/doc/HOWTO-use-crosscompile        Sun Apr 10 18:49:32 2022 +0000
+++ b/doc/HOWTO-use-crosscompile        Sun Apr 10 19:54:02 2022 +0000
@@ -1,7 +1,7 @@
 Cross-compilation in pkgsrc (user's guide)              -*- outline -*-
 Taylor R. Campbell <riastradh%NetBSD.org@localhost>
 
-$NetBSD: HOWTO-use-crosscompile,v 1.10 2022/04/04 11:23:18 riastradh Exp $
+$NetBSD: HOWTO-use-crosscompile,v 1.11 2022/04/10 19:54:02 riastradh Exp $
 
 The following steps enable you to build binary packages for a machine
 architecture other than the one you are building on.  For example, you
@@ -61,14 +61,30 @@
    MACHINE_ARCH=        powerpc
    .endif
 
-You can bootstrap pkgsrc or not; it shouldn't make a difference for
-cross-compilation.  If you do, replace `make' by `bmake' below, of
-course.
-
 XXX Some variables, notably LOCALBASE and other paths that get baked
 into packages, cannot currently be set differently for native and
 target packages.
 
+** Bootstrapped pkgsrc
+
+You can bootstrap pkgsrc or not; it shouldn't make a difference for
+cross-compilation.  If you do:
+
+ - Replace `make' by `bmake' below.
+
+ - Make sure any ABI setting in mk.conf is conditionally set
+   appropriately.
+
+   For example, bootstrap on amd64 leaves ABI=64 in mk.conf, which must
+   be left empty or undefined for earmv7hf cross-builds.  So you might
+   need:
+
+      .if empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+      ABI=    64 # set for native amd64 build
+      .else
+      ABI=    # empty for earmv7hf cross-build
+      .endif
+
 * Make some packages
 
 Now packages you build normally will be cross-compiled for the target:
diff -r 120babb058eb -r d17e2834093e mk/compiler.mk
--- a/mk/compiler.mk    Sun Apr 10 18:49:32 2022 +0000
+++ b/mk/compiler.mk    Sun Apr 10 19:54:02 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.96 2021/12/03 07:40:26 wiz Exp $
+# $NetBSD: compiler.mk,v 1.97 2022/04/10 19:54:02 riastradh Exp $
 #
 # This Makefile fragment implements handling for supported C/C++/Fortran
 # compilers.
@@ -220,6 +220,15 @@
 CWRAPPERS_APPEND.cc+=  ${_CTF_CFLAGS}
 .endif
 
+# Add sysroot if using cross-compilation tools.
+#
+.if !empty(TOOLS_USE_CROSS_COMPILE:M[yY][eE][sS])
+CWRAPPERS_PREPEND.cc+= --sysroot=${TOOLS_CROSS_DESTDIR:Q}
+CWRAPPERS_PREPEND.cxx+=        --sysroot=${TOOLS_CROSS_DESTDIR:Q}
+CWRAPPERS_PREPEND.ld+= --sysroot=${TOOLS_CROSS_DESTDIR:Q}
+# XXX cross fortran
+.endif
+
 # If the languages are not requested, force them not to be available
 # in the generated wrappers.
 #
diff -r 120babb058eb -r d17e2834093e mk/cwrappers.mk
--- a/mk/cwrappers.mk   Sun Apr 10 18:49:32 2022 +0000
+++ b/mk/cwrappers.mk   Sun Apr 10 19:54:02 2022 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: cwrappers.mk,v 1.35 2022/04/04 11:23:06 riastradh Exp $
+# $NetBSD: cwrappers.mk,v 1.36 2022/04/10 19:54:02 riastradh Exp $
 #
 # This Makefile fragment implements integration of pkgtools/cwrappers.
 
 .include "../../mk/wrapper/wrapper-defs.mk"
 .include "../../mk/buildlink3/bsd.buildlink3.mk"
 
-TOOL_DEPENDS+=         cwrappers>=20220403:../../pkgtools/cwrappers
+TOOL_DEPENDS+=         cwrappers>=20150314:../../pkgtools/cwrappers
 
 # XXX This should be PREFIX, but USE_CROSSBASE overrides it.
 CWRAPPERS_SRC_DIR=     ${LOCALBASE}/libexec/cwrappers
@@ -101,9 +101,6 @@
 .    endfor
 .  endif
 . endif
-. if !empty(TOOLS_USE_CROSS_COMPILE:M[yY][eE][sS])
-       ${RUN}echo sysroot=${TOOLS_CROSS_DESTDIR:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-. endif
 .endfor
 
 PREPEND_PATH+=         ${WRAPPER_BINDIR}



Home | Main Index | Thread Index | Old Index