btpf / Alexandria

A minimalistic cross-platform eBook reader built with Tauri, Epub.js, and Typescript
GNU General Public License v3.0
2.15k stars 50 forks source link

MacOS Support #18

Closed liiyee closed 8 months ago

benjstarratt commented 11 months ago

I too would love this. If you do decide to implement it, I can help test on multiple platforms (iPhone, iPad, Mac, etc).

btpf commented 11 months ago

Hi,

I would like to support MacOS, but I don't have an Apple computer and my attempts emulating MacOS have failed. So unless I decide to purchase hardware, I will need some assistance.

TLDR: I need help compiling libmobi as a static library on macOS. After this one obstacle, support seems trivial.

Alexandria depends on libmobi for azw3 support. I modified libmobi to provide a single function, convertToEpub, in the form of a static library. This static library links with libmobi-rs as a lightweight wrapper to use this c library. Compiling the static library once can often be enough , and I may not have to compile it again. See: https://github.com/btpf/libmobi-rs/blob/003ffafcc46939656ea8831093df230ef1b4ff6c/libmobi-rs/build.rs#L11 https://github.com/btpf/Alexandria/blob/main/docs/Build%20Instructions.md#1-build-libmobi-sometimes-not-required

Something standing in the way of getting assistance is trust. If someone compiles the library for the project, I need a way to verify that the compiled library was not tampered with. I do not want to trust a binary blindly and redistribute. Maybe contributing a github action is a good solution? If you are up for the task, Taking a look at how compilation is performed on linux would be a good place to start. https://github.com/btpf/libmobi-rs/blob/003ffafcc46939656ea8831093df230ef1b4ff6c/build.sh

Thanks

benjstarratt commented 11 months ago

Hi. Thanks for the reply. I understand your reluctance on the compiled library! I am going to try to build the project from scratch on my Mac. I’ll provide any feedback that I find on the build instructions in my environment. If I succeed maybe I could just fork your project and post the Mac/iOS artifacts until a better solution arises. I don’t really know what I am doing, but I am fine with that!

sgopalan98 commented 9 months ago

Hi, @btpf , do you still need help with this? I was able to compile the library on MacOS. Would you want me to create a Github action to replicate the build process?

btpf commented 9 months ago

Hi, @btpf , do you still need help with this? I was able to compile the library on MacOS. Would you want me to create a Github action to replicate the build process?

This is great to hear! A Github action for libmobi would be amazing.

Have you tried building Alexandria or testing with libmobi-rs to ensure it's working correctly? https://github.com/btpf/libmobi-rs/tree/main/libmobi-rs

You would need to place the built library inside of libmobi-rs/libs/macos and then run the project with cargo test -- --nocapture.

If that works, then submit a PR to that repo with just the Github action.

Add mac-os to this line and submit a PR https://github.com/btpf/Alexandria/blob/main/.github/workflows/build-action.yml#L13 that way your profile will get show under contributors for the main repo.

Thanks!

sgopalan98 commented 8 months ago

I have created a PR to solve this in your libmobi repo. Once we merge that, I can create a PR here to add MacOS to the GitHub actions here.

sgopalan98 commented 8 months ago

I have created a draft PR for MacOS build with some comments. Please let me know how we want to proceed.

Thanks! :)