Subject: Re: pkg_install/libnbcompat on OpenBSD
To: Jun-ichiro itojun Hagino <itojun@itojun.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-pkg
Date: 09/16/2003 07:55:42
On Tue, 16 Sep 2003, Jun-ichiro itojun Hagino wrote:

> > > 	i386 was a.out until 3.3.  starting 3.4 it is ELF.
> > So it's complicated. I don't suppose there's some equivalent to
> > OBJECT_FMT defined in "/usr/share/mk" on OpenBSD? That would make
> > things easy. Otherwise, it looks like there needs to be a detailed
> > clause in <bsd.prefs.mk> spelling out the variations based on
> > OS_VERSION and MACHINE_ARCH (for ${OPSYS} == "OpenBSD").
>
> 	bsd.own.mk has it:
>
> # Set toolchain to be able to know differences.
> .if (${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \
>      ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "sparc64" || \
>      ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "i386")
> ELF_TOOLCHAIN?= yes
> .else
> ELF_TOOLCHAIN?= no
> .endif

This should do it, then:

Index: bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.126
diff -u -r1.126 bsd.prefs.mk
--- bsd.prefs.mk	2003/09/16 08:09:04	1.126
+++ bsd.prefs.mk	2003/09/16 12:53:30
@@ -161,6 +161,14 @@
 .  endif
 .endif

+.if ${OPSYS} == "OpenBSD"
+ .if defined(ELF_TOOLCHAIN) && ${ELF_TOOLCHAIN} == "yes"
+OBJECT_FMT?=		ELF
+ .else
+OBJECT_FMT?=		a.out
+ .endif
+.endif
+
 # include the defaults file
 .if exists(${.CURDIR}/../../mk/bsd.pkg.defaults.mk)
 .  include "${.CURDIR}/../../mk/bsd.pkg.defaults.mk"


Frederick