Skip to content

README - Added Toolchain section #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 49 additions & 13 deletions INSTALL → INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Grand Central Dispatch (GCD)
## Grand Central Dispatch (GCD)

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

I. Configuring and installing libdispatch (general comments)
### I. Configuring and installing libdispatch (general comments)

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

II. Building and installing on OS X
### II. Building and installing on OS X

The following configure options may be of general interest:

Expand Down Expand Up @@ -93,7 +93,7 @@ OS X as a replacement for /usr/lib/system/libdispatch.dylib:
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.

Typical configuration commands
#### Typical configuration commands

The following command lines create the configuration required to build
libdispatch for /usr/lib/system on OS X El Capitan:
Expand All @@ -112,7 +112,7 @@ libdispatch for /usr/lib/system on OS X El Capitan:
--with-apple-objc4-source=/path/to/10.11.0/objc4-680
make check

III. Building and installing for FreeBSD
### III. Building and installing for FreeBSD

Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with
clang and blocks support:
Expand All @@ -121,33 +121,69 @@ clang and blocks support:
./configure CC=clang --with-blocks-runtime=/usr/local/lib
make check

IV. Building and installing for Linux
### IV. Building and installing for Linux

Note that libdispatch development and testing is done only
on Ubuntu; currently supported versions are 14.04, 15.10 and 16.04.

(1) The first thing to do is install required packages:
1. The first thing to do is install required packages:

1a. Install build tools and clang compiler.
sudo apt-get install autoconf libtool pkg-config clang

1b. Install dtrace (to generate provider.h)
sudo apt-get install systemtap-sdt-dev

1c. Install additional libdispatch dependencies
sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev

Note: compiling libdispatch requires clang 3.8 or better and
Note: compiling libdispatch requires clang 3.8 or better and
the gold linker. If the default clang on your Ubuntu version is
too old, see http://apt.llvm.org/ to install a newer version.
On older Ubuntu releases, you may need to install binutils-gold
to get the gold linker.

(2) Initialize git submodules.
2. Initialize git submodules.
We are using git submodules to incorporate specific revisions of the
upstream pthread_workqueue and libkqueue projects into the build.

```
git submodule init
git submodule update
```

3. Build (as in the general instructions above)

(3) Build (as in the general instructions above)
sh autogen.sh
./configure
make
```
sh autogen.sh
./configure
make
make install
```

## Toolchain
To add libdispatch to the toolchain in Linux, you need to add libdispatch and install-libdispatch lines to ./swift/utils/build-presets.ini under `[preset: buildbot_linux]` section. After those updates the section would be as following:

```
[preset: buildbot_linux]
mixin-preset=mixin_linux_installation
build-subdir=buildbot_linux
lldb
release
test
validation-test
long-test
libdispatch
foundation
lit-args=-v
dash-dash

install-libdispatch
install-foundation
reconfigure
```

After that run:

utils/build-toolchain local.swift

12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ libdispatch on Darwin is a combination of logic in the `xnu` kernel alongside th

Our first tasks for this project are:

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).
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.
0. Adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate coverage on basic functionality.
0. Incrementally add functionality back in.
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)).
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.
3. Adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate coverage on basic functionality.
4. Incrementally add functionality back in.

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.

## See also

[INSTALL](INSTALL.md)