about summary refs log tree commit diff
path: root/tools/eaglemode/plugins/avif/makers/PlAvif.maker.pm
blob: 00b927805a72a437b4f9a9d37665c96a9249a6a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package PlAvif;

use strict;
use warnings;

sub GetDependencies
{
	return ('emCore');
}

sub IsEssential
{
	return 0;
}

sub GetFileHandlingrules
{
	return ();
}

sub GetExtraBuildOptions
{
	return ();
}

sub Build
{
	shift;
	my %options=@_;

	my @libAvifFlags=();
	if ($options{'avif-inc-dir'} eq '' && $options{'avif-lib-dir'} eq '') {
		@libAvifFlags=split("\n",readpipe(
			"perl \"".$options{'utils'}."/PkgConfig.pl\" libavif"
		));
	}
	if (!@libAvifFlags) {
		if ($options{'avif-inc-dir'} ne '') {
			push(@libAvifFlags, "--inc-search-dir", $options{'avif-inc-dir'});
		}
		if ($options{'avif-lib-dir'} ne '') {
			push(@libAvifFlags, "--lib-search-dir", $options{'avif-lib-dir'});
		}
		push(@libAvifFlags, "--link", "avif");
	}

	system(
		@{$options{'unicc_call'}},
		"--math",
		"--rtti",
		"--exceptions",
		"--bin-dir"       , "bin",
		"--lib-dir"       , "lib",
		"--obj-dir"       , "obj",
		"--inc-search-dir", "include",
		@libAvifFlags,
		"--link"          , "emCore",
		"--type"          , "dynlib",
		"--name"          , "PlAvif",
		"src/PlAvif.cpp"
	)==0 or return 0;

	return 1;
}