hearmeneigh / fchat-rising

A heavily modded F-Chat 3.0 client for F-List
https://hearmeneigh.github.io/fchat-rising/
MIT License
41 stars 20 forks source link

Provide an universal dmg for Mac m1 #41

Closed Abeehiltz closed 3 years ago

Abeehiltz commented 3 years ago

Hello,

Now owning a Mac M1 and using F-chat every day, I wanted to know if you could provide an universal dmg for both x64 and arm64 so that people like me owning a Mac m1 could use chat-rising without using Rosetta.

The software works through Rosetta without issues, but when opened for hours every day, it can help battery life and release some ressources that Fchat Rising is holding to be used through Rosetta.

I tried to build one myself, and I went as far as the main window, but it wouldn't load the login and password input.

I was using node v14 (14.18.1) with yarn 1.22.17 to install the project, and then build the electron windows.

Up to that point, I was using Rosetta because node 14 doesn't have a version compatible for arm64. Which means that the yarn start was using Rosetta.

Now, and I know it's possible because on a personal project I did so (though I was not using electron-packager but electron-builder), I tried to build a dmg for arm64.

I went into the pack.js, and in the require for electron-packager I added "arch: 'arm64'" as I saw in the documentation of electron-packager.

A quick yarn run pack and I got a dmg for arm64. After installing it and launching it, I could see in the activity monitor that in fact, it was not using Rosetta2!

However, there was no prompt to input my username and password.

Screen Shot 2021-11-02 at 6 34 02 PM

Another method I tried was to do every step in node v16, which works in arm64. I had to upgrade some dependencies that made the install fail, and I went as far as yarn start for the electron. However, I had an error related to a missing theme in ressources. I didn't screenshot the error unfortunately.

I hope my steps can help you to fix the issue and be able to give us a dmg for Mac m1.

Abeehiltz commented 3 years ago

Update: I managed to build the dmg with node v16! For anyone with a Mac m1 like me, here are the steps I followed.

  1. Clone the project
  2. use node 14
  3. Yarn add node-sass to upgrade it to version 6.0.1 and be able to use it with node 16
  4. go back to node 16
  5. yarn add @vue/devtools@6.0.0-beta.12 unfortunately, there is no stable version of this package that works on arm64 yet. (one of the reason why I haven't made a MR).
  6. (optional I think but better be safe) delete the node modules to be sure nothing stays from the node 14 steps.
  7. yarn install
  8. go into the electron folder and do a yarn build
  9. finish with a yarn run pack, it should automatically build a dmg for arm64 if you're already on a Mac m1
  10. Enjoy! The dmg is in the dist folder.