summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dc810aced0003af4c46bfaa3aa07db8955ddd757 (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: Jay Man <jhollis.ga@gmail.com>

pkgname=imagemagick-essentials-git
pkgver=7.1.2.18.37.g2ab24d7486
pkgrel=1
pkgdesc="ImageMagick 7 built from source with HDRI, OpenCL, jemalloc, and comprehensive format/delegate support"
arch=('x86_64')
url="https://github.com/ImageMagick/ImageMagick"
license=('ImageMagick')
provides=('imagemagick' 'libmagick')
conflicts=('imagemagick' 'imagemagick-full' 'imagemagick-full-doc' 'imagemagick-full-debug' 'imagemagick-full-git')
replaces=('imagemagick')

depends=(
    'bzip2'
    'cairo'
    'fftw'
    'fontconfig'
    'freetype2'
    'ghostscript'
    'glib2'
    'glibc'
    'graphviz'
    'jemalloc'
    'lcms2'
    'libheif'
    'libjpeg-turbo'
    'liblqr'
    'libltdl'
    'libpng'
    'libraqm'
    'librsvg'
    'libtiff'
    'libwebp'
    'libxext'
    'libxml2'
    'ocl-icd'
    'openjpeg2'
    'perl'
    'xz'
    'zlib'
)

makedepends=(
    'git'
    'opencl-headers'
    'pkg-config'
)

optdepends=(
    'djvulibre: DJVU support'
    'jbigkit: JBIG support'
    'libjxl: JPEG XL support'
    'libraw: DNG support'
    'libultrahdr: UHDR support'
    'libwmf: WMF support'
    'libzip: OpenRaster support'
    'openexr: OpenEXR support'
    'pango: Text rendering support'
    'ttf-dejavu: DejaVu font family'
    'gsfonts: Ghostscript fonts'
)

options=('!debug')

source=("${pkgname}::git+https://github.com/ImageMagick/ImageMagick.git")
sha256sums=('SKIP')

install="${pkgname}.install"

pkgver() {
    cd "${pkgname}" || return 1
    git describe --tags --long 2>/dev/null | sed 's/^[vV]//;s/-/./g'
}

build() {
    cd "${pkgname}" || return 1

    autoreconf -fi

    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --enable-delegate-build \
        --enable-hdri \
        --enable-hugepages \
        --enable-legacy-support \
        --enable-opencl \
        --with-dejavu-font-dir=/usr/share/fonts/TTF \
        --with-gs-font-dir=/usr/share/fonts/gsfonts \
        --with-fontpath=/usr/share/fonts/TTF \
        --with-gslib \
        --with-gvc \
        --with-heic \
        --with-jemalloc \
        --with-modules \
        --with-perl \
        --with-pic \
        --with-png \
        --with-quantum-depth=16 \
        --with-rsvg \
        --with-utilities \
        --without-autotrace \
        CFLAGS="${CFLAGS} -DCL_TARGET_OPENCL_VERSION=300" \
        CXXFLAGS="${CXXFLAGS} -DCL_TARGET_OPENCL_VERSION=300" \
        CPPFLAGS="${CPPFLAGS} -DCL_TARGET_OPENCL_VERSION=300"

    make -j"$(nproc)"
}

package() {
    cd "${pkgname}" || return 1
    make DESTDIR="${pkgdir}" install

    # Install license
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    # Remove docs to avoid conflicts with imagemagick-full-doc / other doc packages
    rm -rf "${pkgdir}/usr/share/doc"

    # Scrub $srcdir references from installed files
    local _file
    for _file in "${pkgdir}/usr/lib/ImageMagick-"*/config-Q16HDRI/configure.xml; do
        [[ -f "$_file" ]] && sed -i "s|${srcdir}|/usr/src|g" "$_file"
    done
    find "${pkgdir}/usr/lib/perl5" -name '*.so' -exec \
        strip --strip-unneeded {} + 2>/dev/null || true

    # Clean up perl pod files and empty dirs
    local _perlver
    _perlver=$(perl -e 'print $^V' | sed 's/^v//')

    if [[ -d "${pkgdir}/usr/lib/perl5/${_perlver}" ]]; then
        find "${pkgdir}/usr/lib/perl5" -name '*.pod' -delete
        find "${pkgdir}/usr/lib/perl5" -empty -type d -delete
    fi
}