TestU01: New package (#24136)

This commit is contained in:
LIU Hao 2025-05-03 22:47:11 +08:00 committed by GitHub
parent b45047752d
commit cfb5458d12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 406 additions and 0 deletions

View File

@ -0,0 +1,350 @@
diff --git a/Makefile.am b/Makefile.am
index 72bc898..2f006c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ INCLUDES = -I${top_builddir}
SUBDIRS = . include mylib probdist testu01 examples doc param
-bin_PROGRAMS = tcode
+noinst_PROGRAMS = tcode
tcode_SOURCES = ${top_srcdir}/mylib/tcode.c
noinst_SCRIPTS = bootstrap
diff --git a/examples/Makefile.am b/examples/Makefile.am
index d50d8ed..dd6e2d9 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,4 +1,4 @@
-exdir = ${prefix}/share/TestU01/examples
+exdir = ${prefix}/share/testu01/examples
ex_DATA = bat1.res bat2.res birth1.res ex3.res excel.dat vax.bin my16807.h \
bat1.c bat2.c bat3.c birth1.c birth2.c ex1.c ex3.c ex4.c ex7.c \
diff --git a/include/Makefile.am b/include/Makefile.am
index 04f7838..986fc7c 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,15 +1,15 @@
-%.h: ${MYLIB}/%.tex
- ${top_srcdir}/tcode $< $@
+%.h: ${MYLIB}/%.tex ${top_builddir}/tcode$(EXEEXT)
+ ${top_builddir}/tcode$(EXEEXT) $< $@
-%.h: ${PROBDIST}/%.tex
- ${top_srcdir}/tcode $< $@
+%.h: ${PROBDIST}/%.tex ${top_builddir}/tcode$(EXEEXT)
+ ${top_builddir}/tcode$(EXEEXT) $< $@
-%.h: ${TESTU01}/%.tex
- ${top_srcdir}/tcode $< $@
+%.h: ${TESTU01}/%.tex ${top_builddir}/tcode$(EXEEXT)
+ ${top_builddir}/tcode$(EXEEXT) $< $@
include Makefile.def
-include_HEADERS = $(MYLIBHEADERS) $(PROBDISTHEADERS) $(TESTU01HEADERS) gdefconf.h
+pkginclude_HEADERS = $(MYLIBHEADERS) $(PROBDISTHEADERS) $(TESTU01HEADERS) gdefconf.h
noinst_HEADERS = $(MYLIBTEX) $(PROBDISTTEX) $(TESTU01TEX)
noinst_SCRIPTS = makedef
diff --git a/include/Makefile.def b/include/Makefile.def
index 4bd0d7e..c2e3587 100644
--- a/include/Makefile.def
+++ b/include/Makefile.def
@@ -1,4 +1,4 @@
-docdir = ${prefix}/share/TestU01/doc
+docdir = ${prefix}/share/testu01/doc
MYLIB = ${top_srcdir}/mylib
PROBDIST = ${top_srcdir}/probdist
TESTU01 = ${top_srcdir}/testu01
diff --git a/include/makedef b/include/makedef
index 2180753..36e5afa 100644
--- a/include/makedef
+++ b/include/makedef
@@ -2,7 +2,7 @@
rm -f Makefile.def
-echo 'docdir = ${prefix}/share/TestU01/doc' >> Makefile.def
+echo 'docdir = ${prefix}/share/testu01/doc' >> Makefile.def
echo 'MYLIB = ${top_srcdir}/mylib' >> Makefile.def
echo 'PROBDIST = ${top_srcdir}/probdist' >> Makefile.def
echo 'TESTU01 = ${top_srcdir}/testu01' >> Makefile.def
diff --git a/mylib/Makefile.am b/mylib/Makefile.am
index 3f543ec..4b7610d 100644
--- a/mylib/Makefile.am
+++ b/mylib/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/include/Makefile.def
-lib_LTLIBRARIES = libmylib.la
+noinst_LTLIBRARIES = libmylib.la
libmylib_la_SOURCES = $(MYLIBSOURCES)
libmylib_la_LIBADD = @LIBM@
libmylib_la_LDFLAGS = -no-undefined -version-info 0:1:0
diff --git a/mylib/gdef.tex b/mylib/gdef.tex
index 39b2ce6..dbb8897 100644
--- a/mylib/gdef.tex
+++ b/mylib/gdef.tex
@@ -23,7 +23,7 @@ This module also contains a function that prints the current host name.
#ifndef GDEF_H
#define GDEF_H
-#include <gdefconf.h>
+#include "gdefconf.h"
#include <limits.h>
#ifdef HAVE_LONG_LONG
diff --git a/param/Makefile.am b/param/Makefile.am
index 4d03410..5e8e0da 100644
--- a/param/Makefile.am
+++ b/param/Makefile.am
@@ -1,4 +1,4 @@
-pardir = ${prefix}/share/TestU01/param
+pardir = ${prefix}/share/testu01/param
par_DATA = CombCubLCG.par InvExpl.par InvImpl2b.par LCGWu2.par \
CombCubic2.par InvExpl2a.par LCGBad2.par LFSR1.par TausLCG2.par \
diff --git a/probdist/Makefile.am b/probdist/Makefile.am
index be500ba..4d54fe6 100644
--- a/probdist/Makefile.am
+++ b/probdist/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/include/Makefile.def
lib_LTLIBRARIES = libprobdist.la
libprobdist_la_SOURCES = $(PROBDISTSOURCES)
-libprobdist_la_LIBADD = $(top_builddir)/mylib/libmylib.la
+libprobdist_la_LIBADD = $(top_builddir)/mylib/libmylib.la -lws2_32
libprobdist_la_LDFLAGS = -no-undefined -version-info 0:1:0
EXTRA_DIST = guideprobdist.tex titre.tex copyright.tex guideprobdist.bbl
diff --git a/testu01/Makefile.am b/testu01/Makefile.am
index 46173d8..ee6086b 100644
--- a/testu01/Makefile.am
+++ b/testu01/Makefile.am
@@ -4,7 +4,7 @@ include_HEADERS = TestU01.h
lib_LTLIBRARIES = libtestu01.la
libtestu01_la_SOURCES = $(TESTU01SOURCES)
-libtestu01_la_LIBADD = $(top_builddir)/probdist/libprobdist.la $(top_builddir)/mylib/libmylib.la
+libtestu01_la_LIBADD = $(top_builddir)/probdist/libprobdist.la $(top_builddir)/mylib/libmylib.la -lws2_32
libtestu01_la_LDFLAGS = -no-undefined -version-info 0:1:0
EXTRA_DIST = guidetestu01.tex intro.tex title.tex scatfig.tex bintro.tex copyright.tex fintro.tex sintro.tex uintro.tex guidetestu01.bbl
diff --git a/testu01/TestU01.h b/testu01/TestU01.h
index 65cc4b7..1595a76 100644
--- a/testu01/TestU01.h
+++ b/testu01/TestU01.h
@@ -1,62 +1,62 @@
#ifndef TESTU01_H
#define TESTU01_H
-#include "bbattery.h"
-#include "fcho.h"
-#include "fcong.h"
-#include "ffam.h"
-#include "ffsr.h"
-#include "fknuth.h"
-#include "fmarsa.h"
-#include "fmultin.h"
-#include "fnpair.h"
-#include "fres.h"
-#include "fspectral.h"
-#include "fstring.h"
-#include "ftab.h"
-#include "fvaria.h"
-#include "fwalk.h"
-#include "scatter.h"
-#include "scomp.h"
-#include "sentrop.h"
-#include "sknuth.h"
-#include "smarsa.h"
-#include "smultin.h"
-#include "snpair.h"
-#include "sres.h"
-#include "sspacings.h"
-#include "sspectral.h"
-#include "sstring.h"
-#include "svaria.h"
-#include "swalk.h"
-#include "swrite.h"
-#include "uautomata.h"
-#include "ubrent.h"
-#include "ucarry.h"
-#include "ucrypto.h"
-#include "rijndael-alg-fst.h"
-#include "tu01_sha1.h"
-#include "ucubic.h"
-#include "udeng.h"
-#include "ufile.h"
-#include "ugfsr.h"
-#include "ugranger.h"
-#include "uinv.h"
-#include "uknuth.h"
-#include "ulcg.h"
-#include "ulec.h"
-#include "umarsa.h"
-#include "umrg.h"
-#include "unif01.h"
-#include "unumrec.h"
-#include "uquad.h"
-#include "usoft.h"
-#include "utaus.h"
-#include "utezuka.h"
-#include "utouzin.h"
-#include "uvaria.h"
-#include "uweyl.h"
-#include "uwu.h"
-#include "uxorshift.h"
+#include "testu01/bbattery.h"
+#include "testu01/fcho.h"
+#include "testu01/fcong.h"
+#include "testu01/ffam.h"
+#include "testu01/ffsr.h"
+#include "testu01/fknuth.h"
+#include "testu01/fmarsa.h"
+#include "testu01/fmultin.h"
+#include "testu01/fnpair.h"
+#include "testu01/fres.h"
+#include "testu01/fspectral.h"
+#include "testu01/fstring.h"
+#include "testu01/ftab.h"
+#include "testu01/fvaria.h"
+#include "testu01/fwalk.h"
+#include "testu01/scatter.h"
+#include "testu01/scomp.h"
+#include "testu01/sentrop.h"
+#include "testu01/sknuth.h"
+#include "testu01/smarsa.h"
+#include "testu01/smultin.h"
+#include "testu01/snpair.h"
+#include "testu01/sres.h"
+#include "testu01/sspacings.h"
+#include "testu01/sspectral.h"
+#include "testu01/sstring.h"
+#include "testu01/svaria.h"
+#include "testu01/swalk.h"
+#include "testu01/swrite.h"
+#include "testu01/uautomata.h"
+#include "testu01/ubrent.h"
+#include "testu01/ucarry.h"
+#include "testu01/ucrypto.h"
+#include "testu01/rijndael-alg-fst.h"
+#include "testu01/tu01_sha1.h"
+#include "testu01/ucubic.h"
+#include "testu01/udeng.h"
+#include "testu01/ufile.h"
+#include "testu01/ugfsr.h"
+#include "testu01/ugranger.h"
+#include "testu01/uinv.h"
+#include "testu01/uknuth.h"
+#include "testu01/ulcg.h"
+#include "testu01/ulec.h"
+#include "testu01/umarsa.h"
+#include "testu01/umrg.h"
+#include "testu01/unif01.h"
+#include "testu01/unumrec.h"
+#include "testu01/uquad.h"
+#include "testu01/usoft.h"
+#include "testu01/utaus.h"
+#include "testu01/utezuka.h"
+#include "testu01/utouzin.h"
+#include "testu01/uvaria.h"
+#include "testu01/uweyl.h"
+#include "testu01/uwu.h"
+#include "testu01/uxorshift.h"
#endif
diff --git a/testu01/ucryptoIS.c b/testu01/ucryptoIS.c
index d8331f1..ba7f680 100644
--- a/testu01/ucryptoIS.c
+++ b/testu01/ucryptoIS.c
@@ -143,9 +143,9 @@ typedef struct randctx randctx;
If (flag==TRUE), then use the contents of randrsl[0..RANDSIZ-1] as the seed.
------------------------------------------------------------------------------
*/
-static void randinit(/*_ randctx *r, word flag _*/);
+static void randinit(randctx *r, word flag);
-static void isaac(/*_ randctx *r _*/);
+static void isaac(randctx *r);
/*
@@ -196,8 +196,8 @@ MODIFIED:
*(r++) = b = ind(mm,y>>RANDSIZL) + x; \
}
-static void isaac(ctx)
-randctx *ctx;
+static void isaac(
+randctx *ctx)
{
register ub4 a,b,x,y,*m,*mm,*m2,*r,*mend;
mm=ctx->randmem; r=ctx->randrsl;
@@ -233,9 +233,9 @@ randctx *ctx;
}
/* if (flag==TRUE), then use the contents of randrsl[] to initialize mm[]. */
-static void randinit(ctx, flag)
-randctx *ctx;
-word flag;
+static void randinit(
+randctx *ctx,
+word flag)
{
word i;
ub4 a,b,c,d,e,f,g,h;
diff --git a/testu01/uknuth.c b/testu01/uknuth.c
index 74c119c..e3f0505 100644
--- a/testu01/uknuth.c
+++ b/testu01/uknuth.c
@@ -59,9 +59,9 @@ both versions in our file. (R. Simard)
long ran_x1[KK]; /* the generator state */
/* void ran_array(long aa[],int n) */
-void ran_array1(aa,n) /* put n new random numbers in aa */
- long *aa; /* destination */
- int n; /* array length (must be at least KK) */
+void ran_array1( /* put n new random numbers in aa */
+ long *aa, /* destination */
+ int n) /* array length (must be at least KK) */
{
register int i,j;
for (j=0;j<KK;j++) aa[j]=ran_x1[j];
@@ -75,8 +75,8 @@ void ran_array1(aa,n) /* put n new random numbers in aa */
#define evenize(x) ((x)&(MM-2)) /* make x even */
/* void ran_start(long seed) */
-void ran_start1(seed) /* do this before using ran_array1 */
- long seed; /* selector for different streams */
+void ran_start1( /* do this before using ran_array1 */
+ long seed) /* selector for different streams */
{
register int t,j;
long x[KK+KK-1]; /* the preparation buffer */
@@ -240,9 +240,9 @@ include both versions in our file. (R. Simard)
double ran_u1[KK]; /* the generator state */
/* void ranf_array1(double aa[], int n) */
-void ranf_array1(aa,n) /* put n new random fractions in aa */
- double *aa; /* destination */
- int n; /* array length (must be at least KK) */
+void ranf_array1( /* put n new random fractions in aa */
+ double *aa, /* destination */
+ int n) /* array length (must be at least KK) */
{
register int i,j;
for (j=0;j<KK;j++) aa[j]=ran_u1[j];
@@ -255,8 +255,8 @@ void ranf_array1(aa,n) /* put n new random fractions in aa */
#define is_odd(s) ((s)&1)
/* void ranf_start1(long seed) */
-void ranf_start1(seed) /* do this before using ranf_array1 */
- long seed; /* selector for different streams */
+void ranf_start1( /* do this before using ranf_array1 */
+ long seed) /* selector for different streams */
{
register int t,s,j;
double u[KK+KK-1],ul[KK+KK-1];

View File

@ -0,0 +1,56 @@
# Maintainer: LIU Hao <lh_mouse@126.com>
_realname=testu01
_srcname=TestU01
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.2.3
pkgrel=1
pkgdesc="Empirical testing of random number generators (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://simul.iro.umontreal.ca/testu01/tu01.html'
msys2_repository_url='https://github.com/umontreal-simul/TestU01-2009'
license=('spdx:Apache-2.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-cc")
source=("https://simul.iro.umontreal.ca/testu01/${_srcname}-${pkgver}.zip"
"0001-various-fixes.patch")
sha256sums=('bc1d1dd2aea7ed3b3d28eaad2c8ee55913f11ce67aec8fe4f643c1c0d2ed1cac'
'ff82b40a2d2ff82bd22f7e87a4477d2c1698dc0e9d766344c77ef3914e1b64d9')
prepare() {
cd "${_srcname}-${pkgver}"
patch -p1 -i "${srcdir}/0001-various-fixes.patch"
# They use Autoconf 2.61 and Automake 1.10 which are not provided by MSYS2.
aclocal && autoupdate && autoreconf -ifv
}
build() {
mkdir -p "build-${MSYSTEM}" && cd "build-${MSYSTEM}"
../"${_srcname}-${pkgver}"/configure \
--prefix="${MINGW_PREFIX}" \
--build="${MINGW_CHOST}" \
--host="${MINGW_CHOST}" \
--enable-static \
--enable-shared
make
}
check() {
cd "build-${MSYSTEM}"
make check
}
package() {
cd "build-${MSYSTEM}"
make install DESTDIR="${pkgdir}"
install -Dm644 "${srcdir}/${_srcname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}