ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.64k stars 399 forks source link

PKGBUILD for building and installing on Arch Linux #110

Closed adi-g15 closed 3 years ago

adi-g15 commented 3 years ago

I wrote a PKGBUILD for managing the updating and installation management from pacman on Arch Linux.

Since the build is only CMake .. and CMake --build so it is quite simple. What is Added: Having pacman handle where they are stored, and uninstalling and updating too

The PKGBUILD -

https://github.com/adig-pkgs/ftxui-git/blob/09a3c65df13fe4cb7a2320f86b2100b936d721d4/PKGBUILD#L1-L45

It can also be pushed to the Arch User Repository, which is a community repo for packages for easy use by everyone. [*considering the repo is not just for a single person]

The https://github.com/adig-pkgs/ftxui-git can be directly pushed to AUR too, so it can be directly searched and installed with Arch's official package manager, pacman. You may push it yourself under your account if you like :smiley: :+1:

2021-06-10_20-08
ArthurSonzogni commented 3 years ago

Thank you! That's really nice of you!

I will need to learn a bit about pacman, AUR, PKGBUILD. This might take me a few days.

Maybe you can add me as an additional OWNER of: https://github.com/adig-pkgs/ftxui-git, then we can mark it as the official PKGCONFIG, we can fix the remaining bits and then push it to AUR. What do you think?

Some questions:

  1. Is it possible in PKGBUILD to specify a specific git hash? Or a specific git tag?
  2. What happens if FTXUI is updated to a new version? I usually ask dependencies to depends on a specific hash, but I guess we have to specify a fixed version and stick to it. What is going to happen if I want to introduce a breaking change into the API?

Some suggestion to your patch:

# Maintainer: Arthur Sonzogni <i_dont_know_his_mail>

You can use:

sonzogniarthur+ftxui@gmail.com

arch=('x86_64')

This should compile on multiple arch. On the ubuntu snap package, this is already compiling for:


-DFTXUI_BUILD_DOCS=ON

Is it needed to build docs? This requires doxygen and I don't believe this is worth it.


check() {
  cd "$srcdir/${pkgname%-git}"/build
  # Left for now, ask Arthur later
}

What does check() is usually used for?

adi-g15 commented 3 years ago

Maybe you can add me as an additional OWNER of: https://github.com/adig-pkgs/ftxui-git, then we can mark it as the official PKGCONFIG, we can fix the remaining bits and then push it to AUR. What do you think?

Sure :smile:. Though it's up to you to make in available in AUR, it's still fairly easy to install by anyone by 'cmake --install .', or if meant to be used as a git submodule then also having a installed version maynot always help to share the code with others, others will require it to be installed too.

Some questions:

1. Is it possible in PKGBUILD to specify a specific git hash? Or a specific git tag?

Yes it is possible-

source=("${pkgname%-git}::git+https://github.com/ArthurSonzogni/FTXUI#commit=e9eab32b2fe1d720c5c12d1131074e719840ffdc")

Same can be done for tags, by adding #tag in it

The source=() can be empty too, and the cloning be done in prepare(), since that runs before others.

2. What happens if FTXUI is updated to a new version? I usually ask dependencies to depends on a specific hash, but I guess we have to specify a fixed version and stick to it. What is going to happen if I want to introduce a breaking change into the API?

The version can be updated automatically according to tags or commit number, according to the printf statement in pkgver. These are listed in example PKGBUILD (/usr/share/pacman/PKGBUILD-vcs.proto)


# Git, tags available
printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"

Git, no tags available

    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"


I just leave the pkgver=1, then the next build updates the pkgver according to number of commits, or the latest tag when used.

For breaking changes, it will be the same, if versioned according to commits, it will have r277, r278,r279. Though with tags it can be v1.1, v2.1....
There is the option of manually changing pkgver, and/or pkgrel too, though i guess it needs more maintenance then.

> Though, it is required to run `makepkg && makepkg --printscreeninfo > .SRCINFO`, and git push to AUR, when we want to update the version in AUR's database.

> 
> ### Some suggestion to your patch:

Will update the details :smiley: 

> Is it needed to build docs? This requires doxygen and I don't believe this is worth it.

No not needed this was a personal preferences only.

> What does check() is usually used for?

It is mainly to run make check, to make sure software has been built correctly and works fine with its dependencies. 

<hr/>

Also, the two pages cover almost all of this-
https://wiki.archlinux.org/title/Creating_packages
https://wiki.archlinux.org/title/AUR_submission_guidelines

Also for the PKGBUILD with custom tag or commit ref, i added some files to https://github.com/adig-pkgs/ftxui-git/tree/custom_tag
ArthurSonzogni commented 3 years ago

Package published: https://aur.archlinux.org/packages/ftxui-git/

Thanks you for all the work you did!