Add port of RHash, console utility and library for computing and verifying

hash sums of files.  It is based on the same code as existing Perl wrapper,
`security/p5-Crypt-RHash' port.

Also, properly sort `security/Makefile' while here.
This commit is contained in:
Alexey Dokuchaev 2015-03-13 17:59:00 +00:00
parent e8c53e8c72
commit f6a6c1a417
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=381228
7 changed files with 158 additions and 1 deletions

View file

@ -595,8 +595,8 @@
SUBDIR += p5-GSSAPI
SUBDIR += p5-GnuPG
SUBDIR += p5-GnuPG-Interface
SUBDIR += p5-Heimdal-Kadm5
SUBDIR += p5-HTML-Email-Obfuscate
SUBDIR += p5-Heimdal-Kadm5
SUBDIR += p5-IO-Async-SSL
SUBDIR += p5-IO-Socket-SSL
SUBDIR += p5-MD5
@ -886,6 +886,7 @@
SUBDIR += retranslator
SUBDIR += revealrk
SUBDIR += revelation
SUBDIR += rhash
SUBDIR += rifiuti2
SUBDIR += rkhunter
SUBDIR += rndpassw

28
security/rhash/Makefile Normal file
View file

@ -0,0 +1,28 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
# $FreeBSD$
PORTNAME= rhash
PORTVERSION= 1.3.3
CATEGORIES= security
MASTER_SITES= SF
DISTNAME= ${PORTNAME}-${PORTVERSION}-src
MAINTAINER= danfe@FreeBSD.org
COMMENT= Utility and library for computing and checking of file hashes
LICENSE= MIT
USE_LDCONFIG= yes
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
PORTDOCS= ChangeLog README
post-patch:
@${REINPLACE_CMD} -e 's,/etc/,${PREFIX}&,' ${WRKSRC}/parse_cmdline.c
post-install:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

2
security/rhash/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (rhash-1.3.3-src.tar.gz) = 5b520b597bd83f933d316fce1382bb90e0b0b87b559b8c9c9a197551c935315a
SIZE (rhash-1.3.3-src.tar.gz) = 248855

View file

@ -0,0 +1,50 @@
--- Makefile.orig 2014-08-04 18:55:26 UTC
+++ Makefile
@@ -3,13 +3,13 @@
# compile for pentiumpro: make CFLAGS="-O2 -DNDEBUG -march=i586 -mcpu=pentiumpro -fomit-frame-pointer"
# create rpm with statically linked program: make rpm ADDLDFLAGS="-static -s -Wl,--gc-sections"
VERSION = 1.3.3
-PREFIX = /usr/local
-CC = gcc
+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 = $(CFLAGS) -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections
OPTLDFLAGS =
-CFLAGS = $(OPTFLAGS)
-LDFLAGS = $(OPTLDFLAGS)
+#CFLAGS = $(OPTFLAGS)
+LDFLAGS += $(OPTLDFLAGS)
ADDCFLAGS =
ADDLDFLAGS =
ALLCFLAGS = -pipe $(CFLAGS) $(ADDCFLAGS) \
@@ -55,7 +55,7 @@ I18N_FILES = po/de.po po/en_AU.po po/es.
DIST_FILES = $(LIN_DIST_FILES) $(LIBRHASH_FILES) $(WIN_DIST_FILES) $(WIN_SRC_FILES) $(I18N_FILES)
DESTDIR =
BINDIR = $(PREFIX)/bin
-MANDIR = $(PREFIX)/share/man
+MANDIR = $(PREFIX)/man
LOCALEDIR = $(PREFIX)/share/locale
RPMTOP = rpms
RPMDIRS = SOURCES SPECS BUILD SRPMS RPMS
@@ -70,7 +70,7 @@ build-shared: $(SHARED_TRG)
lib-shared: $(SHAREDLIB)
lib-static: $(LIBRHASH)
-install: all install-binary install-data install-symlinks
+install: all install-binary install-lib-static install-lib-shared install-data install-symlinks
install-shared: $(SHARED_TRG) install-shared-binary install-data install-symlinks
install-data: install-man install-conf
uninstall: uninstall-binary uninstall-data uninstall-symlinks
@@ -105,8 +105,8 @@ install-man:
$(INSTALL_DATA) dist/rhash.1 $(DESTDIR)$(MANDIR)/man1/rhash.1
install-conf:
- $(INSTALL) -d $(DESTDIR)/etc
- sed -e 's/\x0D//g' dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp $(DESTDIR)/etc/rhashrc
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/etc
+ tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp $(DESTDIR)$(PREFIX)/etc/rhashrc.sample
rm -f rc.tmp
# dependencies should be properly set, otherwise 'make -j<n>' can fail

View file

@ -0,0 +1,37 @@
--- librhash/Makefile.orig 2014-08-01 10:53:45 UTC
+++ librhash/Makefile
@@ -1,11 +1,11 @@
# Makefile for LibRHash
-CC = gcc
-AR = ar
+CC ?= gcc
+AR ?= ar
#NOTE: NDEBUG turns off asserts
-OPTFLAGS = -O2 -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections
+OPTFLAGS = $(CFLAGS) -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections
OPTLDFLAGS =
-CFLAGS = $(OPTFLAGS)
-LDFLAGS = $(OPTLDFLAGS)
+#CFLAGS = $(OPTFLAGS)
+LDFLAGS += $(OPTLDFLAGS)
ADDCFLAGS =
LIBCFLAGS =
ADDLDFLAGS =
@@ -24,7 +24,7 @@ LEGACY_LIB_HEADERS = rhash_timing.h
SO_HEADERS = $(LIB_HEADERS) $(LEGACY_LIB_HEADERS)
# installation directories and names
DESTDIR =
-PREFIX = /usr/local
+PREFIX ?= /usr/local
INCDIR = $(PREFIX)/include
LIBDIR = $(PREFIX)/lib
LIBRARY = librhash.a
@@ -182,7 +182,7 @@ 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
+ sed -nE '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 $@
ln -s $(SONAME) $(SOLINK)
# use 'nm -Cg --defined-only $@' to view exported symbols

15
security/rhash/pkg-descr Normal file
View file

@ -0,0 +1,15 @@
RHash is a console utility and library for computing and verifying hash sums
of files. It supports CRC32, MD4, MD5, SHA1, SHA256, SHA512, SHA3, Tiger,
TTH, Torrent BTIH, AICH, ED2K, GOST R 34.11-94, RIPEMD-160, HAS-160, EDON-R
256/512, Whirlpool, and Snefru-128/256 hash sums. Its features are:
* Can calculate Magnet links
* Output in a predefined (SFV, BSD-like) or a user-defined format
* Ability to process directories recursively
* Updating existing hash-files (adding hash sums of files missing in a
hash-file)
* Portable, written in pure C, small in size, open source (MIT license)
Perl wrapper is available as `security/p5-Crypt-RHash' port.
WWW: http://rhash.anz.ru/

24
security/rhash/pkg-plist Normal file
View file

@ -0,0 +1,24 @@
bin/ed2k-link
bin/gost-hash
bin/has160-hash
bin/magnet-link
bin/rhash
bin/sfv-hash
bin/tiger-hash
bin/tth-hash
bin/whirlpool-hash
@sample etc/rhashrc.sample
include/rhash.h
include/rhash_torrent.h
lib/librhash.a
lib/librhash.so
lib/librhash.so.0
man/man1/ed2k-link.1.gz
man/man1/gost-hash.1.gz
man/man1/has160-hash.1.gz
man/man1/magnet-link.1.gz
man/man1/rhash.1.gz
man/man1/sfv-hash.1.gz
man/man1/tiger-hash.1.gz
man/man1/tth-hash.1.gz
man/man1/whirlpool-hash.1.gz