Skip to content

Commit

Permalink
Merge pull request #1309 from citrus-it/dcraw
Browse files Browse the repository at this point in the history
ImageMagick: Use dcraw to convert raw images
  • Loading branch information
hadfl authored Jun 25, 2023
2 parents fe811c6 + a814d97 commit 87c1f3e
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 3 deletions.
95 changes: 95 additions & 0 deletions build/dcraw/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}

# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.

. ../../lib/build.sh

PROG=dcraw
PKG=ooce/multimedia/dcraw
VER=9.28.0
SUMMARY="Raw digital photograph decoder"
DESC="dcraw - Decoding raw digital photographs"

LCMSVER=2.15
JASPERVER=4.0.0

XFORM_ARGS="
-DPREFIX=${PREFIX#/}
-DJASPERVER=$JASPERVER
-DLCMSVER=$LCMSVER
"

SKIP_LICENCES='JasPer'

set_arch 64
set_builddir $PROG

init
prep_build

#########################################################################

save_buildenv

unset CONFIGURE_OPTS
CONFIGURE_OPTS="--prefix=/usr --disable-shared"
build_dependency lcms2 lcms2-$LCMSVER $PROG/lcms2 lcms2 $LCMSVER

unset CONFIGURE_OPTS
CONFIGURE_OPTS+=" -DCMAKE_INSTALL_PREFIX=/usr"
CONFIGURE_OPTS+=" -DJAS_ENABLE_SHARED=false"
build_dependency -cmake jasper jasper-$JASPERVER $PROG/jasper jasper $JASPERVER

restore_buildenv

CPPFLAGS+=" -I$DEPROOT/usr/include"
LDFLAGS+=" -L$DEPROOT/usr/lib"

#########################################################################

note -n "-- Building $PROG"

configure_arch() {
typeset arch=$1

CPPFLAGS+=" -I$OOCEOPT/include"
LDFLAGS+=" -L$OOCEOPT/${LIBDIRS[$arch]} -R$OOCEOPT/${LIBDIRS[$arch]}"

subsume_arch $arch CPPFLAGS
subsume_arch $arch CFLAGS
subsume_arch $arch LDFLAGS
}

make_arch() {
typeset arch=$1

logcmd $GCC $CPPFLAGS $CFLAGS -o dcraw dcraw.c \
$LDFLAGS -lm -ljasper -llcms2 -ljpeg -lheif || logerr "build failed"
}

make_install() {
logcmd $MKDIR -p $DESTDIR/$PREFIX/bin $DESTDIR/$PREFIX/share/man/man1
logcmd $CP $PROG $DESTDIR/$PREFIX/bin || logerr "cp $PROG"
logcmd $CP $PROG.1 $DESTDIR/$PREFIX/share/man/man1/ || logerr "cp $PROG.1"
}

download_source $PROG $PROG $VER
patch_source
build
make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
14 changes: 14 additions & 0 deletions build/dcraw/local.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.

# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.

license ../jasper-$(JASPERVER)/LICENSE.txt license=JasPer
license ../lcms2-$(LCMSVER)/COPYING license=MIT

4 changes: 4 additions & 0 deletions build/imagemagick/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ BUILD_DEPENDS_IPS="
ooce/application/graphviz
"

RUN_DEPENDS_IPS="
ooce/multimedia/dcraw
"

XFORM_ARGS="
-DPREFIX=${PREFIX#/}
-DOPREFIX=${OPREFIX#/}
Expand Down
36 changes: 36 additions & 0 deletions build/imagemagick/patches/dcraw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/MagickCore/delegate.c a/MagickCore/delegate.c
--- a~/MagickCore/delegate.c 1970-01-01 00:00:00
+++ a/MagickCore/delegate.c 1970-01-01 00:00:00
@@ -106,7 +106,7 @@ static const char
" <delegate decode=\"https\" command=\"&quot;curl&quot; -s -k -L -o &quot;%o&quot; &quot;https:%M&quot;\"/>"
" <delegate decode=\"doc\" command=\"&quot;soffice&quot; --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; mv &quot;%i.pdf&quot; &quot;%o&quot;\"/>"
" <delegate decode=\"docx\" command=\"&quot;soffice&quot; --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; mv &quot;%i.pdf&quot; &quot;%o&quot;\"/>"
- " <delegate decode=\"dng:decode\" command=\"&quot;ufraw-batch&quot; --silent --create-id=also --out-type=png --out-depth=16 &quot;--output=%u.png&quot; &quot;%i&quot;\"/>"
+ " <delegate decode=\"dng:decode\" command=\"/opt/ooce/bin/dcraw -c -q 3 -H 5 -w &quot;%i&quot; &gt; &quot;%u.ppm&quot;\"/>"
" <delegate decode=\"dot\" command=\"&quot;dot&quot; -Tsvg &quot;%i&quot; -o &quot;%o&quot;\"/>"
" <delegate decode=\"dvi\" command=\"&quot;dvips&quot; -sstdout=%%stderr -o &quot;%o&quot; &quot;%i&quot;\"/>"
" <delegate decode=\"dxf\" command=\"&quot;uniconvertor&quot; &quot;%i&quot; &quot;%o.svg&quot;; mv &quot;%o.svg&quot; &quot;%o&quot;\"/>"
diff -wpruN --no-dereference '--exclude=*.orig' a~/config/delegates.xml.in a/config/delegates.xml.in
--- a~/config/delegates.xml.in 1970-01-01 00:00:00
+++ a/config/delegates.xml.in 1970-01-01 00:00:00
@@ -66,7 +66,7 @@
<delegate decode="https:decode" command="&quot;@WWWDecodeDelegate@&quot; -s -k -L -o &quot;%u.dat&quot; &quot;https:%M&quot;"/>
<delegate decode="doc" command="&quot;@DOCDecodeDelegate@&quot; --headless --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; @MVDelegate@ &quot;%i.pdf&quot; &quot;%o&quot;"/>
<delegate decode="docx" command="&quot;@DOCDecodeDelegate@&quot; --headless --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; @MVDelegate@ &quot;%i.pdf&quot; &quot;%o&quot;"/>
- <delegate decode="dng:decode" command="&quot;@DNGDecodeDelegate@&quot; --silent --create-id=also --out-type=png --out-depth=16 &quot;--output=%u.png&quot; &quot;%i&quot;"/>
+ <delegate decode="dng:decode" stealth="True" command="/opt/ooce/bin/dcraw -c -q 3 -H 5 -w &quot;%i&quot; &gt; &quot;%u.ppm&quot;"/>
<delegate decode="dot" command="&quot;@GVCDecodeDelegate@&quot; -Tsvg &quot;%i&quot; -o &quot;%o&quot;" />
<delegate decode="dvi" command="&quot;@DVIDecodeDelegate@&quot; -sstdout=%%stderr -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="edit" stealth="True" command="&quot;@EditorDelegate@&quot; -title &quot;Edit Image Comment&quot; -e vi &quot;%o&quot;"/>
diff -wpruN --no-dereference '--exclude=*.orig' a~/www/source/delegates.xml a/www/source/delegates.xml
--- a~/www/source/delegates.xml 1970-01-01 00:00:00
+++ a/www/source/delegates.xml 1970-01-01 00:00:00
@@ -67,7 +67,7 @@
<delegate decode="https" command="&quot;curl&quot; -s -k -L -o &quot;%o&quot; &quot;https:%M&quot;"/>
<delegate decode="doc" command="&quot;soffice&quot; --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; /usr/bin/mv &quot;%i.pdf&quot; &quot;%o&quot;"/>
<delegate decode="docx" command="&quot;soffice&quot; --convert-to pdf -outdir `dirname &quot;%i&quot;` &quot;%i&quot; 2&gt; &quot;%u&quot;; /usr/bin/mv &quot;%i.pdf&quot; &quot;%o&quot;"/>
- <delegate decode="dng:decode" command="&quot;ufraw-batch&quot; --silent --create-id=also --out-type=png --out-depth=16 &quot;--output=%u.png&quot; &quot;%i&quot;"/>
+ <delegate decode="dng:decode" stealth="True" command="/opt/ooce/bin/dcraw -c -q 3 -H 5 -w &quot;%i&quot; &gt; &quot;%u.ppm&quot;"/>
<delegate decode="dot" command='&quot;dot&quot; -Tsvg &quot;%i&quot; -o &quot;%o&quot;' />
<delegate decode="dvi" command="&quot;dvips&quot; -sstdout=%%stderr -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="dxf" command="&quot;uniconvertor&quot; &quot;%i&quot; &quot;%o.svg&quot;; /usr/bin/mv &quot;%o.svg&quot; &quot;%o&quot;"/>
4 changes: 2 additions & 2 deletions build/imagemagick/patches/la.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ correct location.
This patch comes from in-house. It has not been submitted upstream; plans
unclear.

diff -wpruN '--exclude=*.orig' a~/MagickCore/module.c a/MagickCore/module.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/MagickCore/module.c a/MagickCore/module.c
--- a~/MagickCore/module.c 1970-01-01 00:00:00
+++ a/MagickCore/module.c 1970-01-01 00:00:00
@@ -77,7 +77,7 @@ typedef void *ModuleHandle;
Expand Down Expand Up @@ -34,7 +34,7 @@ diff -wpruN '--exclude=*.orig' a~/MagickCore/module.c a/MagickCore/module.c
#endif
}

diff -wpruN '--exclude=*.orig' a~/common.shi.in a/common.shi.in
diff -wpruN --no-dereference '--exclude=*.orig' a~/common.shi.in a/common.shi.in
--- a~/common.shi.in 1970-01-01 00:00:00
+++ a/common.shi.in 1970-01-01 00:00:00
@@ -19,9 +19,9 @@ VALIDATE="@abs_top_builddir@/tests/valid
Expand Down
1 change: 1 addition & 0 deletions build/imagemagick/patches/series
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
la.patch
dcraw.patch
1 change: 1 addition & 0 deletions doc/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
| ooce/library/tiff | 4.5.0 | https://download.osgeo.org/libtiff/ https://libtiff.gitlab.io/libtiff/ | [omniosorg](https://github.com/omniosorg)
| ooce/library/unistring | 1.1 | https://ftp.gnu.org/gnu/libunistring/ | [omniosorg](https://github.com/omniosorg)
| ooce/multimedia/dav1d | 1.2.1 | https://downloads.videolan.org/pub/videolan/dav1d/ https://www.videolan.org/projects/dav1d.html | [omniosorg](https://github.com/omniosorg)
| ooce/multimedia/dcraw | 9.28.0 | https://www.dechifro.org/dcraw/archive/ | [omniosorg](https://github.com/omniosorg)
| ooce/multimedia/exif | 0.6.21 | https://sourceforge.net/projects/libexif/files/exif/ | [omniosorg](https://github.com/omniosorg)
| ooce/multimedia/ffmpeg | 6.0 | https://www.ffmpeg.org/download.html#releases | [omniosorg](https://github.com/omniosorg)
| ooce/multimedia/minidlna | 1.3.3 | https://sourceforge.net/projects/minidlna/files/minidlna/ | [omniosorg](https://github.com/omniosorg)
Expand Down
8 changes: 7 additions & 1 deletion lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2756,14 +2756,16 @@ build_dependency() {
typeset merge=0
typeset oot=0
typeset meson=0
typeset cmake=0
typeset buildargs=
while [[ "$1" = -* ]]; do
case $1 in
-merge) merge=1 ;;
-ctf) buildargs+=" -ctf" ;;
-noctf) buildargs+=" -noctf" ;;
-meson) meson=1 ;& #FALLTHROUGH
-oot) oot=1 ;;
-meson) meson=1 ; oot=1 ;;
-cmake) cmake=1; oot=1 ;;
-multi) buildargs+=" -multi" ;;
esac
shift
Expand Down Expand Up @@ -2800,6 +2802,10 @@ build_dependency() {
MAKE=$NINJA
CONFIGURE_CMD="/usr/lib/python$PYTHONVER/bin/meson setup"
CONFIGURE_CMD+=" $TMPDIR/$BUILDDIR"
elif ((cmake)); then
MAKE=$NINJA
CONFIGURE_CMD="$CMAKE -GNinja"
CONFIGURE_CMD+=" $TMPDIR/$BUILDDIR"
else
CONFIGURE_CMD=$TMPDIR/$BUILDDIR/$CONFIGURE_CMD
fi
Expand Down

0 comments on commit 87c1f3e

Please sign in to comment.