]> git.saurik.com Git - apple/libdispatch.git/blob - install
libdispatch-84.5.3.tar.gz
[apple/libdispatch.git] / install
1 #!/bin/bash
2
3 if [ $EUID -ne 0 ]; then
4 echo "install script must be run as root" 2>&1
5 exit 1
6 fi
7
8 ## Copy Libsystem pieces from ~rc
9 copylibs=0
10 ## Install results in /
11 noinstall=0
12 build=$(sw_vers -buildVersion)
13 train=$(~rc/bin/getTrainForBuild --quiet "$build")
14
15 while [ $# -gt 0 ]; do
16 if [ "${1/=*/}" = "--build" ]; then
17 build="${1/*=/}"
18 elif [ "$1" = "--noinstall" ]; then
19 noinstall=1
20 elif [ "$1" = "--copylibs" ]; then
21 copylibs=1
22 else
23 echo "install: [--build=10A400] [--noinstall] [--copylibs]" 2>&1
24 exit 1
25 fi
26 shift
27 done
28
29 ROOTS=/var/tmp/GCDRoots."$build"
30
31 # Building for another version implies copylibs and noinstall
32 if [ "$build" != "$(sw_vers -buildVersion)" ]; then
33 copylibs=1
34 noinstall=1
35 fi
36
37 set -ex
38 mkdir -p "$ROOTS"
39
40 function BUILDIT() {
41 ~rc/bin/buildit -arch i386 -arch ppc -arch x86_64 -arch armv6 \
42 -release "$train" -rootsDirectory "$ROOTS" "$@" .
43 }
44
45 BUILDIT -project libdispatch -merge / -noverify
46
47 if [ $copylibs = 1 ]; then
48 ALTUSRLOCALLIBSYSTEM="$ROOTS"/system
49 mkdir -p "$ALTUSRLOCALLIBSYSTEM"
50 export ALTUSRLOCALLIBSYSTEM
51 ./install_Libsystem_pieces "$build"
52 cp /usr/local/lib/system/libdispatch* "$ALTUSRLOCALLIBSYSTEM"
53 fi
54
55 LIBSYSTEM=$(~rc/bin/getvers "$train$build" Libsystem)
56 if [ -z "$LIBSYSTEM" ]; then
57 exit 1
58 fi
59 SRCROOT="/var/tmp/$LIBSYSTEM"
60 if [ ! -e "$SRCROOT" ]; then
61 cd $(dirname "$SRCROOT")
62 svn co http://src.apple.com/svn/BSD/Libsystem/tags/"$LIBSYSTEM"
63 fi
64 cd "$SRCROOT"
65 BUILDIT
66
67 if [ $noinstall -eq 1 ]; then
68 exit 0
69 fi
70
71 if [ ! -e /usr/lib/libSystem.B.dylib.orig ]; then
72 cp /usr/lib/libSystem.B.dylib /usr/lib/libSystem.B.dylib.orig
73 fi
74 if [ ! -e /usr/lib/libSystem.B_debug.dylib.orig ] ; then
75 cp /usr/lib/libSystem.B_debug.dylib /usr/lib/libSystem.B_debug.dylib.orig
76 fi
77 if [ ! -e /usr/lib/libSystem.B_profile.dylib.orig ] ; then
78 cp /usr/lib/libSystem.B_profile.dylib /usr/lib/libSystem.B_profile.dylib.orig
79 fi
80 cp -R "$ROOTS"/"$LIBSYSTEM".roots/"$LIBSYSTEM"~sym/libSystem* /usr/lib/
81 update_dyld_shared_cache