Skip to content

Conversation

@fanquake
Copy link
Member

@fanquake fanquake commented Dec 30, 2021

For demonstration, after discussion in #23778, and the question as to why we can't just have a background.tiff that we copy into the macOS DMG, and do away with the somewhat convoluted image generation steps.

From my understanding, the only reason we have this image generation as part of our build system is so that forks of Core can adapt the imagery for their own branding via PACKAGE_NAME. It don't think it provides much value to us, and could just have a static .tiff that we copy into the dmg (replacing the .svg that currently lives in macdeploy/).

Doing this would eliminate the following build dependencies:

For native macOS:

  • sed (usage in Makefile.am)
  • librsvg (rsvg-convert)
  • tiffutil

Linux macOS cross-compile:

  • sed (usage in Makefille.am)
  • librsvg
  • tiffcp
  • convert (imagemagick)
  • font-tuffy

Guix Build:

bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
c98d67796863f4b1bab0ad600d46bd74e744d94072cbd4bc856a6aeaba3bb329  guix-build-e09773d20a92/output/dist-archive/bitcoin-e09773d20a92.tar.gz
3336f90bab312798cb7665e2b4ae24d1a270fb240647d5fed8dbfcd83e3ed37e  guix-build-e09773d20a92/output/x86_64-apple-darwin/SHA256SUMS.part
8fd680c7ee158c64bad212385df7b0b302c6c2143d4e672b4b0eb5da41f9256d  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx-unsigned.dmg
34f54177c2f0700e8cfaf5d85d91e404807cd9d411e22006cdff82653e5f4af2  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx-unsigned.tar.gz
da6b8f54ef755d40330c8eac4f5bd0329637e827be9ee61318600d5d0bdcc3dc  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx64.tar.gz

dmg

@hebasto
Copy link
Member

hebasto commented Dec 30, 2021

Concept ACK.

@prusnak
Copy link
Contributor

prusnak commented Dec 30, 2021

In my take in #23908 I removed the "PACKAGE_NAME" from the SVG completely, since that was the only reason for the whole SVG dance.

Let's do the same thing in this PR since the package name is already shown in the window title and under the icon (see examples below).

See https://github.com/bitcoin/bitcoin/pull/23908/files#diff-ed877ecc59088c3387feeabf1b8bb37da20b3101ea17c8e5d794a7b84f6ebba7 + we could also remove the <style>...</style> at the beginning which only defines the used font.

It is also worth keeping the background.svg in the Git even if it is not used directly.

Before:

Screenshot 2021-12-30 at 15 23 29

After:

Screenshot 2021-12-30 at 15 23 29

It is still quite obvious that Bitcoin Core is about to be installed even without the branding embedded in the background.

Feel free to take the resulting TIFF from https://github.com/prusnak/bitcoin/blob/827a590896acbfd5ef630aaa913e7ca37d1d5f5c/contrib/macdeploy/background.tiff

@hebasto
Copy link
Member

hebasto commented Dec 30, 2021

It is also worth keeping the background.svg in the Git even if it is not used directly.

Agree. And document steps required to convert svg to tiff, that anyone could prove the correctness of the latter.

@prusnak
Copy link
Contributor

prusnak commented Dec 30, 2021

that anyone could prove the correctness of the latter.

Here is the script I used to generate the TIFF from above:

<background.svg rsvg-convert -f png -d 36 -p 36 -o background.png
<background.svg rsvg-convert -f png -d 72 -p 72 -o [email protected]
optipng -o 7 background*.png  # optional
tiffutil -cathidpicheck background.png [email protected] -out background.tiff

@fanquake fanquake marked this pull request as ready for review December 31, 2021 04:00
@fanquake fanquake force-pushed the use_static_background_tiff branch from e22d3ba to 835c308 Compare December 31, 2021 04:00
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23778 (release: Guix 1.4.0 & GCC 10.3 by fanquake)
  • #21851 (build: support cross-compiling for arm64-apple-darwin by fanquake)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@prusnak prusnak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 835c308 (see #23909 (comment)), compiled on Linux Mint 20.2 (x86_64) and on macOS Big Sur 11.6.2 (20G314, Intel).

Guix build:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
f98bd97ae7335ef3fd9fc1fd4f91359d99490cb630930248b844ea933453803c  guix-build-835c308c6a5b/output/dist-archive/bitcoin-835c308c6a5b.tar.gz
0e6e70da98ef7837f611dadbd08ab21b2c054f2442a19d1de30ad0835e5c393c  guix-build-835c308c6a5b/output/x86_64-apple-darwin/SHA256SUMS.part
8d36535b0c14144d860246271ccf6457dc7f5323d63a3393c2ac44d707c16add  guix-build-835c308c6a5b/output/x86_64-apple-darwin/bitcoin-835c308c6a5b-osx-unsigned.dmg
abbc4f6567758dd8ccf2f83da64e386ad392bd7d5c9b61453cde3bde1085d8c0  guix-build-835c308c6a5b/output/x86_64-apple-darwin/bitcoin-835c308c6a5b-osx-unsigned.tar.gz
16e01a91d184455bee35f23d0a3b177328135beb9d5853669f64ac3f24e80f0c  guix-build-835c308c6a5b/output/x86_64-apple-darwin/bitcoin-835c308c6a5b-osx64.tar.gz

Installing bitcoin-835c308c6a5b-osx-unsigned.dmg on macOS Big Sur 11.6.2 (20G314, Intel):
Screenshot from 2021-12-31 17-15-36

Copy link
Contributor

@Zero-1729 Zero-1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 835c308

Compiled and tested on macOS v12.1 (21C52, M1)

Screenshot 2021-12-31 at 17 42 23

@maflcko
Copy link
Member

maflcko commented Dec 31, 2021

Is there a reason to add a 30KB file to the repo? If yes, it would be good to explain why and how you generated it.

Locally I am getting 9KB (zip) or 22KB (lzw)

Commands:

tiffcp -c lzw:2 /tmp/pngs/background{,2x}.tiff /tmp/pngs/background.lzw2.tiff
tiffcp -c zip:p9 /tmp/pngs/background{,2x}.tiff /tmp/pngs/background.zip3p9.tiff

Concept ACK 835c308 🦌

Show signature

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Concept ACK 835c308c6a5b76f07d4e197ef01a4a16edc5e723  🦌
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhnbgv/Zbdg7Xzc8xVd7rZlgYaNx6YfMw1OVAhOr8ybZ1WSrN8vuXmgf+IhtI28
x/LosKocFciBnpfz5M8U94FMSL0ck2fOSUDdOMEctop5qmSkc2GVFzkvRwkKhMZq
d7fBFmYBcBL5G42liFxZBjIM1N/0ywZzEA5fHpvelCAMCm2uGAxigpy9zXlIaeQi
DnHth+dfM7lsqRIQIcQGFVIbkzocVU6bpobgHKI7EHjtM9c4qY+QRdrtzNNxABwd
ROyBFWTQInSTLRGWRYXxiXfbDL4tRP49ciu1VK8CzyWNKWvhVF6fa8J72ZDRT7pM
XKRq+o27HGAmrxM1NKW6d2JQDWj6KClVdV8gJJG50fr/5P+xTtqFgCTOap2GHMi/
Hlh9em0MAs6M5/X/MHLotny9lB9Savz40KuZZC7G2G7Isq+mVjDeg2yYAC4TFGdi
H0CNkpUdXyPacIFbMsq6d2OaWDv0ZvU/GiVsroXJEQEP2p0WQlKJYszgaAheSvhF
rQFMLbix
=vah4
-----END PGP SIGNATURE-----

@fanquake fanquake force-pushed the use_static_background_tiff branch from 835c308 to 5b1fd09 Compare January 1, 2022 09:28
@fanquake
Copy link
Member Author

fanquake commented Jan 1, 2022

it would be good to explain why and how you generated it.

It came from this branch: https://github.com/prusnak/bitcoin/blob/827a590896acbfd5ef630aaa913e7ca37d1d5f5c/contrib/macdeploy/background.tiff, so I'd assume these were the instructions. I've regenerated it now, and it's about half the size (18KB).

I've also removed the .svg. It doesn't need to remain in the tree, and if anyone wants it they can retrieve it from git (along with the conversion instructions in the makefile).

Added screenshot to PR description, and added @prusnak as co-author given he also opened a PR.

@hebasto
Copy link
Member

hebasto commented Jan 2, 2022

It seems no background in Guix's bitcoin-*-osx-unsigned.dmg.

@fanquake fanquake force-pushed the use_static_background_tiff branch from 5b1fd09 to 692b38d Compare January 2, 2022 06:38
@fanquake
Copy link
Member Author

fanquake commented Jan 2, 2022

It seems no background in Guix's bitcoin-*-osx-unsigned.dmg.

Should be fixed now.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK 692b38d

Guix build:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 ls -l
-rw-r--r-- 1 hebasto hebasto 10760618 Jan  2 09:03 guix-build-692b38d2c47e/output/dist-archive/bitcoin-692b38d2c47e.tar.gz
-rw-r--r-- 1 hebasto hebasto 35000686 Jan  2 09:10 guix-build-692b38d2c47e/output/x86_64-apple-darwin/bitcoin-692b38d2c47e-osx64.tar.gz
-rw-r--r-- 1 hebasto hebasto 16053436 Jan  2 09:09 guix-build-692b38d2c47e/output/x86_64-apple-darwin/bitcoin-692b38d2c47e-osx-unsigned.dmg
-rw-r--r-- 1 hebasto hebasto 16396639 Jan  2 09:09 guix-build-692b38d2c47e/output/x86_64-apple-darwin/bitcoin-692b38d2c47e-osx-unsigned.tar.gz
-rw-r--r-- 1 hebasto hebasto      478 Jan  2 09:10 guix-build-692b38d2c47e/output/x86_64-apple-darwin/SHA256SUMS.part

Running bitcoin-692b38d2c47e-osx-unsigned.dmg:

Screenshot from 2022-01-02 09-12-44

@hebasto
Copy link
Member

hebasto commented Jan 2, 2022

CI failure seems related to building out of source tree.

@hebasto
Copy link
Member

hebasto commented Jan 2, 2022

Maybe

--- a/configure.ac
+++ b/configure.ac
@@ -1861,6 +1861,7 @@ AC_CONFIG_LINKS([contrib/devtools/symbol-check.py:contrib/devtools/symbol-check.
 AC_CONFIG_LINKS([contrib/devtools/test-security-check.py:contrib/devtools/test-security-check.py])
 AC_CONFIG_LINKS([contrib/devtools/test-symbol-check.py:contrib/devtools/test-symbol-check.py])
 AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
+AC_CONFIG_LINKS([contrib/macdeploy/background.tiff:contrib/macdeploy/background.tiff])
 AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
 AC_CONFIG_LINKS([test/fuzz/test_runner.py:test/fuzz/test_runner.py])
 AC_CONFIG_LINKS([test/util/test_runner.py:test/util/test_runner.py])

?

(did not test though)

@fanquake fanquake force-pushed the use_static_background_tiff branch from 692b38d to e09773d Compare January 2, 2022 07:38
@luke-jr
Copy link
Member

luke-jr commented Jan 2, 2022

Concept NACK. There's no benefit to this; it only serves to sabotage derivative projects.

As mentioned in #23778, there's a straightforward solution to avoid the Rust dependency by simply not using the Rust-based librsvg...

@hebasto
Copy link
Member

hebasto commented Jan 2, 2022

@luke-jr

it only serves to sabotage derivative projects.

This statement is not true. See OP:

Doing this would eliminate the following build dependencies...

@luke-jr
Copy link
Member

luke-jr commented Jan 2, 2022

Not really. You still need those to actually build it. Now you're just injecting a pre-compiled TIFF into Guix, essentially reverting it back to where things were with gitian (except now the trusted "compiler" isn't necessarily even reproducible).

And these aren't even deps for an actual end-user build, only for producing the release artefacts.

@jnewbery
Copy link
Contributor

jnewbery commented Jan 2, 2022

Concept ACK

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e09773d

@hebasto
Copy link
Member

hebasto commented Jan 2, 2022

Reviewers could be interested in historical context: #7192.

@prusnak
Copy link
Contributor

prusnak commented Jan 2, 2022

There's no benefit to this; it only serves to sabotage derivative projects.

This PR makes it actually easier for derivative projects because they do not need to fiddle with the installer background anymore.

@luke-jr
Copy link
Member

luke-jr commented Jan 2, 2022

This PR makes it actually easier for derivative projects because they do not need to fiddle with the installer background anymore.

They didn't have to before...

@fanquake
Copy link
Member Author

fanquake commented Jan 3, 2022

Concept NACK. There's no benefit to this;

I wouldn't have opened a PR if there was no benefit to doing this. As others have mentioned, and as I laid out in the PR description, the benefit is a reduction in the number of dependencies you need to build Bitcoin Core for macOS. In general, if it's possible to simplify a build process with no, or near zero downside (which I certainly think is the case here), then I think it's something we should be doing.

it only serves to sabotage derivative projects.

Not even sure how to respond to this, but I really think you need to get some perspective. What's changing here is outlined in the image below. Remembering that this is a view that's only shown during the install procedure, for a single host, and likely, at most, for the few seconds it takes for a user to drag the app icon over to the folder. Note that the project name is still shown in two other places, so it's not like this is removing the only branding / naming that was present in the DMG. How exactly is anything being sabotaged by this few second view only containing 2 instances of the project name, rather than 3?

both

Not really. You still need those to actually build it.

No, you don't. Once the .tiff exists in .git, no one has to build it ever again, and thus doesn't need to have those tools present in their build envinronment. That's basically the point of this PR.

Now you're just injecting a pre-compiled TIFF into Guix, essentially reverting it back to where things were with gitian

Comparing the copying of a .tiff into our Guix environment, as the equivalent of reverting back to gitian is absurd.

@luke-jr
Copy link
Member

luke-jr commented Jan 3, 2022

the benefit is a reduction in the number of dependencies you need to build Bitcoin Core for macOS

You don't need the tiff to build Core (only to package it, which is a special case where deps matter quite a bit less).

How exactly is anything being sabotaged by this few second view only containing 2 instances of the project name, rather than 3?

The description in the PR said the image was added unmodified. Having seen the actual tiff, I see the change, and agree it is less problematic than I originally understood it to be. (However, I still think this isn't a good approach)

Comparing the copying of a .tiff into our Guix environment, as the equivalent of reverting back to gitian is absurd.

It's like adding a compiled bitcoind binary to git and saying that means we don't need GCC/LLVM anymore.

@fanquake
Copy link
Member Author

fanquake commented Jan 3, 2022

(only to package it, which is a special case where deps matter quite a bit less).

I agree it's a special case, but not in the way you're seemingly dismissing it. The makeup of our Guix build (release packaging) environment is our most important build environment, thus a very special case. I completely disagree with the notion that "deps matter quite a bit less" there, in fact, I think the opposite is true. In that environment, every additional dependency (and the dependencies of those dependencies) increases the scope for potential compromise, and/or tool/supply chain related attacks and are just more things we have to potentially maintain / vet / install. So I think any change that reduces the build requirements for that environment, is a good one. In this case, we can drop imagemagick, libtiff, librsvg and font-tuffy when performing the macOS cross-compile.

The description in the PR said the image was added unmodified.

Apologies, I'll update the PR description to reflect the current change. However, there were at least 4 screenshots, showing the new DMG view, posted in this thread before you made your comments.

Copy link
Contributor

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e09773d

Clear benefit in this change.

Guix hashes:

find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
c98d67796863f4b1bab0ad600d46bd74e744d94072cbd4bc856a6aeaba3bb329  guix-build-e09773d20a92/output/dist-archive/bitcoin-e09773d20a92.tar.gz
3336f90bab312798cb7665e2b4ae24d1a270fb240647d5fed8dbfcd83e3ed37e  guix-build-e09773d20a92/output/x86_64-apple-darwin/SHA256SUMS.part
8fd680c7ee158c64bad212385df7b0b302c6c2143d4e672b4b0eb5da41f9256d  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx-unsigned.dmg
34f54177c2f0700e8cfaf5d85d91e404807cd9d411e22006cdff82653e5f4af2  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx-unsigned.tar.gz
da6b8f54ef755d40330c8eac4f5bd0329637e827be9ee61318600d5d0bdcc3dc  guix-build-e09773d20a92/output/x86_64-apple-darwin/bitcoin-e09773d20a92-osx64.tar.gz

Copy link
Contributor

@Zero-1729 Zero-1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e09773d

Agree, besides the more minimalist look, having fewer deps would help reduce the potential attack surface.

@fanquake fanquake merged commit 3e5dd94 into bitcoin:master Jan 5, 2022
@fanquake fanquake deleted the use_static_background_tiff branch January 5, 2022 02:34
@theuni
Copy link
Member

theuni commented Jan 5, 2022

Post-merge ACK e09773d. Much better than requiring rust, and a nice simplification.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 6, 2022
@gruve-p
Copy link
Contributor

gruve-p commented Jan 7, 2022

Post-merge ACK e09773d

@noahpollocktech
Copy link

I concur

@bitcoin bitcoin locked and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.