]> git.saurik.com Git - apple/ld64.git/blame - compile_stubs
ld64-236.3.tar.gz
[apple/ld64.git] / compile_stubs
CommitLineData
ebf6f434
A
1#!/bin/csh
2
3# Attempt to find the architecture.
4# First look through the command line args.
5set arch=unknown
6set link_cmd=(`cat link_command`)
7while ( $#link_cmd > 0 )
8 if ( "$link_cmd[1]" == "-arch" ) then
9 set arch=$link_cmd[2]
10 endif
11 shift link_cmd
12end
13
14# look for an explicit arch file
15if ( "$arch" == "unknown" ) then
16 if ( -e arch ) then
17 set arch=`cat arch`
18 endif
19endif
20
21if ( "$arch" == "unknown" ) then
22echo "***** Unable to determine architecture."
23exit 1
24endif
25
26# Create .dylibs for each file in the dylib_stubs directory.
27if ( -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
36endif
37
38# Create .frameworks for each file in the framework_stubs directory.
39if ( -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
48endif
49
50# Clean up.
51rm -f tmp_object.o