tiffany352 / rink-rs

Unit conversion tool and library written in rust
https://rinkcalc.app/about
GNU General Public License v3.0
406 stars 28 forks source link

Better packaging #158

Closed tiffany352 closed 3 months ago

tiffany352 commented 3 months ago

I want rink to adhere slightly better to conventions on Linux.

The asciidoc files will likely become the new source of truth for rink's documentation. There is no way to make PRs to github wikis, so this might be for the best anyway. If I do this though, I'll have to make sure to setup some sort of automatic github pages builds or something.

Currently rink is packaged on arch, nix, and void linux.

Todo:

tiffany352 commented 3 months ago

Made some hacky edits to the pkgbuild to try it out and it works:

diff --git a/PKGBUILD(1) b/PKGBUILD
index ea13b3d..9a366fa 100644
--- a/PKGBUILD(1)
+++ b/PKGBUILD
@@ -1,33 +1,34 @@
 # Maintainer: Daniel M. Capella <polyzen@archlinux.org>

 pkgname=rink
-pkgver=0.7.0
+pkgver=34c46ca1d1a3fd28092e2b502ba32fa76bb00778
 pkgrel=1
 pkgdesc='Unit conversion tool and library written in rust'
 arch=('x86_64')
 url=https://rinkcalc.app
 license=('GPL3' 'MPL2')
 depends=('gcc-libs' 'openssl')
-makedepends=('git' 'rust')
-source=("git+https://github.com/tiffany352/$pkgname-rs.git#tag=v$pkgver")
-b2sums=('fb4a56da89eb99f8a07b26dd149736aafa60238a8fb5adab64adc6461272c54736e35ace01595565d9c6ea5bc059c31213b3f241bd2a0b4dd23ccf28946929c3')
+makedepends=('git' 'rust' 'make' 'asciidoctor')
+source=("git+https://github.com/tiffany352/$pkgname-rs.git#branch=packaging")
+b2sums=('SKIP')

 prepare() {
   cd $pkgname-rs
-  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
+  make fetch FETCHFLAGS="--locked --target $(rustc -vV | sed -n 's/host: //p')"
 }

 build() {
   cd $pkgname-rs
-  cargo build --release --locked --offline
+  make all prefix=/usr
 }

 check() {
   cd $pkgname-rs
-  cargo test --locked --offline
+  make test
 }

 package() {
   cd $pkgname-rs
-  install -Dt "$pkgdir"/usr/bin target/release/$pkgname
+  make install prefix=/usr DESTDIR="$pkgdir/usr"
 }
$ pacman -Ql rink
rink /usr/
rink /usr/bin/
rink /usr/bin/rink
rink /usr/share/
rink /usr/share/man/
rink /usr/share/man/man1/
rink /usr/share/man/man1/rink.1.gz
rink /usr/share/man/man5/
rink /usr/share/man/man5/rink-dates.5.gz
rink /usr/share/man/man5/rink-defs.5.gz
rink /usr/share/man/man5/rink.5.gz
rink /usr/share/man/man7/
rink /usr/share/man/man7/rink.7.gz
rink /usr/share/rink/
rink /usr/share/rink/currency.units
rink /usr/share/rink/datepatterns.txt
rink /usr/share/rink/definitions.units