Subject: RE: pkg/9124: rar package does not build on i386
To: Martin Husemann <martin@rumolt.teuto.de>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 01/09/2000 06:54:32
On Sun, 9 Jan 2000, Martin Husemann wrote:

> > 	We could add (very!) brief note to the COMMENT?
> 
> Couldn't we create global /etc/mk.conf settings like the following?
> 
> ONLY_PKGS_RUNABLE_ON_THIS_HOST="NO"		# default: "YES"
> NO_BINARY_DISTRIBUTION_FROM_PKGSRC="YES"	# default: "NO"

I tend to favor unique solutions for unique problems, and general
solutions only for general problems, so I'd think twice about that.

Take two. I skimmed over the part about the package not even
extracting without compat_12, so maybe a test is called for. You can
use "nm" to test for symbols in the kernel, as follows. It doesn't
work right if the kernel you booted from isn't named "netbsd", but
then a lot of other things don't work, either. Ideally, you would test
for the exact syscalls that the binary needs, with due consideration
to the fact that it may be different on a.out and ELF--compat_12_lstat
or aout_compat_12_lstat, for example--but this illustrates the idea.

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/rar/Makefile,v
retrieving revision 1.19
diff -c -r1.19 Makefile
*** Makefile	2000/01/08 05:07:36	1.19
--- Makefile	2000/01/09 12:52:38
***************
*** 22,29 ****
  EXTRACT_CMD=		${DOWNLOADED_DISTFILE} >/dev/null
  
  pre-extract:
! 	@${ECHO} You must have COMPAT_12 enabled in your kernel,
! 	@${ECHO} else extraction \(and running the program\) will fail.
  	@${CHMOD} a+x ${DISTDIR}/${DISTFILES}
  
  do-build:
--- 22,37 ----
  EXTRACT_CMD=		${DOWNLOADED_DISTFILE} >/dev/null
  
  pre-extract:
! 	@if (${NM} /netbsd | ${GREP} -q compat_12 && \
! 		${NM} /netbsd | ${GREP} -q exec_aout); then true; \
! 	else \
! 		${ECHO} "**************************************************"; \
! 		${ECHO} Make can not proceed! In order to extract \(and run\); \
! 		${ECHO} this package, you must have have booted from a kernel; \
! 		${ECHO} with options COMPAT_12 \(and EXEC_AOUT, if ELF\).; \
! 		${ECHO} "**************************************************"; \
! 		false; \
! 	fi
  	@${CHMOD} a+x ${DISTDIR}/${DISTFILES}
  
  do-build: