]> git.saurik.com Git - apple/ld64.git/blob - compile_stubs
ld64-274.2.tar.gz
[apple/ld64.git] / compile_stubs
1 #!/bin/csh
2
3 # Attempt to find the architecture.
4 # First look through the command line args.
5 set arch=unknown
6 set link_cmd=(`cat link_command`)
7 while ( $#link_cmd > 0 )
8 if ( "$link_cmd[1]" == "-arch" ) then
9 set arch=$link_cmd[2]
10 endif
11 shift link_cmd
12 end
13
14 # look for an explicit arch file
15 if ( "$arch" == "unknown" ) then
16 if ( -e arch ) then
17 set arch=`cat arch`
18 endif
19 endif
20
21 if ( "$arch" == "unknown" ) then
22 echo "***** Unable to determine architecture."
23 exit 1
24 endif
25
26 # Create .dylibs for each file in the dylib_stubs directory.
27 if ( -e dylib_stubs ) then
28 set files=`cd dylib_stubs ; echo *`
29 mkdir -p dylibs
30 foreach file ($files)
31 if ( ! -e dylibs/$file ) then
32 clang -arch $arch -c -fno-builtin -o tmp_object.o -x c dylib_stubs/$file
33 ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o dylibs/$file tmp_object.o
34 endif
35 end
36 endif
37
38 # Create .frameworks for each file in the framework_stubs directory.
39 if ( -e framework_stubs ) then
40 set files=`cd framework_stubs ; echo *`
41 foreach file ($files)
42 if ( ! -e frameworks/$file.framework ) then
43 clang -arch $arch -c -fno-builtin -o tmp_object.o -x c framework_stubs/$file
44 mkdir -p frameworks/$file.framework
45 ld -arch $arch -dylib -macosx_version_min 10.1 -no_version_load_command -o frameworks/$file.framework/$file tmp_object.o
46 endif
47 end
48 endif
49
50 # Clean up.
51 rm -f tmp_object.o