From e1e70d9d7fb88367040f24a1365c29dd9179f2d3 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 11 Aug 2020 19:01:15 +0200 Subject: [PATCH] Add PKGBUILD to repository, fix untrue statement in README --- .gitignore | 2 ++ PKGBUILD | 40 ++++++++++++++++++++++++++++++++++++++++ README.org | 16 +++++++++++++--- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 PKGBUILD diff --git a/.gitignore b/.gitignore index ea8c4bf..069f0aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +/pkg/ +/src/pumopm-git/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..080e822 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,40 @@ +# Maintainer: Lucien Cartier-Tilet +pkgname=pumopm-git +pkgver=.r0.4e2acb9 +pkgrel=1 +pkgdesc="A tiny power manager written in Rust" +arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64') +url="https://labs.phundrak.com/phundrak/pumopm" +license=('GPL3') +depends=() +makedepends=('rustup' 'git') +options=() +source=("$pkgname::git+https://github.com/phundrak/pumopm") +md5sums=('SKIP') + +pkgver() { + cd "$pkgname" + local tag=$(git tag --sort=-v:refname | grep '^[0-9]' | head -1) + local commits_since=$(git rev-list $tag..HEAD --count) + echo "$tag.r$commits_since.$(git log --pretty=format:'%h' -n 1)" +} + +build() { + cd "$pkgname" + if command -v rustup >/dev/null 2>&1; then + RUSTFLAGS="-C target-cpu=native" rustup run stable cargo build --release + elif rustc --version | grep -q stable; then + RUSTFLAGS="-C target-cpu=native" cargo build --release + else + cargo build --release + fi +} + +package() { + cd "$pkgname" + + install -Dm755 "target/release/pumopm" "$pkgdir/usr/bin/pumopm" + install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" +} + +# vim:set ts=2 sw=2 et: diff --git a/README.org b/README.org index a103728..a863108 100644 --- a/README.org +++ b/README.org @@ -30,7 +30,7 @@ To run the project, you currently only have one option: download the project’s source code, compile it, and run it. You will need to have [[https://www.rust-lang.org/][Rust installed]]. Update your Rust installation if needed with ~rustup update~. Then, simply - begin with a ~git clone~, then cd into the project’s directory. You can then + begin with a ~git clone~, then cd into the project’s directory. You can then build the project with ~cargo~, and even install it locally if you want to. #+BEGIN_SRC sh $ git clone https://labs.phundrak.com/phundrak/pumopm @@ -40,6 +40,16 @@ $ cargo install --path . # optional, to install for the user the project #+END_SRC + If you are an Arch Linux user, make sure you have ~rustup~ installed, and then + you can install PumoPM using the ~PKGBUILD~ available in the repository. To do + so, simply run + #+BEGIN_SRC sh + $ makepkg -si + #+END_SRC + + You will then have PumoPM installed as a native package on your machine which + you can uninstall using Pacman. + * Usage It is possible to run PumoPM with a couple of different flags. You will find their description here: @@ -50,9 +60,9 @@ - ~-c --critical~ :: level at which the battery is considered to be critical - ~-r --refresh-rate~ :: refresh rate of the battery’s reads - ~-v --verbose~ :: augment the program’s verbosity, can be repeated - The arguments ~-l~, ~-L~ and ~-c~ accept an integer between 5 and 75 (actually + The arguments ~-l~, ~-L~ and ~-c~ accept an integer between 5 and 95 (actually any value that will fit in an unsigned byte, but it will be rounded up to 5 or - down to 75), while ~-r~ accepts any integer that can fit in a ~u64~, although + down to 95), while ~-r~ accepts any integer that can fit in a ~u64~, although I’m sure you’ll never need that long of a refresh time. The levels will also see their values ordered. If the ~-L~ value is higher