Debian Codegraph @

.github/build/msys2/PKGBUILD

raw
1 # Adapted from upstream:
2 # https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-imagemagick
3
4 # Maintainer: Alexey Pavlov <[email protected]>
5
6 _realname=imagemagick
7 pkgbase="mingw-w64-${_realname}"
8 pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
9 "${MINGW_PACKAGE_PREFIX}-${_realname}-docs")
10 _basever=7.1.1
11 _rc=-47
12 pkgver=${_basever}${_rc//-/.} # pkgver doesn't have "," "/", "-" and space.
13 pkgrel=1
14 pkgdesc="An image viewing/manipulation program (mingw-w64)"
15 arch=('any')
16 mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
17 url="https://www.imagemagick.org/"
18 msys2_repository_url="https://github.com/ImageMagick/ImageMagick"
19 msys2_references=(
20 'archlinux: imagemagick'
21 'aur: imagemagick-full'
22 'cygwin: ImageMagick'
23 'gentoo: media-gfx/imagemagick'
24 'cpe: cpe:/a:imagemagick:imagemagick'
25 )
26 license=("spdx:ImageMagick")
27 makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
28 "${MINGW_PACKAGE_PREFIX}-autotools"
29 "${MINGW_PACKAGE_PREFIX}-pkgconf"
30 "${MINGW_PACKAGE_PREFIX}-cairo"
31 "${MINGW_PACKAGE_PREFIX}-ghostscript"
32 "${MINGW_PACKAGE_PREFIX}-graphviz"
33 "${MINGW_PACKAGE_PREFIX}-libjxl"
34 "${MINGW_PACKAGE_PREFIX}-librsvg"
35 "${MINGW_PACKAGE_PREFIX}-libultrahdr"
36 "${MINGW_PACKAGE_PREFIX}-libxml2"
37 "${MINGW_PACKAGE_PREFIX}-openexr"
38 "${MINGW_PACKAGE_PREFIX}-pango")
39 depends=("${MINGW_PACKAGE_PREFIX}-bzip2"
40 "${MINGW_PACKAGE_PREFIX}-djvulibre"
41 "${MINGW_PACKAGE_PREFIX}-flif"
42 "${MINGW_PACKAGE_PREFIX}-fftw"
43 "${MINGW_PACKAGE_PREFIX}-fontconfig"
44 "${MINGW_PACKAGE_PREFIX}-freetype"
45 "${MINGW_PACKAGE_PREFIX}-glib2"
46 "${MINGW_PACKAGE_PREFIX}-gsfonts"
47 "${MINGW_PACKAGE_PREFIX}-jasper"
48 "${MINGW_PACKAGE_PREFIX}-jbigkit"
49 "${MINGW_PACKAGE_PREFIX}-lcms2"
50 "${MINGW_PACKAGE_PREFIX}-libheif"
51 "${MINGW_PACKAGE_PREFIX}-liblqr"
52 "${MINGW_PACKAGE_PREFIX}-libpng"
53 "${MINGW_PACKAGE_PREFIX}-libraqm"
54 "${MINGW_PACKAGE_PREFIX}-libraw"
55 "${MINGW_PACKAGE_PREFIX}-libtiff"
56 "${MINGW_PACKAGE_PREFIX}-libltdl"
57 "${MINGW_PACKAGE_PREFIX}-libwebp"
58 "${MINGW_PACKAGE_PREFIX}-libwinpthread"
59 "${MINGW_PACKAGE_PREFIX}-libwmf"
60 "${MINGW_PACKAGE_PREFIX}-libxml2"
61 "${MINGW_PACKAGE_PREFIX}-omp"
62 "${MINGW_PACKAGE_PREFIX}-openjpeg2"
63 #"${MINGW_PACKAGE_PREFIX}-perl"
64 "${MINGW_PACKAGE_PREFIX}-ttf-dejavu"
65 "${MINGW_PACKAGE_PREFIX}-xz"
66 "${MINGW_PACKAGE_PREFIX}-zlib"
67 "${MINGW_PACKAGE_PREFIX}-zstd"
68 )
69 optdepends=("${MINGW_PACKAGE_PREFIX}-ghostscript: for Ghostscript support"
70 "${MINGW_PACKAGE_PREFIX}-graphviz: for GVC support"
71 "${MINGW_PACKAGE_PREFIX}-libjxl: for JPEG XL support"
72 "${MINGW_PACKAGE_PREFIX}-librsvg: for SVG support"
73 "${MINGW_PACKAGE_PREFIX}-libultrahdr: for Ultra HDR support"
74 "${MINGW_PACKAGE_PREFIX}-openexr: for OpenEXR support"
75 #"${MINGW_PACKAGE_PREFIX}-jasper: for JPEG-2000 support"
76 #"${MINGW_PACKAGE_PREFIX}-libpng: for PNG support"
77 #"${MINGW_PACKAGE_PREFIX}-libtiff: for PNG support"
78 #"${MINGW_PACKAGE_PREFIX}-libwebp: for WEBP support"
79 )
80 # libtool files are required in imagemagick to relocate modules path
81 options=('libtool')
82 # source=(https://imagemagick.org/archive/releases/ImageMagick-${_basever}${_rc}.tar.xz{,.asc}
83 # pathtools.c
84 # pathtools.h
85 # 001-7.1.1.39-relocate.patch)
86 # sha256sums=('2396cd3c4237cfbc09a89d31d1cee157ee11fbc8ec1e540530e10175cb707160'
87 # 'SKIP'
88 # 'ebf471173f5ee9c4416c10a78760cea8afaf1a4a6e653977321e8547ce7bf3c0'
89 # '1585ef1b61cf53a2ca27049c11d49e0834683dfda798f03547761375df482a90'
90 # 'f3454a7938069f91fbe220dc03e444e7454a4a8a286b2408bbfe6f15a9c8a6dc')
91 #Lexie Parsimoniae (ImageMagick code signing key) <[email protected]>
92 validpgpkeys=('D8272EF51DA223E4D05B466989AB63D48277377A')
93
94 source_dir="$GITHUB_WORKSPACE"
95
96 # Helper macros to help make tasks easier #
97 # apply_patch_with_msg() {
98 # for _patch in "$@"
99 # do
100 # msg2 "Applying $_patch"
101 # patch -Nbp1 -i "${srcdir}/${_patch}"
102 # done
103 # }
104 # =========================================== #
105
106 prepare() {
107 #test ! -d "${startdir}/../mingw-w64-pathtools" || {
108 # cmp "${startdir}/../mingw-w64-pathtools/pathtools.c" "${srcdir}/pathtools.c" &&
109 # cmp "${startdir}/../mingw-w64-pathtools/pathtools.h" "${srcdir}/pathtools.h"
110 #} || exit 1
111
112 #cd ImageMagick-${_basever}${_rc}
113 #cp -fHv "${srcdir}"/pathtools.[ch] MagickCore/
114
115 #apply_patch_with_msg \
116 # 001-7.1.1.39-relocate.patch
117
118 cd "${source_dir}"
119
120 autoreconf -fi
121 }
122
123 build() {
124 export lt_cv_deplibs_check_method='pass_all'
125
126 mkdir -p "${source_dir}"/build-${MSYSTEM} && cd "${source_dir}"/build-${MSYSTEM}
127
128 # --with-lcms2, --with-opencl, --without-ltdl
129 ../configure \
130 --prefix=${MINGW_PREFIX} \
131 --build=${MINGW_CHOST} \
132 --host=${MINGW_CHOST} \
133 --disable-deprecated \
134 --enable-legacy-support \
135 --enable-hdri \
136 --with-djvu \
137 --with-fftw \
138 --with-gslib \
139 --with-gvc \
140 --with-flif \
141 --with-jxl \
142 --with-lcms \
143 --with-lqr \
144 --with-modules \
145 --with-openexr \
146 --with-openjp2 \
147 --with-rsvg \
148 --with-uhdr \
149 --with-webp \
150 --with-wmf \
151 --with-xml \
152 --without-autotrace \
153 --without-dps \
154 --without-fpx \
155 --with-jbig \
156 --without-perl \
157 --without-x \
158 --with-raqm \
159 --with-magick-plus-plus \
160 --with-windows-font-dir=c:/Windows/fonts \
161 --with-gs-font-dir=${MINGW_PREFIX}/share/fonts/gsfonts \
162 --with-dejavu-font-dir=${MINGW_PREFIX}/share/fonts/TTF \
163 CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
164
165 if check_option "debug" "y"; then
166 MAKE_VERBOSE="V=1"
167 fi
168 make ${MAKE_VERBOSE}
169
170 #--enable-opencl \
171 #--with-perl-options="INSTALLDIRS=vendor"
172 }
173
174 package_imagemagick() {
175 cd "${source_dir}"/build-${MSYSTEM}
176 if check_option "debug" "y"; then
177 MAKE_VERBOSE="V=1"
178 fi
179 make -j1 DESTDIR="${pkgdir}" install ${MAKE_VERBOSE}
180
181 #find . -name "*.xml" -exec sed -i "s/${MINGW_PREFIX}/newWord/g" '{}' \;
182
183 install -Dm644 "${source_dir}"/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
184 install -Dm644 "${source_dir}"/NOTICE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/NOTICE"
185
186 local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
187 # fix hard-coded pathes in XML files.
188 find "${pkgdir}"${MINGW_PREFIX}/lib -name "*.xml" -exec sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i {} \;
189 # fix libtool .la files
190 find "${pkgdir}"${MINGW_PREFIX}/lib -name "*.la" -exec sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i {} \;
191 # fix hard-coded pathes in .pc files
192 for _f in "${pkgdir}${MINGW_PREFIX}"\/lib\/pkgconfig\/*.pc; do
193 sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
194 done
195
196 # Split docs
197 mkdir -p dest${MINGW_PREFIX}/share
198 mv "${pkgdir}${MINGW_PREFIX}"/share/doc dest${MINGW_PREFIX}/share/doc
199 }
200
201 package_imagemagick-docs() {
202 pkgdesc+=" (documentation)"
203 depends=()
204 optdepends=()
205
206 cd "${source_dir}"/build-${MSYSTEM}
207 mv dest/* "${pkgdir}"
208 }
209
210 # template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
211 # vim: set ft=bash :
212
213 # generate wrappers
214 for _name in "${pkgname[@]}"; do
215 _short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
216 _func="$(declare -f "${_short}")"
217 eval "${_func/#${_short}/package_${_name}}"
218 done
219 # template end;