-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_stubs
executable file
·51 lines (45 loc) · 1.35 KB
/
compile_stubs
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
#!/bin/csh
# Attempt to find the architecture.
# First look through the command line args.
set arch=unknown
set link_cmd=(`cat link_command`)
while ( $#link_cmd > 0 )
if ( "$link_cmd[1]" == "-arch" ) then
set arch=$link_cmd[2]
endif
shift link_cmd
end
# look for an explicit arch file
if ( "$arch" == "unknown" ) then
if ( -e arch ) then
set arch=`cat arch`
endif
endif
if ( "$arch" == "unknown" ) then
echo "***** Unable to determine architecture."
exit 1
endif
# Create .dylibs for each file in the dylib_stubs directory.
if ( -e dylib_stubs ) then
set files=`cd dylib_stubs ; echo *`
mkdir -p dylibs
foreach file ($files)
if ( ! -e dylibs/$file ) then
clang -arch $arch -c -fno-builtin -o tmp_object.o -x c dylib_stubs/$file
ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o dylibs/$file tmp_object.o
endif
end
endif
# Create .frameworks for each file in the framework_stubs directory.
if ( -e framework_stubs ) then
set files=`cd framework_stubs ; echo *`
foreach file ($files)
if ( ! -e frameworks/$file.framework ) then
clang -arch $arch -c -fno-builtin -o tmp_object.o -x c framework_stubs/$file
mkdir -p frameworks/$file.framework
ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o frameworks/$file.framework/$file tmp_object.o
endif
end
endif
# Clean up.
rm -f tmp_object.o