pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   riastradh
Date:           Fri Apr 12 19:54:44 UTC 2024

Modified Files:
        pkgsrc/cross/cross-libtool-base: Makefile PLIST
        pkgsrc/doc: HOWTO-dev-crosscompile
        pkgsrc/mk: bsd.pkg.use.mk bsd.prefs.mk
        pkgsrc/mk/pkgformat/pkg: depends.mk

Log Message:
mk: Pass through all CROSSVARS as TARGET_* for tool depends.

Use this for cross-libtool-base.

Name it cross-libtool-base-${MACHINE_PLATFORM} instead of
cross-libtool-base-${MACHINE_ARCH}.  MACHINE_GNU_PLATFORM isn't quite
enough, because it doesn't reflect OS versions (e.g., aarch64--netbsd
covers both NetBSD 9 and NetBSD 10).

No functional change intended in native builds -- everything here is
conditional on cross builds.  The _DEPENDS_INSTALL_CMD shell fragment
is changed in native builds, but only to move around some of the
shell-based cross-build fragments (which could maybe be factored out
to save a bit of shell execution in native builds, but that's for
another day).

XXX MACHINE_PLATFORM doesn't cover all the other little exotic OS
knobs like LOWER_OPSYS_VERSUFFIX.  Do we care?


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 pkgsrc/cross/cross-libtool-base/Makefile
cvs rdiff -u -r1.3 -r1.4 pkgsrc/cross/cross-libtool-base/PLIST
cvs rdiff -u -r1.6 -r1.7 pkgsrc/doc/HOWTO-dev-crosscompile
cvs rdiff -u -r1.74 -r1.75 pkgsrc/mk/bsd.pkg.use.mk
cvs rdiff -u -r1.440 -r1.441 pkgsrc/mk/bsd.prefs.mk
cvs rdiff -u -r1.19 -r1.20 pkgsrc/mk/pkgformat/pkg/depends.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/cross/cross-libtool-base/Makefile
diff -u pkgsrc/cross/cross-libtool-base/Makefile:1.8 pkgsrc/cross/cross-libtool-base/Makefile:1.9
--- pkgsrc/cross/cross-libtool-base/Makefile:1.8        Thu Jun  8 22:59:17 2023
+++ pkgsrc/cross/cross-libtool-base/Makefile    Fri Apr 12 19:54:43 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.8 2023/06/08 22:59:17 riastradh Exp $
+# $NetBSD: Makefile,v 1.9 2024/04/12 19:54:43 riastradh Exp $
 
 # XXX This is kludgerific copypasta of devel/libtool-base/Makefile for
 # cross-compilation.  Please make it go away!
@@ -37,7 +37,7 @@ LIBTOOL_CROSS_COMPILE=        yes
 
 # XXX Tweaked for cross-compilation.
 #PKGNAME=      ${DISTNAME:S/-/-base-/}
-PKGNAME=       ${DISTNAME:S/^libtool-/cross-libtool-base-${MACHINE_ARCH}-/}
+PKGNAME=       ${DISTNAME:S/^libtool-/cross-libtool-base-${MACHINE_PLATFORM}-/}
 PKGREVISION=   8
 
 COMMENT=       Generic shared library support script (the script itself)
@@ -64,10 +64,11 @@ CFLAGS.SunOS+=      ${_COMPILER_ABI_FLAG.${AB
 # and Fortran compilers.
 #
 USE_LANGUAGES=         c c++
-# XXX Added for cross-compilation.  XXX Should be ${TARGET_ARCH}, but
-# currently we have to fake-cross-compile libtool because it's broken
-# upstream.
-GNU_CONFIGURE_PREFIX=  ${PREFIX}/cross-${MACHINE_ARCH}
+# XXX Added for cross-compilation.  XXX Should be
+# ${TARGET_MACHINE_PLATFORM}, but currently we have to
+# fake-cross-compile libtool because it's broken upstream.
+GNU_CONFIGURE_PREFIX=  ${PREFIX}/cross-${MACHINE_PLATFORM}
+PLIST_SUBST+=          MACHINE_PLATFORM=${MACHINE_PLATFORM:Q}
 CONFIGURE_ARGS+=       --disable-ltdl-install
 CONFIGURE_ARGS+=       F77=no FC=no
 
@@ -96,7 +97,7 @@ post-build:
                ${FILESDIR}/shlibtool.in > ${WRKSRC}/shlibtool
 
 post-install:
-       ${INSTALL_SCRIPT} ${WRKSRC}/shlibtool ${DESTDIR}${PREFIX}/cross-${MACHINE_ARCH}/bin/shlibtool
+       ${INSTALL_SCRIPT} ${WRKSRC}/shlibtool ${DESTDIR}${PREFIX}/cross-${MACHINE_PLATFORM}/bin/shlibtool
 
 BUILDLINK_DEPMETHOD.dlcompat=  build
 

Index: pkgsrc/cross/cross-libtool-base/PLIST
diff -u pkgsrc/cross/cross-libtool-base/PLIST:1.3 pkgsrc/cross/cross-libtool-base/PLIST:1.4
--- pkgsrc/cross/cross-libtool-base/PLIST:1.3   Tue Jul  9 15:45:25 2019
+++ pkgsrc/cross/cross-libtool-base/PLIST       Fri Apr 12 19:54:43 2024
@@ -1,55 +1,55 @@
-@comment $NetBSD: PLIST,v 1.3 2019/07/09 15:45:25 riastradh Exp $
-cross-${MACHINE_ARCH}/bin/libtool
-cross-${MACHINE_ARCH}/bin/libtoolize
-cross-${MACHINE_ARCH}/bin/shlibtool
-cross-${MACHINE_ARCH}/man/man1/libtool.1
-cross-${MACHINE_ARCH}/man/man1/libtoolize.1
-cross-${MACHINE_ARCH}/share/aclocal/libtool.m4
-cross-${MACHINE_ARCH}/share/aclocal/ltargz.m4
-cross-${MACHINE_ARCH}/share/aclocal/ltdl.m4
-cross-${MACHINE_ARCH}/share/aclocal/ltoptions.m4
-cross-${MACHINE_ARCH}/share/aclocal/ltsugar.m4
-cross-${MACHINE_ARCH}/share/aclocal/ltversion.m4
-cross-${MACHINE_ARCH}/share/aclocal/lt~obsolete.m4
-cross-${MACHINE_ARCH}/share/libtool/COPYING.LIB
-cross-${MACHINE_ARCH}/share/libtool/Makefile.am
-cross-${MACHINE_ARCH}/share/libtool/Makefile.in
-cross-${MACHINE_ARCH}/share/libtool/README
-cross-${MACHINE_ARCH}/share/libtool/aclocal.m4
-cross-${MACHINE_ARCH}/share/libtool/build-aux/compile
-cross-${MACHINE_ARCH}/share/libtool/build-aux/config.guess
-cross-${MACHINE_ARCH}/share/libtool/build-aux/config.sub
-cross-${MACHINE_ARCH}/share/libtool/build-aux/depcomp
-cross-${MACHINE_ARCH}/share/libtool/build-aux/install-sh
-cross-${MACHINE_ARCH}/share/libtool/build-aux/ltmain.sh
-cross-${MACHINE_ARCH}/share/libtool/build-aux/missing
-cross-${MACHINE_ARCH}/share/libtool/config-h.in
-cross-${MACHINE_ARCH}/share/libtool/configure
-cross-${MACHINE_ARCH}/share/libtool/configure.ac
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__alloc.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__argz_.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__dirent.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__glibc.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__private.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt__strl.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt_dlloader.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt_error.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/lt_system.h
-cross-${MACHINE_ARCH}/share/libtool/libltdl/slist.h
-cross-${MACHINE_ARCH}/share/libtool/loaders/dld_link.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/dlopen.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/dyld.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/load_add_on.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/loadlibrary.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/preopen.c
-cross-${MACHINE_ARCH}/share/libtool/loaders/shl_load.c
-cross-${MACHINE_ARCH}/share/libtool/lt__alloc.c
-cross-${MACHINE_ARCH}/share/libtool/lt__argz.c
-cross-${MACHINE_ARCH}/share/libtool/lt__dirent.c
-cross-${MACHINE_ARCH}/share/libtool/lt__strl.c
-cross-${MACHINE_ARCH}/share/libtool/lt_dlloader.c
-cross-${MACHINE_ARCH}/share/libtool/lt_error.c
-cross-${MACHINE_ARCH}/share/libtool/ltdl.c
-cross-${MACHINE_ARCH}/share/libtool/ltdl.h
-cross-${MACHINE_ARCH}/share/libtool/ltdl.mk
-cross-${MACHINE_ARCH}/share/libtool/slist.c
+@comment $NetBSD: PLIST,v 1.4 2024/04/12 19:54:43 riastradh Exp $
+cross-${MACHINE_PLATFORM}/bin/libtool
+cross-${MACHINE_PLATFORM}/bin/libtoolize
+cross-${MACHINE_PLATFORM}/bin/shlibtool
+cross-${MACHINE_PLATFORM}/man/man1/libtool.1
+cross-${MACHINE_PLATFORM}/man/man1/libtoolize.1
+cross-${MACHINE_PLATFORM}/share/aclocal/libtool.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/ltargz.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/ltdl.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/ltoptions.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/ltsugar.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/ltversion.m4
+cross-${MACHINE_PLATFORM}/share/aclocal/lt~obsolete.m4
+cross-${MACHINE_PLATFORM}/share/libtool/COPYING.LIB
+cross-${MACHINE_PLATFORM}/share/libtool/Makefile.am
+cross-${MACHINE_PLATFORM}/share/libtool/Makefile.in
+cross-${MACHINE_PLATFORM}/share/libtool/README
+cross-${MACHINE_PLATFORM}/share/libtool/aclocal.m4
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/compile
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/config.guess
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/config.sub
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/depcomp
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/install-sh
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/ltmain.sh
+cross-${MACHINE_PLATFORM}/share/libtool/build-aux/missing
+cross-${MACHINE_PLATFORM}/share/libtool/config-h.in
+cross-${MACHINE_PLATFORM}/share/libtool/configure
+cross-${MACHINE_PLATFORM}/share/libtool/configure.ac
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__alloc.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__argz_.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__dirent.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__glibc.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__private.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt__strl.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt_dlloader.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt_error.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/lt_system.h
+cross-${MACHINE_PLATFORM}/share/libtool/libltdl/slist.h
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/dld_link.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/dlopen.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/dyld.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/load_add_on.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/loadlibrary.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/preopen.c
+cross-${MACHINE_PLATFORM}/share/libtool/loaders/shl_load.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt__alloc.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt__argz.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt__dirent.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt__strl.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt_dlloader.c
+cross-${MACHINE_PLATFORM}/share/libtool/lt_error.c
+cross-${MACHINE_PLATFORM}/share/libtool/ltdl.c
+cross-${MACHINE_PLATFORM}/share/libtool/ltdl.h
+cross-${MACHINE_PLATFORM}/share/libtool/ltdl.mk
+cross-${MACHINE_PLATFORM}/share/libtool/slist.c

Index: pkgsrc/doc/HOWTO-dev-crosscompile
diff -u pkgsrc/doc/HOWTO-dev-crosscompile:1.6 pkgsrc/doc/HOWTO-dev-crosscompile:1.7
--- pkgsrc/doc/HOWTO-dev-crosscompile:1.6       Tue Jun 27 10:27:20 2023
+++ pkgsrc/doc/HOWTO-dev-crosscompile   Fri Apr 12 19:54:43 2024
@@ -1,7 +1,7 @@
 Cross-compilation in pkgsrc (developer's guide)         -*- outline -*-
 Taylor R. Campbell <riastradh%NetBSD.org@localhost>
 
-$NetBSD: HOWTO-dev-crosscompile,v 1.6 2023/06/27 10:27:20 riastradh Exp $
+$NetBSD: HOWTO-dev-crosscompile,v 1.7 2024/04/12 19:54:43 riastradh Exp $
 
 These are some notes on how to make your package cross-compilable.
 There is no single recipe for it -- each package is different, and
@@ -11,34 +11,42 @@ have ever thought of cross-compilation.
 
 * Native and target platform
 
-When building a package, MACHINE_ARCH, MACHINE_GNU_PLATFORM, &c.,
-describe the platform for which the package is being built.  If
+When building a package, MACHINE_ARCH, OPSYS, &c., describe the
+platform for which the package is being built.  If
 USE_CROSS_COMPILE=no, this is the native platform; otherwise, if
-USE_CROSS_COMPILE=yes, it is the target platform, and the additional
-variables NATIVE_MACHINE_ARCH, NATIVE_MACHINE_GNU_PLATFORM, &c.,
-describe the native platform.
+USE_CROSS_COMPILE=yes, it is the target platform.  The additional
+variables NATIVE_MACHINE_ARCH, NATIVE_OPSYS, &c., always describe the
+native platform.
 
 When building a native package for cross-compilation, such as a
-compiler for the target, the variable TARGET_ARCH describes the target
-platform like MACHINE_ARCH.  If the build product varies with the
-choice of target, then TARGET_ARCH should be embedded into the PKGNAME
+compiler for the target, the variables TARGET_MACHINE_ARCH,
+TARGET_OPSYS, &c., describe the target platform.  If the build product
+varies with the choice of target, then TARGET_MACHINE_ARCH or
+TARGET_OPSYS or whatever affects it should be embedded into the PKGNAME
 somewhere so that the different build products are distinguished by
 having different package names.
 
-XXX This pattern is incompletely realized.  We should probably replace
-TARGET_ARCH by TARGET_MACHINE_ARCH, TARGET_MACHINE_GNU_PLATFORM, &c.,
-and perhaps decide which of those is the main switch that you set when
-you want to select cross-compilation.  Ideally, this switch should
-also support cross-compilation to other operating systems.
+XXX Missing:
+XXX - TARGET_MACHINE_GNU_PLATFORM
+XXX - TARGET_MACHINE_GNU_ARCH
+XXX - probably other variables defined in terms of the CROSSVARS
 
 * Specifying the toolchain
 
-Software built following GNU conventions can set GNU_CONFIGURE=yes so
-that pkgsrc will automatically specify the right --build, --host, and
---target options for cross-compilation and point everything at the
-right toolchain.
-
-XXX And software not built following GNU conventions...?
+The following build systems should automagically handle
+cross-compilation by passing through the architecture and OS
+information:
+
+- GNU_CONFIGURE=yes
+- .include "../../devel/meson/build.mk" (sets
+- .include "../../devel/cmake/build.mk" (and legacy USE_CMAKE=yes)
+
+Additional tweaks are sometimes needed (but not always), conditional on
+${USE_CROSS_COMPILE:tl} == "yes" (after including bsd.prefs.mk):
+
+- (pkg-config) ALL_ENV+= PKG_CONFIG_SYSROOT_DIR=${CROSS_DESTDIR:Q}
+- (pkg-config) ALL_ENV+= PKG_CONFIG_FDO_SYSROOT_RULES=1
+- (cmake) CMAKE_ARGS+= -DCMAKE_SYSROOT:STRING=${CROSS_DESTDIR:Q}
 
 * Tool dependencies
 
@@ -107,7 +115,7 @@ pre-answer the tests for autoconf:
 
 .include "../../bsd.prefs.mk"
 
-.if ${USE_CROSS_COMPILE:U:tl} == "yes"
+.if ${USE_CROSS_COMPILE:tl} == "yes"
 # Configure wants to check for /dev/random but can't.  We know NetBSD
 # always has a /dev/random, so inform autoconf of the fact.
 CONFIGURE_ENV.NetBSD+= ac_cv_file__dev_random=yes

Index: pkgsrc/mk/bsd.pkg.use.mk
diff -u pkgsrc/mk/bsd.pkg.use.mk:1.74 pkgsrc/mk/bsd.pkg.use.mk:1.75
--- pkgsrc/mk/bsd.pkg.use.mk:1.74       Tue Jun 27 10:27:20 2023
+++ pkgsrc/mk/bsd.pkg.use.mk    Fri Apr 12 19:54:44 2024
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.use.mk,v 1.74 2023/06/27 10:27:20 riastradh Exp $
+#      $NetBSD: bsd.pkg.use.mk,v 1.75 2024/04/12 19:54:44 riastradh Exp $
 #
 # Turn USE_* macros into proper depedency logic.  Included near the top of
 # bsd.pkg.mk, after bsd.prefs.mk.
@@ -91,8 +91,8 @@ TOOL_DEPENDS+=                libtool-fortran>=${_OPSY
 .  endif
 .else
 .  if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
-PKG_LIBTOOL?=          ${TOOLBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/libtool
-PKG_SHLIBTOOL?=                ${TOOLBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/shlibtool
+PKG_LIBTOOL?=          ${TOOLBASE}/cross-${TARGET_MACHINE_PLATFORM:U${MACHINE_PLATFORM}}/bin/libtool
+PKG_SHLIBTOOL?=                ${TOOLBASE}/cross-${TARGET_MACHINE_PLATFORM:U${MACHINE_PLATFORM}}/bin/shlibtool
 .  else
 PKG_LIBTOOL?=          ${TOOLBASE}/bin/libtool
 PKG_SHLIBTOOL?=                ${TOOLBASE}/bin/shlibtool
@@ -103,7 +103,7 @@ SHLIBTOOL?=         ${WRAPPER_BINDIR}/shlibtool
 .if defined(USE_LIBTOOL)
 LIBTOOL_REQD?=         2.4.2nb9
 .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
-TOOL_DEPENDS+=         cross-libtool-base-${MACHINE_ARCH}>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../cross/cross-libtool-base
+TOOL_DEPENDS+=         cross-libtool-base-${MACHINE_PLATFORM}>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../cross/cross-libtool-base
 .else
 TOOL_DEPENDS+=         libtool-base>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../devel/libtool-base
 .endif

Index: pkgsrc/mk/bsd.prefs.mk
diff -u pkgsrc/mk/bsd.prefs.mk:1.440 pkgsrc/mk/bsd.prefs.mk:1.441
--- pkgsrc/mk/bsd.prefs.mk:1.440        Fri Apr 12 19:53:25 2024
+++ pkgsrc/mk/bsd.prefs.mk      Fri Apr 12 19:54:44 2024
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.440 2024/04/12 19:53:25 riastradh Exp $
+# $NetBSD: bsd.prefs.mk,v 1.441 2024/04/12 19:54:44 riastradh Exp $
 #
 # This file includes the mk.conf file, which contains the user settings.
 #
@@ -389,6 +389,12 @@ MACHINE_PLATFORM?=         ${OPSYS}-${OS_VERSIO
 NATIVE_MACHINE_GNU_PLATFORM?=  ${NATIVE_MACHINE_GNU_ARCH}-${NATIVE_LOWER_VENDOR}-${NATIVE_LOWER_OPSYS:C/[0-9]//g}${NATIVE_APPEND_ELF}${NATIVE_LOWER_OPSYS_VERSUFFIX}${NATIVE_APPEND_ABI}
 MACHINE_GNU_PLATFORM?=         ${MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}${APPEND_ABI}
 
+.ifdef TARGET_MACHINE_ARCH
+TARGET_MACHINE_GNU_ARCH=       ${GNU_ARCH.${TARGET_MACHINE_ARCH}:U${TARGET_MACHINE_ARCH}}
+TARGET_MACHINE_GNU_PLATFORM=   ${TARGET_MACHINE_GNU_ARCH}-${TARGET_LOWER_VENDOR}-${TARGET_LOWER_OPSYS:C/[0-9]//g}${TARGET_APPEND_ELF}${TARGET_LOWER_OPSYS_VERSUFFIX}${TARGET_APPEND_ABI}
+TARGET_MACHINE_PLATFORM=       ${TARGET_OPSYS}-${TARGET_OS_VERSION}-${TARGET_MACHINE_ARCH}
+.endif
+
 # Set this before <bsd.own.mk> does, since it doesn't know about Darwin
 # We will later set OBJECT_FMT to be conditional on USE_CROSS_COMPILE.
 .if ${NATIVE_OPSYS} == "Darwin"
@@ -407,15 +413,18 @@ OBJECT_FMT?=              Mach-O
 # the rest of the native package build with USE_CROSS_COMPILE=no.
 #
 # This can't live inside the cross-libtool makefile because the
-# TARGET_ARCH / MACHINE_ARCH / NATIVE_MACHINE_ARCH switcheroo has to
-# happen in the middle of this file -- after NATIVE_MACHINE_ARCH is
-# determined, before MACHINE_ARCH is used for anything else.
-#
-.if !empty(LIBTOOL_CROSS_COMPILE:M[yY][eE][sS])
-.  if !defined(TARGET_ARCH)
-PKG_FAIL_REASON+=      "Must set TARGET_ARCH for cross-libtool."
+# TARGET_MACHINE_ARCH / MACHINE_ARCH / NATIVE_MACHINE_ARCH switcheroo
+# has to happen in the middle of this file -- after NATIVE_MACHINE_ARCH
+# is determined, before MACHINE_ARCH is used for anything else.
+#
+.if ${LIBTOOL_CROSS_COMPILE:U:tl} == "yes"
+.  if !defined(TARGET_MACHINE_ARCH)
+PKG_FAIL_REASON+=      "Must set TARGET_MACHINE_ARCH for cross-libtool."
 .  endif
-MACHINE_ARCH:=                 ${TARGET_ARCH}
+.  for _v_ in ${CROSSVARS}
+${_v_}=                                ${TARGET_${_v_}}
+.  endfor
+# XXX Other CROSSVARS for _BUILD_DEFS?
 _BUILD_DEFS.MACHINE_ARCH=      ${NATIVE_MACHINE_ARCH}
 _BUILD_DEFS.MACHINE_GNU_ARCH=  ${NATIVE_MACHINE_GNU_ARCH}
 _BUILD_DEFS.OBJECT_FMT=                ${NATIVE_OBJECT_FMT}
@@ -630,6 +639,9 @@ TOOLS_CROSS_DESTDIR=                # empty
 
 # Depends on MACHINE_ARCH override above
 .if ${OPSYS} == "NetBSD"
+.  ifdef TARGET_MACHINE_ARCH
+TARGET_OBJECT_FMT?=    ${OBJECT_FMT} # XXX
+.  endif
 .  if ${NATIVE_OBJECT_FMT} == "ELF" && \
    (!empty(NATIVE_MACHINE_ARCH:Mearm*) || \
     ${NATIVE_MACHINE_GNU_ARCH} == "arm" || \
@@ -654,12 +666,28 @@ NATIVE_APPEND_ELF=        elf
     ${MACHINE_ARCH} == "vax")
 APPEND_ELF=            elf
 .  endif
+.  if defined(TARGET_MACHINE_ARCH) && \
+   ${TARGET_OBJECT_FMT} == "ELF" && \
+   (!empty(TARGET_MACHINE_ARCH:Mearm*) || \
+    ${TARGET_MACHINE_GNU_ARCH} == "arm" || \
+    ${TARGET_MACHINE_ARCH} == "i386" || \
+    ${TARGET_MACHINE_ARCH} == "m68k" || \
+    ${TARGET_MACHINE_ARCH} == "m68000" || \
+    ${TARGET_MACHINE_GNU_ARCH} == "sh" || \
+    ${TARGET_MACHINE_GNU_ARCH} == "shle" || \
+    ${TARGET_MACHINE_ARCH} == "sparc" || \
+    ${TARGET_MACHINE_ARCH} == "vax")
+TARGET_APPEND_ELF=     elf
+.  endif
 .  if !empty(NATIVE_MACHINE_ARCH:Mearm*)
 NATIVE_APPEND_ABI=     -${NATIVE_MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/}
 .  endif
 .  if !empty(MACHINE_ARCH:Mearm*)
 APPEND_ABI=            -${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/}
 .  endif
+.  if !empty(TARGET_MACHINE_ARCH:Mearm*)
+TARGET_APPEND_ABI=     -${TARGET_MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/}
+.  endif
 .endif
 
 # if the system is IPv6-ready, compile with IPv6 support turned on.

Index: pkgsrc/mk/pkgformat/pkg/depends.mk
diff -u pkgsrc/mk/pkgformat/pkg/depends.mk:1.19 pkgsrc/mk/pkgformat/pkg/depends.mk:1.20
--- pkgsrc/mk/pkgformat/pkg/depends.mk:1.19     Sun Mar 31 13:41:23 2024
+++ pkgsrc/mk/pkgformat/pkg/depends.mk  Fri Apr 12 19:54:44 2024
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.19 2024/03/31 13:41:23 js Exp $
+# $NetBSD: depends.mk,v 1.20 2024/04/12 19:54:44 riastradh Exp $
 
 # This command prints out the dependency patterns for all full (run-time)
 # dependencies of the package.
@@ -90,6 +90,8 @@ _RESOLVE_DEPENDS_CMD= \
                        " "${BUILD_DEPENDS:Q} \
                        " "${DEPENDS:Q}
 
+CROSSTARGETSETTINGS=   ${CROSSVARS:@_v_@TARGET_${_v_}=${${_v_}}@}
+
 # _DEPENDS_INSTALL_CMD checks whether the package $pattern is installed,
 #      and installs it if necessary.
 #
@@ -110,17 +112,20 @@ _DEPENDS_INSTALL_CMD=                                                     \
        case $$type in                                                  \
        bootstrap|tool)                                                 \
                case "${USE_CROSS_COMPILE:Uno:tl}" in                   \
-               yes) extradep="" ;;                                     \
-               *) extradep=" ${PKGNAME}" ;;                            \
+               yes)    extradep="";                                    \
+                       crosstargetsettings=${CROSSTARGETSETTINGS:Q};   \
+                       ;;                                              \
+               *)      extradep=" ${PKGNAME}";                         \
+                       crosstargetsettings=;                           \
+                       ;;                                              \
                esac;                                                   \
                cross=no;                                               \
-               archopt=TARGET_ARCH=${MACHINE_ARCH};                    \
                pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;  \
                ;;                                                      \
-       build|test|full)                                                        \
+       build|test|full)                                                \
                extradep=" ${PKGNAME}";                                 \
+               crosstargetsettings=;                                   \
                cross=${USE_CROSS_COMPILE:Uno};                         \
-               archopt=;                                               \
                pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;       \
                ;;                                                      \
        esac;                                                           \
@@ -133,11 +138,12 @@ _DEPENDS_INSTALL_CMD=                                                     \
                cd $$dir;                                               \
                unset _PKGSRC_BARRIER || true;                          \
                unset MAKEFLAGS || true;                                \
+               unset ${CROSSVARS:@_v_@TARGET_${_v_}@} || true;         \
                ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV} PATH=${_PATH_ORIG:Q}\
                        _PKGSRC_DEPS="$$extradep${_PKGSRC_DEPS}"        \
                        PKGNAME_REQD="$$pattern"                        \
                        USE_CROSS_COMPILE=$$cross                       \
-                       $$archopt                                       \
+                       $$crosstargetsettings                           \
                    ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target;       \
                case $$type in                                          \
                bootstrap|tool)                                         \



Home | Main Index | Thread Index | Old Index