Page MenuHomePhabricator

[CMAKE] Build a stripped version of the application bundle and use it
AbandonedPublic

Authored by Fabien on Nov 7 2019, 15:12.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

This adds a variant target to build a stripped application bundle. This
stripped version will be used for building the DMG image.
This is necessary because the macdeployqt tools will strip everything
but the input application.

Depends on D4384.

Test Plan
ninja BitcoinABC-Qt
ls -l src/qt/BitcoinABC-Qt.app/Contents/MacOS/BitcoinABC-Qt

Note the size of the binary.

ninja BitcoinABC-Qt-strip
ls -l src/qt/BitcoinABC-Qt.app/Contents/MacOS/BitcoinABC-Qt

Check the binary size decreased.

ninja osx-dmg # Sanity check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_osx_strip_dist_and_dmg
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8023
Build 14043: Bitcoin ABC Buildbot (legacy)
Build 14042: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Nov 10 2019, 13:05
deadalnix added inline comments.
src/qt/CMakeLists.txt
342

Considering this is something that is OSX specific, the names chosen are very confusing. It seems that this an OSX duplication of the bitcoin-qt target. You need to fix this before proceeding.

This revision now requires changes to proceed.Nov 10 2019, 13:05
src/qt/CMakeLists.txt
342

This doesn't looks like the original command. Can you explain what's up?

It looks like it is modifying the file in place, which is usually a bad idea for dependency management reasons.

Fabien requested review of this revision.Nov 10 2019, 15:42
Fabien added inline comments.
src/qt/CMakeLists.txt
342

I should have put a comment regarding the name: this is for compatibility with what autotools produce (and what the content from the metadata file expects). This does not apply to the stripped target though, but it keeps the name consistent with the non stripped target.

The strip parameters are specific to the OSX strip tool, which differ from the gnu strip. Unfortunately I have been unable to find a man page online, I had to run the man from an OSX machine. The parameters are the same that recent CMake versions use for executables, you can find some infos here: https://gitlab.kitware.com/cmake/cmake/merge_requests/2892.

Yes it is modifying the file in place and is then exclusive with the non stripped version.
The same principle applies when installing the files with CMake, you can have the binaries stripped or not, but not both at a time.
The only dependencies are the files for building an installer, which will always require a stripped binary. I could have copied the bundle structure and stripped the duplicated binary to avoid this, but I don't see a use case for having both. Let me know if you think this is an issue, and I'll update.

Fabien planned changes to this revision.Nov 11 2019, 09:33

I have another solution which can be more elegant to this problem, so moving this diff out of the review queue for now.