Skip to content

Building

David Morais edited this page Mar 22, 2023 · 2 revisions

Build instructions

Since there are native Windows & macOs clients, currently Kuro is only build distributed for Linux distros.

Pre-requisites

These are the pre-requisites to build packages. On a default Ubuntu install I had to install the following targets:

.rpm

You need the following packages to build the .rpm packagetarget

 sudo apt-get update
 sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
 sudo apt-get install --no-install-recommends -y rpm
 sudo apt-get install snapd && sudo snap install snapcraft --clasic

.pacman

You need the following packages to build .pacman target.

sudo apt install libarchive-tools

Building the package

Simply run yarn release. This won't publish or release Kuro and will only populate your dist folder with the built packages.

Nix Instructions

Improve suggestion is from https://github.com/NixOS/nixpkgs/pull/211022

And, The Nix mainline has been migrated to the brand-new flake system. So, we now have Flake support! Most intuitively, we can now just use nix run in the project directory to build and run kuro package directly. There also is nix develop for develop shell (Not yet implemented, so now just nothing), and nix build command for build package. If this pull request is merged, We also can usenix run github:davidsmorais/kuro to do same things but anywhere with nix. And I didn't remove default.nix so the legacy nix-build command is also work.

You can find more here: https://nixos.org/manual/nix/stable/command-ref/experimental-commands.html

Here is also some help for packaging for nix:

For this current package, Nix will independently manage and use the Electron binary provided by itself, so if you update the Electron version, you need to update the Electron provided to the Nix package synchronously(in default.nix).

If there is no change in the software architecture related to Electron (also no calls to other things like natively compiled binaries), you need to do these things when syncing versions:

Update the rev and the hash in the fetchFromGitHub method:

The rev can be a released version (like 9.0.0) or a commit hash (like daec9191a69a4e5fae709867f63a479036624a98) The hash can be calculated by fetch the tarball of source like this:

nix flake prefetch https://github.com/davidsmorais/kuro/archive/refs/tags/v9.0.0.tar.gz

This will download the tarball and unpack it, store it and able to used by flake, and also calculate the SRI hash with sha256.

And we need yarn.nix for mkYarnPackage to download all yarn packages at build time. You can use yarn2nix for yarn.nix:

yarn2nix > yarn.nix

Make sure you have done yarn install before do this.

Generally, that's all you have to do,