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
f24ed6d Delete README_osx.md and move its contents into build-osx.md (Martin Erlandsson)
Pull request description:
With its current name, the file `doc/README_osx.md` looks like an entry point README for OSX users, but it only contains specific instructions on how to build a DMG.
This PR deletes the file and moves the contents of the file into `doc/build-osx.md`.
Tree-SHA512: 2636b9da967f2a4c0d68cb9a157fb3db137bdb8fbff5d9d004f28b5d816e9c27fddc5c403e6b0c363d1dc9ddc7cac8b295efa01fc691126c0e36e21bb9b3cbd3
In order to build a working toolchain, the following source packages are needed
128
+
from Apple: cctools, dyld, and ld64.
129
+
130
+
These tools inject timestamps by default, which produce non-deterministic
131
+
binaries. The ZERO_AR_DATE environment variable is used to disable that.
132
+
133
+
This version of cctools has been patched to use the current version of clang's
134
+
headers and its libLTO.so rather than those from llvmgcc, as it was
135
+
originally done in toolchain4.
136
+
137
+
To complicate things further, all builds must target an Apple SDK. These SDKs
138
+
are free to download, but not redistributable.
139
+
To obtain it, register for a developer account, then download the [Xcode 7.3.1 dmg](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg).
140
+
141
+
This file is several gigabytes in size, but only a single directory inside is
Unfortunately, the usual linux tools (7zip, hpmount, loopback mount) are incapable of opening this file.
148
+
To create a tarball suitable for Gitian input, there are two options:
149
+
150
+
Using macOS, you can mount the dmg, and then create it with:
151
+
```
152
+
$ hdiutil attach Xcode_7.3.1.dmg
153
+
$ tar -C /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ -czf MacOSX10.11.sdk.tar.gz MacOSX10.11.sdk
154
+
```
155
+
156
+
Alternatively, you can use 7zip and SleuthKit to extract the files one by one.
157
+
The script contrib/macdeploy/extract-osx-sdk.sh automates this. First ensure
158
+
the dmg file is in the current directory, and then run the script. You may wish
159
+
to delete the intermediate 5.hfs file and MacOSX10.11.sdk (the directory) when
160
+
you've confirmed the extraction succeeded.
161
+
162
+
```bash
163
+
apt-get install p7zip-full sleuthkit
164
+
contrib/macdeploy/extract-osx-sdk.sh
165
+
rm -rf 5.hfs MacOSX10.11.sdk
166
+
```
167
+
168
+
The Gitian descriptors build 2 sets of files: Linux tools, then Apple binaries
169
+
which are created using these tools. The build process has been designed to
170
+
avoid including the SDK's files in Gitian's outputs. All interim tarballs are
171
+
fully deterministic and may be freely redistributed.
172
+
173
+
genisoimage is used to create the initial DMG. It is not deterministic as-is,
174
+
so it has been patched. A system genisoimage will work fine, but it will not
175
+
be deterministic because the file-order will change between invocations.
176
+
The patch can be seen here: [theuni/osx-cross-depends](https://raw.githubusercontent.com/theuni/osx-cross-depends/master/patches/cdrtools/genisoimage.diff).
177
+
No effort was made to fix this cleanly, so it likely leaks memory badly. But
178
+
it's only used for a single invocation, so that's no real concern.
179
+
180
+
genisoimage cannot compress DMGs, so afterwards, the 'dmg' tool from the
181
+
libdmg-hfsplus project is used to compress it. There are several bugs in this
182
+
tool and its maintainer has seemingly abandoned the project. It has been forked
183
+
and is available (with fixes) here: [theuni/libdmg-hfsplus](https://github.com/theuni/libdmg-hfsplus).
184
+
185
+
The 'dmg' tool has the ability to create DMGs from scratch as well, but this
186
+
functionality is broken. Only the compression feature is currently used.
187
+
Ideally, the creation could be fixed and genisoimage would no longer be necessary.
188
+
189
+
Background images and other features can be added to DMG files by inserting a
190
+
.DS_Store before creation. This is generated by the script
191
+
contrib/macdeploy/custom_dsstore.py.
192
+
193
+
As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a
194
+
requirement in order to satisfy the new Gatekeeper requirements. Because this
195
+
private key cannot be shared, we'll have to be a bit creative in order for the
196
+
build process to remain somewhat deterministic. Here's how it works:
197
+
198
+
- Builders use Gitian to create an unsigned release. This outputs an unsigned
199
+
dmg which users may choose to bless and run. It also outputs an unsigned app
200
+
structure in the form of a tarball, which also contains all of the tools
201
+
that have been previously (deterministically) built in order to create a
202
+
final dmg.
203
+
- The Apple keyholder uses this unsigned app to create a detached signature,
204
+
using the script that is also included there. Detached signatures are available from this [repository](https://github.com/bitcoin-core/bitcoin-detached-sigs).
205
+
- Builders feed the unsigned app + detached signature back into Gitian. It
206
+
uses the pre-built tools to recombine the pieces into a deterministic dmg.
Create the macOS SDK tarball, see the [macOS readme](README_osx.md) for details, and copy it into the inputs directory.
95
+
Create the macOS SDK tarball, see the [macOS build instructions](build-osx.md#deterministic-macos-dmg-notes) for details, and copy it into the inputs directory.
96
96
97
97
### Optional: Seed the Gitian sources cache and offline git repositories
0 commit comments