]> git.saurik.com Git - apple/libdispatch.git/blame - INSTALL
libdispatch-703.1.4.tar.gz
[apple/libdispatch.git] / INSTALL
CommitLineData
e85f4437
A
1Grand Central Dispatch (GCD)
2
3GCD is a concurrent programming framework first shipped with Mac OS X Snow
4Leopard. This package is an open source bundling of libdispatch, the core
5user space library implementing GCD. At the time of writing, support for
6the BSD kqueue API, and specifically extensions introduced in Mac OS X Snow
beb15981
A
7Leopard and FreeBSD 9-CURRENT, are required to use libdispatch. Support
8for Linux is a work in progress (see Linux notes below). Other systems are
9currently unsupported.
e85f4437
A
10
11 Configuring and installing libdispatch
12
13GCD is built using autoconf, automake, and libtool, and has a number of
14compile-time configuration options that should be reviewed before starting.
15An uncustomized install requires:
16
17 sh autogen.sh
18 ./configure
19 make
20 make install
21
22The following configure options may be of general interest:
23
beb15981 24--with-apple-libpthread-source
e85f4437 25
beb15981
A
26 Specify the path to Apple's libpthread package, so that appropriate headers
27 can be found and used.
28
29--with-apple-libplatform-source
30
31 Specify the path to Apple's libplatform package, so that appropriate headers
32 can be found and used.
e85f4437
A
33
34--with-apple-libclosure-source
35
36 Specify the path to Apple's Libclosure package, so that appropriate headers
37 can be found and used.
38
39--with-apple-xnu-source
40
c093abd6
A
41 Specify the path to Apple's XNU package, so that appropriate headers can be
42 found and used.
e85f4437
A
43
44--with-blocks-runtime
45
c093abd6 46 On systems where -fblocks is supported, specify an additional library path
beb15981 47 in which libBlocksRuntime can be found. This is not required on OS X,
c093abd6
A
48 where the Blocks runtime is included in libSystem, but is required on
49 FreeBSD.
e85f4437 50
c093abd6 51The following options are likely to only be useful when building libdispatch on
beb15981 52OS X as a replacement for /usr/lib/system/libdispatch.dylib:
e85f4437 53
fe4ce08b
A
54--with-apple-objc4-source
55
56 Specify the path to Apple's objc4 package, so that appropriate headers can
57 be found and used.
58
e85f4437
A
59--disable-libdispatch-init-constructor
60
c093abd6
A
61 Do not tag libdispatch's init routine as __constructor, in which case it
62 must be run manually before libdispatch routines can be called. This is the
beb15981 63 default when building on OS X. For /usr/lib/system/libdispatch.dylib
c093abd6 64 the init routine is called automatically during process start.
e85f4437
A
65
66--enable-apple-tsd-optimizations
67
c093abd6 68 Use a non-portable allocation scheme for pthread per-thread data (TSD) keys
beb15981
A
69 when building libdispatch for /usr/lib/system on OS X. This should not
70 be used on other OS's, or on OS X when building a stand-alone library.
e85f4437
A
71
72 Typical configuration commands
73
74The following command lines create the configuration required to build
beb15981 75libdispatch for /usr/lib/system on OS X El Capitan:
e85f4437 76
beb15981
A
77 clangpath=$(dirname `xcrun --find clang`)
78 sudo mkdir -p "$clangpath/../local/lib/clang/enable_objc_gc"
79 LIBTOOLIZE=glibtoolize sh autogen.sh
fe4ce08b
A
80 cflags='-arch x86_64 -arch i386 -g -Os'
81 ./configure CFLAGS="$cflags" OBJCFLAGS="$cflags" CXXFLAGS="$cflags" \
beb15981 82 --prefix=/usr --libdir=/usr/lib/system --disable-static \
e85f4437 83 --enable-apple-tsd-optimizations \
beb15981
A
84 --with-apple-libpthread-source=/path/to/10.11.0/libpthread-137.1.1 \
85 --with-apple-libplatform-source=/path/to/10.11.0/libplatform-73.1.1 \
86 --with-apple-libclosure-source=/path/to/10.11.0/libclosure-65 \
87 --with-apple-xnu-source=/path/to/10.11.0/xnu-3247.1.106 \
88 --with-apple-objc4-source=/path/to/10.11.0/objc4-680
c093abd6 89 make check
e85f4437
A
90
91Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with
92clang and blocks support:
93
94 sh autogen.sh
95 ./configure CC=clang --with-blocks-runtime=/usr/local/lib
c093abd6 96 make check
beb15981
A
97
98Instructions for building on Linux. Initial focus is on ubuntu 15.04.
99Prepare your system
100 1. Install compiler, autotools
101 sudo apt-get install clang
102 sudo apt-get install autoconf libtool pkg-config
103 2. Install dtrace (to generate provider.h)
104 sudo apt-get install systemtap-sdt-dev
105 3. Install libdispatch pre-reqs
106 sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev
107
108Initialize git submodules:
109 We are using git submodules to incorporate a specific revision of the
110 upstream pthread_workqueue library into the build.
111 git submodule init
112 git submodule update
113
114Build:
115 sh autogen.sh
116 ./configure
117 make
118
119Note: the build currently fails building tests, but libdispatch.so should
120 build successfully.