diff --git a/extra/libraw/PKGBUILD b/extra/libraw/PKGBUILD new file mode 100644 index 000000000..fe0917bfc --- /dev/null +++ b/extra/libraw/PKGBUILD @@ -0,0 +1,48 @@ +# $Id$ +# Maintainer: Antonio Rojas <arojas@archlinux.org> +# Contributor: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org> +# Contributor: Ionut Biru <ibiru@archlinux.org> +# Contributor: Joeny Ang <ang(dot)joeny(at)gmail(dot)com> +# Contributor: Brad Fanella <bradfanella@archlinux.us> + +# ALARM: Kevin Mihelich <kevin@archlinuxarm.org> +# - patch for signed char on ARM + +pkgname=libraw +pkgver=0.17.2 +pkgrel=1 +pkgdesc="A library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)" +arch=('i686' 'x86_64') +url="http://www.libraw.org/" +license=(CDDL LGPL custom) +depends=(lcms2 jasper) +source=("http://www.libraw.org/data/LibRaw-${pkgver}.tar.gz" libraw-gcc6.patch + 'arm.patch') +sha256sums=('92b0c42c7666eca9307e5e1f97d6fefc196cf0b7ee089e22880259a76fafd15c' + '317af364c48fd346eef0b116264a8c048aed923e2d850c0f2dd2d30a34b3771a' + '2aeaeb18d9e6305da84d792b5f81a533d57b3d394c925eb2c6d780fa9d637daf') + +prepare() { + cd LibRaw-$pkgver +# Fix build with GCC 6 (Fedora) + patch -p0 -i ../libraw-gcc6.patch +# Fix build on ARM + patch -p1 -i ../arm.patch +} + +build() { + cd LibRaw-$pkgver + ./configure --prefix=/usr \ + --disable-examples + make +} + +package() { + cd LibRaw-$pkgver + make DESTDIR="$pkgdir" install + + install -d "$pkgdir"/usr/share/licenses/$pkgname + install -D -m644 "$srcdir"/LibRaw-$pkgver/LICENSE.LibRaw.pdf \ + "$pkgdir"/usr/share/licenses/$pkgname +} diff --git a/extra/libraw/arm.patch b/extra/libraw/arm.patch new file mode 100644 index 000000000..79ff18ada --- /dev/null +++ b/extra/libraw/arm.patch @@ -0,0 +1,12 @@ +diff -urN a/internal/dcraw_common.cpp b/internal/dcraw_common.cpp +--- a/internal/dcraw_common.cpp 2016-05-30 11:35:23.779168782 -0600 ++++ b/internal/dcraw_common.cpp 2016-05-30 11:35:37.268641475 -0600 +@@ -2469,7 +2469,7 @@ + + void CLASS kodak_radc_load_raw() + { +- static const char src[] = { ++ static const signed char src[] = { + 1,1, 2,3, 3,4, 4,2, 5,7, 6,5, 7,6, 7,8, + 1,0, 2,1, 3,3, 4,4, 5,2, 6,7, 7,6, 8,5, 8,8, + 2,1, 2,3, 3,0, 3,2, 3,4, 4,6, 5,5, 6,7, 6,8, diff --git a/extra/libraw/libraw-gcc6.patch b/extra/libraw/libraw-gcc6.patch new file mode 100644 index 000000000..de2182b55 --- /dev/null +++ b/extra/libraw/libraw-gcc6.patch @@ -0,0 +1,82 @@ +--- internal/dcraw_common.cpp ++++ internal/dcraw_common.cpp +@@ -4417,30 +4417,37 @@ void CLASS lin_interpolate() + */ + void CLASS vng_interpolate() + { +- static const signed char *cp, terms[] = { +- -2,-2,+0,-1,0,0x01, -2,-2,+0,+0,1,0x01, -2,-1,-1,+0,0,0x01, +- -2,-1,+0,-1,0,0x02, -2,-1,+0,+0,0,0x03, -2,-1,+0,+1,1,0x01, +- -2,+0,+0,-1,0,0x06, -2,+0,+0,+0,1,0x02, -2,+0,+0,+1,0,0x03, +- -2,+1,-1,+0,0,0x04, -2,+1,+0,-1,1,0x04, -2,+1,+0,+0,0,0x06, +- -2,+1,+0,+1,0,0x02, -2,+2,+0,+0,1,0x04, -2,+2,+0,+1,0,0x04, +- -1,-2,-1,+0,0,0x80, -1,-2,+0,-1,0,0x01, -1,-2,+1,-1,0,0x01, +- -1,-2,+1,+0,1,0x01, -1,-1,-1,+1,0,0x88, -1,-1,+1,-2,0,0x40, +- -1,-1,+1,-1,0,0x22, -1,-1,+1,+0,0,0x33, -1,-1,+1,+1,1,0x11, +- -1,+0,-1,+2,0,0x08, -1,+0,+0,-1,0,0x44, -1,+0,+0,+1,0,0x11, +- -1,+0,+1,-2,1,0x40, -1,+0,+1,-1,0,0x66, -1,+0,+1,+0,1,0x22, +- -1,+0,+1,+1,0,0x33, -1,+0,+1,+2,1,0x10, -1,+1,+1,-1,1,0x44, +- -1,+1,+1,+0,0,0x66, -1,+1,+1,+1,0,0x22, -1,+1,+1,+2,0,0x10, +- -1,+2,+0,+1,0,0x04, -1,+2,+1,+0,1,0x04, -1,+2,+1,+1,0,0x04, +- +0,-2,+0,+0,1,0x80, +0,-1,+0,+1,1,0x88, +0,-1,+1,-2,0,0x40, +- +0,-1,+1,+0,0,0x11, +0,-1,+2,-2,0,0x40, +0,-1,+2,-1,0,0x20, +- +0,-1,+2,+0,0,0x30, +0,-1,+2,+1,1,0x10, +0,+0,+0,+2,1,0x08, +- +0,+0,+2,-2,1,0x40, +0,+0,+2,-1,0,0x60, +0,+0,+2,+0,1,0x20, +- +0,+0,+2,+1,0,0x30, +0,+0,+2,+2,1,0x10, +0,+1,+1,+0,0,0x44, +- +0,+1,+1,+2,0,0x10, +0,+1,+2,-1,1,0x40, +0,+1,+2,+0,0,0x60, +- +0,+1,+2,+1,0,0x20, +0,+1,+2,+2,0,0x10, +1,-2,+1,+0,0,0x80, +- +1,-1,+1,+1,0,0x88, +1,+0,+1,+2,0,0x08, +1,+0,+2,-1,0,0x40, +- +1,+0,+2,+1,0,0x10 +- }, chood[] = { -1,-1, -1,0, -1,+1, 0,+1, +1,+1, +1,0, +1,-1, 0,-1 }; ++ struct interpolate_terms { ++ signed char y1, x1, y2, x2, weight; ++ unsigned char grads; ++ }; ++ static const interpolate_terms terms[] = { ++ {-2,-2,+0,-1,0,0x01}, {-2,-2,+0,+0,1,0x01}, {-2,-1,-1,+0,0,0x01}, ++ {-2,-1,+0,-1,0,0x02}, {-2,-1,+0,+0,0,0x03}, {-2,-1,+0,+1,1,0x01}, ++ {-2,+0,+0,-1,0,0x06}, {-2,+0,+0,+0,1,0x02}, {-2,+0,+0,+1,0,0x03}, ++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0x20}, {+0,+1,+2,+2,0,0x10}, {+1,-2,+1,+0,0,0x80}, ++ {+1,-1,+1,+1,0,0x88}, {+1,+0,+1,+2,0,0x08}, {+1,+0,+2,-1,0,0x40}, ++ {+1,+0,+2,+1,0,0x10} ++ }; ++ const interpolate_terms *cpt; ++ signed char *cp; ++ signed char chood[] = { -1,-1, -1,0, -1,+1, 0,+1, +1,+1, +1,0, +1,-1, 0,-1 }; + ushort (*brow[5])[4], *pix; + int prow=8, pcol=2, *ip, *code[16][16], gval[8], gmin, gmax, sum[4]; + int row, col, x, y, x1, x2, y1, y2, t, weight, grads, color, diag; +@@ -4456,11 +4463,11 @@ void CLASS vng_interpolate() + for (row=0; row < prow; row++) /* Precalculate for VNG */ + for (col=0; col < pcol; col++) { + code[row][col] = ip; +- for (cp=terms, t=0; t < 64; t++) { +- y1 = *cp++; x1 = *cp++; +- y2 = *cp++; x2 = *cp++; +- weight = *cp++; +- grads = *cp++; ++ for (cpt=&terms[0], t=0; t < 64, cpt = &terms[t]; t++) { ++ y1 = cpt->y1; x1 = cpt->x1; ++ y2 = cpt->y2; x2 = cpt->x2; ++ weight = cpt->weight; ++ grads = cpt->grads; + color = fcol(row+y1,col+x1); + if (fcol(row+y2,col+x2) != color) continue; + diag = (fcol(row,col+1) == color && fcol(row+1,col) == color) ? 2:1; +