summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2ea1003876ff14258396a304fe51e1a1b0f69cbe (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
44
45
46
47
48
49
50
51
52
53
# Maintainer: Zach Callear <zach@callear.org>
# Contributor: Mark Quinn <mmq.arch@dekinai.com>
# Contributor: sekret, mail=$(echo c2VrcmV0QHBvc3Rlby5zZQo= | base64 -d)
_pkgname=imgmin
pkgname=$_pkgname-git
pkgver=1.1.r17.g3451031
pkgrel=7
pkgdesc="Automated lossy JPEG optimization"
arch=('i686' 'x86_64' 'armv7h' 'armv6h')
url="https://github.com/rflynn/imgmin"
license=('MIT')
depends=('libmagick6')
makedepends=("git")
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("$_pkgname::git+$url.git")
md5sums=('SKIP')

pkgver() {
  cd "$_pkgname"
  git describe --long --tags | sed -r 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

prepare() {
  cd "$_pkgname"

  # Use libmagick6 instead of 7 by using pkg-config directly instead of MagickWand-config.
  #
  # Previously it was possible to use the MagickWand-config script from ImageMagick 7, but it
  #     now hardcodes MagickWand-7 in its pkg-config call.
  sed -i 's~AC_CHECK_PROGS(MAGICK_CONFIG.*~AC_CHECK_PROG(MAGICK_CONFIG, pkg-config, PKG_CONFIG_PATH=/usr/lib/imagemagick6/pkgconfig pkg-config MagickWand)~g' configure.ac
  sed -i 's~ --cppflags~ --cflags~g' src/Makefile.am src/apache2/Makefile.am
  sed -i 's~ --ldflags~ --libs~g' src/Makefile.am src/apache2/Makefile.am
  
  # Temporarily fix https://github.com/rflynn/imgmin/issues/56 (Chroma Downsampling Lowers Visual Quality).
  sed -i 's~        (void) MagickSetImageProperty(mw, "jpeg:sampling-factor", "2x2");~//\0~' src/imgmin.c

  autoreconf -fi
}

build() {
  cd "$_pkgname"
  ./configure --prefix=/usr
  make
}

package() {
  cd "$_pkgname"
  make DESTDIR="$pkgdir/" install
  install -Dm644 LICENSE-MIT.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et: