Skip to content
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

Backport macOS PRs #6808

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft

Backport macOS PRs #6808

wants to merge 28 commits into from

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Dec 31, 2023

Draft PR opened for testing these changes in CI. This PR will likely be broken into several separate PRs.

Closes #5884.

luke-jr and others added 28 commits December 30, 2023 18:42
Zcash: Applies to 2015 for Zcash purposes.

(cherry picked from commit bitcoin/bitcoin@1a6c67c)
…e name

This helps avoid accidental removal of upstream copyright names

(cherry picked from commit bitcoin/bitcoin@917b1d0)
Zcash: We don't have `share/setup.nsi.in` anymore, but this will ensure
that any uses of `@PACKAGE_URL@` in future will be substituted.

(cherry picked from commit bitcoin/bitcoin@29598e4)
…ons so it gets passed to extract-strings correctly

(cherry picked from commit bitcoin/bitcoin@cddffaf)
…add a second line to copyrights in -version, About dialog, and splash screen

(cherry picked from commit bitcoin/bitcoin@027fdb8)
Currently these test failures are not caught by travis leading to bugs like:
bitcoin/bitcoin#10506

Zcash: Only the changes to the depends build system.

(cherry picked from commit bitcoin/bitcoin@4f92b5f)
Previously, if ./configure was invoked with:

```
$ env CONFIG_SITE=depends/x86_64-pc-linux-gnu/share/config.site ./configure
```

Where $CONFIG_SITE was a relative path, ./configure would fail with the
following misleading output:

```
checking for boostlib >= 1.58.0 (105800)... yes
checking whether the Boost::System library is available... yes
configure: error: Could not find a version of the Boost::System library!
```

Fully resolving depends_prefix in config.site.in fixes this. To make
sure that there are no other side effects I ran a diff on the
config.status generated by:

1. The scripts prior to this change with CONFIG_SITE set to a full path:
       env CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure
2. The scripts after this change with CONFIG_SITE set to a relative path:
       env CONFIG_SITE=depends/x86_64-pc-linux-gnu/share/config.site ./configure

And it looks good!

Diff: https://paste.sr.ht/~dongcarl/95b469fbc555c128046e85723d87a9082a754f6b
(cherry picked from commit bitcoin/bitcoin@6c7e8f0)
Files like config.site.in are not referenced by any other script in our
tree, so we need to mark it manually with a "shellcheck shell="
directive and make sure that shellcheck is run on them.

(cherry picked from commit bitcoin/bitcoin@618cbd2)
Previously, when running ./configure:

1. With CONFIG_SITE pointed to our depends config.site.in, and
2. PYTHONPATH was not set either in the environment or by the user

The configure would output something like:

PYTHONPATH='depends/x86_64-pc-linux-gnu/share/../native/lib/python3/dist-packages:'

When we really mean:

PYTHONPATH='depends/x86_64-pc-linux-gnu/share/../native/lib/python3/dist-packages'

...without the colon

This change makes sure that:

1. There's no trailing colon, and
2. We use the $PATH_SEPARATOR variable instead of a colon

(cherry picked from commit bitcoin/bitcoin@46756a6)
Catalina SDK clang stopped automatically searching the SDK include paths when
invoked without --sysroot:

bitcoin/bitcoin#16367 (comment)
Homebrew/homebrew-core#45061

This hasn't been a problem for current native depends packages because are
passing their own --sysroot values, and hasn't been a problem for current host
packages because they use `darwin_` commands instead of `build_darwin_`
commands.  But the current `build_darwin_CC` and `build_darwin_CXX` commands
are still unnecessarily fragile, and incompatible with new native depends
packages added in bitcoin/bitcoin#18677.

Cory Fields <cory-nospam-@coryfields.com> suggested in
bitcoin/bitcoin#16367 (comment) switching
compiler from SDK clang to native clang (from $PATH) to avoid this problem.
This is easy and makes a certain amount of sense for building native packages,
as opposed to host packages. But fanquake <fanquake@gmail.com> pointed out in
bitcoin/bitcoin#18677 (comment) that it
would be inconsistent use switch to non-SDK compilers while still using other
SDK tools like ranlib and install_name_tool. So simplest, minimal fix seems to
be just adding the missing --sysroot option.

(cherry picked from commit bitcoin/bitcoin@1e94a2b)
Prior to this commit, when int_vars was called for packages, it would
immediately expand the "single-dollar variables", which may be defined
in terms of variables which are not yet determined (e.g. variables
defined in package/*.mk, which are included after int_vars is called).

This is required for the next commit as after that commit, for darwin
cross-builds:

0. int_vars is defined in terms of $(1)_cc
1. $(1)_cc is defined in terms of darwin_CC
2. ... which is defined in terms of clang_resource_dir
3. ... which is defined in terms of native_cctools_clang_version
4. which is undetermined at the time when int_vars is being expanded and evaluated

(cherry picked from commit bitcoin/bitcoin@107f33d)
Zcash: Excludes `FORCE_USE_SYSTEM_CLANG` changes.

(cherry picked from commit bitcoin/bitcoin@3007339)
clang warns when a command line option is unused, and some of our tests
use Werror, so unfortunately we cannot use this flag to pin our linker
for now. Leaving this commit in for future reference, as it would be
great if there's more granularity to Werror and we can be explicit about
what linker we want to use.

(cherry picked from commit bitcoin/bitcoin@77b1ef8)
SC2086 is disabled in our linter script so this wasn't caught.

(cherry picked from commit bitcoin/bitcoin@8033110)
Instead of doing the awkward /bin path prepending at config.site
creation time, set darwin_{CC,CXX} in a way that fully determines the
program's path (clang/clang++) similar to how AC_PATH_{TOOL,PROG} would
do.

Also see the added comment block in depends/Makefile for more context on
determining $PATH for our config.site.

Zcash:
- `default_host_{CC,CXX}` are adjusted to be absolute paths to the
  pinned binaries.
- Excludes `FORCE_USE_SYSTEM_CLANG` changes.

(cherry picked from commit bitcoin/bitcoin@880660a)
See previous commit for description.

Zcash: `default_host_*` are adjusted to be absolute paths to the pinned
binaries.

(cherry picked from commit bitcoin/bitcoin@949c480)
Zcash: Merged into our existing `native_clang` pinning.

(cherry picked from commit bitcoin/bitcoin@765e0be)
@str4d str4d added A-build Area: Build system C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. labels Dec 31, 2023
@str4d str4d added the O-macos Operating system: macOS label Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: Build system C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. O-macos Operating system: macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backport upstream macOS build changes from 2021
8 participants