You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GCD is a concurrent programming framework first shipped with Mac OS X Snow
4
4
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
8
8
supported, but requires specific packages to be installed (see Linux
9
9
section at the end of the file). Other systems are currently unsupported.
10
10
11
-
I. Configuring and installing libdispatch (general comments)
11
+
###Configuring and installing libdispatch (general comments)
12
12
13
13
GCD is built using autoconf, automake, and libtool, and has a number of
14
14
compile-time configuration options that should be reviewed before starting.
@@ -41,59 +41,83 @@ Note that once libdispatch is installed into a Swift toolchain, that
41
41
toolchain cannot be used to compile libdispatch again (you must 'make uninstall'
42
42
libdispatch from the toolchain before using it to rebuild libdispatch).
43
43
44
-
II. Building and installing on OS X
44
+
You can also use the build-toolchain script to create a toolchain
45
+
that includes libdispatch on Linux:
46
+
47
+
1. Add libdispatch and install-libdispatch lines to ./swift/utils/build-presets.ini under `[preset: buildbot_linux]` section, as following:
48
+
49
+
```
50
+
[preset: buildbot_linux]
51
+
mixin-preset=mixin_linux_installation
52
+
build-subdir=buildbot_linux
53
+
lldb
54
+
release
55
+
test
56
+
validation-test
57
+
long-test
58
+
libdispatch
59
+
foundation
60
+
lit-args=-v
61
+
dash-dash
62
+
63
+
install-libdispatch
64
+
install-foundation
65
+
reconfigure
66
+
```
67
+
68
+
2. Run:
69
+
70
+
```
71
+
./swift/utils/build-toolchain local.swift
72
+
```
73
+
74
+
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.
75
+
76
+
### Building and installing on OS X
45
77
46
78
The following configure options may be of general interest:
47
79
48
-
--with-apple-libpthread-source
80
+
`--with-apple-libpthread-source`
49
81
50
-
Specify the path to Apple's libpthread package, so that appropriate headers
82
+
Specify the path to Apple's libpthread package, so that appropriate headers
51
83
can be found and used.
52
84
53
-
--with-apple-libplatform-source
85
+
`--with-apple-libplatform-source`
54
86
55
-
Specify the path to Apple's libplatform package, so that appropriate headers
87
+
Specify the path to Apple's libplatform package, so that appropriate headers
56
88
can be found and used.
57
89
58
-
--with-apple-libclosure-source
90
+
`--with-apple-libclosure-source`
59
91
60
-
Specify the path to Apple's Libclosure package, so that appropriate headers
92
+
Specify the path to Apple's Libclosure package, so that appropriate headers
61
93
can be found and used.
62
94
63
-
--with-apple-xnu-source
95
+
`--with-apple-xnu-source`
64
96
65
-
Specify the path to Apple's XNU package, so that appropriate headers can be
97
+
Specify the path to Apple's XNU package, so that appropriate headers can be
66
98
found and used.
67
99
68
-
--with-blocks-runtime
100
+
`--with-blocks-runtime`
69
101
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.
102
+
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.
74
103
75
104
The following options are likely to only be useful when building libdispatch on
76
105
OS X as a replacement for /usr/lib/system/libdispatch.dylib:
77
106
78
-
--with-apple-objc4-source
107
+
`--with-apple-objc4-source`
79
108
80
-
Specify the path to Apple's objc4 package, so that appropriate headers can
109
+
Specify the path to Apple's objc4 package, so that appropriate headers can
81
110
be found and used.
82
111
83
-
--disable-libdispatch-init-constructor
112
+
`--disable-libdispatch-init-constructor`
84
113
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.
114
+
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.
89
115
90
-
--enable-apple-tsd-optimizations
116
+
`--enable-apple-tsd-optimizations`
91
117
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.
118
+
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.
95
119
96
-
Typical configuration commands
120
+
#### Typical configuration commands
97
121
98
122
The following command lines create the configuration required to build
99
123
libdispatch for /usr/lib/system on OS X El Capitan:
@@ -112,7 +136,7 @@ libdispatch for /usr/lib/system on OS X El Capitan:
Copy file name to clipboardExpand all lines: README.md
+9-16Lines changed: 9 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -4,23 +4,16 @@ Grand Central Dispatch (GCD or libdispatch) provides comprehensive support for c
4
4
5
5
libdispatch is currently available on all Darwin platforms. This project aims to make a modern version of libdispatch available on all other Swift platforms. To do this, we will implement as much of the portable subset of the API as possible, using the existing open source C implementation.
6
6
7
-
## Project Goals
8
-
9
-
We are currently very early in the development of this project. Our starting point is simply a mirror of the open source drop that corresponds with OS X El Capitan (10.11). Therefore, our earliest goals are:
10
-
11
-
0. Build and test the C source code as a dynamic library on the current Swift Linux targets (Ubuntu 14.04 and Ubuntu 15.10).
12
-
0. Add a `module.modulemap` and make the libdispatch API importable into Swift.
13
-
0. After the previous two steps are done, consider possible improvements to the interface of the libdispatch API in Swift.
7
+
libdispatch on Darwin is a combination of logic in the `xnu` kernel alongside the user-space Library. The kernel has the most information available to balance workload across the entire system. As a first step, however, we believe it is useful to bring up the basic functionality of the library using user-space pthread primitives on Linux. Eventually, a Linux kernel module could be developed to support more informed thread scheduling.
14
8
15
-
## Building a C Library
16
-
17
-
libdispatch on Darwin is a combination of logic in the `xnu` kernel alongside the user-space Library. The kernel has the most information available to balance workload across the entire system. As a first step, however, we believe it is useful to bring up the basic functionality of the library using user-space pthread primitives on Linux.
9
+
## Project Goals
18
10
19
-
Our first tasks for this project are:
11
+
We are currently early in the development of this project. We began with a mirror of the open source drop that corresponds with OS X El Capitan (10.11) and have ported it to x86_64 Ubuntu 14.04 and 15.10. The next steps are:
12
+
1. Complete the work to adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate test coverage on basic functionality of the Swift API.
13
+
2. Include libdispatch and libdispatch-enabled Core Libraries in the Swift CI environment and the pre-built Swift toolchains at Swift.org.
14
+
4. Develop a test suite for the Swift APIs of libdispatch.
15
+
4. Enhance libdispatch as needed to support Swift language evolution and the needs of the other Core Libraries projects.
20
16
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.
17
+
## Build and Install
25
18
26
-
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.
19
+
For detailed instructions on building and installing libdispatch, see [INSTALL.md](INSTALL.md)
0 commit comments