From ec54090892935cabf60f9aec7271036fc534596c Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 21 Sep 2018 20:20:37 +0000 Subject: user/labplot: fix endianness (upstream #398342) --- user/labplot/APKBUILD | 11 +- user/labplot/disable-liborigin.patch | 169 --------------------- user/labplot/liborigin-endian.patch | 26 ++++ user/labplot/really-disable-liborigin.patch | 32 ---- user/labplot/really-really-disable-liborigin.patch | 65 -------- 5 files changed, 29 insertions(+), 274 deletions(-) delete mode 100644 user/labplot/disable-liborigin.patch create mode 100644 user/labplot/liborigin-endian.patch delete mode 100644 user/labplot/really-disable-liborigin.patch delete mode 100644 user/labplot/really-really-disable-liborigin.patch (limited to 'user/labplot') diff --git a/user/labplot/APKBUILD b/user/labplot/APKBUILD index 53c91a025..c3b4d0388 100644 --- a/user/labplot/APKBUILD +++ b/user/labplot/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=labplot pkgver=2.5.0 -pkgrel=0 +pkgrel=1 pkgdesc="Interactive tool for graphing and analysis of scientific data" url="https://www.kde.org/applications/education/labplot/" arch="all" @@ -15,9 +15,7 @@ makedepends="cmake extra-cmake-modules qt5-qtbase-dev qt5-qtsvg-dev kconfig-dev qt5-qtserialport-dev syntax-highlighting-dev bison libexecinfo-dev" subpackages="$pkgname-doc $pkgname-lang" source="https://download.kde.org/stable/labplot/$pkgver/labplot-$pkgver.tar.xz - disable-liborigin.patch - really-disable-liborigin.patch - really-really-disable-liborigin.patch + liborigin-endian.patch " build() { @@ -32,7 +30,6 @@ build() { -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_C_FLAGS="$CFLAGS -D_GNU_SOURCE" \ - -DENABLE_LIBORIGIN=False \ ${CMAKE_CROSSOPTS} make } @@ -49,6 +46,4 @@ package() { } sha512sums="a4b285917e30b0ac00cb8c8ad6827ba3884d95fccc0511a0a317bb2d637e48e6579929c45cfb8bba737bb5a01472a2baa9d812a688730ac4fa40b23cc6625eba labplot-2.5.0.tar.xz -c309bc9d8d73377298824a5b5c741a4caf796f7136a562827c8f9969c860cef0f5f510a85527b3ef89cbd35d08d986b5d95f5d44e1a30f8a8eed083f3ebedcc7 disable-liborigin.patch -d2dd6f90a4382f88b28a8a2cb5e07c618ea8ba823e040638f08b95a4df97f4db76c025f897e6b618eb9546cf39a401904329697422db6af1c14cd2e8f6961362 really-disable-liborigin.patch -cba3c70d661fa2a887c414595757b9961771500402e58e6414e403cef2dd4fe183e253ce1e5accb49c6f930519ac4ff02ee8f63dfb5eb53289c6d0d3fab6703c really-really-disable-liborigin.patch" +d251300ca0992637453ef12021f3fa4ba0ed5651a19b27bee7573f50b101aaa787544c035bf0d00b9a9ef14156536ce027879d605ede228761754b762db88ded liborigin-endian.patch" diff --git a/user/labplot/disable-liborigin.patch b/user/labplot/disable-liborigin.patch deleted file mode 100644 index 9fd4e4ba7..000000000 --- a/user/labplot/disable-liborigin.patch +++ /dev/null @@ -1,169 +0,0 @@ -From d67faf643b2e69c017c21e9d9aaa1fe2d3de6b0e Mon Sep 17 00:00:00 2001 -From: Alexander Semke -Date: Wed, 12 Sep 2018 08:46:38 +0200 -Subject: Fixed the build with -DENABLE_LIBORIGIN=OFF. - ---- - INSTALL | 1 + - src/CMakeLists.txt | 5 ++++- - src/kdefrontend/MainWin.cpp | 18 +++++++++++++++++- - src/kdefrontend/datasources/ImportProjectDialog.cpp | 8 ++++++++ - 4 files changed, 30 insertions(+), 2 deletions(-) - -diff --git a/INSTALL b/INSTALL -index cc2bab9..05dd97b 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -41,5 +41,7 @@ To compile LabPlot without optional dependencies even if they are present on the - -DENABLE_LIBCERF=OFF - -DENABLE_CANTOR=OFF -+-DENABLE_MQTT=OFF -+-DENABLE_LIBORIGIN=OFF - - Note, by switching off these libraries the feature set of LabPlot will be reduced. - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ba5763d..892c3c3 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -223,7 +223,6 @@ set(BACKEND_SOURCES - ${BACKEND_DIR}/datasources/filters/ROOTFilter.cpp - ${BACKEND_DIR}/datasources/projects/ProjectParser.cpp - ${BACKEND_DIR}/datasources/projects/LabPlotProjectParser.cpp -- ${BACKEND_DIR}/datasources/projects/OriginProjectParser.cpp - ${BACKEND_DIR}/gsl/ExpressionParser.cpp - ${BACKEND_DIR}/matrix/Matrix.cpp - ${BACKEND_DIR}/matrix/matrixcommands.cpp -@@ -271,6 +270,10 @@ set(BACKEND_SOURCES - ${BACKEND_DIR}/datapicker/DatapickerCurve.cpp - ) - -+IF (ENABLE_LIBORIGIN) -+ lsit(APPEND BACKEND_SOURCES ${BACKEND_DIR}/datasources/projects/OriginProjectParser.cpp) -+ENDIF () -+ - set(NSL_SOURCES - ${BACKEND_DIR}/nsl/nsl_conv.c - ${BACKEND_DIR}/nsl/nsl_dft.c -diff --git a/src/kdefrontend/MainWin.cpp b/src/kdefrontend/MainWin.cpp -index 6f90d38..f7d6f8b 100644 ---- a/src/kdefrontend/MainWin.cpp -+++ b/src/kdefrontend/MainWin.cpp -@@ -37,7 +37,9 @@ - #include "backend/matrix/Matrix.h" - #include "backend/worksheet/Worksheet.h" - #include "backend/datasources/LiveDataSource.h" -+#ifdef HAVE_LIBORIGIN - #include "backend/datasources/projects/OriginProjectParser.h" -+#endif - #ifdef HAVE_CANTOR_LIBS - #include "backend/cantorWorksheet/CantorWorksheet.h" - #endif -@@ -295,7 +297,11 @@ void MainWin::initGUI(const QString& fileName) { - connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSaveProject())); - - if (!fileName.isEmpty()) { -+#ifdef HAVE_LIBORIGIN - if (Project::isLabPlotProject(fileName) || OriginProjectParser::isOriginProject(fileName)) { -+#else -+ if (Project::isLabPlotProject(fileName)) { -+#endif - QTimer::singleShot(0, this, [=] () { openProject(fileName); }); - } else { - newProject(); -@@ -939,7 +945,11 @@ void MainWin::openProject() { - KConfigGroup conf(KSharedConfig::openConfig(), "MainWin"); - const QString& dir = conf.readEntry("LastOpenDir", ""); - const QString& path = QFileDialog::getOpenFileName(this,i18n("Open project"), dir, -+#ifdef HAVE_LIBORIGIN - i18n("LabPlot Projects (%1);;Origin Projects (%2)", Project::supportedExtensions(), OriginProjectParser::supportedExtensions()) ); -+#else -+ i18n("LabPlot Projects (%1)", Project::supportedExtensions()) ); -+#endif - - if (path.isEmpty())// "Cancel" was clicked - return; -@@ -970,12 +980,14 @@ void MainWin::openProject(const QString& filename) { - bool rc = false; - if (Project::isLabPlotProject(filename)) - rc = m_project->load(filename); -+#ifdef HAVE_LIBORIGIN - else if (OriginProjectParser::isOriginProject(filename)) { - OriginProjectParser parser; - parser.setProjectFileName(filename); - parser.importTo(m_project, QStringList()); //TODO: add return code - rc = true; - } -+#endif - - if (!rc) { - closeProject(); -@@ -1718,7 +1730,11 @@ void MainWin::dropEvent(QDropEvent* event) { - QUrl url = event->mimeData()->urls().at(0); - const QString& f = url.toLocalFile(); - -+#ifdef HAVE_LIBORIGIN - if (Project::isLabPlotProject(f) || OriginProjectParser::isOriginProject(f)) -+#else -+ if (Project::isLabPlotProject(f)) -+#endif - openProject(f); - else { - if (!m_project) -diff --git a/src/kdefrontend/datasources/ImportProjectDialog.cpp b/src/kdefrontend/datasources/ImportProjectDialog.cpp -index 85cbf34..5216127 100644 ---- a/src/kdefrontend/datasources/ImportProjectDialog.cpp -+++ b/src/kdefrontend/datasources/ImportProjectDialog.cpp -@@ -111,8 +111,10 @@ ImportProjectDialog::ImportProjectDialog(MainWin* parent, ProjectType type) : QD - title = i18n("Import LabPlot Project"); - break; - case (ProjectOrigin): -+#ifdef HAVE_LIBORIGIN - m_projectParser = new OriginProjectParser(); - title = i18n("Import Origin Project"); -+#endif - break; - } - -@@ -234,8 +236,10 @@ void ImportProjectDialog::importTo(QStatusBar* statusBar) const { - timer.start(); - connect(m_projectParser, SIGNAL(completed(int)), progressBar, SLOT(setValue(int))); - -+#ifdef HAVE_LIBORIGIN - if (m_projectType == ProjectOrigin && ui.chbUnusedObjects->isVisible() && ui.chbUnusedObjects->isChecked()) - reinterpret_cast(m_projectParser)->setImportUnusedObjects(true); -+#endif - - m_projectParser->importTo(targetFolder, selectedPathes); - statusBar->showMessage( i18n("Project data imported in %1 seconds.", (float)timer.elapsed()/1000) ); -@@ -251,6 +255,7 @@ void ImportProjectDialog::refreshPreview() { - QString project = ui.leFileName->text(); - m_projectParser->setProjectFileName(project); - -+#ifdef HAVE_LIBORIGIN - if (m_projectType == ProjectOrigin) { - OriginProjectParser* originParser = reinterpret_cast(m_projectParser); - if (originParser->hasUnusedObjects()) -@@ -260,6 +265,7 @@ void ImportProjectDialog::refreshPreview() { - - originParser->setImportUnusedObjects(ui.chbUnusedObjects->isVisible() && ui.chbUnusedObjects->isChecked()); - } -+#endif - - ui.tvPreview->setModel(m_projectParser->model()); - -@@ -349,9 +355,11 @@ void ImportProjectDialog::selectFile() { - supportedFormats = i18n("LabPlot Projects (%1)", Project::supportedExtensions()); - break; - case (ProjectOrigin): -+#ifdef HAVE_LIBORIGIN - title = i18n("Open Origin Project"); - lastDirConfEntryName = QLatin1String("LastImportOriginProjecttDir"); - supportedFormats = i18n("Origin Projects (%1)", OriginProjectParser::supportedExtensions()); -+#endif - break; - } - --- -cgit v0.11.2 - diff --git a/user/labplot/liborigin-endian.patch b/user/labplot/liborigin-endian.patch new file mode 100644 index 000000000..b40782a3a --- /dev/null +++ b/user/labplot/liborigin-endian.patch @@ -0,0 +1,26 @@ +diff --git a/OriginAnyParser.cpp b/OriginAnyParser.cpp +index c9e863e..2637945 100644 +--- a/liborigin/OriginAnyParser.cpp ++++ b/liborigin/OriginAnyParser.cpp +@@ -24,10 +24,18 @@ + #include + + /* define a macro to get an int (or uint) from a istringstream in binary mode */ +-#define GET_INT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4);}; +-#define GET_SHORT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 2);}; +-#define GET_FLOAT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4);}; ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++#define GET_SHORT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 2);}; ++#define GET_INT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4);}; ++#define GET_FLOAT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4);}; + #define GET_DOUBLE(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 8);}; ++#else ++void inline swap_bytes(unsigned char* data, int size) {int i = 0, j = size - 1; while(i < j) {std::swap(data[i], data[j]); ++i, --j;}} ++#define GET_SHORT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 2); swap_bytes(reinterpret_cast(&ovalue), 2);}; ++#define GET_INT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4); swap_bytes(reinterpret_cast(&ovalue), 4);}; ++#define GET_FLOAT(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 4); swap_bytes(reinterpret_cast(&ovalue), 4);}; ++#define GET_DOUBLE(iss, ovalue) {iss.read(reinterpret_cast(&ovalue), 8); swap_bytes(reinterpret_cast(&ovalue), 8);}; ++#endif + + OriginAnyParser::OriginAnyParser(const string& fileName) + : file(fileName.c_str(),ios::binary), diff --git a/user/labplot/really-disable-liborigin.patch b/user/labplot/really-disable-liborigin.patch deleted file mode 100644 index c97a30ed7..000000000 --- a/user/labplot/really-disable-liborigin.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 75408146f9e26521dff825acc2bfb270dc4f6179 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" -Date: Wed, 12 Sep 2018 11:56:17 -0500 -Subject: [PATCH] datasources: Only include Origin header if enabled - -ImportProjectDialog was still #including the OriginProjectParser header, -which caused a build error if -DENABLE_LIBORIGIN=OFF. - -Signed-off-by: A. Wilcox -Fixes: d67faf643b2e69c017c21e9d9aaa1fe2d3de6b0e ---- - src/kdefrontend/datasources/ImportProjectDialog.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/kdefrontend/datasources/ImportProjectDialog.cpp b/src/kdefrontend/datasources/ImportProjectDialog.cpp -index 52161277..9fac9389 100644 ---- a/src/kdefrontend/datasources/ImportProjectDialog.cpp -+++ b/src/kdefrontend/datasources/ImportProjectDialog.cpp -@@ -30,7 +30,9 @@ - #include "backend/core/AspectTreeModel.h" - #include "backend/core/Project.h" - #include "backend/datasources/projects/LabPlotProjectParser.h" --#include "backend/datasources/projects/OriginProjectParser.h" -+#ifdef HAVE_LIBORIGIN -+# include "backend/datasources/projects/OriginProjectParser.h" -+#endif - #include "kdefrontend/MainWin.h" - #include "commonfrontend/widgets/TreeViewComboBox.h" - --- -2.18.0 - diff --git a/user/labplot/really-really-disable-liborigin.patch b/user/labplot/really-really-disable-liborigin.patch deleted file mode 100644 index 6deb963c8..000000000 --- a/user/labplot/really-really-disable-liborigin.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 5e37796f4db1a2408fdd56562f0d80ef7988ff38 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" -Date: Wed, 12 Sep 2018 12:02:44 -0500 -Subject: [PATCH] Tests: disable Origin tests when lib is disabled - -Compiling with liborigin disabled caused a build failure while building -ProjectImportTest, because it still unconditionally #included -OriginProjectParser and called into Origin code. ---- - tests/import_export/project/ProjectImportTest.cpp | 6 +++++- - tests/import_export/project/ProjectImportTest.h | 2 ++ - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/tests/import_export/project/ProjectImportTest.cpp b/tests/import_export/project/ProjectImportTest.cpp -index 11ac7845..91163b62 100755 ---- a/tests/import_export/project/ProjectImportTest.cpp -+++ b/tests/import_export/project/ProjectImportTest.cpp -@@ -26,7 +26,9 @@ - ***************************************************************************/ - - #include "ProjectImportTest.h" --#include "backend/datasources/projects/OriginProjectParser.h" -+#ifdef HAVE_LIBORIGIN -+# include "backend/datasources/projects/OriginProjectParser.h" -+#endif - #include "backend/core/Project.h" - #include "backend/core/Workbook.h" - #include "backend/matrix/Matrix.h" -@@ -49,6 +51,7 @@ void ProjectImportTest::initTestCase() { - //############################################################################## - - -+#ifdef HAVE_LIBORIGIN - //############################################################################## - //###################### import of Origin projects ############################ - //############################################################################## -@@ -375,5 +378,6 @@ void ProjectImportTest::testOriginTextNumericColumns() { - QCOMPARE(!std::isnan(column->valueAt(3)), false); - QCOMPARE(!std::isnan(column->valueAt(4)), false); - } -+#endif - - QTEST_MAIN(ProjectImportTest) -diff --git a/tests/import_export/project/ProjectImportTest.h b/tests/import_export/project/ProjectImportTest.h -index 2e27bcd0..22b414a3 100755 ---- a/tests/import_export/project/ProjectImportTest.h -+++ b/tests/import_export/project/ProjectImportTest.h -@@ -37,12 +37,14 @@ private slots: - - //import of LabPlot projects - -+#ifdef HAVE_LIBORIGIN - //import of Origin projects - void testOrigin01(); - void testOrigin02(); - void testOrigin03(); - void testOrigin04(); - void testOriginTextNumericColumns(); -+#endif - - private: - QString m_dataDir; --- -2.18.0 - -- cgit v1.2.3-60-g2f50