Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Linux Support #294

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Feature: Linux Support #294

wants to merge 10 commits into from

Conversation

Rucadi
Copy link
Contributor

@Rucadi Rucadi commented Nov 5, 2023

I think that supporting Linux should be straight-forward, but I Don't know if you have any reason not to support it.
Probably an AppImage could be created for convenience.

In order to test the Linux version, I created this Dockerfile:

FROM fischerscode/flutter
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y ninja-build clang pkg-config libunwind-dev libgtk-3-dev libwebkit2gtk-4.0-dev libssl-dev libsecret-1-dev xpra

USER flutter
RUN git clone --depth=1 -b linux https://github.com/Rucadi/FEhViewer
WORKDIR  /home/flutter/FEhViewer
RUN mv lib/config/config.dart.sample lib/config/config.dart
RUN flutter build linux --release

CMD xpra start :100 --bind-tcp=0.0.0.0:8888 --daemon=no --start-child=/home/flutter/FEhViewer/build/linux/x64/release/bundle/fehviewer --start-new-commands=no --exit-with-children  --quality=100 \
  --encodings=vp9 \
  --min-quality=100

That can be used via:

docker build . -t fapp
docker run -p 8888:8888 --rm fapp

Which exposes a page at localhost:8888 with the application running.

(Check the bottom right for the window, it likes to hide a little)

@honjow honjow requested review from honjow and 3003h and removed request for honjow November 5, 2023 09:22
@3003h
Copy link
Owner

3003h commented Nov 5, 2023

Thank you very much, could you consider adding support in GitHub Action build scripts as well?

@3003h
Copy link
Owner

3003h commented Nov 5, 2023

I created a test branch, added the build script for linux, and it doesn't seem to be too much of a problem.
https://github.com/3003h/FEhViewer/actions/runs/6761406406
You can test if Artifacts works
But there seems to be some work to be done to build it as an AppImage!

@Rucadi
Copy link
Contributor Author

Rucadi commented Nov 5, 2023

I created a test branch, added the build script for linux, and it doesn't seem to be too much of a problem. https://github.com/3003h/FEhViewer/actions/runs/6761406406 You can test if Artifacts works But there seems to be some work to be done to build it as an AppImage!

That was fast!
I was just working also on it hahaha

I was in the appimage generation part, for the moment I had something like this (WIP, probably will not work yet, missing icon and desktop)

` - name: Install appimagetool
run: wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage && chmod +x appimagetool-x86_64.AppImage

  - name: Generate AppImage
    run: |
      mkdir FEhViewer.AppDir
      cp -r build/linux/x64/release/bundle/ FEhViewer.AppDir
      echo '
            #!/bin/sh
            cd "\$(dirname "\$0")"
            exec ./fehviewer
            '> FEhViewer.AppDir/AppRun
       chmod a+x FEhViewer.AppDir/AppRun
      ./appimagetool-x86_64.AppImage FEhViewer.AppDir

`

I have no experience with gitlab ci actions, I Was using "act" to build the job, are you just letting github build it or do you have some kind of setup to do it locally?

@Rucadi
Copy link
Contributor Author

Rucadi commented Nov 5, 2023

I created an script called build_appimage.sh in my branch, it generates an AppImage, (but first you have to compile with release).

I have this appimage generated on my branches, and now the fork at Rucadi:linux has the latest changes done:
https://github.com/Rucadi/FEhViewer/suites/17922301180/artifacts/1029748318

I don't know if it will work as-is or if more things need to be taken into account.
The icon is just a placeholder.

Confirmed woring on https://www.onworks.net/ where I created a VM, downloaded the appimage and it just worked.

@Rucadi
Copy link
Contributor Author

Rucadi commented Nov 8, 2023

The PoC is done wit this, try to take a look when you have time at the branch, and propose an adaptation (or adapt) the scripts freely :)

@Rucadi
Copy link
Contributor Author

Rucadi commented Nov 10, 2023

I created a NIX Package so it can be installed on nixos or other distros with nixpkgs installed,
for the moment it is here:
https://github.com/Rucadi/nixpkgs-fehviewer

The implementation can be seen here:

{ lib
, flutter
, fetchFromGitHub
, makeDesktopItem
, pkg-config
}:

flutter.buildFlutterApplication rec {
  pname = "fehviwer";
  version = "testing_linux";

  #pubspecLockFile = ./pubspec.lock;
  depsListFile = ./deps.json;
  vendorHash = "sha256-QqR1isHtQqGDhxkzuy5hm7Vem9iI1qBfK5GZLt/h03U=";

  src = fetchFromGitHub {
    owner = "Rucadi";
    repo = "FEhViewer";
    rev = "master";
    hash = "sha256-Sx7JkzgH/8NRpG5h/5aeqsZa4Jqd3M7vy4rlAQ+xHVA=";
  };

  prePatch = ''
    mv lib/config/config.dart.sample lib/config/config.dart 
  '';

  postInstall = ''
    rm -rf $out/bin/*
    makeWrapper $out/app/fehviewer $out/bin/fehviewer  \
            --prefix LD_LIBRARY_PATH : $out/app/lib
  '';


desktopItem = makeDesktopItem {
    name = "FEhViewer";
    exec = "@out@/bin/fehviewer";
    #icon = "fehviewer";
    desktopName = "FEhViewer";
    genericName = "View E-Hentai and ExHentai libraries!";
    categories = [ "Adult" "Viewer" "Art" ];
  };

  meta = with lib; {
    description = "View E-Hentai and ExHentai libraries!";
    homepage = "https://github.com/3003h/FEhViewer";
    license =  "Apache 2.0";
    maintainers = with maintainers; [  ];
    platforms = platforms.linux;
  };
}

Once this is mainstream, is it fine by you if I create a MR to nixpkgs to include it on their repositories?
Probably this also compiles on ARM64 by default for linux.

That would mean that it can be installed in nixos/any linux with nix as easy as doing:

nix-shell -p fehviewer

However, I Don't know if your analytics can be integrated there.

Demo:
image

@3003h
Copy link
Owner

3003h commented Nov 11, 2023

I created a NIX Package so it can be installed on nixos or other distros with nixpkgs installed, for the moment it is here: https://github.com/Rucadi/nixpkgs-fehviewer

The implementation can be seen here:

{ lib
, flutter
, fetchFromGitHub
, makeDesktopItem
, pkg-config
}:

flutter.buildFlutterApplication rec {
  pname = "fehviwer";
  version = "testing_linux";

  #pubspecLockFile = ./pubspec.lock;
  depsListFile = ./deps.json;
  vendorHash = "sha256-QqR1isHtQqGDhxkzuy5hm7Vem9iI1qBfK5GZLt/h03U=";

  src = fetchFromGitHub {
    owner = "Rucadi";
    repo = "FEhViewer";
    rev = "master";
    hash = "sha256-Sx7JkzgH/8NRpG5h/5aeqsZa4Jqd3M7vy4rlAQ+xHVA=";
  };

  prePatch = ''
    mv lib/config/config.dart.sample lib/config/config.dart 
  '';

  postInstall = ''
    rm -rf $out/bin/*
    makeWrapper $out/app/fehviewer $out/bin/fehviewer  \
            --prefix LD_LIBRARY_PATH : $out/app/lib
  '';


desktopItem = makeDesktopItem {
    name = "FEhViewer";
    exec = "@out@/bin/fehviewer";
    #icon = "fehviewer";
    desktopName = "FEhViewer";
    genericName = "View E-Hentai and ExHentai libraries!";
    categories = [ "Adult" "Viewer" "Art" ];
  };

  meta = with lib; {
    description = "View E-Hentai and ExHentai libraries!";
    homepage = "https://github.com/3003h/FEhViewer";
    license =  "Apache 2.0";
    maintainers = with maintainers; [  ];
    platforms = platforms.linux;
  };
}

Once this is mainstream, is it fine by you if I create a MR to nixpkgs to include it on their repositories? Probably this also compiles on ARM64 by default for linux.

That would mean that it can be installed in nixos/any linux with nix as easy as doing:

nix-shell -p fehviewer

However, I Don't know if your analytics can be integrated there.

Demo: image

Of course, no problem.

@3003h 3003h force-pushed the master branch 4 times, most recently from 38729b7 to 9d12de5 Compare November 18, 2023 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants