summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media-gfx/cataract/Manifest4
-rw-r--r--media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild48
-rw-r--r--media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.patch286
-rw-r--r--media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporting.patch123
-rw-r--r--profiles/package.mask4
5 files changed, 465 insertions, 0 deletions
diff --git a/media-gfx/cataract/Manifest b/media-gfx/cataract/Manifest
index 9186d65..56bf346 100644
--- a/media-gfx/cataract/Manifest
+++ b/media-gfx/cataract/Manifest
@@ -1,3 +1,7 @@
+AUX cataract-1.1.0_p20110326-exif-orientation.patch 10051 RMD160 8e4b69f6b028182c5ef15416245f00ccffc2d059 SHA1 cfa03dc1f3ac37454a235c8781109e03f3b1767f SHA256 889bdc5856e1353583c47883a57756d81c892797ad0d5eeb84b72a1c1c398795
+AUX cataract-1.1.0_p20110326-setup.xml-reporting.patch 3881 RMD160 f77285e53cccbee919241df8e276848519bfbe9f SHA1 4a07739d686bc7ac9f2df0ce753f6c9b83c4c4ba SHA256 b15c46f3fe8b8cdbdd40643b9f66b36dce729f8609e727d8e75172e9b06a63c7
DIST cataract-1.1.0.tar.bz2 4750865 RMD160 9837d3a83db2951e03425d905f98610ab208d9f5 SHA1 5a13a7b4be0ed97598d12f10edfc2ec5148701f6 SHA256 6d6831df842c66c7af1cea9506d1927aa38dd2c01cae04d7e213e0a9fcce1457
+DIST cataract-1.1.0_p20110326.tar.bz2 4583211 RMD160 c0131589007bcf24760daac0daaa99bc9d23078e SHA1 8840c95cd9b322e256659ef5327b2f99e9729d11 SHA256 1841aa6d10f6fbbda0b9cc157bab1fcb6794a051d21500d107643e438d10f437
EBUILD cataract-1.1.0-r1.ebuild 805 RMD160 cc39d93f043bccee60a03405a07a745626906b1e SHA1 ee8464901469f7de9c4134c3dfbba032152f0b16 SHA256 d897f47a74b2006b5a553ad443095016acffb7a58097332eaf7b69f499cfdd3d
+EBUILD cataract-1.1.0_p20110326_p2.ebuild 1094 RMD160 adef5ddd24452074734aae89e66f4e4342ca619e SHA1 7bcae53e6b5171e0414aecc8372538abf54d264a SHA256 66f534dfc03a56501880c7df244592dd2ca483a69288d98d5ddd39e23e03686d
MISC metadata.xml 257 RMD160 04e4c6e678ba8e8ffde93f57d06a40b60f9eaa69 SHA1 e3c39bf9a25beebbe626726bb94f6e22db4fa06d SHA256 b4a209de2bfbbcc5ceab61bf458a1ee79da4c60a30e4aabf54b76e9709b56db8
diff --git a/media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild b/media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild
new file mode 100644
index 0000000..721a328
--- /dev/null
+++ b/media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit versionator autotools
+
+MY_PV=$(get_version_component_range 1-4)
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Simple static web photo gallery, designed to be clean and easily usable."
+HOMEPAGE="http://cgg.bzatek.net/"
+SRC_URI="http://www.hartwork.org/public/${MY_P}.tar.bz2"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/glib
+ dev-libs/libxml2
+ media-gfx/imagemagick
+ media-gfx/exiv2"
+DEPEND="${RDEPEND}
+ dev-util/pkgconfig"
+
+S="${WORKDIR}"/${MY_P}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${MY_P}-setup.xml-reporting.patch \
+ "${FILESDIR}"/${MY_P}-exif-orientation.patch
+
+ mkdir m4 # Workaround for aclocal
+ eautoreconf
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc NEWS README AUTHORS || die
+
+ # Install sample
+ rm sample/{gen.sh,Makefile*} || die
+ sed 's|<path>../../templates</path>|<path>/usr/share/cgg</path>|' \
+ -i sample/src/setup.xml || die
+ insinto /usr/share/cgg/
+ doins -r sample || die
+}
diff --git a/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.patch b/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.patch
new file mode 100644
index 0000000..553a618
--- /dev/null
+++ b/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.patch
@@ -0,0 +1,286 @@
+From c73706517be3141742f575aa2f18050aa78954f4 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Mon, 6 Jun 2011 02:45:56 +0200
+Subject: [PATCH 2/2] Add support for EXIF orientation tags
+
+---
+ src/generators.c | 16 ++++---
+ src/jpeg-utils.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ src/jpeg-utils.h | 8 +++-
+ 3 files changed, 118 insertions(+), 14 deletions(-)
+
+diff --git a/src/generators.c b/src/generators.c
+index 95bed37..1a865a5 100644
+--- a/src/generators.c
++++ b/src/generators.c
+@@ -1,5 +1,6 @@
+ /* Cataract - Static web photo gallery generator
+ * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
++ * Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -158,7 +159,8 @@ generate_image (TGallerySetup *setup,
+
+ /* Do something when necessary */
+ if (res) {
+- get_image_sizes (img_src_full, &new_w, &new_h);
++ OrientationType orientation = UndefinedOrientation;
++ get_image_sizes (img_src_full, &new_w, &new_h, &orientation);
+
+ if (new_w > 0 && new_h > 0) {
+ stats_images_inc ();
+@@ -166,7 +168,7 @@ generate_image (TGallerySetup *setup,
+
+ /* Generate thumbnail */
+ g_assert (thumb_src_full != NULL);
+- get_image_sizes (thumb_src_full, &thumb_w, &thumb_h);
++ get_image_sizes (thumb_src_full, &thumb_w, &thumb_h, NULL);
+
+ if (thumb_w > 0 && thumb_h > 0) {
+ if (! item->hidden) {
+@@ -180,7 +182,7 @@ generate_image (TGallerySetup *setup,
+ calculate_sizes (setup->thumbnail_portrait_width, setup->thumbnail_portrait_height, &thumb_w, &thumb_h);
+ else
+ calculate_sizes (setup->thumbnail_landscape_width, setup->thumbnail_landscape_height, &thumb_w, &thumb_h);
+- if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb_h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type))
++ if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb_h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type, orientation))
+ log_error ("generate_image: error resizing thumbnail %s\n", thumb_src_full);
+ }
+ } else {
+@@ -215,7 +217,7 @@ generate_image (TGallerySetup *setup,
+ }
+
+ g_assert (img_src_full != NULL);
+- if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE, 0))
++ if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE, 0, orientation))
+ log_error ("generate_image: error resizing big image %s\n", img_src_full);
+ }
+ else {
+@@ -465,7 +467,7 @@ write_html_album (TGallerySetup *setup,
+ s2 = item_get_thumbnail_src (setup, items, item, i);
+ if (s2 != NULL) {
+ s4 = g_build_filename (path_info->dest_dir, setup->thumbnail_dir, s2, NULL);
+- get_image_sizes (s4, &img_thumb_w, &img_thumb_h);
++ get_image_sizes (s4, &img_thumb_w, &img_thumb_h, NULL);
+ g_free (s4);
+ s1 = (img_thumb_h > img_thumb_w) ? "IMG_LIST_PORTRAIT" : "IMG_LIST_LANDSCAPE";
+ }
+@@ -649,12 +651,12 @@ write_html_image (TGallerySetup *setup,
+ log_error ("write_html_image: error getting exif data from file \"%s\"\n", orig_dst);
+
+ /* Retrieve image sizes of preview and original image */
+- get_image_sizes (big_dst, &img_big_w, &img_big_h);
++ get_image_sizes (big_dst, &img_big_w, &img_big_h, NULL);
+ image_fullsize = item->force_fullsize || setup->override_nofullsize ||
+ (parent_items->fullsize && ! item->force_nofullsize) ||
+ (! item->force_nofullsize && ! parent_items->nofullsize && ! setup->nofullsize);
+ if (image_fullsize)
+- get_image_sizes (orig_dst, &img_orig_w, &img_orig_h);
++ get_image_sizes (orig_dst, &img_orig_w, &img_orig_h, NULL);
+
+ /* Get title and description from IPTC/EXIF/JPEG if not defined */
+ title = g_strdup (item->title);
+diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp
+index 55e3442..0e057b3 100644
+--- a/src/jpeg-utils.cpp
++++ b/src/jpeg-utils.cpp
+@@ -1,5 +1,6 @@
+ /* Cataract - Static web photo gallery generator
+ * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
++ * Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -22,8 +23,6 @@
+ #include <exiv2/image.hpp>
+ #include <exiv2/exif.hpp>
+
+-#include <wand/magick-wand.h>
+-
+ #include <config.h>
+
+ #include "jpeg-utils.h"
+@@ -225,6 +224,47 @@ free_exif_data (TExifData *data)
+ }
+
+
++OrientationType get_image_orientation(const char * filename) {
++ OrientationType lookup[] = {
++ UndefinedOrientation,
++ TopLeftOrientation,
++ TopRightOrientation,
++ BottomRightOrientation,
++ BottomLeftOrientation,
++ LeftTopOrientation,
++ RightTopOrientation,
++ RightBottomOrientation,
++ LeftBottomOrientation
++ };
++
++ unsigned long val = 0;
++ try
++ {
++ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open (filename);
++ g_assert (image.get() != 0);
++ image->readMetadata();
++
++ Exiv2::ExifData &exifData = image->exifData();
++ try {
++ if (! exifData.empty()) {
++ val = exifData["Exif.Image.Orientation"].toLong();
++ }
++ } catch (...) { }
++ }
++ catch (Exiv2::AnyError& e)
++ {
++ log_error ("get_exif: Caught Exiv2 exception: '%s'\n", e.what());
++ }
++
++ if (val >= sizeof(lookup)/sizeof(OrientationType)) {
++ return UndefinedOrientation;
++ } else {
++ return lookup[val];
++ }
++}
++
++
++
+ /*
+ * resize_image: resize image pointed by src and save result to dst
+ */
+@@ -233,7 +273,8 @@ resize_image (const gchar *src, const gchar *dst,
+ unsigned long size_x, unsigned long size_y,
+ int quality,
+ gboolean thumbnail,
+- ThumbnailSquareType squared_thumbnail_type)
++ ThumbnailSquareType squared_thumbnail_type,
++ OrientationType orientation)
+ {
+ MagickWand *magick_wand;
+ ExceptionType severity;
+@@ -251,6 +292,40 @@ resize_image (const gchar *src, const gchar *dst,
+ return FALSE;
+ }
+
++
++ /* http://sylvana.net/jpegcrop/exif_orientation.html */
++ PixelWand *dummy_background = NewPixelWand();
++ switch (orientation) {
++ case TopRightOrientation:
++ MagickFlopImage(magick_wand);
++ break;
++ case BottomRightOrientation:
++ MagickRotateImage(magick_wand, dummy_background, 180.0);
++ break;
++ case BottomLeftOrientation:
++ MagickFlipImage(magick_wand);
++ break;
++ case LeftTopOrientation:
++ MagickTransposeImage(magick_wand);
++ break;
++ case RightTopOrientation:
++ MagickRotateImage(magick_wand, dummy_background, 90.0);
++ break;
++ case RightBottomOrientation:
++ MagickTransverseImage(magick_wand);
++ break;
++ case LeftBottomOrientation:
++ MagickRotateImage(magick_wand, dummy_background, 270.0);
++ break;
++ case TopLeftOrientation:
++ case UndefinedOrientation:
++ default:
++ break;
++ }
++ DestroyPixelWand(dummy_background);
++ dummy_background = NULL;
++
++
+ /* Don't resize if smaller than desired size */
+ if (MagickGetImageWidth (magick_wand) > size_x ||
+ MagickGetImageHeight (magick_wand) > size_y)
+@@ -291,11 +366,11 @@ resize_image (const gchar *src, const gchar *dst,
+
+
+ /*
+- * get_image_sizes: retrieve image dimensions
++ * get_image_sizes: retrieve image dimensions (respecting EXIF orientation)
+ */
+ void
+ get_image_sizes (const gchar *img,
+- unsigned long *width, unsigned long *height)
++ unsigned long *width, unsigned long *height, OrientationType *orientation)
+ {
+ MagickWand *magick_wand;
+ ExceptionType severity;
+@@ -316,6 +391,29 @@ get_image_sizes (const gchar *img,
+ *height = MagickGetImageHeight (magick_wand);
+
+ magick_wand = DestroyMagickWand (magick_wand);
++
++ /* ImageMagick's MagickGetOrientation() seems to always return 0
++ * (even with full image read) so I use exiv2 instead */
++ const OrientationType recorded_orientation = get_image_orientation(img);
++
++ switch (recorded_orientation) {
++ case LeftTopOrientation:
++ case RightTopOrientation:
++ case RightBottomOrientation:
++ case LeftBottomOrientation:
++ { /* Swap dimensions */
++ unsigned long c = *height;
++ *height = *width;
++ *width = c;
++ }
++ break;
++ default:
++ break;
++ }
++
++ if (orientation) {
++ *orientation = recorded_orientation;
++ }
+ }
+
+
+diff --git a/src/jpeg-utils.h b/src/jpeg-utils.h
+index e5845bc..5e16502 100644
+--- a/src/jpeg-utils.h
++++ b/src/jpeg-utils.h
+@@ -1,5 +1,6 @@
+ /* Cataract - Static web photo gallery generator
+ * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
++ * Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -19,6 +20,7 @@
+ #define __CGG__JPEG_UTILS_H__
+
+ #include <glib.h>
++#include <wand/magick-wand.h> /* for OrientationType */
+ #include "setup.h"
+
+ G_BEGIN_DECLS
+@@ -73,13 +75,15 @@ gboolean resize_image (const gchar *src, const gchar *dst,
+ unsigned long size_x, unsigned long size_y,
+ int quality,
+ gboolean thumbnail,
+- ThumbnailSquareType squared_thumbnail_type);
++ ThumbnailSquareType squared_thumbnail_type,
++ OrientationType orientation);
+
+ /*
+ * get_image_sizes: retrieve image dimensions
+ */
+ void get_image_sizes (const gchar *img,
+- unsigned long *width, unsigned long *height);
++ unsigned long *width, unsigned long *height,
++ OrientationType *orientation);
+
+ /*
+ * calculate_sizes: calculate maximal image sizes within specified limits keeping aspect ratio
+--
+1.7.5.3
+
diff --git a/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporting.patch b/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporting.patch
new file mode 100644
index 0000000..c530149
--- /dev/null
+++ b/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporting.patch
@@ -0,0 +1,123 @@
+From 43577828a097c6f0cc0fe651e3d78b7a9259e248 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Sun, 5 Jun 2011 22:01:09 +0200
+Subject: [PATCH 1/2] Improve error reporting for missing setup.xml, stick to
+ first setup.xml found
+
+---
+ src/cgg.c | 18 ++++++++++++++++--
+ src/setup.c | 39 +++++++++++++++++----------------------
+ 2 files changed, 33 insertions(+), 24 deletions(-)
+
+diff --git a/src/cgg.c b/src/cgg.c
+index 0f72fb3..ca980ed 100644
+--- a/src/cgg.c
++++ b/src/cgg.c
+@@ -1,5 +1,6 @@
+ /* Cataract - Static web photo gallery generator
+ * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
++ * Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -109,6 +110,7 @@ main (int argc, char* argv[])
+ time_t time_stop;
+ gchar *s;
+ TPathInfo *path_info;
++ gchar *setup_xml_path = NULL;
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+@@ -136,11 +138,23 @@ main (int argc, char* argv[])
+ }
+
+ /* Read gallery settings */
+- setup = find_setup_xml ();
++ setup = find_setup_xml (&setup_xml_path);
+ if (! setup) {
+- fprintf (stderr, "error: could not parse gallery settings file\n");
++ if (! setup_xml_path) {
++ gchar *cwd = g_get_current_dir ();
++ gchar *home_cgg = g_build_filename (g_getenv ("HOME"), ".cgg", NULL);
++ gchar *datadir_cgg = g_build_filename (DATADIR, "cgg", NULL);
++ fprintf (stderr, "error: could not find setup.xml in\n1) %s\n2) %s\n3) %s\n", cwd, home_cgg, datadir_cgg);
++ g_free (datadir_cgg);
++ g_free (home_cgg);
++ g_free (cwd);
++ }
+ return -2;
+ }
++ if (setup_xml_path) {
++ g_free(setup_xml_path);
++ setup_xml_path = NULL;
++ }
+
+ setup->real_templates_dir = find_templates_directory (setup);
+ if (setup->real_templates_dir == NULL) {
+diff --git a/src/setup.c b/src/setup.c
+index 68c3cd3..71553c7 100644
+--- a/src/setup.c
++++ b/src/setup.c
+@@ -1,5 +1,6 @@
+ /* Cataract - Static web photo gallery generator
+ * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
++ * Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -41,36 +42,30 @@
+ * find_setup_xml: try to find setup.xml in standard paths
+ */
+ TGallerySetup *
+-find_setup_xml ()
++find_setup_xml (gchar **setup_xml_path)
+ {
+- gchar *pth;
+ gchar *cwd;
+- TGallerySetup *setup;
+-
+- setup = NULL;
+ cwd = g_get_current_dir ();
+- pth = g_build_filename (cwd, SETUP_XML, NULL);
++
++ *setup_xml_path = g_build_filename (cwd, SETUP_XML, NULL);
+ g_free (cwd);
+
+- if (g_access (pth, R_OK) == 0)
+- setup = parse_setup_xml (pth);
+- g_free (pth);
++ if (g_access (*setup_xml_path, R_OK) == 0)
++ return parse_setup_xml (*setup_xml_path);
+
+- if (! setup) {
+- pth = g_build_filename (g_getenv ("HOME"), ".cgg", SETUP_XML, NULL);
+- if (g_access (pth, R_OK) == 0)
+- setup = parse_setup_xml (pth);
+- g_free (pth);
+- }
++ g_free (*setup_xml_path);
++ *setup_xml_path = g_build_filename (g_getenv ("HOME"), ".cgg", SETUP_XML, NULL);
++ if (g_access (*setup_xml_path, R_OK) == 0)
++ return parse_setup_xml (*setup_xml_path);
+
+- if (! setup) {
+- pth = g_build_filename (DATADIR, "cgg", SETUP_XML, NULL);
+- if (g_access (pth, R_OK) == 0)
+- setup = parse_setup_xml (pth);
+- g_free (pth);
+- }
++ g_free (*setup_xml_path);
++ *setup_xml_path = g_build_filename (DATADIR, "cgg", SETUP_XML, NULL);
++ if (g_access (*setup_xml_path, R_OK) == 0)
++ return parse_setup_xml (*setup_xml_path);
+
+- return setup;
++ g_free (*setup_xml_path);
++ *setup_xml_path = NULL;
++ return NULL;
+ }
+
+
+--
+1.7.5.3
+
diff --git a/profiles/package.mask b/profiles/package.mask
index 17f8b40..814916e 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -1 +1,5 @@
~sys-apps/dbus-9999
+
+# 2011-06-06 Sebastian Pipping <sping@gentoo.org>
+# Experimental downstream patches
+=media-gfx/cataract-1.1.0_p20110326_p2