Subject: Re: Preliminary patch for Linux emulation
To: Jeremy C. Reed <>
From: Johnny C. Lam <>
List: tech-pkg
Date: 12/11/2005 03:21:29
On Sat, Dec 10, 2005 at 01:24:35PM -0800, Jeremy C. Reed wrote:
> Thanks for your work on this. This will be helpful for me on my Linux 
> systems.
> Maybe instead of hardcoding use of including 
> ../../emulators/suse_linux/Makefile.application create some generic 
> ../../mk/ (or that does some of the same and then 
> (for now) just uses the suse_linux.
> In pkgsrc-wip there is a wip/mk/ that also may give some 
> ideas.
> The idea is to later use Debian, Fedora and/or other Linux distributions 
> instead of just SuSE Linux.

I think Joerg's idea of only listing ONLY_FOR_PLATFORM in a single
location is the correct one, and we should definitely move toward
that.  Joerg's posted patch is fairly limited in scope and does fix
up this one problem.  However, it would be really nice if we could
scrap that whole Linux emulation mess and put in something better.

wip/mk/ is mostly the right way to do this, but I would
rename it to /usr/pkgsrc/emulators/linux/ and extend it with
something like the code below (completely untested).  The idea is that
a package Makefile for a Linux binary package would include a snippet
like the following:

    USE_LINUX_MODULES=	gtk2 locale openmotif
    .include "../../emulators/linux/"

I wish I had time to do this, but I don't; however, I hope the idea gets
across and someone else will feel motivated to do the real work.


	-- Johnny Lam <>

.include "../../mk/"

# LINUX_DISTRO_DEFAULT is a user-settable variable whose value is the
#	default Linux distribution (in pkgsrc) to use.
# LINUX_DISTRO_ACCEPTED is a package-settable list of Linux distributions
#	that may be used by the package.
# USE_LINUX_MODULES is a package-settable list of Linux run-time modules
#	that are needed by the package, e.g. x11, gtk, libc5, jpeg, etc.
.if ${OPSYS} == "Linux"

# _LINUX_DISTROS is an exhaustive list of all of the linux distributions
#	that we support.
_LINUX_DISTROS?=	suse suse91 #slackware

# LINUX_DISTRO is a read-only variable exported by this file that names
#	the chosen Linux distribution.  It is set to "none" if no
#	acceptable distribution can be found.

.if ${LINUX_DISTRO} == "none"
	"${LINUX_DISTRO_DEFAULT} is not an acceptable Linux distribution for ${PKGNAME}."
# Include the distribution-specific file that describes which packages
# supply what functionality in various _LINUX_DEPENDS.<mod> variables.
# For example, a the ../../emul/linux/ file would contain
# settings like the following:
#    _LINUX_DEPENDS.base=  suse_base>=9.1:../../emulators/suse91_base
#    _LINUX_DEPENDS.jpeg=  suse_libjpeg>=9.1:../../emulators/suse91_libjpeg
#    _LINUX_DEPENDS.glx=   suse_glx>=9.1:../../emulators/suse91_glx
#    _LINUX_DEPENDS.x11=   suse_x11>=9.1:../../emulators/suse91_x11
#    # ... etc.
.  sinclude "../../emulators/linux/${LINUX_DISTRO}.mk"
.  for _mod_ in ${USE_LINUX_MODULES}
.    if ${LINUX_DISTRO} == "native"
_LINUX_DEPENDS.${_mod_}?=	# "native" Linux supplies everything
.    endif
.  endfor