aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2016-04-02 01:23:44 +0800
committerjbeich <jbeich@FreeBSD.org>2016-04-02 01:23:44 +0800
commit46ee2b3b53250f5091f892b584bbeecc201fcfce (patch)
treedc6813f5561977285edb733e771a31f657851eef
parent77ed66fb46da6c39bc0869b76100924b8e877ee4 (diff)
downloadfreebsd-ports-gnome-46ee2b3b53250f5091f892b584bbeecc201fcfce.tar.gz
freebsd-ports-gnome-46ee2b3b53250f5091f892b584bbeecc201fcfce.tar.zst
freebsd-ports-gnome-46ee2b3b53250f5091f892b584bbeecc201fcfce.zip
graphics/sekrit-twc-zimg: add new port
The "z" library implements the commonly required image processing basics of scaling, colorspace conversion, and depth conversion. A simple API enables conversion between any supported formats to operate with minimal knowledge from the programmer. All library routines were designed from the ground-up with flexibility, thread-safety, and correctness as first priorities. Allocation, buffering, and I/O are cleanly separated from processing, allowing the programmer to adapt "z" to many scenarios. https://github.com/sekrit-twc/zimg
-rw-r--r--graphics/Makefile1
-rw-r--r--graphics/sekrit-twc-zimg/Makefile57
-rw-r--r--graphics/sekrit-twc-zimg/distinfo2
-rw-r--r--graphics/sekrit-twc-zimg/files/patch-no-extra-deps113
-rw-r--r--graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__sse2__test.cpp11
-rw-r--r--graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__test.cpp36
-rw-r--r--graphics/sekrit-twc-zimg/pkg-descr10
-rw-r--r--graphics/sekrit-twc-zimg/pkg-plist9
8 files changed, 239 insertions, 0 deletions
diff --git a/graphics/Makefile b/graphics/Makefile
index 43f96f50c883..751b6696598a 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -978,6 +978,7 @@
SUBDIR += seam-carving-gui
SUBDIR += seejpeg
SUBDIR += seexpr
+ SUBDIR += sekrit-twc-zimg
SUBDIR += seom
SUBDIR += separate
SUBDIR += seq2gif
diff --git a/graphics/sekrit-twc-zimg/Makefile b/graphics/sekrit-twc-zimg/Makefile
new file mode 100644
index 000000000000..148f7bf80498
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/Makefile
@@ -0,0 +1,57 @@
+# $FreeBSD$
+
+PORTNAME= zimg
+PORTVERSION= 2.0.4
+DISTVERSIONPREFIX= release-
+CATEGORIES= graphics
+PKGNAMEPREFIX= ${GH_ACCOUNT}-
+
+MAINTAINER= jbeich@FreeBSD.org
+COMMENT= Scaling, colorspace conversion, and dithering library
+
+LICENSE= WTFPL2
+LICENSE_NAME= Do What The Fuck You Want To Public License version 2
+LICENSE_FILE= ${WRKSRC}/COPYING
+LICENSE_PERMS= ${_LICENSE_PERMS_DEFAULT}
+
+USE_GITHUB= yes
+GH_ACCOUNT= sekrit-twc
+
+USES= autoreconf compiler:c++11-lib gmake libtool pathfix
+EXTRACT_AFTER_ARGS= --exclude test/extra
+PATHFIX_MAKEFILEIN= Makefile.am
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --enable-testapp
+CFLAGS+= -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH_TR1 \
+ -D_DECLARE_C99_LDBL_MATH # XXX ports/193528
+INSTALL_TARGET= install-strip
+USE_LDCONFIG= yes
+
+OPTIONS_DEFINE= TEST
+
+OPTIONS_DEFINE_amd64= SIMD
+OPTIONS_DEFINE_i386= SIMD
+OPTIONS_DEFAULT_amd64= SIMD
+OPTIONS_DEFAULT_i386= SIMD # runtime detection
+
+SIMD_CONFIGURE_ENABLE= x86simd
+
+TEST_BUILD_DEPENDS= googletest>=1.6.0:devel/googletest
+TEST_USES= localbase
+TEST_CONFIGURE_ENABLE= unit-test
+TEST_TEST_TARGET= check VERBOSE=1
+
+post-patch:
+ @${REINPLACE_CMD} -e 's/x86_64/&|amd64/g' \
+ ${WRKSRC}/configure.ac
+ @${REINPLACE_CMD} -e 's/-O2 //' \
+ -e '/zimg-test/ { s/+=/=/; s/^noinst_/bin_/; } ' \
+ ${WRKSRC}/Makefile.am
+ @${REINPLACE_CMD} -e 's/nullptr_t/std::&/' \
+ -e 's/off64_t/off_t/' \
+ ${WRKSRC}/src/testcommon/json.* \
+ ${WRKSRC}/src/testcommon/mmap.cpp
+
+pre-install-TEST-on: do-test
+
+.include <bsd.port.mk>
diff --git a/graphics/sekrit-twc-zimg/distinfo b/graphics/sekrit-twc-zimg/distinfo
new file mode 100644
index 000000000000..fe97b9a513df
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/distinfo
@@ -0,0 +1,2 @@
+SHA256 (sekrit-twc-zimg-release-2.0.4_GH0.tar.gz) = e3b1f5b9f8ce750f96b9bc9801ff5d6aa931d35300d67711826e397df43c5245
+SIZE (sekrit-twc-zimg-release-2.0.4_GH0.tar.gz) = 174469
diff --git a/graphics/sekrit-twc-zimg/files/patch-no-extra-deps b/graphics/sekrit-twc-zimg/files/patch-no-extra-deps
new file mode 100644
index 000000000000..19197742cc02
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/files/patch-no-extra-deps
@@ -0,0 +1,113 @@
+--- Makefile.am.orig 2016-01-22 18:12:28 UTC
++++ Makefile.am
+@@ -197,35 +197,16 @@ endif # TESTAPP
+ if UNIT_TEST
+ TESTS = test/unit_test
+
+-check_LTLIBRARIES = test/libmusl_m.la
+ check_PROGRAMS = test/unit_test
+
+-test_libmusl_m_la_CFLAGS = $(AM_CFLAGS) -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable
+-
+-test_libmusl_m_la_SOURCES = test/extra/musl-libm/__cos.c \
+- test/extra/musl-libm/__rem_pio2.c \
+- test/extra/musl-libm/__rem_pio2_large.c \
+- test/extra/musl-libm/__sin.c \
+- test/extra/musl-libm/cos.c \
+- test/extra/musl-libm/fpu_wrapper.c \
+- test/extra/musl-libm/libm.h \
+- test/extra/musl-libm/mymath.h \
+- test/extra/musl-libm/pow.c \
+- test/extra/musl-libm/powf.c \
+- test/extra/musl-libm/sin.c
+-
+ test_unit_test_CPPFLAGS = -I$(srcdir)/src/zimg \
+ -I$(srcdir)/test \
+- -I$(srcdir)/test/extra \
+- -I$(srcdir)/test/extra/googletest/googletest/include
++ -I$(srcdir)/test/extra
+
+ test_unit_test_SOURCES = test/main.cpp \
+ test/colorspace/colorspace_test.cpp \
+ test/depth/depth_convert_test.cpp \
+ test/depth/dither_test.cpp \
+- test/extra/sha1/config.h \
+- test/extra/sha1/sha1.c \
+- test/extra/sha1/sha1.h \
+ test/graph/audit_buffer.cpp \
+ test/graph/audit_buffer.h \
+ test/graph/basic_filter_test.cpp \
+@@ -247,7 +228,6 @@ test_unit_test_SOURCES += test/colorspac
+
+ endif #X86SIMD
+
+-test_unit_test_LDADD = test/extra/googletest/googletest/lib/libgtest.la \
+- test/libmusl_m.la \
++test_unit_test_LDADD = -lgtest -lmd -lpthread \
+ libzimg.la
+ endif # UNIT_TEST
+--- configure.ac.orig 2016-01-22 18:12:28 UTC
++++ configure.ac
+@@ -29,8 +29,6 @@ AS_IF([test "x$enable_unit_test" = "xyes
+ [x86_64], [],
+ [AC_MSG_WARN([Could not determine how to enable IEEE-754 compliance on host. Tests may fail.])]
+ )
+- AC_CONFIG_SUBDIRS(test/extra/googletest/googletest)
+- AC_SUBST([CONFIG_SUBDIRS], [test/extra/googletest/googletest])
+ ],
+ )
+
+--- test/graph/filter_validator.cpp.orig 2016-01-22 18:12:28 UTC
++++ test/graph/filter_validator.cpp
+@@ -13,7 +13,7 @@
+ #include "gtest/gtest.h"
+
+ extern "C" {
+- #include "sha1/sha1.h"
++ #include <sha.h>
+ }
+
+ #include "audit_buffer.h"
+@@ -35,14 +35,14 @@ void hash_buffer(const AuditBuffer<T> &b
+ auto image_buffer = buf.as_read_buffer();
+ SHA1_CTX sha_ctx;
+
+- SHA1Init(&sha_ctx);
++ SHA1_Init(&sha_ctx);
+
+ for (unsigned i = 0; i < height; ++i) {
+ const unsigned char *ptr = zimg::graph::static_buffer_cast<const unsigned char>(image_buffer[p])[i];
+- SHA1Update(&sha_ctx, ptr, width * sizeof(T));
++ SHA1_Update(&sha_ctx, ptr, width * sizeof(T));
+ }
+
+- SHA1Final(digest, &sha_ctx);
++ SHA1_Final(digest, &sha_ctx);
+ }
+
+ std::string hash_to_str(const unsigned char digest[20])
+--- test/main.cpp.orig 2016-01-22 18:12:28 UTC
++++ test/main.cpp
+@@ -3,22 +3,11 @@
+ #include "common/libm_wrapper.h"
+
+ #include "gtest/gtest.h"
+-#include "musl-libm/mymath.h"
+-
+-void wrap_libm()
+-{
+- _zimg_sin = mysin;
+- _zimg_cos = mycos;
+- _zimg_pow = mypow;
+- _zimg_powf = mypowf;
+-}
+
+ int main(int argc, char **argv)
+ {
+ int ret;
+
+- wrap_libm();
+-
+ ::testing::InitGoogleTest(&argc, argv);
+ ret = RUN_ALL_TESTS();
+
diff --git a/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__sse2__test.cpp b/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__sse2__test.cpp
new file mode 100644
index 000000000000..99afc2ea8336
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__sse2__test.cpp
@@ -0,0 +1,11 @@
+--- test/resize/resize_impl_sse2_test.cpp.orig 2016-01-22 18:12:28 UTC
++++ test/resize/resize_impl_sse2_test.cpp
+@@ -7,6 +7,8 @@
+ #include "gtest/gtest.h"
+ #include "graph/filter_validator.h"
+
++#include <cmath> // INFINITY
++
+ namespace {;
+
+ void test_case(const zimg::resize::Filter &filter, bool horizontal, unsigned src_w, unsigned src_h, unsigned dst_w, unsigned dst_h,
diff --git a/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__test.cpp b/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__test.cpp
new file mode 100644
index 000000000000..57010adfee5f
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/files/patch-test_resize_resize__impl__test.cpp
@@ -0,0 +1,36 @@
+test/resize/resize_impl_test.cpp:37:3: error: no matching conversion for functional-style cast from
+ 'std::__1::unique_ptr<zimg::graph::ImageFilter,
+ std::__1::default_delete<zimg::graph::ImageFilter> >' to '::testing::AssertionResult'
+ ASSERT_TRUE(filter);
+ ^~~~~~~~~~~~~~~~~~~
+/usr/local/include/gtest/gtest.h:1921:3: note: expanded from macro 'ASSERT_TRUE'
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/usr/local/include/gtest/internal/gtest-internal.h:1111:7: note: expanded from macro
+ 'GTEST_TEST_BOOLEAN_'
+ ::testing::AssertionResult(expression)) \
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/usr/local/include/gtest/gtest.h:260:3: note: candidate constructor not viable: no known conversion
+ from 'std::__1::unique_ptr<zimg::graph::ImageFilter,
+ std::__1::default_delete<zimg::graph::ImageFilter> >' to 'const testing::AssertionResult' for
+ 1st argument
+ AssertionResult(const AssertionResult& other);
+ ^
+/usr/local/include/gtest/gtest.h:262:12: note: candidate constructor not viable: no known conversion
+ from 'std::__1::unique_ptr<zimg::graph::ImageFilter,
+ std::__1::default_delete<zimg::graph::ImageFilter> >' to 'bool' for 1st argument
+ explicit AssertionResult(bool success) : success_(success) {}
+ ^
+1 error generated.
+
+--- test/resize/resize_impl_test.cpp.orig 2016-01-22 18:12:28 UTC
++++ test/resize/resize_impl_test.cpp
+@@ -34,7 +34,7 @@ void test_case(const zimg::PixelFormat &
+ set_shift(shift).
+ set_subwidth(subwidth_factor * (horizontal ? src_w : src_h)).create();
+
+- ASSERT_TRUE(filter);
++ ASSERT_TRUE(static_cast<bool>(filter));
+ validate_filter(filter.get(), src_w, src_h, format, expected_sha1[sha1_idx++]);
+ }
+ }
diff --git a/graphics/sekrit-twc-zimg/pkg-descr b/graphics/sekrit-twc-zimg/pkg-descr
new file mode 100644
index 000000000000..73e1caf2d2c5
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/pkg-descr
@@ -0,0 +1,10 @@
+The "z" library implements the commonly required image processing
+basics of scaling, colorspace conversion, and depth conversion. A
+simple API enables conversion between any supported formats to operate
+with minimal knowledge from the programmer. All library routines were
+designed from the ground-up with flexibility, thread-safety, and
+correctness as first priorities. Allocation, buffering, and I/O are
+cleanly separated from processing, allowing the programmer to adapt
+"z" to many scenarios.
+
+WWW: https://github.com/sekrit-twc/zimg
diff --git a/graphics/sekrit-twc-zimg/pkg-plist b/graphics/sekrit-twc-zimg/pkg-plist
new file mode 100644
index 000000000000..6a89e85c2963
--- /dev/null
+++ b/graphics/sekrit-twc-zimg/pkg-plist
@@ -0,0 +1,9 @@
+bin/zimg-test
+include/zimg++.hpp
+include/zimg.h
+lib/libzimg.a
+lib/libzimg.so
+lib/libzimg.so.2
+lib/libzimg.so.2.0.0
+lib/zimg/vszimg.so
+libdata/pkgconfig/zimg.pc