rhash: Update to 1.4.0

This commit is contained in:
Alexey Pavlov
2020-10-26 09:21:12 +03:00
parent d80de27c3d
commit f0d3776aeb
2 changed files with 263 additions and 4 deletions

View File

@@ -0,0 +1,252 @@
--- origsrc/RHash-1.4.0/librhash/util.h 2020-07-14 21:35:11.000000000 +0200
+++ librhash/util.h 2020-07-25 21:58:43.514676800 +0200
@@ -32,7 +32,7 @@ extern "C" {
#define IS_PTR_ALIGNED_BY(ptr, align) IS_SIZE_ALIGNED_BY((char*)(ptr) - (char*)0, (align))
/* define rhash_aligned_alloc() and rhash_aligned_free() */
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
# define HAS_WIN32_ALIGNED_ALLOC
# include <malloc.h>
--- origsrc/RHash-1.3.9/common_func.c 2019-12-14 17:52:11.000000000 +0100
+++ common_func.c 2019-12-19 16:17:43.866849500 +0100
@@ -11,8 +11,9 @@
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
+#include <sys/time.h>
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
# include <windows.h>
#endif
@@ -241,7 +242,7 @@ const char* get_bt_program_name(void)
*/
static double rsh_fsec(timedelta_t* timer)
{
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
return (double)*timer / freq.QuadPart;
@@ -250,7 +251,7 @@ static double rsh_fsec(timedelta_t* time
#endif
}
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
#define get_timedelta(delta) QueryPerformanceCounter((LARGE_INTEGER*)delta)
#else
#define get_timedelta(delta) gettimeofday(delta, NULL)
@@ -265,7 +266,7 @@ double rsh_timer_stop(timedelta_t* timer
{
timedelta_t end;
get_timedelta(&end);
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
*timer = end - *timer;
#else
timer->tv_sec = end.tv_sec - timer->tv_sec - (end.tv_usec >= timer->tv_usec ? 0 : 1);
@@ -276,7 +277,7 @@ double rsh_timer_stop(timedelta_t* timer
unsigned rhash_get_ticks(void)
{
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
return GetTickCount();
#else
struct timeval tv;
--- origsrc/RHash-1.3.9/common_func.h 2019-12-14 17:52:11.000000000 +0100
+++ common_func.h 2019-12-19 16:19:03.896876500 +0100
@@ -18,7 +18,7 @@
#include <stdint.h>
#include <stdio.h>
#include <time.h> /* for time_t */
-#if !defined( _WIN32) && !defined(__CYGWIN__)
+#if !defined( _WIN32)
# include <sys/time.h> /* for timeval */
#elif _MSC_VER > 1300
# include "platform.h"
@@ -86,7 +86,7 @@ const char* get_bt_program_name(void);
/* time delta and timer functions */
/* portable timer definition */
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
typedef unsigned long long timedelta_t;
#else
#include <sys/time.h> /* for timeval */
--- origsrc/RHash-1.3.9/file.c 2019-12-14 17:52:11.000000000 +0100
+++ file.c 2019-12-19 16:19:29.386535500 +0100
@@ -18,7 +18,7 @@
#include <string.h>
#include <sys/stat.h>
-#if defined( _WIN32) || defined(__CYGWIN__)
+#if defined( _WIN32)
# include <windows.h>
#if !defined(__CYGWIN__)
# include <share.h> /* for _SH_DENYWR */
--- origsrc/RHash-1.3.9/librhash/plug_openssl.c 2019-12-14 17:52:11.000000000 +0100
+++ librhash/plug_openssl.c 2019-12-19 16:34:19.467508100 +0100
@@ -39,7 +39,7 @@
#include "plug_openssl.h"
#if defined(OPENSSL_RUNTIME)
-# if defined(_WIN32) || defined(__CYGWIN__)
+# if defined(_WIN32)
# include <windows.h>
# else
# include <dlfcn.h>
@@ -138,7 +138,7 @@ rhash_hash_info rhash_openssl_hash_info[
#ifdef OPENSSL_RUNTIME
-#if (defined(_WIN32) || defined(__CYGWIN__)) /* __CYGWIN__ is also defined in MSYS */
+#if defined(_WIN32)
# define GET_DLSYM(name) (void(*)(void))GetProcAddress(handle, name)
#else /* _WIN32 */
# define GET_DLSYM(name) dlsym(handle, name)
@@ -157,7 +157,7 @@ rhash_hash_info rhash_openssl_hash_info[
*/
static int load_openssl_runtime(void)
{
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
HMODULE handle;
/* suppress the error popup dialogs */
UINT oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
--- origsrc/RHash-1.3.9/librhash/rhash.c 2019-12-14 17:52:11.000000000 +0100
+++ librhash/rhash.c 2019-12-19 16:48:42.605848200 +0100
@@ -15,7 +15,7 @@
*/
/* modifier for Windows DLL */
-#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(RHASH_EXPORTS)
+#if defined(_WIN32) && defined(RHASH_EXPORTS)
# define RHASH_API __declspec(dllexport)
#endif
@@ -621,7 +621,7 @@ size_t RHASH_API rhash_print(char* outpu
return rhash_print_bytes(output, digest, digest_size, flags);
}
-#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(RHASH_EXPORTS)
+#if defined(_WIN32) && defined(RHASH_EXPORTS)
#include <windows.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved);
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved)
--- origsrc/RHash-1.3.9/librhash/rhash_timing.c 2019-12-14 17:52:11.000000000 +0100
+++ librhash/rhash_timing.c 2019-12-19 16:31:44.576455100 +0100
@@ -15,7 +15,7 @@
*/
/* modifier for Windows dll */
-#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(RHASH_EXPORTS)
+#if defined(_WIN32) && defined(RHASH_EXPORTS)
# define RHASH_API __declspec(dllexport)
#endif
@@ -45,7 +45,7 @@ static uint64_t read_tsc(void) {
/* TIMER FUNCTIONS */
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
#include <windows.h>
#define get_timedelta(delta) QueryPerformanceCounter((LARGE_INTEGER*)delta)
#else
@@ -64,7 +64,7 @@ static uint64_t read_tsc(void) {
*/
static double fsec(timedelta_t* timer)
{
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
return (double)*timer / freq.QuadPart;
@@ -82,7 +82,7 @@ double rhash_timer_stop(timedelta_t* tim
{
timedelta_t end;
get_timedelta(&end);
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
*timer = end - *timer;
#else
timer->tv_sec = end.tv_sec - timer->tv_sec - (end.tv_usec >= timer->tv_usec ? 0 : 1);
@@ -91,7 +91,7 @@ double rhash_timer_stop(timedelta_t* tim
return fsec(timer);
}
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
/**
* Set process priority and affinity to use all cpu's but the first one.
* This improves benchmark results on a multi-cpu systems.
@@ -154,7 +154,7 @@ void rhash_run_benchmark(unsigned hash_i
double cpb = 0;
#endif /* HAVE_TSC */
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
benchmark_cpu_init(); /* set cpu affinity to improve test results */
#endif
--- origsrc/RHash-1.3.9/librhash/rhash_timing.h 2019-12-14 17:52:11.000000000 +0100
+++ librhash/rhash_timing.h 2019-12-19 16:24:27.906642100 +0100
@@ -19,7 +19,7 @@ extern "C" {
# define RHASH_API
#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
/**
* Platform-dependent time delta.
*/
--- origsrc/RHash-1.3.9/librhash/rhash_torrent.c 2019-12-14 17:52:11.000000000 +0100
+++ librhash/rhash_torrent.c 2019-12-19 16:54:28.185099200 +0100
@@ -15,7 +15,7 @@
*/
/* modifier for Windows DLL */
-#if (defined(_WIN32) || defined(__CYGWIN__) ) && defined(RHASH_EXPORTS)
+#if defined(_WIN32) && defined(RHASH_EXPORTS)
# define RHASH_API __declspec(dllexport)
#endif
--- origsrc/RHash-1.3.9/win_utils.c 2019-12-14 17:52:11.000000000 +0100
+++ win_utils.c 2019-12-19 16:25:58.681744700 +0100
@@ -1,5 +1,5 @@
/* win_utils.c - utility functions for Windows and CygWin */
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
#include "win_utils.h"
#include <windows.h>
@@ -575,4 +575,4 @@ size_t win_fwrite(const void* ptr, size_
#endif /* _WIN32 */
#else
typedef int dummy_declaration_required_by_strict_iso_c;
-#endif /* defined(_WIN32) || defined(__CYGWIN__) */
+#endif /* defined(_WIN32) */
--- origsrc/RHash-1.3.9/win_utils.h 2019-12-14 17:52:11.000000000 +0100
+++ win_utils.h 2019-12-19 16:26:20.156506200 +0100
@@ -2,7 +2,7 @@
#ifndef WIN_UTILS_H
#define WIN_UTILS_H
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
#ifdef __cplusplus
extern "C" {
@@ -58,6 +58,6 @@ size_t win_fwrite(const void* ptr, size_
}
#endif
-#endif /* defined(_WIN32) || defined(__CYGWIN__) */
+#endif /* defined(_WIN32) */
#endif /* WIN_UTILS_H */

View File

@@ -2,17 +2,24 @@
pkgbase=rhash
pkgname=("lib${pkgbase}" "lib${pkgbase}-devel" "${pkgbase}")
pkgver=1.3.9
pkgver=1.4.0
pkgrel=1
pkgdesc='Utility for verifying hash sums of files'
url='https://sourceforge.net/projects/rhash/'
license=('custom' 'MIT')
arch=('i686' 'x86_64')
source=(${pkgbase}-${pkgver}.tar.gz::https://github.com/rhash/RHash/archive/v${pkgver}.tar.gz
${pkgbase}-${pkgver}.tar.gz.asc::https://github.com/rhash/RHash/releases/download/v${pkgver}/v${pkgver}.tar.gz.asc)
${pkgbase}-${pkgver}.tar.gz.asc::https://github.com/rhash/RHash/releases/download/v${pkgver}/v${pkgver}.tar.gz.asc
1.4.0_rhash-CYGWIN.patch)
makedepends=('openssl-devel')
sha256sums=('42b1006f998adb189b1f316bf1a60e3171da047a85c4aaded2d0d26c1476c9f6'
'SKIP')
sha256sums=('2ea39540f5c580da0e655f7b483c19e0d31506aed4202d88e8459fa7aeeb8861'
'SKIP'
'67e8f1b2d6c843caa342eac69134502c259e436209c7eafa5614e705df7dd7fb')
prepare() {
cd RHash-${pkgver}
patch -p2 -i ${srcdir}/1.4.0_rhash-CYGWIN.patch
}
build() {
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}