Bug 202635 - [NEW PORTS] multimedia/pHash: Open source perceptual hash library and multimedia/php-pHash (PHP extension for pHash)
Summary: [NEW PORTS] multimedia/pHash: Open source perceptual hash library and multime...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-25 03:08 UTC by Naram Qashat
Modified: 2015-09-12 01:30 UTC (History)
1 user (show)

See Also:


Attachments
pHash-0.9.6.shar (3.88 KB, text/plain)
2015-08-25 03:08 UTC, Naram Qashat
no flags Details
php-pHash-0.9.6.shar (3.57 KB, text/plain)
2015-08-25 03:09 UTC, Naram Qashat
no flags Details
Poudriere log for pHash (91.71 KB, text/plain)
2015-08-25 03:09 UTC, Naram Qashat
no flags Details
Poudriere log for php-pHash (70.84 KB, text/plain)
2015-08-25 03:09 UTC, Naram Qashat
no flags Details
pre-commit fixup (3.84 KB, patch)
2015-09-11 21:34 UTC, Jan Beich
harrison.grundy: maintainer-approval+
harrison.grundy: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naram Qashat 2015-08-25 03:08:52 UTC
Created attachment 160321 [details]
pHash-0.9.6.shar

Add new port multimedia/pHash: Open source perceptual hash library, version 0.9.6.

Also add new port multimedia/php-pHash, the PHP extension for pHash. I have patched it to compile with PHP 5.5 and later.

NOTE: I am not 100% sure if multimedia is the best category for this. The library does image, audio, and video hashing, so I figured that multimedia would work best for it, with devel as a secondary.

Shar for php-pHash, and poudriere logs, in upcoming replies.
Comment 1 Naram Qashat 2015-08-25 03:09:09 UTC
Created attachment 160322 [details]
php-pHash-0.9.6.shar
Comment 2 Naram Qashat 2015-08-25 03:09:35 UTC
Created attachment 160323 [details]
Poudriere log for pHash
Comment 3 Naram Qashat 2015-08-25 03:09:52 UTC
Created attachment 160324 [details]
Poudriere log for php-pHash
Comment 4 Jan Beich freebsd_committer freebsd_triage 2015-09-11 21:34:41 UTC
Created attachment 160940 [details]
pre-commit fixup

Everything is addressed in the attached patch waiting for your approval. OPENMP option is a bonus.

-------- multimedia/pHash -------- 

$ portlint -AC
WARN: Makefile: Consider defining LICENSE.
0 fatal errors and 1 warning found.

Does not compile with VIDEO option unselected. libpHash.so doesn't actually link against libpthread.so but bootlegs it from libavcodec.so. The issue is likely in m4/ax_pthread.m4 and can be worked around by overriding PTHREAD_LIBS from environment.

  /bin/sh ../libtool --tag=CXX   --mode=link c++  -O2 -pipe -fstack-protector -fno-strict-aliasing  -ffast-math -O3  -fstack-protector -L/usr/local/lib -o test_texthash test_texthash.o ../src/libpHash.la -lmpg123 -lsamplerate -lsndfile   -lpng -ljpeg -lfftw3
  libtool: link: c++ -O2 -pipe -fstack-protector -fno-strict-aliasing -ffast-math -O3 -fstack-protector -o .libs/test_texthash test_texthash.o  -L/usr/local/lib ../src/.libs/libpHash.so /usr/local/lib/libsndfile.so -lmpg123 -lsamplerate -lpng -ljpeg -lfftw3 -Wl,-rpath -Wl,/usr/local/lib
  ../src/.libs/libpHash.so: undefined reference to `pthread_create'
  c++: error: linker command failed with exit code 1 (use -v to see invocation)
  Makefile:323: recipe for target 'test_texthash' failed

Also, -ffast-math -O3 may hinder DEBUG builds if unconditional.

>XUSES=		gmake:lite libtool

devel/gmake-lite is mainly used to avoid a circular dependency. If devel/gmake doesn't somehow depend on this port then drop :lite.

>X--- Makefile.in.orig	2013-04-23 18:48:25 UTC
>X+++ Makefile.in
>X@@ -291,7 +291,7 @@ top_srcdir = @top_srcdir@
>X include_HEADERS = pHash-config.h
>X SUBDIRS = src bindings examples
>X EXTRA_DIST = $(subdirs) libpHash.spec
>X-pkgconfigdir = $(libdir)/pkgconfig
>X+pkgconfigdir = ${PREFIX}/libdata/pkgconfig
>X pkgconfig_DATA = pHash.pc
>X LIBTOOL_DEPS = @LIBTOOL_DEPS@

USES=pathfix exists exactly for such cases.

>X--- src/pHash.cpp.orig	2013-04-13 17:23:12 UTC
>X+++ src/pHash.cpp
>X@@ -34,7 +34,7 @@
>X int ph_num_threads()
>X {
>X 	int numCPU = 1;
>X-#ifdef __GLIBC__
>X+#if defined(__GLIBC__) || defined(__FreeBSD__)
>X 		numCPU = sysconf( _SC_NPROCESSORS_ONLN );
>X #else
>X 		int mib[2];

_SC_NPROCESSORS_ONLN maybe standardized in POSIX one day[1]. Better, use the version that would work on at least DragonFly as well.

http://austingroupbugs.net/view.php?id=339
http://muscles.dragonflybsd.org/bulk/latest-per-pkg/pHash/ (not yet)

-------- multimedia/php-pHash --------

$ portlint -AC
WARN: Makefile: Consider defining LICENSE.
0 fatal errors and 1 warning found.

>XBUILD_DEPENDS=	${LOCALBASE}/include/CImg.h:${PORTSDIR}/graphics/cimg

Looking under ${WRKSRC} nothing uses CImg.h unlike multimedia/pHash where it's conditional against some options. Maybe make it RUN_DEPENDS there to avoid leaking the implementation detail into consumers.

>XWRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}/bindings/php

Convert to WRKSRC_SUBDIR.

>Xpre-install:
>X	@${STRIP_CMD} ${WRKSRC}/modules/pHash.so

Redundant as Mk/bsd.php.mk uses INSTALL_LIB which strips module according to STRIP variable or DEBUG option. Also, see install(1) manpage for -s flag.
Comment 5 Naram Qashat 2015-09-11 22:34:28 UTC
Comment on attachment 160940 [details]
pre-commit fixup

The changes being made to the ports before commit are more than acceptable. I'll be honest in saying that I had no idea that gmake:lite was to avoid circular dependencies or that pathfix was meant to fix where pkg-config entries go. (I might need to do this for some of my other ports now.)
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-09-11 23:27:53 UTC
A commit references this bug:

Author: jbeich
Date: Fri Sep 11 23:27:48 UTC 2015
New revision: 396723
URL: https://svnweb.freebsd.org/changeset/ports/396723

Log:
  multimedia/pHash: add new port

  PR:		202635
  Submitted by:	Naram Qashat <cyberbotx@cyberbotx.com>

  pHash is an open source software library released under the GPLv3 license that
  implements several perceptual hashing algorithms, and provides a C-like API to
  use those functions in your own programs. pHash itself is written in C++.

  http://phash.org/

Changes:
  head/multimedia/Makefile
  head/multimedia/pHash/
  head/multimedia/pHash/Makefile
  head/multimedia/pHash/distinfo
  head/multimedia/pHash/files/
  head/multimedia/pHash/files/patch-src_pHash.cpp
  head/multimedia/pHash/pkg-descr
  head/multimedia/pHash/pkg-plist
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-09-11 23:28:55 UTC
A commit references this bug:

Author: jbeich
Date: Fri Sep 11 23:28:04 UTC 2015
New revision: 396724
URL: https://svnweb.freebsd.org/changeset/ports/396724

Log:
  multimedia/php-pHash: add new port

  PR:		202635
  Submitted by:	Naram Qashat <cyberbotx@cyberbotx.com>

  This is the PHP extension of the pHash library, which is an open source software
  library released under the GPLv3 license that implements several perceptual
  hashing algorithms, and provides a C-like API to use those functions in your own
  programs. pHash itself is written in C++.

  http://phash.org/

Changes:
  head/multimedia/Makefile
  head/multimedia/php-pHash/
  head/multimedia/php-pHash/Makefile
  head/multimedia/php-pHash/distinfo
  head/multimedia/php-pHash/files/
  head/multimedia/php-pHash/files/patch-pHash.cpp
  head/multimedia/php-pHash/pkg-descr
Comment 8 Jan Beich freebsd_committer freebsd_triage 2015-09-11 23:30:48 UTC
Thanks. Committed.
Comment 9 Harrison Grundy 2015-09-12 01:30:29 UTC
Comment on attachment 160940 [details]
pre-commit fixup

Maintainer Approved (Per CyberBotX)