summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7f55f9295288e74ca231760534f32aa466afa278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Maintainer: Score_Under <seejay.11@gmail.com>
pkgname=pngwolf-zopfli-git
pkgver=0.r80.31b3399
pkgrel=2
pkgdesc="A PNG optimizer using a genetic algorithm to find effective compression parameters"
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/jibsen/pngwolf-zopfli"
license=('GPL3')
# At the time of writing, you can get libdeflate as "libdeflate-git" from the
# AUR.
depends=(libzopfli.so zlib libdeflate)
makedepends=('git')
source=(git+https://github.com/jibsen/pngwolf-zopfli.git
        git+https://github.com/jibsen/galib.git#branch=pngwolf-support)
md5sums=(SKIP SKIP)

provides=('pngwolf')
conflicts=('pngwolf')

pkgver() {
  cd pngwolf-zopfli
  printf '0.r%s.%s' "$(git rev-list HEAD --count)" "$(git rev-parse --short HEAD)"
}

build() {
  cd pngwolf-zopfli
  # Yes I know how morally wrong that awk is. What's worse is compiling it "by
  # the book", because that requires checking out all the git submodules and
  # prevents you from using dynamic libraries. Also, it's using Windows line
  # endings -- for shame!
  SOURCES="pngwolf.cxx $(awk '/^ *galib/{gsub("\r",""); print "../" $1}' CMakeLists.txt)"
  CPPFLAGS="-I../galib $CPPFLAGS"
  LDLIBS="-lz -lzopfli -ldeflate $LDLIBS"
  (
    set -x
    g++ -o pngwolf $SOURCES $CPPFLAGS $CXXFLAGS $LDFLAGS $LDLIBS
  )
}

package() {
  cd pngwolf-zopfli
  install -D pngwolf "$pkgdir/usr/bin/pngwolf"
}