tech-pkg archive

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

Re: Cross-compiling pkgsrc



> Date: Mon, 4 Sep 2023 13:30:39 -0600
> From: Brook Milligan <brook%nmsu.edu@localhost>
> 
> It would seem that the packages made in the process of a
> cross-compilation will be a mixture of native and cross packages,
> and that only the cross packages should be installed on the target
> machine.  Is that true?  Is there a way to tell the difference?

Easiest way is to put them in different directories, but you can also
look at `pkg_info -B' if you're not sure.

$ pkg_info -B ./packages/All/sqlite3-3.42.0.tgz | grep MACHINE_ARCH
MACHINE_ARCH=x86_64
$ pkg_info -B ./packages.vax/All/sqlite3-3.42.0.tgz  | grep MACHINE_ARCH
MACHINE_ARCH=vax

> Does it make sense to include something like the following in
> mk.conf to put packages in two different places, or will
> USE_CROSS_COMPILE not be defined in the right way?
> 
> .if empty(USE_CROSS_COMPILE:M[yY][eE][sS])
> PACKAGES=/path/to/native/packages
> .else
> PACKAGES=/path/to/cross/packages
> .endif
> 
> If that makes any sense, I'll suggest adding it to your HOWTO at
> some point (or other information on differentiating the native/cross
> packages for installation on a target).

Does that make sense?  Kind of!  So much sense that I used to have
that in HOWTO-use-crosscompile until revision 1.10 last year, when I
committed a change that was supposed to make it automatically use
packages.${MACHINE_ARCH} for cross-compiled packages:

https://mail-index.netbsd.org/pkgsrc-changes/2022/04/04/msg251420.html

Unfortunately, I made a mistake so the change didn't work (because
PACKAGES is already autodefined by defaults/mk.conf so the line I
changed in bsd.prefs.mk has no effect) and I didn't notice for a while
because I still had the conditional in my mk.conf, more like this:

.if ${USE_CROSS_COMPILE:tl} == "yes"
PACKAGES=	${PKGSRCDIR}/packages.${MACHINE_ARCH}
.endif

Fortunately, this is one of the things that will be fixed soon in the
cross-OS compilation patch series so the default actually works (and
it'll be ${MACHINE_PLATFORM} by default instead of ${MACHINE_ARCH}).


Home | Main Index | Thread Index | Old Index