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

Lawrence Velázquez larryv at macports.org
Fri Sep 2 22:28:25 PDT 2016


> On Sep 3, 2016, at 12:52 AM, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
> 
> now I need to figure out how to customize the "make" to "make XYZ".

Use "build.target XYZ".

> PortSystem              1.0
> PortGroup				github 1.0
> PortGroup				active_variants 1.1
> github.setup			cebix macemu 1bf6f4d64023851e5de17c7d3090db99c7671c04

You seem to be mixing tabs and spaces. Please don't do this.

> version             	20160829
> name                    basiliskII

The current port is "basiliskii", so you're changing the case of the name. I don't actually know whether this would be a problem, but it's a bit unorthodox.

> 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).

Port descriptions are usually about the software itself and not about the port. So you wouldn't mention the variant or the dependencies or anything MacPorts-specific.

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

We require RMD160 and SHA256 checksums and generally only include MD5 if upstream publishes it.

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

You can use trace mode ("port -t") to do this.

> # ----------- 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

The autogen.sh script calls through to configure at the end, so it's cleaner to use "configure.cmd ./autogen.sh" and set the other configure options as usual. You'd have to manually add dependencies on the relevant Autotools ports, though.

> # ----------- 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

Does this actually do anything? Passing debug and optimization flags to the preprocessor doesn't really make sense.

> 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

Perhaps you should look into using the "MacOSX" build.

> # ----------- 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} {

Does this mean that +slirp requires +jit? If so, you should specify that requirement.

> 	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
> }

You should get rid of these "require_active_variants" commands. Since you've already set "supported_archs i386", base will automatically ensure that dependencies are also built for i386.

(This explicit requirement would actually be overkill on some systems. Imagine a MacPorts installation with "universal_archs i386 ppc". Then explicitly requiring +universal would force the user to install the dependencies with PowerPC slices for no reason.)

vq


More information about the macports-dev mailing list