summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fe21ff7652ada4808a9d24778775e5d4e45bf9e4 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Maintainer:  Chris Severance aur.severach aATt spamgourmet dott com
# Contributor: Limao Luo <luolimao+AUR@gmail.com>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# From core package
# Contributor: Eric BĂ©langer <eric@archlinux.org>

set -u
_pkgname='imagemagick'
pkgbase="${_pkgname}-git"
#_srcdir="${pkgbase}"
_srcdir='ImageMagick'
pkgname=("${pkgbase}"{,-doc})
pkgver=7.0.6.7.r12351.geaada474d
pkgrel=1
pkgdesc='An image viewing/manipulation program'
arch=('i686' 'x86_64')
url='http://www.imagemagick.org/script/'
license=('custom')
makedepends=('libltdl' 'lcms2' 'libxt' 'fontconfig' 'libxext' 'ghostscript'
             'openexr' 'libwmf' 'librsvg' 'libxml2' 'liblqr' 'openjpeg2'
             'opencl-headers' 'ocl-icd' 'libwebp' 'patch' 'git')
_verwatch=("${url/script/download/}" 'ImageMagick-\([-0-9\.]\+\)\.tar\.bz2' 'l')
_archlink="@@@::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/@@@?h=packages/${_pkgname}"
source=(
  #"${_srcdir}::git+http://git.imagemagick.org/repos/ImageMagick.git"
  "git+https://github.com/ImageMagick/ImageMagick.git"
  'libpng_mmx_patch_x86_64.patch'
  "${_archlink//@@@/perlmagick.rpath.patch}"
)
sha256sums=('SKIP'
            '4f3ab23349fd3958a88eb09a7107e08c2c6f3953287907103ec48cfa83575e87'
            '17218bbecc17f3c7a86935a09d5a47e46113a1fc28f7d91c2fe495019cc36088')
#validpgpkeys=('D8272EF51DA223E4D05B466989AB63D48277377A')

pkgver() {
  set -u
  cd "${_srcdir}/"
  local _version="$(grep -o -m1 '[0-9]\+\.[0-9]\+\.[0-9\.-]\+' 'ChangeLog')"
  printf '%s.r%s.g%s' "${_version//-/.}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  set +u
}

prepare() {
  set -u
  cd "${_srcdir}/"
  #[ "${CARCH}" = 'x86_64' ] && patch -p1 -i "${srcdir}/libpng_mmx_patch_x86_64.patch"
  sed -e '/AC_PATH_XTRA/d' -i 'configure.ac'
  set +u
}

_configure() {
  set -u
  cd "${_srcdir}/"
  if [ ! -s 'Makefile' ]; then
    autoreconf --force --install
    patch -p0 -i "${srcdir}/perlmagick.rpath.patch"
    declare -A _EXTRAOPTS=([i686]='i686' [x86_64]='x86-64')
    #./configure --prefix='/usr' --sysconfdir='/etc' --with-modules --disable-static --enable-openmp --with-x --with-wmf --with-openexr --with-xml --with-gslib --with-gs-font-dir='/usr/share/fonts/Type1' --with-perl --with-perl-options='INSTALLDIRS=vendor' --without-gvc --with-djvu --without-autotrace --with-jp2 --with-jbig --without-fpx --without-dps --without-fftw
    ./configure --prefix='/usr' --sysconfdir='/etc' --with-modules \
      --enable-hdri --with-wmf --with-openexr --with-xml --with-lcms2 \
      --with-webp --with-gslib --with-gs-font-dir='/usr/share/fonts/Type1' \
      --with-perl --with-perl-options='INSTALLDIRS=vendor' --with-lqr --with-rsvg \
      --enable-opencl --with-openjp2 --without-gvc --without-djvu --without-autotrace \
      --without-jbig --without-fpx --without-dps --without-fftw --with-gcc-arch="${_EXTRAOPTS[${CARCH}]}"
    sed -e 's: -mtune=x86-64 : :g' -i 'Makefile' # This works even though the screen still shows the flags
  fi
  cd "${srcdir}"
  set +u
}

build() {
  _configure
  set -u
  cd "${_srcdir}/"
  local _nproc="$(nproc)"; _nproc=$((_nproc>8?8:_nproc))
  nice make -s -j "${_nproc}"
  set +u
}

check() {
  cd "${_srcdir}/"
  #make -s -j1 check
}

package_imagemagick-git() {
  set -u
  pkgdesc='An image viewing/manipulation program'
  depends=('libltdl' 'lcms2' 'libxt' 'fontconfig' 'libxext' 'liblqr')
  optdepends=('imagemagick-doc: for additional information'
              'ghostscript: for Ghostscript support' 
              'openexr: for OpenEXR support' 
              'openjpeg2: for JP2 support' 
              'libwmf: for WMF support' 
              'librsvg: for SVG support' 
              'libxml2: for XML support' 
              'libpng: for PNG support' 
              'libwebp: for WEBP support')
  backup=("etc/ImageMagick-${pkgver%%.*}"/{coder,colors,delegates,log,magic,mime,policy,thresholds,type{,-dejavu,-ghostscript,-windows}})
  #options=('libtool' '!emptydirs' '!makeflags')
  options=('!docs' 'libtool' '!emptydirs')
  provides=("${_pkgname}=${pkgver%.r*}")
  conflicts=("${_pkgname}")

  cd "${_srcdir}/"
  make -s -j1 DESTDIR="${pkgdir}" install
  #install -d "${pkgdir}/usr/share/licenses/${_pkgname}/"
  install -Dpm644 'LICENSE' 'NOTICE' -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
  #Cleaning. Why are we deleting a file that says DO NOT DELETE?
  #rm -f "${pkgdir}/usr/lib"/*.la
  #rm -rf "${pkgdir}/usr/share/doc/" # same as option !docs

  # This looks dangerous. Upgrading perl will remove ImageMagick
  if ! :; then
    # template start; name=perl-binary-module-dependency; version=1;
    if [ ! -z "$(find "${pkgdir}/usr/lib/perl5/" -name '*.so')" ]; then
      local _perlver_min="$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')"
      local _perlver_max="$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')"
      eval 'dep''ends+=("perl>=${_perlver_min}" "perl<${_perlver_max}")' # keep mksrcinfo from reading this
    fi
    # template end;
  fi
  set +u
}

package_imagemagick-git-doc() {
  set -u
  pkgdesc='The ImageMagick documentation (utilities manuals and libraries API)'
  provides=("${_pkgname}-doc")
  conflicts=("${_pkgname}-doc")
  depends=("${_pkgname}")

  cd "${_srcdir}/"
  make -s DESTDIR="${pkgdir}" install-data-html
  install -Dpm644 'LICENSE' 'NOTICE' -t "${pkgdir}/usr/share/licenses/${_pkgname}-doc/"
  set +u
}
set +u