#!/bin/csh
set arch=unknown
set link_cmd=(`cat link_command`)
while ( $ if ( "$link_cmd[1]" == "-arch" ) then
set arch=$link_cmd[2]
endif
shift link_cmd
end
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
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
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
rm -f tmp_object.o