keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.07k stars 1.46k forks source link

Support building on and packaging for M1 macs #8592

Open vraravam opened 2 years ago

vraravam commented 2 years ago

Summary

I noticed that the build process and documentation do not support M1 macs. For eg, the documentation has /usr/local hardcoded. For M1 macs, the homebrew location has changed to /opt/homebrew. Also, when I run the publicly released app, it shows up as being created/packaged for the x64 architecture which can take up a lot of battery when running on M1

Examples

Context

Battery longevity

vraravam commented 2 years ago

I followed the instructions on the [installation](https://github.com/keepassxreboot/keepassxc/blob/develop/INSTALL.md] page. I used the following command line to build:

cmake -DCMAKE_PREFIX_PATH=`brew --prefix qt5`/lib/cmake -DCMAKE_INSTALL_PREFIX=`brew --prefix` -DCMAKE_VERBOSE_MAKEFILE=ON ..

This is after I searched and replaced /usr/local with /opt/homebrew (in a couple of places, I could delegate to embedded brew --prefix so as to be arch-agnostic). The src/KeePassXC.app that was generated did not startup.

phoerious commented 2 years ago

We already build for M1, you just have to download the correct package. As for the paths, I think I set them as environment variables or made symlinks, but I will have to check.

vraravam commented 2 years ago

thanks for responding @phoerious - but, i dont see the relevant changes in the latest codebase (default branch develop) since, as I mentioned, there are quite a few hardcoded items that wouldn't work on ARM M1s. A good example of this is the hardcoded /usr/local

phoerious commented 2 years ago

There are no changes, but we are building on and for M1 Macs with the codebase we have. As I said, I am either overriding paths with environment variables or I added symlinks at some point. I don't have access to my M1 machine right now and will have to check that later.

vraravam commented 2 years ago

There are no changes, but we are building on and for M1 Macs with the codebase we have. As I said, I am either overriding paths with environment variables or I added symlinks at some point. I don't have access to my M1 machine right now and will have to check that later.

It would be good to document these for new contributors. I have made some changes in the #8593 PR - please review and approve.

droidmonkey commented 2 years ago

By definition documentation is not "hardcoded"

vraravam commented 2 years ago

@droidmonkey - i dont want to debate whether documentation should be hardcoded or not. All I was aiming with #8593 is for the scripts to become more versatile based on the architecture being run in.