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