Package: libtbb4
Version: 2017-u8
Revision: 1
Description: Threading Building Blocks
DescDetail: <<
    Threading Building Blocks (TBB) is an award-winning C++ runtime library
    that abstracts the low-level threading details necessary for optimal
    multi-core performance. It uses common C++ templates and coding style to
    eliminate tedious threading implementation work.

    TBB requires fewer lines of code to achieve parallelism than other
    threading models. The applications you write are portable across platforms.
    Since the library is also inherently scalable, no code maintenance is
    required as more processor cores become available.
<<
DescPort: <<
Note that Debian treats ttb 3.x through 4.x as backward compatible in shlibs
and uses soversion 2 as far back as version 3.0. Left 4.0 soversion in place
as it is completely arbitrary (despite it looking odd).

Upstream discussion on fixing the install_name situation at build time rather than at install time. We make no effort to fix the C_V value.
https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/505370
<<
DescPackaging: <<
Previously maintained by Abdulla Kamar <abdulla.kamar+fink@gmail.com>.
<<
License: GPL
HomePage: https://github.com/oneapi-src/oneTBB
Maintainer: None <fink-devel@lists.sourceforge.net>

Source: https://github.com/oneapi-src/oneTBB/archive/refs/tags/2017_U8.tar.gz
SourceRename: oneTBB-2017_U8.tar.gz
Source-Checksum: SHA256(227cc1a8329da67f9957285f0020ad4d73d9ce26cbf88614349b8b74bb189ae1)
Depends: libtbb4-shlibs (= %v-%r)
Conflicts: libtbb-dev
Replaces: libtbb-dev
BuildDependsOnly: true

SetLDFLAGS: -Wl,-headerpad_max_install_names
PatchScript: <<
	#!/bin/sh -ev
	case %m in
		i386)
			ARCH=ia32
			;;
		x86_64)
			ARCH=intel64
			;;
		arm64)
			ARCH=arm64
			;;
		*)
			echo "TBB doesn't support %m at this time."
			exit 2
			;;
	esac
	echo $ARCH > ARCH
<<
CompileScript: <<
	make tbb tbbmalloc tbbproxy arch=`cat ARCH` tbb_build_prefix=finkbuild
<<

InfoTest: TestScript: make test arch=`cat ARCH` tbb_build_prefix=finkbuild || exit 2

InstallScript: <<
    #!/bin/sh -ev
	mkdir -p %i/lib %i/include %i/share/%n

	rm include/tbb/index.html
	cp -r include/tbb %i/include
	cp -r examples %i/share/%n/examples
	cp -r doc %i/share/%n/doc

	for I in tbb tbbmalloc tbbmalloc_proxy; do
		install_name_tool -id %p/lib/lib${I}.4.0.dylib build/finkbuild_release/lib${I}.dylib
		cp build/finkbuild_release/lib${I}.dylib %i/lib/lib${I}.4.0.dylib

		pushd %i/lib
		ln -s lib${I}.4.0.dylib lib${I}.dylib
		popd
	done
	install_name_tool -change @rpath/libtbbmalloc.dylib %p/lib/libtbbmalloc.4.0.dylib %i/lib/libtbbmalloc_proxy.4.0.dylib
<<

DocFiles: CHANGES LICENSE README*

SplitOff: <<
	Package: libtbb4-shlibs
	Files: lib/libtbb.4.0.dylib lib/libtbbmalloc.4.0.dylib lib/libtbbmalloc_proxy.4.0.dylib
	Shlibs: <<
		%p/lib/libtbb.4.0.dylib 0.0.0 %n (>= 4.0-1)
		%p/lib/libtbbmalloc.4.0.dylib 0.0.0 %n (>= 4.0-1)
		%p/lib/libtbbmalloc_proxy.4.0.dylib 0.0.0 %n (>= 4.3-1)
	<<
	DocFiles: CHANGES LICENSE README*
<<