Diff below brings rhash to the latest version fixing some bugs and
adding support for a new hash function. Changelog can be found at
https://github.com/rhash/RHash/blob/v1.3.8/ChangeLog.

Notable change is that a configure script is supplied.

Changes to the port:
- New HOMEPAGE as the old one gave a 404
- Take MAINTAINER
- Add sysutils/ggrep as TDEP. Some of the tests do some grepping, which
  are not supported by our grep
- The configure script negates the use of heavy patching

Testing (amd64):
- All tests run successfully
- rhash has a single consumer: cmake. Output of 'make test' of the
  latter is the same as without this update:

99% tests passed, 5 tests failed out of 501

Label Time Summary:
Label1    =   0.09 sec*proc (1 test)
Label2    =   0.09 sec*proc (1 test)

Total Test time (real) = 2778.14 sec

The following tests FAILED:
        177 - RuntimePath (Failed)
        312 - RunCMake.CMP0060 (Failed)
        334 - RunCMake.FindLua (Failed)
        442 - RunCMake.CommandLine (Failed)
        444 - RunCMake.install (Failed)


Comments/OK?


diff --git Makefile Makefile
index 3d4cfb61aad..464fac84aae 100644
--- Makefile
+++ Makefile
@@ -2,42 +2,42 @@
 
 COMMENT =      utility and library for computing hash sums
 
-DISTNAME =     rhash-1.3.5-src
-
+DISTNAME =     rhash-1.3.8-src
 PKGNAME =      ${DISTNAME:S/-src$//}
-REVISION =     0
 
 SHARED_LIBS =  rhash 0.0
 
 CATEGORIES =   security
 
-HOMEPAGE =     http://rhash.anz.ru/
+HOMEPAGE =     http://rhash.sf.net
+
+MAINTAINER =   Bjorn Ketelaars <b...@openbsd.org>
 
 # MIT
 PERMIT_PACKAGE =       Yes
 
-WANTLIB +=     c
+WANTLIB =      c
 
 MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=rhash/}
 
-MAKE_FLAGS =   SONAME="librhash.so.${LIBrhash_VERSION}"
+TEST_DEPENDS = sysutils/ggrep
 
-FAKE_FLAGS =   PREFIX=${PREFIX} \
-               INSTALL_DATA="${INSTALL_DATA}" \
-               INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
-               INSTALL_SHARED="${INSTALL_DATA}" \
-               MANDIR=${PREFIX}/man \
-               SONAME="librhash.so.${LIBrhash_VERSION}"
+CONFIGURE_STYLE =      simple
+CONFIGURE_ARGS =       --enable-lib-static \
+                       --extra-cflags="${CFLAGS}" \
+                       --extra-ldflags="${LDFLAGS}" \
+                       --mandir=${PREFIX}/man \
+                       --prefix=${PREFIX} \
+                       --sysconfdir=${SYSCONFDIR}
 
 WRKDIST =      ${WRKDIR}/${PKGNAME:S/^rhash/RHash/}
 
-ALL_TARGET =   build-shared
-
-INSTALL_TARGET =install-shared
-
 pre-configure:
        ${SUBST_CMD} ${WRKSRC}/common_func.h \
-               ${WRKSRC}/parse_cmdline.c
+               ${WRKSRC}/configure
+
+pre-test:
+       sed -i 's,grep,ggrep,g' ${WRKSRC}/tests/test_rhash.sh
 
 do-test:
        cd ${WRKSRC}/tests && env \
diff --git distinfo distinfo
index b073854f437..67d2dc248cb 100644
--- distinfo
+++ distinfo
@@ -1,2 +1,2 @@
-SHA256 (rhash-1.3.5-src.tar.gz) = mOBoisrinmjCmP+827D4OIZBBfmyvYhXmAZkQ1sfHy4=
-SIZE (rhash-1.3.5-src.tar.gz) = 316867
+SHA256 (rhash-1.3.8-src.tar.gz) = vlNqVqz+/IfbyLHbMPxjkCDkHt8FUYGF6phjDj33wEw=
+SIZE (rhash-1.3.8-src.tar.gz) = 393544
diff --git patches/patch-Makefile patches/patch-Makefile
index e84596ccc4b..97011bccaf8 100644
--- patches/patch-Makefile
+++ patches/patch-Makefile
@@ -3,46 +3,14 @@ $OpenBSD: patch-Makefile,v 1.2 2017/08/14 12:20:57 dcoppa Exp 
$
 Index: Makefile
 --- Makefile.orig
 +++ Makefile
-@@ -6,10 +6,10 @@ VERSION = 1.3.5
- PREFIX  ?= /usr/local
- CC      ?= gcc
- # using OPTFLAGS/OPTLDFLAGS for compatibilty with old scripts using this 
makefile
--OPTFLAGS = -O2 -DNDEBUG -fomit-frame-pointer -ffunction-sections 
-fdata-sections
-+OPTFLAGS = -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections
- OPTLDFLAGS =
--CFLAGS = $(OPTFLAGS)
--LDFLAGS = $(OPTLDFLAGS)
-+CFLAGS += $(OPTFLAGS)
-+LDFLAGS += $(OPTLDFLAGS)
- ADDCFLAGS =
- ADDLDFLAGS =
- ALLCFLAGS = -pipe $(CFLAGS) $(ADDCFLAGS) \
-@@ -71,7 +71,7 @@ lib-shared: $(SHAREDLIB)
- lib-static: $(LIBRHASH)
- 
- install: build-install-binary install-data install-symlinks
--install-shared: build-install-shared-binary install-data install-symlinks
-+install-shared: build-install-shared-binary install-lib-static 
install-lib-shared install-data install-symlinks
- install-data: install-man install-conf
- uninstall: uninstall-binary uninstall-data uninstall-symlinks uninstall-lib
- 
-@@ -112,8 +112,8 @@ install-man:
-       $(INSTALL_DATA) dist/rhash.1 $(DESTDIR)$(MANDIR)/man1/rhash.1
+@@ -81,8 +81,8 @@ install-man:
+       $(INSTALL_DATA) dist/rhash.1 $(MANDIR)/man1/rhash.1
  
  install-conf:
--      $(INSTALL) -d $(DESTDIR)/etc
--      tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp 
$(DESTDIR)/etc/rhashrc
-+      $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/examples/$(PROGNAME)
-+      tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp 
$(DESTDIR)$(PREFIX)/share/examples/$(PROGNAME)/rhashrc
+-      $(INSTALL) -d $(SYSCONFDIR)
+-      tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp 
$(SYSCONFDIR)/rhashrc
++      $(INSTALL) -d $(DESTDIR)$(TRUEPREFIX)/share/examples/$(RHASH_NAME)
++      tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp 
$(DESTDIR)$(TRUEPREFIX)/share/examples/$(RHASH_NAME)/rhashrc
        rm -f rc.tmp
  
  # dependencies should be properly set, otherwise 'make -j<n>' can fail
-@@ -178,7 +178,7 @@ $(TARGET): $(OBJECTS) $(LIBRHASH)
-       $(CC) $(OBJECTS) -o $@ $(ALLLDFLAGS)
- 
- $(SHARED_TRG): $(OBJECTS) $(SHAREDLIB)
--      $(CC) $(OBJECTS) $(SHRDLFLAGS) -o $(SHARED_TRG) $(SHAREDLIB)
-+      $(CC) $(OBJECTS) $(SHRDLFLAGS) -o $(SHARED_TRG) $(LDLIBRHASH)
- 
- # NOTE: dependences were generated by 'gcc -Ilibrhash -MM *.c'
- # we are using plain old makefile style to support BSD make
diff --git patches/patch-common_func_h patches/patch-common_func_h
index 88b4d20cee1..e265d2accec 100644
--- patches/patch-common_func_h
+++ patches/patch-common_func_h
@@ -3,7 +3,7 @@ $OpenBSD: patch-common_func_h,v 1.2 2017/08/14 12:20:57 dcoppa 
Exp $
 Index: common_func.h
 --- common_func.h.orig
 +++ common_func.h
-@@ -13,7 +13,7 @@
+@@ -8,7 +8,7 @@
  # define _(str) gettext(str)
  # define TEXT_DOMAIN "rhash"
  # ifndef LOCALEDIR
diff --git patches/patch-configure patches/patch-configure
new file mode 100644
index 00000000000..f69963cf21f
--- /dev/null
+++ patches/patch-configure
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: configure
+--- configure.orig
++++ configure
+@@ -540,7 +540,7 @@ OPTFLAGS=$(join_params $BUILD_DEBUG $OPTLEVEL $OPTFLAG
+ # detect proper shared library name
+ SHARED_PREFIX="lib"
+ STATIC_PREFIX="lib"
+-SHARED_EXT=".so.0"
++SHARED_EXT=".so.${LIBrhash_VERSION}"
+ STATIC_EXT=".a"
+ SOLINK_EXT=".so"
+ EXEC_EXT=
diff --git patches/patch-librhash_Makefile patches/patch-librhash_Makefile
deleted file mode 100644
index 2c7b006bd67..00000000000
--- patches/patch-librhash_Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-$OpenBSD: patch-librhash_Makefile,v 1.2 2017/08/14 12:20:57 dcoppa Exp $
-
-Index: librhash/Makefile
---- librhash/Makefile.orig
-+++ librhash/Makefile
-@@ -2,10 +2,10 @@
- CC      ?= gcc
- AR      ?= ar
- #NOTE: NDEBUG turns off asserts
--OPTFLAGS   = -O2 -DNDEBUG -fomit-frame-pointer -ffunction-sections 
-fdata-sections
-+OPTFLAGS   = -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections
- OPTLDFLAGS =
--CFLAGS     = $(OPTFLAGS)
--LDFLAGS    = $(OPTLDFLAGS)
-+CFLAGS     += $(OPTFLAGS)
-+LDFLAGS    += $(OPTLDFLAGS)
- ADDCFLAGS  =
- LIBCFLAGS  =
- ADDLDFLAGS =
-@@ -187,10 +187,9 @@ test-dll: $(DLLNAME) test_hashes.o
- 
- # shared and static libraries
- $(SONAME): $(SOURCES)
--      sed -n '1s/.*/{ global:/p; s/^RHASH_API.* \([a-z0-9_]\+\)(.*/  \1;/p; 
$$s/.*/local: *; };/p' $(SO_HEADERS) > exports.sym
--      $(CC) -fpic $(ALLCFLAGS) -shared $(SOURCES) 
-Wl,--version-script,exports.sym,-soname,$(SONAME) $(LIBLDFLAGS) -o $@
-+      sed -n '1s/.*/{ global:/p; s/^RHASH_API.* \([a-z0-9_]*\)(.*/  \1;/p; 
$$s/.*/local: *; };/p' $(SO_HEADERS) > exports.sym
-+      $(CC) -fpic $(ALLCFLAGS) -shared $(SOURCES) 
-Wl,--version-script,exports.sym $(LIBLDFLAGS) -o $@
-       rm -f $(SOLINK)
--      ln -s $(SONAME) $(SOLINK)
- # use 'nm -Cg --defined-only $@' to view exported symbols
- 
- $(DYNAME): $(SOURCES)
diff --git patches/patch-librhash_byte_order_h 
patches/patch-librhash_byte_order_h
index 387374aa253..b31bce99123 100644
--- patches/patch-librhash_byte_order_h
+++ patches/patch-librhash_byte_order_h
@@ -5,12 +5,12 @@ hppa is big endian.
 Index: librhash/byte_order.h
 --- librhash/byte_order.h.orig
 +++ librhash/byte_order.h
-@@ -55,7 +55,7 @@ extern "C" {
-       defined(__POWERPC__) || defined(POWERPC) || defined(__powerpc) || \
-       defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || \
-       defined(__hpux)  || defined(_MIPSEB) || defined(mc68000) || \
--      defined(__s390__) || defined(__s390x__) || defined(sel)
-+      defined(__s390__) || defined(__s390x__) || defined(sel) || 
defined(__hppa__)
- # define CPU_BIG_ENDIAN
- # define IS_BIG_ENDIAN 1
- # define IS_LITTLE_ENDIAN 0
+@@ -68,7 +68,7 @@ extern "C" {
+       defined(__POWERPC__) || defined(POWERPC) || defined(__powerpc) || \
+       defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || \
+       defined(__hpux)  || defined(_MIPSEB) || defined(mc68000) || \
+-      defined(__s390__) || defined(__s390x__) || defined(sel)
++      defined(__s390__) || defined(__s390x__) || defined(sel) || 
define(__hppa__)
+ # define RHASH_BYTE_ORDER RHASH_BYTE_ORDER_BE
+ #else
+ #  error "Can't detect CPU architechture"
diff --git patches/patch-parse_cmdline_c patches/patch-parse_cmdline_c
deleted file mode 100644
index 13d12d3a1df..00000000000
--- patches/patch-parse_cmdline_c
+++ /dev/null
@@ -1,14 +0,0 @@
-$OpenBSD: patch-parse_cmdline_c,v 1.1.1.1 2017/08/08 22:04:57 dcoppa Exp $
-
-Index: parse_cmdline.c
---- parse_cmdline.c.orig
-+++ parse_cmdline.c
-@@ -514,7 +514,7 @@ static const char* find_conf_file(void)
-               free(path);
-       }
-       /* then check for global config */
--      path = "/etc/" CONF_FILE_NAME;
-+      path = "${SYSCONFDIR}/" CONF_FILE_NAME;
-       if (is_regular_file(path)) {
-               return (conf_opt.config_file = path);
-       }
diff --git patches/patch-tests_test_rhash_sh patches/patch-tests_test_rhash_sh
deleted file mode 100644
index bbd541ef40d..00000000000
--- patches/patch-tests_test_rhash_sh
+++ /dev/null
@@ -1,30 +0,0 @@
-$OpenBSD: patch-tests_test_rhash_sh,v 1.3 2017/08/14 12:20:57 dcoppa Exp $
-
-Index: tests/test_rhash.sh
---- tests/test_rhash.sh.orig
-+++ tests/test_rhash.sh
-@@ -2,14 +2,12 @@
- 
- if [ "$1" = "--full" ]; then FULL_TEST=1; shift; fi
- 
--[ -x "$1" ] && rhash="$(cd ${1%/*} && echo $PWD/${1##*/})" || 
rhash="../rhash";
-+[ -x "$1" ] && rhash="$(cd ${1%/*} && echo $PWD/${1##*/})" || 
rhash="../rhash_shared";
- cd $(dirname "$0") # chdir after getting absolute path of $1, but before 
checking for ../rhash
--[ -x "$rhash" ] || rhash="`which rhash`"
- if [ ! -x $rhash ]; then 
-   echo "Fatal: $rhash not found"
-   exit 1
- fi
--[ "$rhash" != "../rhash" ] && echo "Testing $rhash"
- 
- #version="`$rhash -V|sed 's/^.* v//'`"
- HASHOPT="`$rhash --list-hashes|sed 's/ .*$//;/[^3]-/s/-\([0-9R]\)/\1/'|tr A-Z 
a-z`"
-@@ -133,7 +131,7 @@ if [ "$FULL_TEST" = 1 ]; then
-   errors=0
-   for opt in $HASHOPT ; do
-     TEST_RESULT=$( printf "a" | $rhash --$opt --simple - )
--    match "$TEST_RESULT" "\b[0-9a-z]\{8,128\}\b" . || errors=$((errors+1))
-+    match "$TEST_RESULT" "[[:<:]][0-9a-z]\{8,128\}[[:>:]]" . || 
errors=$((errors+1))
-   done
-   check $errors 0
- fi
diff --git pkg/PLIST pkg/PLIST
index e356c0aceff..e41e5719fc0 100644
--- pkg/PLIST
+++ pkg/PLIST
@@ -1,5 +1,7 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2017/08/08 22:04:57 dcoppa Exp $
 bin/ed2k-link
+bin/edonr256-hash
+bin/edonr512-hash
 bin/gost-hash
 bin/has160-hash
 bin/magnet-link
@@ -10,9 +12,11 @@ bin/tth-hash
 bin/whirlpool-hash
 include/rhash.h
 include/rhash_torrent.h
-lib/librhash.a
+@static-lib lib/librhash.a
 @lib lib/librhash.so.${LIBrhash_VERSION}
 @man man/man1/ed2k-link.1
+@man man/man1/edonr256-hash.1
+@man man/man1/edonr512-hash.1
 @man man/man1/gost-hash.1
 @man man/man1/has160-hash.1
 @man man/man1/magnet-link.1

Reply via email to