Page MenuHomePhabricator

[CMAKE] Strip the osx bundle binary
AbandonedPublic

Authored by Fabien on Nov 11 2019, 12:11.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

This diff adds a post build step to the OSX application bundle
construction to strip the binary.
The bitcoin-qt executable is still available for debugging if needed.

Depends on D4384.
Alternative to D4406.

Test Plan

On OSX (or cross build):

ninja

Compare the size of the binaries src/qt/bitcoin-qt and
src/qt/BitcoinABC-Qt.app/Contents/MacOS/BitcoinABC-Qt (the later
should be stripped).

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_osx_strip_bundle
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8058
Build 14111: Bitcoin ABC Buildbot (legacy)
Build 14110: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Nov 12 2019, 13:57
deadalnix added inline comments.
src/qt/CMakeLists.txt
314

Why do we need a bitcoin-qt target and this? This is a bit strange, because on every target, ninja bitcoin-qt will build bitcoin-qt, but on OSX, it will actually build a broken version of bitcoin-qt and I need to do ninja bitcoinABC-Qt to actually get the real deal. I think it is better to fix this rather than pile more on top of it.

350

I find this a bit disappointing, as it prevent dependency tracking. If the command doesn't allow for it, maybe simpl copying the file and then running it in place could do the trick.

This revision now requires changes to proceed.Nov 12 2019, 13:57
Fabien requested review of this revision.Nov 12 2019, 14:21
Fabien added inline comments.
src/qt/CMakeLists.txt
314

I see them as 2 different things. The bitcoin-qt target is still a valid target (and is not broken) on OSX and builds the bitcoin-qt executable the same way that it is done on Linux.
The application bundle is more like an AppImage. It contains an executable and a few metadata files to provide context such as version number, the minimum platform or an icon. It's purpose it to integrate nicely with the OSX system which recognizes it as an application.

350

My understanding is that this signature of add_custom_command doesn't break the dependency tracking.
The extra post-build command becomes part of the target itself, is run when the target is built is do not repeat if the target is already built.

src/qt/CMakeLists.txt
314

It is a second executable that contains the exact same code, but in addition contains various OSX metadata. If we are on OSX, then that should be bitcoin-qt. Just likeon Windows, bitcoin-qt is enriched with some windows specific metadata.

Fabien planned changes to this revision.Nov 12 2019, 16:27

OK let's do this.
We are shipping both the executable alone and as a bundle as part of our releases, so it will require a copy which can be done when running the gitian build.