Code Monkey home page Code Monkey logo

Comments (6)

PrestonN avatar PrestonN commented on May 8, 2024

This is something I've been meaning to do. I'll try to see if I can set this up better later today.

If you have everything setup already, feel free to make a pull request and I'll merge it. :)

from freetube.

keijukainen avatar keijukainen commented on May 8, 2024

I'm currently using electron-packager to build the app on my 64-bit system. I haven't tested it without the "--arch x64" option so I don't know if it will auto-detect the correct arch. I didn't want to create a pull request without knowing how these changes would affect 32-bit users. I'll try to test it further in the next couple of days.

from freetube.

keijukainen avatar keijukainen commented on May 8, 2024

I ran a bunch of tests and there's some good news and some bad news. The good news is that you can omit the arch from the electron-packager command. It will auto-detect the host system arch. So you only need one command to build on any host system (make:linux).

The bad news is that the command to package the app requires that you specify the arch. And the output folder from the build operation is auto-generated and named after the host system arch (e.g., freetube-linux-x64). So you'll have to know the output folder name along with the correct arch to build the package.

To further complicate the problem there are different arch terms based upon the distro. So a redhat package might use x86_64 as the arch but a debian package would use amd64. And electron packager has its own list of compatible arch terms. If you were to embed the arch into the package command then you would need a minimum of 4 commands per package type (package:deb32, package:deb64, package:debArm32, package:debArm64).

The only way to condense all of the packaging options into a single command is to create a separate bash script and provide it in the same folder as the package.json file.

"package:deb": "electron-installer-debian --src out/freetube-linux-$(./getArch dir)/ --dest out/packages/ --arch $(./getArch deb)",
"package:rpm": "electron-installer-redhat --src out/freetube-linux-$(./getArch dir)/ --dest out/packages/ --arch $(./getArch rpm)",
"make:linux": "electron-packager . freetube --platform linux --out out/",

  "devDependencies": {
    "electron-forge": "^5.1.1",
    "electron-prebuilt-compile": "1.8.2",
    "electron-winstaller": "^2.6.4",
    "electron-installer-debian": "^0.8.1",
    "electron-installer-redhat": "^0.5.0",
    "electron-packager": "^11.1.0"
  },
// yarn is only needed for electron-forge

example of the getArch bash script

#!/bin/bash

# get system arch
arch=$(uname -m)
if [ "${arch}" == "x86_64" ]; then
    # if first option passed to bash script is "dir" then we return
    # a string pointing to the output folder created by electron
    # packager
    if [ "${1}" == "dir" ]; then
        echo -n "x64"
    else
        if [ "${1}" == "deb" ]; then
            # return a debian compatible arch string
            echo -n "amd64"
        else
            # return a redhat/rpm compatible arch string
            echo -n "x86_64"
        fi
    fi
fi

To build and package

npm install --only=prod
npm install --only=dev
npm run make:linux
npm run package:deb
OR
npm run package:rpm

If you're interested in using the electron-packager/electron-installer/bash approach I'd be willing to put together the complete bash script. First step would be to compile the list of all possible arch variables. The final version of the bash script would use getopts instead of the $1 variable.

from freetube.

PrestonN avatar PrestonN commented on May 8, 2024

Hey sorry for the late reply. Yeah the way Electron Forge does it's packaging is that it automatically builds for the user's current platform as you've noticed. I appreciate you taking the time into looking into this as well. I'm perfectly okay with having the separate commands for building the packages. It should save you some scripting as well if we went that way. It would probably be better in the long run anyways that way the person building the application has a better idea on what's being built. If you already have the commands separated feel free to send a pull request. If you don't have time to do so then I will try to get to it this weekend.

Thanks again!

from freetube.

keijukainen avatar keijukainen commented on May 8, 2024

I added 8 new packaging options to provide 32/64 bit options for x86 and arm. The one arch that I left out is mips64el. It's supported by electron-packager but it seemed unnecessary. I didn't have time to test all of them. I believe the arch terms are correct and should work fine but it would require setting up 8 different VMs to test them all. No worries if it takes a few weeks before you merge the pull request or use a different approach. Thanks for the software.

from freetube.

PrestonN avatar PrestonN commented on May 8, 2024

I'll go ahead and close this issue as we have more options for downloading such as Flatpak and AUR.

from freetube.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.