-
Notifications
You must be signed in to change notification settings - Fork 88
/
libffi.rb
64 lines (58 loc) · 2.67 KB
/
libffi.rb
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
component 'libffi' do |pkg, settings, platform|
pkg.version '3.4.6'
pkg.sha256sum 'b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e'
pkg.url "https://github.com/libffi/libffi/releases/download/v#{pkg.get_version}/#{pkg.get_name}-#{pkg.get_version}.tar.gz"
pkg.mirror "#{settings[:buildsources_url]}/#{pkg.get_name}-#{pkg.get_version}.tar.gz"
if platform.is_aix?
if platform.name == 'aix-7.1-ppc'
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)"
else
pkg.environment "PATH", "/opt/freeware/bin:$(PATH)"
end
elsif platform.is_cross_compiled_linux?
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH):#{settings[:bindir]}"
pkg.environment "CFLAGS", settings[:cflags]
pkg.environment "LDFLAGS", settings[:ldflags]
elsif platform.is_solaris?
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH):/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin:#{settings[:bindir]}"
if !platform.is_cross_compiled? && platform.architecture == 'sparc'
# must use gnu99 due to `asm` keyword
# https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Extended-Asm.html
pkg.environment "CFLAGS", "#{settings[:cflags]} -std=gnu99"
else
pkg.environment "CFLAGS", "#{settings[:cflags]} -std=c99"
end
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment 'MAKE', 'gmake'
elsif platform.is_macos?
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
if platform.is_cross_compiled?
pkg.environment 'CC', 'clang -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CC', 'clang -target arm64-apple-macos12' if platform.name =~ /osx-12/
end
elsif platform.is_windows?
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(PATH)"
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
if platform.architecture == "x86"
pkg.apply_patch "resources/patches/libffi/revert_clang_32bit.patch"
end
else
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
end
pkg.build_requires "runtime-#{settings[:runtime_project]}"
pkg.configure do
["./configure --prefix=#{settings[:prefix]} --sbindir=#{settings[:prefix]}/bin --libexecdir=#{settings[:prefix]}/lib/libffi --disable-multi-os-directory #{settings[:host]}"]
end
pkg.build do
["#{platform[:make]} VERBOSE=1 -j$(shell expr $(shell #{platform[:num_cores]}) + 1)"]
end
pkg.install do
[
"#{platform[:make]} VERBOSE=1 -j$(shell expr $(shell #{platform[:num_cores]}) + 1) install",
"rm -rf #{settings[:datadir]}/doc/#{pkg.get_name}*"
]
end
end