cross-platform / icloud-for-linux

Access all of your favourite iCloud apps from Linux
https://snapcraft.io/icloud-for-linux
GNU General Public License v3.0
365 stars 54 forks source link

Pull Request: Enable RPM Support #86

Closed afro-systems closed 1 week ago

afro-systems commented 1 month ago

Overview

This pull request introduces RPM support for the icloud-for-linux Client, an application that allows users to access iCloud services on a Linux machine using GTK and WebKit. The changes include:

  1. Main Application Code:

    • Added detailed error handling and logging in main.cpp.
    • Implemented a function to retrieve TLD from environment variables.
  2. Build Configuration:

    • Updated CMakeLists.txt to set the C++ standard to C++17, enable position-independent code, and include necessary libraries for GTK and WebKit.
    • Configured conditional linking for different platforms.
  3. Packaging:

    • Added a .spec file for building RPM packages.
    • Included steps to set up the build environment, compile the project, and package the executable and documentation.
  4. Documentation:

    • Created a README.md file providing an overview of the project, build instructions, usage examples, and contributing guidelines.

Detailed Changes

  1. main.cpp:

    • Added detailed error handling and logging for better debugging.
    • Ensured valid arguments are provided and handled insufficient arguments gracefully.
    • Implemented a function to retrieve TLD from environment variables, with a default fallback.
  2. CMakeLists.txt:

    • Set CMAKE_POSITION_INDEPENDENT_CODE to ON for position-independent code.
    • Set C++ standard to C++17 and enforced its requirement.
    • Configured build to find and link GTK and WebKit libraries on Linux.
    • Configured installation of the built executable to the bin directory.
  3. .spec File:

    • Defined package metadata including name, version, release, summary, and license.
    • Specified source tarball and build dependencies.
    • Included build and runtime requirements for GTK and WebKit libraries.
    • Set up the build environment and compiled the project using CMake.
    • Configured installation of the built executable and necessary documentation.
    • Included a changelog for version tracking and updates.
  4. README.md:

    • Provided an overview of the icloud-for-linux Client project.
    • Listed key features of the application.
    • Included prerequisites and instructions for building from source.
    • Detailed the steps to run the application with examples.
    • Explained how to customize the TLD using environment variables.
    • Provided steps for packaging the application as an RPM.
    • Included contributing guidelines and license information.

How to Test

  1. Build from Source:

    • Follow the instructions in the README.md to install dependencies and build the project from source.
  2. Run the Application:

    • Test the application by running various iCloud services (e.g., mail, contacts, calendar) using the provided examples in the README.md.
  3. Package as RPM:

    • Follow the instructions in the README.md to set up the RPM build environment, prepare the source code, and build the RPM package.
afro-systems commented 1 month ago

Pull Request resolves Issue #85

afro-systems commented 1 month ago

Possibly solves Issue #51

marcusziade commented 4 weeks ago

Is this related to running sudo snap install icloud-for-linux ?

I'm on Bazzitte OS which is Fedora and the iCloud download gives this:


marcus@windows11:~$ sudo dnf install snapd
[sudo] password for marcus: 
Note: This system is image (rpm-ostree) based.
Checking out tree 2b1081f... done
Enabled rpm-md repositories: copr:copr.fedorainfracloud.org:matte-schwartz:sunshine copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager copr:copr.fedorainfracloud.org:rodoma92:rmlint copr:copr.fedorainfracloud.org:rok:cdemu updates fedora rpmfusion-free-updates-testing rpmfusion-free-updates rpmfusion-free 1password updates-archive
Updating metadata for 'updates'... done
Updating metadata for 'updates-archive'... done
Importing rpm-md... done
rpm-md repo 'copr:copr.fedorainfracloud.org:matte-schwartz:sunshine' (cached); generated: 2024-07-16T09:20:36Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager' (cached); generated: 2024-04-20T12:39:00Z solvables: 12
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:rmlint' (cached); generated: 2024-05-10T10:16:28Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rok:cdemu' (cached); generated: 2024-07-09T09:13:21Z solvables: 23
rpm-md repo 'updates'; generated: 2024-07-20T02:21:05Z solvables: 21928
rpm-md repo 'fedora' (cached); generated: 2024-04-14T18:51:11Z solvables: 74881
rpm-md repo 'rpmfusion-free-updates-testing' (cached); generated: 2024-07-19T11:40:41Z solvables: 16
rpm-md repo 'rpmfusion-free-updates' (cached); generated: 2024-07-19T11:38:50Z solvables: 136
rpm-md repo 'rpmfusion-free' (cached); generated: 2024-04-20T12:11:51Z solvables: 422
rpm-md repo '1password' (cached); generated: 2024-06-11T15:37:49Z solvables: 2
rpm-md repo 'updates-archive'; generated: 2024-06-30T05:31:17Z solvables: 22869
Resolving dependencies... done
Installing 19 packages:
  1password-8.10.36-1.x86_64 (@commandline)
  dnf-data-4.21.0-1.fc40.noarch (updates)
  dnf-plugins-core-4.8.0-1.fc40.noarch (updates)
  libcomps-0.1.20-5.fc40.x86_64 (fedora)
  libdnf-0.73.2-1.fc40.x86_64 (updates)
  plasma-discover-snap-6.1.2-1.fc40.x86_64 (updates)
  python3-dnf-4.21.0-1.fc40.noarch (updates)
  python3-dnf-plugins-core-4.8.0-1.fc40.noarch (updates)
  python3-hawkey-0.73.2-1.fc40.x86_64 (updates)
  python3-libcomps-0.1.20-5.fc40.x86_64 (fedora)
  python3-libdnf-0.73.2-1.fc40.x86_64 (updates)
  python3-unbound-1.20.0-1.fc40.x86_64 (updates)
  rpm-plugin-systemd-inhibit-4.19.1.1-1.fc40.x86_64 (fedora)
  snap-confine-2.63-0.fc40.x86_64 (updates)
  snapd-2.63-0.fc40.x86_64 (updates)
  snapd-glib-1.64-1.fc40.x86_64 (fedora)
  snapd-qt-1.64-1.fc40.x86_64 (fedora)
  snapd-selinux-2.63-0.fc40.noarch (updates)
  xdelta-3.1.0-18.fc40.x86_64 (fedora)
Continue? [y/N] y
Checking out tree 2b1081f... done
Enabled rpm-md repositories: copr:copr.fedorainfracloud.org:matte-schwartz:sunshine copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager copr:copr.fedorainfracloud.org:rodoma92:rmlint copr:copr.fedorainfracloud.org:rok:cdemu updates fedora rpmfusion-free-updates-testing rpmfusion-free-updates rpmfusion-free 1password updates-archive
Importing rpm-md... done
rpm-md repo 'copr:copr.fedorainfracloud.org:matte-schwartz:sunshine' (cached); generated: 2024-07-16T09:20:36Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:kde-cdemu-manager' (cached); generated: 2024-04-20T12:39:00Z solvables: 12
rpm-md repo 'copr:copr.fedorainfracloud.org:rodoma92:rmlint' (cached); generated: 2024-05-10T10:16:28Z solvables: 4
rpm-md repo 'copr:copr.fedorainfracloud.org:rok:cdemu' (cached); generated: 2024-07-09T09:13:21Z solvables: 23
rpm-md repo 'updates' (cached); generated: 2024-07-20T02:21:05Z solvables: 21928
rpm-md repo 'fedora' (cached); generated: 2024-04-14T18:51:11Z solvables: 74881
rpm-md repo 'rpmfusion-free-updates-testing' (cached); generated: 2024-07-19T11:40:41Z solvables: 16
rpm-md repo 'rpmfusion-free-updates' (cached); generated: 2024-07-19T11:38:50Z solvables: 136
rpm-md repo 'rpmfusion-free' (cached); generated: 2024-04-20T12:11:51Z solvables: 422
rpm-md repo '1password' (cached); generated: 2024-06-11T15:37:49Z solvables: 2
rpm-md repo 'updates-archive' (cached); generated: 2024-06-30T05:31:17Z solvables: 22869
Resolving dependencies... done
Checking out packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Writing OSTree commit... done
Staging deployment... done
Freed: 433.9 MB (pkgcache branches: 2)
Computing /etc diff to preserve... done
Updating /usr... done
Updating /etc... done
Running systemd-tmpfiles for /run and /var... done
error: Running tmpfiles for /run and /var: Running systemd worker: exit status: 73
marcus@windows11:~$ sudo snap install icloud-for-linux
error: cannot communicate with server: Post "http://localhost/v2/snaps/icloud-for-linux": dial unix /run/snapd.socket: connect: no such file or directory
afro-systems commented 3 weeks ago

@marcusziade I haven't tested this against WSL, you'd have to test it.

Interested in your use case here as well as I see you're on Windows.

marcusziade commented 3 weeks ago

@marcusziade I haven't tested this against WSL, you'd have to test it.

Interested in your use case here as well as I see you're on Windows.

i'm on fedora linux. the machine name was just windows 11 due to a migration. i've renamed it since

afro-systems commented 2 weeks ago

I'd recommend just pulling my branch @marcusziade

afro-systems commented 2 weeks ago

@MarcusTomlinson, hello! From you push history, you appear to be very busy. Just wanted to put this pull request at the top of your inbox. I know you'll get to it when you get to it. I'm just trying to do my due diligence on my end.

Hope to hear from you soon!

MarcusTomlinson commented 1 week ago

Hi @afro-systems, looks good, however, my intention for this project is for it to be a snap only. My suggestion for anyone wanting to re-purpose this for other package managers, is to fork rather. Sorry about that.