@@ -4,21 +4,45 @@ GCD is a concurrent programming framework first shipped with Mac OS X Snow
44Leopard. This package is an open source bundling of libdispatch, the core
55user space library implementing GCD. At the time of writing, support for
66the BSD kqueue API, and specifically extensions introduced in Mac OS X Snow
7- Leopard and FreeBSD 9-CURRENT, are required to use libdispatch. Support
8- for Linux is a work in progress (see Linux notes below). Other systems are
9- currently unsupported.
7+ Leopard and FreeBSD 9-CURRENT, are required to use libdispatch. Linux is
8+ supported, but requires specific packages to be installed (see Linux
9+ section at the end of the file). Other systems are currently unsupported.
1010
11- Configuring and installing libdispatch
11+ I. Configuring and installing libdispatch (general comments)
1212
1313GCD is built using autoconf, automake, and libtool, and has a number of
1414compile-time configuration options that should be reviewed before starting.
15- An uncustomized install requires:
15+ An uncustomized install of the C-API to libdispatch requires:
1616
1717 sh autogen.sh
1818 ./configure
1919 make
2020 make install
2121
22+ libdispatch can be optionally built to include a Swift API. This requires a
23+ Swift toolchain to compile the Swift code in libdispatch and can be done
24+ in two possible scenarios.
25+
26+ If you are building your own Swift toolchain from source, then you should build
27+ libdispatch simply by giving additional arguments to swift/utils/build-script:
28+
29+ ./swift/utils/build-script --libdispatch -- --install-libdispatch
30+
31+ To build libdispatch using a pre-built Swift toolchain and install libdispatch
32+ into that toolchain (to allow that toolchain to compile Swift code containing
33+ "import Dispatch") requires:
34+
35+ sh autogen.sh
36+ ./configure --with-swift-toolchain=<PATH_TO_SWIFT_TOOLCHAIN> --prefix=<PATH_TO_SWIFT_TOOLCHAIN>
37+ make
38+ make install
39+
40+ Note that once libdispatch is installed into a Swift toolchain, that
41+ toolchain cannot be used to compile libdispatch again (you must 'make uninstall'
42+ libdispatch from the toolchain before using it to rebuild libdispatch).
43+
44+ II. Building and installing on OS X
45+
2246The following configure options may be of general interest:
2347
2448--with-apple-libpthread-source
@@ -88,33 +112,42 @@ libdispatch for /usr/lib/system on OS X El Capitan:
88112 --with-apple-objc4-source=/path/to/10.11.0/objc4-680
89113 make check
90114
115+ III. Building and installing for FreeBSD
116+
91117Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with
92118clang and blocks support:
93119
94120 sh autogen.sh
95121 ./configure CC=clang --with-blocks-runtime=/usr/local/lib
96122 make check
97123
98- Instructions for building on Linux. Initial focus is on ubuntu 15.04.
99- Prepare 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)
124+ IV. Building and installing for Linux
125+
126+ Note that libdispatch development and testing is done only
127+ on Ubuntu; currently supported versions are 14.04, 15.10 and 16.04.
128+
129+ (1) The first thing to do is install required packages:
130+ 1a. Install build tools and clang compiler.
131+ sudo apt-get install autoconf libtool pkg-config clang
132+ 1b. Install dtrace (to generate provider.h)
104133 sudo apt-get install systemtap-sdt-dev
105- 3 . Install libdispatch pre-reqs
134+ 1c . Install additional libdispatch dependencies
106135 sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev
107136
108- Initialize git submodules:
109- We are using git submodules to incorporate a specific revision of the
110- upstream pthread_workqueue library into the build.
137+ Note: compiling libdispatch requires clang 3.8 or better and
138+ the gold linker. If the default clang on your Ubuntu version is
139+ too old, see http://apt.llvm.org/ to install a newer version.
140+ On older Ubuntu releases, you may need to install binutils-gold
141+ to get the gold linker.
142+
143+ (2) Initialize git submodules.
144+ We are using git submodules to incorporate specific revisions of the
145+ upstream pthread_workqueue and libkqueue projects into the build.
111146 git submodule init
112147 git submodule update
113148
114- Build:
149+ (3) Build (as in the general instructions above)
115150 sh autogen.sh
116151 ./configure
117152 make
118-
119- Note: the build currently fails building tests, but libdispatch.so should
120- build successfully.
153+ make install
0 commit comments