Skip to content

Commit 310012a

Browse files
committed
Added Toolchain section in INSTALL.md
1 parent f99215a commit 310012a

File tree

2 files changed

+80
-44
lines changed

2 files changed

+80
-44
lines changed

INSTALL renamed to INSTALL.md

Lines changed: 72 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Grand Central Dispatch (GCD)
1+
## Grand Central Dispatch (GCD)
22

33
GCD is a concurrent programming framework first shipped with Mac OS X Snow
44
Leopard. This package is an open source bundling of libdispatch, the core
@@ -8,7 +8,7 @@ Leopard and FreeBSD 9-CURRENT, are required to use libdispatch. Linux is
88
supported, but requires specific packages to be installed (see Linux
99
section at the end of the file). Other systems are currently unsupported.
1010

11-
I. Configuring and installing libdispatch (general comments)
11+
### Configuring and installing libdispatch (general comments)
1212

1313
GCD is built using autoconf, automake, and libtool, and has a number of
1414
compile-time configuration options that should be reviewed before starting.
@@ -41,59 +41,82 @@ Note that once libdispatch is installed into a Swift toolchain, that
4141
toolchain cannot be used to compile libdispatch again (you must 'make uninstall'
4242
libdispatch from the toolchain before using it to rebuild libdispatch).
4343

44-
II. Building and installing on OS X
44+
To create the toolchain with libdispatch Using build-toolchain in Linux:
45+
46+
1. Add libdispatch and install-libdispatch lines to ./swift/utils/build-presets.ini under `[preset: buildbot_linux]` section, as following:
47+
48+
```
49+
[preset: buildbot_linux]
50+
mixin-preset=mixin_linux_installation
51+
build-subdir=buildbot_linux
52+
lldb
53+
release
54+
test
55+
validation-test
56+
long-test
57+
libdispatch
58+
foundation
59+
lit-args=-v
60+
dash-dash
61+
62+
install-libdispatch
63+
install-foundation
64+
reconfigure
65+
```
66+
67+
2. Run:
68+
69+
```
70+
./swift/utils/build-toolchain local.swift
71+
```
72+
73+
Note that adding libdispatch in build-presets.ini is for Linux only as Swift on macOS platforms uses the system installed libdispatch, so its not required.
74+
75+
### Building and installing on OS X
4576
4677
The following configure options may be of general interest:
4778
48-
--with-apple-libpthread-source
79+
`--with-apple-libpthread-source`
4980
50-
Specify the path to Apple's libpthread package, so that appropriate headers
81+
Specify the path to Apple's libpthread package, so that appropriate headers
5182
can be found and used.
5283
53-
--with-apple-libplatform-source
84+
`--with-apple-libplatform-source`
5485
55-
Specify the path to Apple's libplatform package, so that appropriate headers
86+
Specify the path to Apple's libplatform package, so that appropriate headers
5687
can be found and used.
5788
58-
--with-apple-libclosure-source
89+
`--with-apple-libclosure-source`
5990
60-
Specify the path to Apple's Libclosure package, so that appropriate headers
91+
Specify the path to Apple's Libclosure package, so that appropriate headers
6192
can be found and used.
6293
63-
--with-apple-xnu-source
94+
`--with-apple-xnu-source`
6495
65-
Specify the path to Apple's XNU package, so that appropriate headers can be
96+
Specify the path to Apple's XNU package, so that appropriate headers can be
6697
found and used.
6798
68-
--with-blocks-runtime
99+
`--with-blocks-runtime`
69100
70-
On systems where -fblocks is supported, specify an additional library path
71-
in which libBlocksRuntime can be found. This is not required on OS X,
72-
where the Blocks runtime is included in libSystem, but is required on
73-
FreeBSD.
101+
On systems where -fblocks is supported, specify an additional library path in which libBlocksRuntime can be found. This is not required on OS X, where the Blocks runtime is included in libSystem, but is required on FreeBSD.
74102
75103
The following options are likely to only be useful when building libdispatch on
76104
OS X as a replacement for /usr/lib/system/libdispatch.dylib:
77105
78-
--with-apple-objc4-source
106+
`--with-apple-objc4-source`
79107
80-
Specify the path to Apple's objc4 package, so that appropriate headers can
108+
Specify the path to Apple's objc4 package, so that appropriate headers can
81109
be found and used.
82110
83-
--disable-libdispatch-init-constructor
111+
`--disable-libdispatch-init-constructor`
84112
85-
Do not tag libdispatch's init routine as __constructor, in which case it
86-
must be run manually before libdispatch routines can be called. This is the
87-
default when building on OS X. For /usr/lib/system/libdispatch.dylib
88-
the init routine is called automatically during process start.
113+
Do not tag libdispatch's init routine as __constructor, in which case it must be run manually before libdispatch routines can be called. This is the default when building on OS X. For /usr/lib/system/libdispatch.dylib the init routine is called automatically during process start.
89114
90-
--enable-apple-tsd-optimizations
115+
`--enable-apple-tsd-optimizations`
91116
92-
Use a non-portable allocation scheme for pthread per-thread data (TSD) keys
93-
when building libdispatch for /usr/lib/system on OS X. This should not
94-
be used on other OS's, or on OS X when building a stand-alone library.
117+
Use a non-portable allocation scheme for pthread per-thread data (TSD) keys when building libdispatch for /usr/lib/system on OS X. This should not be used on other OS's, or on OS X when building a stand-alone library.
95118
96-
Typical configuration commands
119+
#### Typical configuration commands
97120
98121
The following command lines create the configuration required to build
99122
libdispatch for /usr/lib/system on OS X El Capitan:
@@ -112,7 +135,7 @@ libdispatch for /usr/lib/system on OS X El Capitan:
112135
--with-apple-objc4-source=/path/to/10.11.0/objc4-680
113136
make check
114137
115-
III. Building and installing for FreeBSD
138+
### Building and installing for FreeBSD
116139
117140
Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with
118141
clang and blocks support:
@@ -121,33 +144,42 @@ clang and blocks support:
121144
./configure CC=clang --with-blocks-runtime=/usr/local/lib
122145
make check
123146
124-
IV. Building and installing for Linux
147+
### Building and installing for Linux
125148
126149
Note that libdispatch development and testing is done only
127150
on Ubuntu; currently supported versions are 14.04, 15.10 and 16.04.
128151
129-
(1) The first thing to do is install required packages:
152+
1. The first thing to do is install required packages:
153+
130154
1a. Install build tools and clang compiler.
131-
sudo apt-get install autoconf libtool pkg-config clang
155+
`sudo apt-get install autoconf libtool pkg-config clang`
156+
132157
1b. Install dtrace (to generate provider.h)
133-
sudo apt-get install systemtap-sdt-dev
158+
`sudo apt-get install systemtap-sdt-dev`
159+
134160
1c. Install additional libdispatch dependencies
135-
sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev
161+
`sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev`
136162
137-
Note: compiling libdispatch requires clang 3.8 or better and
163+
Note: compiling libdispatch requires clang 3.8 or better and
138164
the gold linker. If the default clang on your Ubuntu version is
139165
too old, see http://apt.llvm.org/ to install a newer version.
140166
On older Ubuntu releases, you may need to install binutils-gold
141167
to get the gold linker.
142168
143-
(2) Initialize git submodules.
169+
2. Initialize git submodules.
144170
We are using git submodules to incorporate specific revisions of the
145171
upstream pthread_workqueue and libkqueue projects into the build.
172+
173+
```
146174
git submodule init
147175
git submodule update
176+
```
177+
178+
3. Build (as in the general instructions above)
148179
149-
(3) Build (as in the general instructions above)
150-
sh autogen.sh
151-
./configure
152-
make
180+
```
181+
sh autogen.sh
182+
./configure
183+
make
153184
make install
185+
```

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ libdispatch on Darwin is a combination of logic in the `xnu` kernel alongside th
1818

1919
Our first tasks for this project are:
2020

21-
0. Adapt the current autotools build system to work on Linux, or develop a new makefile or other build script for the project on Linux. The current version of the build system has only been tested on Darwin, though previous versions have been made to work on FreeBSD and Linux (see INSTALL).
22-
0. Omit as much of the extra functionality of the library as possible, to get a core version of the project building. Much of the OS X-specific functionality can be elided completely on Linux.
23-
0. Adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate coverage on basic functionality.
24-
0. Incrementally add functionality back in.
21+
1. Adapt the current autotools build system to work on Linux, or develop a new makefile or other build script for the project on Linux. The current version of the build system has only been tested on Darwin, though previous versions have been made to work on FreeBSD and Linux (see [INSTALL](INSTALL.md)).
22+
2. Omit as much of the extra functionality of the library as possible, to get a core version of the project building. Much of the OS X-specific functionality can be elided completely on Linux.
23+
3. Adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate coverage on basic functionality.
24+
4. Incrementally add functionality back in.
2525

2626
Some C headers and sources (e.g. `Availability.h`, `Block.h`, and the libclosure `runtime.c`) are similar to ones embedded into the CoreFoundation part of [swift-corelibs-foundation](http://github.com/apple/swift-corelibs-foundation). We should figure out a mechanism to share these instead of duplicating them across projects.
27+
28+
## See also
29+
30+
[INSTALL](INSTALL.md)

0 commit comments

Comments
 (0)