diff --git a/utils/bonnie++/Makefile b/utils/bonnie++/Makefile index 6e6d6dfb61..5f3442749a 100644 --- a/utils/bonnie++/Makefile +++ b/utils/bonnie++/Makefile @@ -8,27 +8,27 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bonnie++ -PKG_VERSION:=1.98 -PKG_RELEASE:=4 +PKG_VERSION:=2.00a +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz -PKG_SOURCE_URL:=https://www.coker.com.au/bonnie++/ -PKG_HASH:=6e0bcbc08b78856fd998dd7bcb352d4615a99c26c2dc83d5b8345b102bad0b04 +PKG_SOURCE_URL:=https://www.coker.com.au/bonnie++ +PKG_HASH:=a8d33bbd81bc7eb559ce5bf6e584b9b53faea39ccfb4ae92e58f27257e468f0e PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=copyright.txt -PKG_FIXUP:=autoreconf -PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +PKG_BUILD_DEPENDS:=meson/host -include $(INCLUDE_DIR)/uclibc++.mk include $(INCLUDE_DIR)/package.mk +include ../../devel/meson/meson.mk define Package/bonniexx SECTION:=utils CATEGORY:=Utilities - DEPENDS:=$(CXX_DEPENDS) +libpthread + DEPENDS:=+libstdcpp +libpthread TITLE:=Bonnie++ - hard drive bottleneck testing program. URL:=https://www.coker.com.au/bonnie++/ endef @@ -38,12 +38,17 @@ define Package/bonniexx/description tests of hard drive and file system performance. endef -TARGET_CXXFLAGS += -ffunction-sections -fdata-sections -fno-rtti -flto +MESON_ARGS += \ + -Db_lto=true \ + -Dcpp_eh=none \ + -Dcpp_rtti=false + +TARGET_CXXFLAGS += -ffunction-sections -fdata-sections define Package/bonniexx/install $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_BUILD_DIR)/bonnie++ $(1)/usr/bin/ - $(CP) $(PKG_BUILD_DIR)/bon_csv2html $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bonnie++ $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/bon_csv2html $(1)/usr/bin/ endef $(eval $(call BuildPackage,bonniexx)) diff --git a/utils/bonnie++/patches/010-meson.patch b/utils/bonnie++/patches/010-meson.patch new file mode 100644 index 0000000000..91b4939b25 --- /dev/null +++ b/utils/bonnie++/patches/010-meson.patch @@ -0,0 +1,80 @@ +--- /dev/null ++++ b/conf.h.meson +@@ -0,0 +1 @@ ++#mesondefine HAVE_ALGORITHM +--- /dev/null ++++ b/meson.build +@@ -0,0 +1,73 @@ ++project('bonnie++', 'cpp', ++ version : '2.00a', ++ default_options : [ 'cpp_std=c++11' ]) ++ ++cxx = meson.get_compiler('cpp') ++cdata = configuration_data() ++ ++cdata.set('HAVE_ALGORITHM', cxx.has_header('algorithm')) ++ ++configure_file(input : 'conf.h.meson', ++ output : 'conf.h', ++ configuration : cdata) ++ ++bonniepp_incdir = include_directories('.') ++thread_dep = dependency('threads') ++ ++add_global_arguments('-DHAVE_CONFIG_H', language : 'cpp') ++ ++executable('bonnie++', ++ 'bonnie++.cpp', ++ 'bon_io.cpp', ++ 'bon_file.cpp', ++ 'bon_time.cpp', ++ 'semaphore.cpp', ++ 'sync.cpp', ++ 'thread.cpp', ++ 'bon_suid.cpp', ++ 'duration.cpp', ++ 'util.cpp', ++ 'rand.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++ dependencies : thread_dep, ++) ++ ++executable('bon_csv2html', ++ 'bon_csv2html.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++) ++ ++executable('zcav', ++ 'zcav.cpp', ++ 'thread.cpp', ++ 'zcav_io.cpp', ++ 'bon_suid.cpp', ++ 'duration.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++ dependencies : [ thread_dep ] ++) ++ ++executable('getc_putc', ++ 'getc_putc.cpp', ++ 'bon_suid.cpp', ++ 'duration.cpp', ++ 'util.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++) ++ ++executable('getc_putc_helper', ++ 'getc_putc_helper.cpp', ++ 'duration.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++) ++ ++executable('generate_randfile', ++ 'generate_randfile.cpp', ++ install: true, ++ include_directories : bonniepp_incdir, ++) diff --git a/utils/bonnie++/patches/010-openwrt-fixes.patch b/utils/bonnie++/patches/010-openwrt-fixes.patch deleted file mode 100644 index 123a481a88..0000000000 --- a/utils/bonnie++/patches/010-openwrt-fixes.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/Makefile.in -+++ b/Makefile.in -@@ -7,12 +7,6 @@ SCRIPTS=bon_csv2txt - - prefix=@prefix@ - eprefix=@exec_prefix@ --#MORE_WARNINGS=-Weffc++ --WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS) --CFLAGS=-O2 @debug@ -DNDEBUG $(WFLAGS) $(MORECFLAGS) --CXX=@CXX@ $(CFLAGS) --LINK=@CXX@ --THREAD_LFLAGS=@thread_ldflags@ - - INSTALL=@INSTALL@ - INSTALL_PROGRAM=@INSTALL_PROGRAM@ -@@ -34,22 +28,22 @@ GETCHSRC=getc_putc_helper.cpp duration.c - GETCHOBJS=$(GETCHSRC:.cpp=.o) - - bonnie++: $(BONOBJS) -- $(LINK) -o bonnie++ $(BONOBJS) $(THREAD_LFLAGS) -+ $(CXX) $(CXXFLAGS) -o bonnie++ $(BONOBJS) @thread_ldflags@ - - zcav: $(ZCAVOBJS) -- $(LINK) -o zcav $(ZCAVOBJS) $(THREAD_LFLAGS) -+ $(CXX) $(CXXFLAGS) -o zcav $(ZCAVOBJS) @thread_ldflags@ - - getc_putc: $(GETCOBJS) getc_putc_helper -- $(LINK) -o getc_putc $(GETCOBJS) $(THREAD_LFLAGS) -+ $(CXX) $(CXXFLAGS) -o getc_putc $(GETCOBJS) - - getc_putc_helper: $(GETCHOBJS) -- $(CXX) -o getc_putc_helper $(GETCHOBJS) -+ $(CXX) $(CXXFLAGS) -o getc_putc_helper $(GETCHOBJS) - - bon_csv2html: bon_csv2html.o -- $(LINK) bon_csv2html.o -o bon_csv2html -+ $(CXX) $(CXXFLAGS) bon_csv2html.o -o bon_csv2html - - generate_randfile: generate_randfile.o -- $(LINK) generate_randfile.o -o generate_randfile -+ $(CXX) $(CXXFLAGS) generate_randfile.o -o generate_randfile - - install-bin: $(EXE) $(EXES) - mkdir -p $(eprefix)/bin $(eprefix)/sbin -@@ -63,7 +57,7 @@ install: install-bin - @INSTALL_DATA@ $(MAN8) @mandir@/man8 - - %.o: %.cpp -- $(CXX) -c $< -+ $(CXX) $(CXXFLAGS) -c $< - - clean: - rm -f $(EXE) $(EXES) *.o build-stamp install-stamp ---- a/configure.in -+++ b/configure.in -@@ -31,7 +31,6 @@ fi - - dnl Checks for programs. - AC_LANG_CPLUSPLUS --AC_PROG_CC - AC_PROG_CXX - AC_PROG_CXXCPP - AC_PROG_INSTALL -@@ -66,7 +65,7 @@ AC_SUBST(linux_pthread) - AC_TRY_COMPILE([#define _GNU_SOURCE - #include - ] , [pthread_mutexattr_t attr; -- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);] -+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);] - , linux_pthread="yes") - if [[ -n "$linux_pthread" ]]; then - linux_pthread="#define LINUX_PTHREAD" -@@ -83,7 +82,7 @@ void * thread_func(void * param) { retur - , thread_ldflags="-pthread") - - AC_SUBST(large_file) --AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE -+AC_TRY_COMPILE([#ifndef _LARGEFILE64_SOURCE - #define _LARGEFILE64_SOURCE - #endif - #include diff --git a/utils/bonnie++/patches/100-remove-using-namespace-std.patch b/utils/bonnie++/patches/100-remove-using-namespace-std.patch new file mode 100644 index 0000000000..10574ab629 --- /dev/null +++ b/utils/bonnie++/patches/100-remove-using-namespace-std.patch @@ -0,0 +1,163 @@ +From 4f60ce245b3cfe2117fdaf00a9e74a49f769daca Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 22 Feb 2021 16:03:21 -0800 +Subject: [PATCH] remove using namespace std + +Fixes: warning: using directive refers to implicitly-defined namespace 'std' + +Signed-off-by: Rosen Penev +--- + bon_time.cpp | 8 ++++---- + bonnie++.cpp | 8 ++++---- + bonnie.h | 2 -- + duration.cpp | 4 +--- + getc_putc.cpp | 2 +- + rand.cpp | 4 ++-- + rand.h | 5 ++--- + 7 files changed, 14 insertions(+), 19 deletions(-) + +--- a/bon_time.cpp ++++ b/bon_time.cpp +@@ -26,12 +26,12 @@ void BonTimer::add_delta_report(report_s + } + else + { +- m_delta[test].FirstStart = min(m_delta[test].FirstStart, rep.StartTime); +- m_delta[test].LastStop = max(m_delta[test].LastStop, rep.EndTime); ++ m_delta[test].FirstStart = std::min(m_delta[test].FirstStart, rep.StartTime); ++ m_delta[test].LastStop = std::max(m_delta[test].LastStop, rep.EndTime); + } + m_delta[test].CPU += rep.CPU; + m_delta[test].Elapsed = m_delta[test].LastStop - m_delta[test].FirstStart; +- m_delta[test].Latency = max(m_delta[test].Latency, rep.Latency); ++ m_delta[test].Latency = std::max(m_delta[test].Latency, rep.Latency); + } + + BonTimer::BonTimer() +@@ -56,7 +56,7 @@ BonTimer::Initialize() + void + BonTimer::add_latency(tests_t test, double t) + { +- m_delta[test].Latency = max(m_delta[test].Latency, t); ++ m_delta[test].Latency = std::max(m_delta[test].Latency, t); + } + + int BonTimer::print_cpu_stat(tests_t test) +--- a/bonnie++.cpp ++++ b/bonnie++.cpp +@@ -75,7 +75,7 @@ public: + void set_io_chunk_size(int size) + { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; } + void set_file_chunk_size(int size) +- { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; } ++ { delete m_buf; m_buf = new char[std::max(size, m_io_chunk_size)]; m_file_chunk_size = size; } + + // Return the page-aligned version of the local buffer + char *buf() { return m_buf_pa; } +@@ -142,7 +142,7 @@ CGlobalItems::CGlobalItems(bool *exitFla + , m_buf(NULL) + , m_buf_pa(NULL) + { +- pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa); ++ pa_new(std::max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa); + SetName("."); + } + +@@ -407,8 +407,8 @@ int main(int argc, char *argv[]) + usage(); + } + #endif +- globals.byte_io_size = min(file_size, globals.byte_io_size); +- globals.byte_io_size = max(0, globals.byte_io_size); ++ globals.byte_io_size = std::min(file_size, globals.byte_io_size); ++ globals.byte_io_size = std::max(0, globals.byte_io_size); + + if(machine == NULL) + { +--- a/bonnie.h ++++ b/bonnie.h +@@ -1,8 +1,6 @@ + #ifndef BONNIE + #define BONNIE + +-using namespace std; +- + #define BON_VERSION "2.00" + #define CSV_VERSION "1.98" + +--- a/duration.cpp ++++ b/duration.cpp +@@ -1,5 +1,3 @@ +-using namespace std; +- + #include + + #include "duration.h" +@@ -38,7 +36,7 @@ double Duration_Base::stop() + getTime(&tv); + double ret; + ret = tv - m_start; +- m_max = max(m_max, ret); ++ m_max = std::max(m_max, ret); + return ret; + } + +--- a/getc_putc.cpp ++++ b/getc_putc.cpp +@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) + int size = 0, wrote; + while(size < file_size) + { +- wrote = write(FILE_FD, buf, min(sizeof(buf), (size_t)file_size - size)); ++ wrote = write(FILE_FD, buf, std::min(sizeof(buf), (size_t)file_size - size)); + if(wrote < 0) + { + fprintf(stderr, "Can't extend file - disk full?\n"); +--- a/rand.cpp ++++ b/rand.cpp +@@ -31,7 +31,7 @@ bool Rand::seedFile(CPCCHAR name) + } + close(fd); + m_ind = -1; +- m_name = string(name); ++ m_name = std::string(name); + return false; + } + +@@ -44,7 +44,7 @@ void Rand::seedNum(UINT num) + m_init = num; + char buf[12]; + sprintf(buf, "%u", num); +- m_name = string(buf); ++ m_name = std::string(buf); + } + + void Rand::reset() +--- a/rand.h ++++ b/rand.h +@@ -1,7 +1,6 @@ + #ifndef RAND_H + #define RAND_H + +-using namespace std; + #include "port.h" + #include + #include +@@ -31,7 +30,7 @@ public: + + int getSize() { return m_size; } + +- string getSeed() { return m_name; } ++ std::string getSeed() { return m_name; } + + void reset(); + +@@ -39,7 +38,7 @@ private: + int *m_arr; + int m_size; + int m_ind; +- string m_name; ++ std::string m_name; + UINT m_init; + + Rand(const Rand &t); diff --git a/utils/bonnie++/patches/101-fix-wrong-printf-off_t-format.patch b/utils/bonnie++/patches/101-fix-wrong-printf-off_t-format.patch new file mode 100644 index 0000000000..a912089518 --- /dev/null +++ b/utils/bonnie++/patches/101-fix-wrong-printf-off_t-format.patch @@ -0,0 +1,31 @@ +From 4f4d854b7758da89ced4dc800fcbec11667d61c8 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 22 Feb 2021 16:05:54 -0800 +Subject: [PATCH] fix wrong printf off_t format + +It's long vs. long long. There's a macro for this. + +Signed-off-by: Rosen Penev +--- + port.h | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/port.h ++++ b/port.h +@@ -3,14 +3,13 @@ + + #include "conf.h" + +- +- ++#include + + #ifndef _LARGEFILE64_SOURCE + #define _LARGEFILE64_SOURCE + #endif + #ifdef _LARGEFILE64_SOURCE +-#define OFF_T_PRINTF "%lld" ++#define OFF_T_PRINTF "%" PRId64 + #else + #define OFF_T_PRINTF "%d" + #endif diff --git a/utils/bonnie++/patches/102-add-missing-cast.patch b/utils/bonnie++/patches/102-add-missing-cast.patch new file mode 100644 index 0000000000..04f5d377ed --- /dev/null +++ b/utils/bonnie++/patches/102-add-missing-cast.patch @@ -0,0 +1,23 @@ +From 2e3e25454a165d55cbcd4fc78539454d4e0d8d51 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 22 Feb 2021 16:07:02 -0800 +Subject: [PATCH] add missing cast + +Fixes -Wformat + +Signed-off-by: Rosen Penev +--- + bon_time.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/bon_time.cpp ++++ b/bon_time.cpp +@@ -146,7 +146,7 @@ int BonTimer::print_stat(tests_t test, i + } + else + { +- fprintf(m_fp, " %5d", stat); ++ fprintf(m_fp, " %5d", int(stat)); + } + } + else