sysutils/rsyncrypto: improving Makefile

Requires archivers/gzip. The gzip in FreeBSD doesn't support --rsyncable
flag. It requires a patch to use ${LOCALBASE}/bin/gzip.
Add TEST_TARGET.
Add LICENSE_FILE.
Switch to DISTVERSION.
Submitter takes maintainership.

PR:		283817
This commit is contained in:
Älven 2025-01-08 07:42:43 +01:00 committed by Zsolt Udvari
parent 119972ab41
commit 5640fc41d4
5 changed files with 66 additions and 30 deletions

View file

@ -1,36 +1,47 @@
PORTNAME= rsyncrypto
PORTVERSION= 1.14
PORTREVISION= 2
DISTVERSION= 1.14
PORTREVISION= 3
CATEGORIES= sysutils net
MASTER_SITES= SF
MAINTAINER= ports@FreeBSD.org
MAINTAINER= alster@vinterdalen.se
COMMENT= Rsync Friendly File Encryption
WWW= https://rsyncrypto.lingnu.com/
WWW= https://rsyncrypto.lingnu.com/ \
https://sourceforge.net/projects/rsyncrypto/
LICENSE= GPLv2+
LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= ${GZIP_DEPENDS}
LIB_DEPENDS= libargtable2.so:devel/argtable
RUN_DEPENDS= rsync:net/rsync
RUN_DEPENDS= ${GZIP_DEPENDS} \
rsync:net/rsync
TEST_DEPENDS= ${GZIP_DEPENDS} \
bash:shells/bash
USES= compiler:c++11-lang gmake localbase shebangfix ssl tar:bzip2
SHEBANG_FILES= tests/regtest
USES= compiler:c++11-lang gmake localbase ssl tar:bzip2
GNU_CONFIGURE= yes
GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
PLIST_FILES= bin/rsyncrypto \
bin/rsyncrypto_recover \
share/man/man1/rsyncrypto.1.gz \
share/man/man1/rsyncrypto_recover.1.gz
TEST_TARGET= test
# Just to make configure phase runtime checks happy
BINARY_ALIAS= gzip=${LOCALBASE}/bin/gzip
PORTDOCS= AUTHORS ChangeLog NEWS README
OPTIONS_DEFINE= DOCS
GZIP_DEPENDS= ${LOCALBASE}/bin/gzip:archivers/gzip
# Use gzip from localbase, as gzip from base lacks support of needed --rsyncable option
post-patch:
# Inhibit the check for RSA_get0_factors() to support older OpenSSL versions
@${REINPLACE_CMD} -e '/RSA_get0_factors/,+49d' ${WRKSRC}/configure
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/rsyncrypto.h
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View file

@ -1,16 +0,0 @@
--- crypto.cpp.orig 2016-11-11 20:23:00 UTC
+++ crypto.cpp
@@ -155,9 +155,13 @@ std::unique_ptr<key> decrypt_header( file_t fromfd, RS
unsigned char *buff=filemap.get_uc()+sizeof(HEADER_ENCRYPTION_VERSION);
auto_array<unsigned char> decrypted(new unsigned char[headsize]);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ if( (prv->p==nullptr || prv->q==nullptr) ) {
+#else
const BIGNUM *p, *q;
RSA_get0_factors(prv, &p, &q);
if( (p==nullptr || q==nullptr) ) {
+#endif
// This is not a private key!
throw rscerror("Neither AES session key nor RSA private key present - cannot decrypt using only public key");
}

View file

@ -0,0 +1,20 @@
--- rsyncrypto.h.orig 2016-11-27 18:44:10 UTC
+++ rsyncrypto.h
@@ -58,7 +58,7 @@ struct startup_options {
"Force a new key size, even if previous encryption used a different setting.");
argtable[i++]=noarch=arg_lit0( NULL, "no-archive-mode", "Do not try to preserve timestamps");
argtable[i++]=gzip=arg_file0( NULL, "gzip", "<file>",
- "Path to gzip-like program to use. Must accept a --rsyncable command option");
+ "Path to gzip-like program to use. Must accept a --rsyncable command option. Default is %%LOCALBASE%%/bin/gzip");
argtable[i++]=rem1=arg_rem( "Advanced options:", "" );
argtable[i++]=rollwin=arg_int0( NULL, "roll-win", "<n>", "Rollover window size. Default is 8192 byte");
argtable[i++]=rollmin=arg_int0( NULL, "roll-min", "<n>",
@@ -76,7 +76,7 @@ struct startup_options {
trim->ival[0]=1;
rollwin->ival[0]=8192;
rollmin->ival[0]=8192;
- gzip->filename[0]="gzip";
+ gzip->filename[0]="%%LOCALBASE%%/bin/gzip";
nenest->ival[0]=0;
}
}

View file

@ -0,0 +1,17 @@
--- rsyncrypto.man.orig 2008-10-22 11:34:49 UTC
+++ rsyncrypto.man
@@ -236,10 +236,10 @@ it. In order not to become rsync unfriendly due to the
it. In order not to become rsync unfriendly due to the compression,
\fBrsyncrypto\fP will search the path for an instance of
.BR gzip (1)
-that supports the \fB\-\-rsyncable\fP option. If the system's default gzip does
-not support this option (all Debian and derivatives, as well as some others, support it), use
-this option to tell \fBrsyncrypto\fP to use a different instance of gzip. The
-tests directory of rsyncrypto's source has a file called "gzip", that does NULL
+that supports the \fB\-\-rsyncable\fP option. FreeBSD base system's default gzip doesn't
+support this option, so this port builds with archivers/gzip from ports tree, which does.
+You still can use this option to tell \fBrsyncrypto\fP to use a different instance of gzip.
+The tests directory of rsyncrypto's source has a file called "gzip", that does NULL
compression by redirecting the input and output to
.BR cat (1).
.TP

View file

@ -0,0 +1,4 @@
bin/rsyncrypto
bin/rsyncrypto_recover
share/man/man1/rsyncrypto.1.gz
share/man/man1/rsyncrypto_recover.1.gz