PortSystem		1.0
name			simage
version			1.7.0
revision                7
license			{public-domain permissive}
description		library for loading and saving images, sound and video
long_description	simage is a library capable of loading, manipulating \
	and saving images, creating and saving movies (AVI and mpeg), and    \
	loading audio. The simage library relies heavily on 3rd party        \
	libraries to perform these tasks.

categories		graphics devel
homepage		http://www.coin3d.org/lib/simage/
platforms		darwin
maintainers		nomaintainer
master_sites		http://ftp.coin3d.org/coin/src/all/
checksums		md5     c479cc27fc80ffc39142318a233c6ae2 \
			sha1    32b2bbfd7f2e7ec3591f506094c9d006e4af3921 \
			rmd160  be5e13c0acc345a39f4686e3121222faa3cdbd51

depends_lib		path:include/turbojpeg.h:libjpeg-turbo \
			port:libpng \
			port:libsndfile \
			port:giflib \
			port:tiff \
			port:zlib

configure.args		--disable-quicktime \
			--with-jpeg=${prefix} \
			--with-png=${prefix} \
			--with-libsndfile=${prefix} \
			--with-ungif=${prefix} \
			--with-tiff=${prefix} \
			--with-zlib=${prefix}

post-build {
	reinplace -E {s|-arch [a-z0-9_]+||g} \
		${worksrcpath}/simage.pc \
		${worksrcpath}/simage-default.cfg
}

# The QuickTime variant uses QuickTime for image loading, removing
# the dependencies on additional image libraries.
variant quicktime description {Use QuickTime instead of the many smaller libraries} {
	depends_lib-delete	path:include/turbojpeg.h:libjpeg-turbo \
				port:libpng \
				port:giflib \
				port:tiff \
				port:zlib

	configure.args-delete	--with-jpeg=${prefix} \
				--with-png=${prefix} \
				--with-ungif=${prefix} \
				--with-tiff=${prefix} \
				--with-zlib=${prefix}

	configure.args-replace	--disable-quicktime \
				--enable-quicktime

	foreach arch [get_canonical_archs] {
		if {${arch} in {ppc64 x86_64}} {
			known_fail	yes
			depends_lib
			pre-configure {
				ui_error "The +quicktime variant cannot be used when building 64-bit"
				return -code error "incompatible arch"
			}
			break
		}
	}

	if {[vercmp ${macosx_sdk_version} 10.11] > 0} {
		known_fail	yes
		depends_lib
		pre-configure {
			ui_error "The +quicktime variant cannot be used with a macOS SDK later than 10.11"
			return -code error "incompatible macOS SDK"
		}
	}
}
