From 0eea69141f8a758b5205b69a1495332aff9e78e9 Mon Sep 17 00:00:00 2001 From: Zoltan Puskas Date: Thu, 19 Dec 2019 02:26:24 -0800 Subject: [PATCH] sci-electronics/kicad: Fix build failure and QA Fix recent build failure in KiCAD. Also apply backported patches from upstream to address QA issues that remained since introducing this version of the ebuild. Package-Manager: Portage-2.3.80, Repoman-2.3.19 Signed-off-by: Zoltan Puskas Closes: https://bugs.gentoo.org/682480 Closes: https://bugs.gentoo.org/722288 Signed-off-by: Alexey Shvetsov --- .../kicad/files/kicad-5.1.5-ninja-build.patch | 6 ++--- .../files/kicad-5.1.5-strict-aliasing.patch | 25 +++++++++++++++++++ .../kicad/files/kicad-algorithm-header.patch | 11 ++++++++ .../kicad/files/kicad-metainfo.patch | 12 +++++++++ ...-5.1.5-r1.ebuild => kicad-5.1.5-r2.ebuild} | 17 ++++++++++++- 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 sci-electronics/kicad/files/kicad-5.1.5-strict-aliasing.patch create mode 100644 sci-electronics/kicad/files/kicad-algorithm-header.patch create mode 100644 sci-electronics/kicad/files/kicad-metainfo.patch rename sci-electronics/kicad/{kicad-5.1.5-r1.ebuild => kicad-5.1.5-r2.ebuild} (83%) diff --git a/sci-electronics/kicad/files/kicad-5.1.5-ninja-build.patch b/sci-electronics/kicad/files/kicad-5.1.5-ninja-build.patch index 3aac927b5bd2..3b4b6a4d2fef 100644 --- a/sci-electronics/kicad/files/kicad-5.1.5-ninja-build.patch +++ b/sci-electronics/kicad/files/kicad-5.1.5-ninja-build.patch @@ -13,8 +13,8 @@ diff -Naur kicad-5.1.5-orig/pcbnew/CMakeLists.txt kicad-5.1.5/pcbnew/CMakeLists. + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.kiface DESTINATION ${PYTHON_DEST} COMPONENT binary RENAME "_pcbnew.so" ) set( PYMOD_EXT "so" ) endif() - -@@ -827,18 +823,16 @@ + +@@ -792,18 +788,16 @@ if( KICAD_SCRIPTING_MODULES ) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} ) else() @@ -41,5 +41,5 @@ diff -Naur kicad-5.1.5-orig/pcbnew/CMakeLists.txt kicad-5.1.5/pcbnew/CMakeLists. + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} + ) endif() - + endif() diff --git a/sci-electronics/kicad/files/kicad-5.1.5-strict-aliasing.patch b/sci-electronics/kicad/files/kicad-5.1.5-strict-aliasing.patch new file mode 100644 index 000000000000..b01a6b7d79f6 --- /dev/null +++ b/sci-electronics/kicad/files/kicad-5.1.5-strict-aliasing.patch @@ -0,0 +1,25 @@ +diff --git a/eeschema/dialogs/dialog_spice_model.cpp b/eeschema/dialogs/dialog_spice_model.cpp +index b265e2363..eb1187d86 100644 +--- a/eeschema/dialogs/dialog_spice_model.cpp ++++ b/eeschema/dialogs/dialog_spice_model.cpp +@@ -34,6 +34,7 @@ + #include + + #include ++#include + + // Helper function to shorten conditions + static bool empty( const wxTextCtrl* aCtrl ) +@@ -804,9 +804,11 @@ bool DIALOG_SPICE_MODEL::addPwlValue( const wxString& aTime, const wxString& aVa + float timeF; + m_pwlTime->GetValue().ToDouble( &timeD ); + timeF = timeD; ++ long data; ++ std::memcpy( &data, &timeF, sizeof( timeF ) ); + + // Store the time value, so the entries can be sorted +- m_pwlValList->SetItemData( idx, *reinterpret_cast( &timeF ) ); ++ m_pwlValList->SetItemData( idx, data ); + + // Sort items by timestamp + m_pwlValList->SortItems( comparePwlValues, -1 ); diff --git a/sci-electronics/kicad/files/kicad-algorithm-header.patch b/sci-electronics/kicad/files/kicad-algorithm-header.patch new file mode 100644 index 000000000000..aa118ea6f860 --- /dev/null +++ b/sci-electronics/kicad/files/kicad-algorithm-header.patch @@ -0,0 +1,11 @@ +diff -Naur kicad-5.1.5-orig/common/lib_tree_model.cpp kicad-5.1.5/common/lib_tree_model.cpp +--- kicad-5.1.5-orig/common/lib_tree_model.cpp 2020-05-11 00:36:36.568301297 +0200 ++++ kicad-5.1.5/common/lib_tree_model.cpp 2020-05-11 00:37:50.472359703 +0200 +@@ -21,6 +21,7 @@ + + #include + ++#include + #include + #include + #include diff --git a/sci-electronics/kicad/files/kicad-metainfo.patch b/sci-electronics/kicad/files/kicad-metainfo.patch new file mode 100644 index 000000000000..48a5ef5be507 --- /dev/null +++ b/sci-electronics/kicad/files/kicad-metainfo.patch @@ -0,0 +1,12 @@ +diff -Naur kicad-5.1.5-orig/CMakeLists.txt kicad-5.1.5/CMakeLists.txt +--- kicad-5.1.5-orig/CMakeLists.txt 2019-11-14 09:09:45.000000000 -0800 ++++ kicad-5.1.5/CMakeLists.txt 2020-05-11 23:51:52.122093410 -0700 +@@ -919,7 +919,7 @@ + set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime ) + set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons ) + set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications ) +- set( UNIX_APPDATA_FILES resources/linux/appdata ) ++ set( UNIX_APPDATA_FILES resources/linux/metainfo ) + + # Install Mime directory + install( DIRECTORY ${UNIX_ICON_FILES} diff --git a/sci-electronics/kicad/kicad-5.1.5-r1.ebuild b/sci-electronics/kicad/kicad-5.1.5-r2.ebuild similarity index 83% rename from sci-electronics/kicad/kicad-5.1.5-r1.ebuild rename to sci-electronics/kicad/kicad-5.1.5-r2.ebuild index aaf6a6bf350a..8dbca2a8ae44 100644 --- a/sci-electronics/kicad/kicad-5.1.5-r1.ebuild +++ b/sci-electronics/kicad/kicad-5.1.5-r2.ebuild @@ -57,6 +57,9 @@ CHECKREQS_DISK_BUILD="800M" PATCHES=( "${FILESDIR}"/"${PN}-5.1.5-help.patch" "${FILESDIR}"/"${PN}-5.1.5-ninja-build.patch" + "${FILESDIR}"/"${PN}-5.1.5-strict-aliasing.patch" + "${FILESDIR}"/"${PN}-algorithm-header.patch" + "${FILESDIR}"/"${PN}-metainfo.patch" "${FILESDIR}"/"ldflags.patch" ) @@ -67,11 +70,22 @@ pkg_setup() { check-reqs_pkg_setup } +src_unpack() { + default_src_unpack + # For the metainfo patch to work the kicad.appdata.xml has to be moved to + # avoid QA issue. This is needed because /usr/share/appdata location is + # deprecated, it should not be used anymore by new software. + # Appdata/Metainfo files should be installed into /usr/share/metainfo + # directory. as per + # https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html + mv "${S}/resources/linux/appdata" "${S}/resources/linux/metainfo" || die "Appdata move failed" +} + src_configure() { xdg_environment_reset local mycmakeargs=( - -DKICAD_DOCS="${EPREFIX}/usr/share/doc/${P}" + -DKICAD_DOCS="${EPREFIX}/usr/share/doc/${PF}" -DKICAD_HELP="${EPREFIX}/usr/share/doc/${PN}-doc-${PV}" -DBUILD_GITHUB_PLUGIN="$(usex github)" -DKICAD_SCRIPTING="$(usex python)" @@ -84,6 +98,7 @@ src_configure() { -DKICAD_USE_OCC="$(usex occ)" -DKICAD_USE_OCE="$(usex oce)" -DKICAD_INSTALL_DEMOS="$(usex examples)" + -DCMAKE_SKIP_RPATH="ON" ) use python && mycmakeargs+=( -DPYTHON_DEST="$(python_get_sitedir)" -- 2.26.2