Subject: suse_* packages support for more OSes.
To: None <tech-pkg@NetBSD.org>
From: Juan RP <juan@xtraeme.UnixBSD.org>
List: tech-pkg
Date: 09/12/2003 02:41:23
--J2SCkAp4GZ/dPZZf
Content-Type: text/plain; Format=Flowed; DelSp=Yes; charset=ISO-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: 8bit


Hi people, these days I've been playing with FreeBSD and pkgsrc, and I would  
like to add support of FreeBSD/OpenBSD for the suse_* packages. My fix
was really easy, we have to change on suse_base/Makefile, /emul/$emul to
/compat/$emul (INSTALL), and modify the Makefile.application of suse_linux.  
FreeBSD needs to use an utilitity to change the ELF OS ABI header "brandelf 
(1)", with this patch all that you need to do will be to add another variable  
to the Makefile of any linux package, i.e:

FIX_LINUX_BINS=	bin/quake3arena

Perhaps this patch is not very useful, but it can give some ideas, about what  
we need to add to these packages to make this work on more Operating Systems.

Comments ?

--
Juan RP
<juan AT xtraeme DOT UnixBSD DOT org>

--J2SCkAp4GZ/dPZZf
Content-Type: text/x-patch; charset=unknown-8bit
Content-Disposition: attachment; filename="suse_linux.patch"

Index: defs.FreeBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.FreeBSD.mk,v
retrieving revision 1.23
diff -b -u -r1.23 defs.FreeBSD.mk
--- defs.FreeBSD.mk	2003/09/02 06:59:45	1.23
+++ defs.FreeBSD.mk	2003/09/12 00:23:23
@@ -147,6 +147,11 @@
 DEFAULT_SERIAL_DEVICE?=	/dev/null
 SERIAL_DEVICES?=	/dev/null
 
+# Linux compatibility values
+BRANDELF=		/usr/bin/brandelf
+BRANDELF_ARGS=		-t Linux
+PATCH_LINUX_BIN?=	${BRANDELF} ${BRANDELF_ARGS}
+
 # check for kqueue(2) support
 .if exists(/usr/include/sys/event.h)
 PKG_HAVE_KQUEUE=	# defined
Index: Makefile.application
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/suse_linux/Makefile.application,v
retrieving revision 1.10
diff -b -u -r1.10 Makefile.application
--- Makefile.application	2003/09/04 08:21:52	1.10
+++ Makefile.application	2003/09/12 00:23:46
@@ -4,6 +4,15 @@
 
 .if ${OPSYS} == "NetBSD" && (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc")
 LINUX_KERNEL_OSRELEASE!=	(/sbin/sysctl -n emul.linux.kern.osrelease 2>/dev/null; ${ECHO} 2.0.38) | ${HEAD} -1
+.elif ${OPSYS} == "FreeBSD"
+LINUX_KERNEL_OSRELEASE!=        (/sbin/sysctl -n compat.linux.osrelease 2>/dev/null; ${ECHO} 2.0.38) | ${HEAD} -1
+
+.if !target(post-install)
+post-install:
+.for F in ${FIX_LINUX_BINS}
+	@${PATCH_LINUX_BIN} ${PREFIX}/${F}
+.endfor
+.endif
 
 .  if ${LINUX_KERNEL_OSRELEASE} == "2.0.38"
 SUSE_DIR_PREFIX=		suse64

--J2SCkAp4GZ/dPZZf--