Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
110 lines (93 sloc) 3.58 KB
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=zopfli
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0.2
pkgrel=2
arch=('any')
url="https://github.com/google/zopfli"
license=('apache')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake")
source=("https://github.com/google/zopfli/archive/${_realname}-$pkgver.tar.gz"
"7554e4d34e7000b0595aa606e7d72357cf46ba86.patch"
"win32-fixes.patch")
sha256sums=('4a570307c37172d894ec4ef93b6e8e3aacc401e78cbcc51cf85b212dbc379a55'
'3a3c002af41a8b066984362216099152ee127f2a31335bc6a3360f96d3a88366'
'25c2734059f3c794a8dddd5e9c7c176d96ff6f8d0ac0dada8d750951a995b41e')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying $_patch"
patch -Nbp1 -i "${srcdir}/$_patch"
done
}
del_file_exists() {
for _fname in "$@"
do
if [ -f $_fname ]; then
rm -rf $_fname
fi
done
}
# =========================================== #
prepare() {
cd "$srcdir/zopfli-zopfli-$pkgver"
del_file_exists CMakeLists.txt
# sed -i -e "/^CFLAGS = / s/$/ $CFLAGS/" \
# -e "/^CXXFLAGS = / s/$/ $CXXFLAGS/" Makefile
apply_patch_with_msg 7554e4d34e7000b0595aa606e7d72357cf46ba86.patch \
win32-fixes.patch
}
build() {
cd "${srcdir}"/zopfli-zopfli-$pkgver
[[ -d "${srcdir}"/build-${CARCH}-shared ]] && rm -rf "${srcdir}"/build-${CARCH}-shared
mkdir -p "${srcdir}"/build-${CARCH}-shared && cd "${srcdir}"/build-${CARCH}-shared
declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G'MSYS Makefiles' \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
"${extra_config[@]}" \
-DBUILD_SHARED_LIBS=ON \
../zopfli-zopfli-$pkgver
make
[[ -d "${srcdir}"/build-${CARCH}-static ]] && rm -rf "${srcdir}"/build-${CARCH}-static
mkdir -p "${srcdir}"/build-${CARCH}-static && cd "${srcdir}"/build-${CARCH}-static
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G'MSYS Makefiles' \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
"${extra_config[@]}" \
-DBUILD_SHARED_LIBS=OFF \
../zopfli-zopfli-$pkgver
make
}
package() {
#shared
cd "${srcdir}"/build-${CARCH}-shared
# -- zopfli
install -Dm755 "zopfli.exe" "$pkgdir${MINGW_PREFIX}/bin/zopfli.exe"
install -Dm644 "../zopfli-zopfli-$pkgver/src/zopfli/zopfli.h" "$pkgdir${MINGW_PREFIX}/include/zopfli.h"
install -Dm755 "libzopfli.dll" "$pkgdir${MINGW_PREFIX}/bin/libzopfli.dll"
install -Dm644 "libzopfli.dll.a" "$pkgdir${MINGW_PREFIX}/lib/libzopfli.dll.a"
# -- zopfipng
install -Dm755 "zopflipng" "$pkgdir${MINGW_PREFIX}/bin/zopflipng"
install -Dm644 "../zopfli-zopfli-$pkgver/src/zopflipng/zopflipng_lib.h" "$pkgdir${MINGW_PREFIX}/include/zopflipng_lib.h"
install -Dm755 "libzopflipng.dll" "$pkgdir${MINGW_PREFIX}/bin/libzopflipng.dll"
install -Dm755 "libzopflipng.dll.a" "$pkgdir${MINGW_PREFIX}/lib/libzopflipng.dll.a"
#static
cd "${srcdir}"/build-${CARCH}-static
# -- zopfli
install -Dm644 "libzopfli.a" "$pkgdir${MINGW_PREFIX}/lib/libzopfli.a"
install -Dm644 "../zopfli-zopfli-$pkgver/README" "$pkgdir${MINGW_PREFIX}/share/doc/${_realname}/README"
# -- zopfipng
install -Dm755 "libzopflipng.a" "$pkgdir${MINGW_PREFIX}/lib/libzopflipng.a"
install -Dm644 "../zopfli-zopfli-$pkgver/README.zopflipng" "$pkgdir${MINGW_PREFIX}/share/doc/${_realname}/README.zopflipng"
}
You can’t perform that action at this time.