port only builds with build_arch=i386 on command line -- any way to specify that in the portfile?

Ken Cunningham ken.cunningham.webuse at gmail.com
Fri Sep 2 21:52:33 PDT 2016


> Sounds like a jit variant which sets supported_archs may be in order then. That way users on x86_64 systems can decide whether they want to lose the JIT or rebuild all the dependencies with +universal.
> 
> - Josh


Hey! I feel a little better about my lack of knowledge now -- I think I might be (slowly) learning!

Because that is exactly what I did.

Ken

So here's what I have so far, to see how this is going for a newbie, moving from hacking makefiles, to hacking portfiles, to actually writing portfiles.
I think I could have picked an easier one than BasiliskII for my first go 'round, but it works, and I'm into the fine tuning now...
compiler options, variants, active variant requirements ... 
now I need to figure out how to customize the "make" to "make XYZ".

I'm sure there are many ways this is not right.... there is a lot of information in the macports website for portfile writing to absorb..
-------------------------

# $Id: Portfile 135117 2015-04-15 19:51:30Z ryandesign at macports.org $

PortSystem              1.0
PortGroup				github 1.0
PortGroup				active_variants 1.1
github.setup			cebix macemu 1bf6f4d64023851e5de17c7d3090db99c7671c04
version             	20160829
name                    basiliskII
categories              emulators
license                 GPL-2+
platforms               darwin
maintainers             gmail.com:ken-cunningham-webuse openmaintainer
description             Opensource 68k Mac emulator.

long_description \
    Longstanding 68K Macintosh emulator. You will need an appropriate Macintosh ROM image and a copy of Mac OS (0.x thru 7.5 for Classic emulation, 7.x or 8.0/8.1 for Mac II emulation).  The default "jit" variant enables the Just-In-Time compiler, which is 32bit only. This may be faster on your system. It will require the dependent libraries to be built universal. Slirp networking is also 32bit-only at present. You can try a build without JIT or slirp, and this will generate a native build for your system (usually 64bit).

homepage                http://basilisk.cebix.net/
checksums               md5 f289deebce6e528bc913fad0375752df

# ----------- DEPENDENCIES -------------

depends_lib 			port:libsdl	\
				port:gtk1
						
#consider how to find out if any other ports already installed are required by this port

# ----------- AUTOCONF -------------
worksrcdir           	${distname}/BasiliskII/src/Unix
use_autoconf			yes

#this seems to be a funny command -- is there a more elegant way? this is a custom autogen.sh script
autoconf.cmd			NO_CONFIGURE=1 `port work BasiliskII`/${worksrcdir}/autogen.sh

# ----------- COMPILER CHOICE -------------

# a bit complicated

# I confirmed  build with clang-3.7 (x86_64 and i386) and gcc-4.0 (can build i386 only)
# should therefore build with macports apple-gcc40
# confirmed not to build correctly with gcc-42
# clang < 500 means clang 3.3 or earlier

#compiler.whitelist			macports-clang-3.7 gcc-4.0 apple-gcc40
#compiler.whitelist			{clang > 500} gcc-4.0 apple-gcc40

compiler.blacklist-append   {clang < 500} macports-clang-2.9 macports-clang-3.0 macports-clang-3.1 macports-clang-3.2 macports-clang-3.3
compiler.blacklist-append   {*gcc-4.[1-9]} {*gcc-3*}

# ----------- CONFIGURATION -------------
# no idea if this is the best optimization we can do -- direct from the gcc makefile

configure.cppflags		-g -O2
configure.cxxflags		-g -O2

configure.args	--without-esd --enable-sdl-video --enable-sdl-audio --disable-vosf


# ----------- VARIANTS -------------
# the default build builds the executable and installs it in ${prefix}/bin
# have to learn how to build the BasiliskII_App and move it into directory instead





# ----------- VARIANTS -------------

#building universal is not sensible for this port
universal_variant       no


# jit variant enables the JIT compiler and also slirp networking, but it could be slower than x86_64
# so allow people to turn it off if they want to 

default_variants +jit

variant jit description {JIT compiler is supported on arch i386 only, and also allows slirp which is i386-only} {
	supported_archs         i386
	configure.args-append	--enable-jit-compiler
	
	# make sure the dependent libraries are installed +universal, or this won't link
	# could be just require i386 if machine arch is i386, and universal on x86_64 -- but that's just too complicated
	# https://trac.macports.org/wiki/PortfileRecipes#gcc
	require_active_variants libsdl universal
	require_active_variants gtk1 universal
}

variant slirp description {Slirp networking is supported on arch i386 only. } {
	supported_archs         i386

	require_active_variants libsdl universal
	require_active_variants gtk1 universal
}

#if have libc++ set and using clang and on Mountain Lion or less, adjust to -stdlib=libc++
if { ${configure.cxx_stdlib} eq "libc++" && [string match "*clang*" [option configure.cxx]] && ${os.major} <= 12 } {
		configure.ldflags-append -stdlib=libc++
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20160902/1222b278/attachment.html>


More information about the macports-dev mailing list