DevilXD / TwitchDropsMiner

An app that allows you to AFK mine timed Twitch drops, with automatic drop claiming and channel switching.
MIT License
1.73k stars 170 forks source link

Better linux build support #617

Open biast12 opened 1 week ago

biast12 commented 1 week ago

Improves the bat files Added bash/.sh files so linux can easily create the env and build too Added support for building with other architectures too

biast12 commented 1 week ago

This wiki page might also need to be updated to include the .sh files, but i don't think i'm able to update that https://github.com/DevilXD/TwitchDropsMiner/wiki/Setting-up-the-environment,-building-and-running

biast12 commented 1 week ago

and done xD

DevilXD commented 1 week ago

Hello. I've been more or less absent for the past week or so. I've read the discussion, and I can of course merge this one in.

I saw Wiki instructions being mentioned though. Is there something that needs to be changed/added there? The building instructions only really cover Windows support, and I agree that Linux building should also be covered there.

biast12 commented 1 week ago

Mostly only the packages that needs to be installed and mention that they can run the .sh files if they're on linux

@guihkx anything missing? i don't think there's more than that tbh

guihkx commented 1 week ago

I don't think anything else is missing. I've added Linux-specific instructions to the "Setting up the environment, building and running" page in this diff (feel free to use/modify it to your liking):

diff --git a/Setting-up-the-environment,-building-and-running.md b/Setting-up-the-environment,-building-and-running.md
index dd4e586..ce9409b 100644
--- a/Setting-up-the-environment,-building-and-running.md
+++ b/Setting-up-the-environment,-building-and-running.md
@@ -1,28 +1,64 @@
 # Prerequisites

-In order to setup the development environment for the application, you'll need to install both Python and Git. Here are two guides which will help you through the process:
+In order to setup the development environment for the application, you'll need to install both Python and Git.
+
+## Windows
+
+Here are two guides which will help you through the process:

 - [Git Installation](https://github.com/DevilXD/TwitchDropsMiner/wiki/Git-Installation)
 - [Python Installation](https://github.com/DevilXD/TwitchDropsMiner/wiki/Python-Installation)

 Continuing past this point, you should have both of them installed with the configuration and steps explained in each guide, and your computer should be restarted (see the "Final note" section in either of the two guides above for details). 

+## Linux
+
+This guide assumes you're on a modern version of a Ubuntu-based Linux distribution. If you're on a different distro, the name of packages used below will likely be different, and you will need to adapt them yourself.
+
+You'll need to install Git (`git`), Python 3 with Tkinter support (`python3-tk`), Python's package installer (`python3-pip`) and Python's virtual environment module (`python3-venv`).
+
+For system tray support, you'll also need Ayatana's AppIndicator (`libayatana-appindicator3-1`), GObject introspection files for Ayatana's AppIndicator (`gir1.2-ayatanaappindicator3-0.1`), Python 3 development headers (`python3-dev`), Cairo 2D development headers (`libcairo2-dev`), Pycairo development headers (`python3-cairo-dev`), GObject introspection data development headers (`libgirepository1.0-dev`), pkgconf (`pkg-config`) and a C compiler (`gcc`).
+
+In one `apt install` command:
+
+```sh
+sudo apt install git python3-tk python3-pip python3-venv libayatana-appindicator3-1 gir1.2-ayatanaappindicator3-0.1 python3-dev libcairo2-dev python3-cairo-dev libgirepository1.0-dev pkg-config gcc
+```
+
 # Setup the environment

 To setup the runtime environment for the application, first, download the source code. If you're using `git`, you can `git clone https://github.com/DevilXD/TwitchDropsMiner` the project into a folder of choice. Otherwise, you can download the source code from the main project's page by using the button shown below, and then unzip it into a folder of choice.

 ![code-download](https://user-images.githubusercontent.com/4180725/206105115-5d94e594-9a79-4fda-b6b6-5ed487985208.png)

+## Windows
+
 Once you have the source code, run `setup_env.bat`. This will create an `env` folder next to the source code files, and install all required Python packages inside it. Watch out for permission errors, you may need to run it as Administrator.

+## Linux
+
+Once you have the source code, open a terminal window and use the `cd` command to navigate to the location of the source code. After that, run `./setup_env.sh`. This will create an `env` folder next to the source code files, and install all required Python packages inside it.
+
 # Running from source

+## Windows
+
 Run `run_dev.bat` to start the development build from source code. Starting without a console is perfectly fine, but you may want to start with a console if you'd expect errors to be printed out.

+## Linux
+
+First, run `source ./env/bin/activate` to activate the Python virtual environment. Then, run `python3 main.py` to start the application.
+
 # Building an executable

+## Windows
+
 If you'd want to build an executable, run `build.bat` - this will create a `dist` folder with the resulting executable inside. PyInstaller will be automatically installed into the environment (`env` folder) on the first build attempt, and thus might require running it as Administrator. Subsequent builds should complete just fine with normal permissions.

+## Linux
+
+If you'd want to build an executable, run `./build.sh` - this will create a `dist` folder with the resulting executable inside. PyInstaller will be automatically installed into the environment (`env` folder) on the first build attempt.
+
 # Manual instructions

 If you're one of those people who doesn't trust pre-made scripts, or you're interested in doing something those scripts haven't foreseen, here's some quick instructions which can get you up and running. Note that all commands assume you have Python and Git installed - if not, check out the prerequisites section at the top. Also, it's assumed you'll start your command prompt in the source code's directory, setting it as the current working directory.
guihkx commented 1 week ago

I just noticed setup_env.sh and build.sh don't have execute permissions.

@biast12 Can you please do that?

biast12 commented 1 week ago

I can change it but it for some reason won't allow me to commit it :/

guihkx commented 1 week ago

That's odd... Do you get an error or something?

biast12 commented 1 week ago

Nope, it just doesn't change anything binary wise about the files so github can't see any difference, i just tried to force it but to no avail

(gonna rebase it again 2 sec)

guihkx commented 1 week ago

If you want, feel free to add me as a collaborator to your TwitchDropsMiner fork (so I'm given commit access), and I can try to fix it for you.

But if you think that's too much work or not worth it, I can do it later in a future PR. And you can remove your last empty commit as well.

biast12 commented 1 week ago

I just added you, pretty sure that's the best and easiest route for us all xD

guihkx commented 1 week ago

Should be good now. I've removed myself as a collaborator too. :p