diff --git a/mingw-w64-kicad/012-ki-7.0-Set-StockEDALibraryPath-to-usr-share-kicad7.0.patch b/mingw-w64-kicad/012-ki-7.0-Set-StockEDALibraryPath-to-usr-share-kicad7.0.patch new file mode 100644 index 0000000000000..f4e87947e898b --- /dev/null +++ b/mingw-w64-kicad/012-ki-7.0-Set-StockEDALibraryPath-to-usr-share-kicad7.0.patch @@ -0,0 +1,53 @@ +From 1f46231b631ab8abab0befb2ce7960e071a90ffd Mon Sep 17 00:00:00 2001 +From: Tim Stahlhut +Date: Fri, 3 Nov 2023 23:06:59 -0400 +Subject: Set StockEDALibraryPath to getWindowsMSys2Root() + "usr/share/kicad7.0" + +--- + common/paths.cpp | 10 +++++++++- + include/paths.h | 5 +++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/common/paths.cpp b/common/paths.cpp +index f6fac6af0a..5d03620e32 100644 +--- a/common/paths.cpp ++++ b/common/paths.cpp +@@ -190,7 +190,7 @@ wxString PATHS::GetStockEDALibraryPath() + #if defined( __WXMAC__ ) + path = GetOSXKicadMachineDataDir(); + #elif defined( __WXMSW__ ) +- path = GetStockDataPath( false ); ++ path = getWindowsMSys2Root() + "usr/share/kicad7.0"; + #else + path = wxString::FromUTF8Unchecked( KICAD_LIBRARY_DATA ); + #endif +@@ -470,4 +470,12 @@ wxString PATHS::getWindowsKiCadRoot() + + return root.GetPathWithSep(); + } ++ ++wxString PATHS::getWindowsMSys2Root() ++{ ++ wxFileName root( Pgm().GetExecutablePath() + wxT( "/../../" ) ); ++ root.MakeAbsolute(); ++ ++ return root.GetPathWithSep(); ++} + #endif +diff --git a/include/paths.h b/include/paths.h +index 7dfa9f5d1d..4fa21ece44 100644 +--- a/include/paths.h ++++ b/include/paths.h +@@ -195,6 +195,11 @@ private: + * This retrieves that root for usage in other methods + */ + static wxString getWindowsKiCadRoot(); ++ /** ++ * Gets the root of the MSys2 install on Windows specifically. ++ * This retrieves that root for usage in other methods ++ */ ++ static wxString getWindowsMSys2Root(); + #endif + }; + +-- diff --git a/mingw-w64-kicad/PKGBUILD b/mingw-w64-kicad/PKGBUILD index 1f4a498f47fd2..2a90cdb4df1b6 100644 --- a/mingw-w64-kicad/PKGBUILD +++ b/mingw-w64-kicad/PKGBUILD @@ -1,24 +1,26 @@ # Maintainer: Alexey Pavlov # Contributor: Tim Stahlhut -# Remember to update mingw-w64-kicad-doc and mingw-w64-kicad-library when -# updating this build rule. +# Remember to update mingw-w64-kicad-doc and MSys2 kicad-library when +# upgrading this build rule. _realname=kicad _wx_basever=3.2 +_basepkgver=7.0 +_msys2basepkgname=${_realname}${_basepkgver} pkgbase=mingw-w64-${_realname} -pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") -pkgver=7.0.8 +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" + #"${MINGW_PACKAGE_PREFIX}-${_realname}-meta" +) +pkgver=${_basepkgver}.9 pkgrel=1 pkgdesc="Software for the creation of electronic schematic diagrams and printed circuit board artwork (mingw-w64)" arch=(any) -mingw_arch=('mingw64' 'ucrt64' 'clang64') # 'mingw32' 'clang32') +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'mingw32' 'clang32') url="https://www.kicad.org/" license=("spdx:GPL-3.0-or-later") groups=("${MINGW_PACKAGE_PREFIX}-eda") options=('strip' '!debug') -conflicts=(${MINGW_PACKAGE_PREFIX}-${_realname}-git) -replaces=(${MINGW_PACKAGE_PREFIX}-${_realname}-git) depends=( "${MINGW_PACKAGE_PREFIX}-boost" "${MINGW_PACKAGE_PREFIX}-curl" @@ -33,8 +35,6 @@ depends=( "${MINGW_PACKAGE_PREFIX}-zlib" $([[ ${MINGW_PACKAGE_PREFIX} == *-clang-aarch64* ]] || echo "${MINGW_PACKAGE_PREFIX}-opencascade") "${MINGW_PACKAGE_PREFIX}-cairo" - "${MINGW_PACKAGE_PREFIX}-kicad-footprints" - "${MINGW_PACKAGE_PREFIX}-kicad-symbols" ) makedepends=( "${MINGW_PACKAGE_PREFIX}-cc" @@ -46,14 +46,6 @@ makedepends=( "${MINGW_PACKAGE_PREFIX}-wxwidgets${_wx_basever}-msw" "git" ) -optdepends=( - "${MINGW_PACKAGE_PREFIX}-kicad-templates: for template libraries" - "${MINGW_PACKAGE_PREFIX}-kicad-packages3D: for 3D model libraries" -) -_doc=("ca" "de" "en" "es" "fr" "id" "it" "ja" "nl" "pl" "ru" "zh") -for _doclang in ${_doc[@]}; do - optdepends+=("${MINGW_PACKAGE_PREFIX}-${_realname}-doc-${_doclang}: for documentation (${_doclang})"); -done source=( "https://gitlab.com/kicad/code/kicad/-/archive/${pkgver}/kicad-${pkgver}.tar.bz2" '002-ki-6.0-cmake-fixes-for-MINGW-CLANG.patch' @@ -61,12 +53,14 @@ source=( '006-ki-6.0-rewrite-kiwin32_rc_for_clang.patch' # This is not a patch to use with standard production builds '007-ki-6.0-manifest-remove-win10-11-manifest-support.patch' + '012-ki-7.0-Set-StockEDALibraryPath-to-usr-share-kicad7.0.patch' ) -sha256sums=('a97b3a831e7d0a2f3b54e2dd4258fe42bb0657e1ddb8c9aa2cc3f8e3b85a002d' +sha256sums=('45322e7495cbf0b6bba70b8fb8b58fdafa408d4d8473209fd1c5e8bad5a818f7' '2924a86849c02aecd21cded0bd2069353fca33c3364f9b41f9bfdd80e19085cf' 'd8d5f4bdd0aa6d8a907710c523f6f95840636cb2ef69e5275c6ed4966f134353' 'e03dbb58409145c8fb54991d8259f14bc0ba6b21abca24f9b914ec354c9df89c' - '550397b8d2ba66b924933020e409e868d3e4b2352a235f329798bc631b9fd28f') + '550397b8d2ba66b924933020e409e868d3e4b2352a235f329798bc631b9fd28f' + '386273230e6e984cf11d2f95538369d6457543a9b6454283b03c023e70e3ddbd') # Helper macros to help make tasks easier # apply_patch_with_msg() { @@ -87,6 +81,7 @@ prepare() { # used for the production version of the package #apply_patch_with_msg \ #007-ki-6.0-manifest-remove-win10-11-manifest-support.patch + apply_patch_with_msg 012-ki-7.0-Set-StockEDALibraryPath-to-usr-share-kicad7.0.patch } build() { @@ -119,10 +114,49 @@ build() { "${MINGW_PREFIX}"/bin/cmake.exe --build . # --parallel 1 --verbose } -package() { +package_kicad() { + conflicts=(${MINGW_PACKAGE_PREFIX}-${_realname}-git) + #${MINGW_PACKAGE_PREFIX}-${_realname}-footprints + #${MINGW_PACKAGE_PREFIX}-${_realname}-symbols + #${MINGW_PACKAGE_PREFIX}-${_realname}-templates + #${MINGW_PACKAGE_PREFIX}-${_realname}-packages3D) + replaces=(${MINGW_PACKAGE_PREFIX}-${_realname}-git) + optdepends=() + _doc=("ca" "de" "en" "es" "fr" "id" "it" "ja" "nl" "pl" "ru" "zh") + for _doclang in ${_doc[@]}; do + optdepends+=("${MINGW_PACKAGE_PREFIX}-${_realname}-doc-${_doclang}: for documentation (${_doclang})"); + done + optdepends+=("${_msys2basepkgname}-footprints: for footprints libraries") + optdepends+=("${_msys2basepkgname}-symbols: for symbols libraries") + optdepends+=("${_msys2basepkgname}-templates: for template libraries") + optdepends+=("${_msys2basepkgname}-packages3D: for 3D model libraries") + cd "${srcdir}/build-${MSYSTEM}" DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install . # --parallel 1 --verbose install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.README" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.README" install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.GPLv3" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.GPLv3" } + +package_kicad-meta() { + pkgdesc="Meta package for KiCad containing the core application and support libraries (mingw-w64)" + options=('!strip') + + depends=(${MINGW_PACKAGE_PREFIX}-${_realname} + ${_msys2basepkgname}-footprints + ${_msys2basepkgname}-symbols + ${_msys2basepkgname}-templates + ${_msys2basepkgname}-packages3D) + optdepends=() +} + +# template start; name=mingw-w64-splitpkg-wrappers; version=1.0; +# vim: set ft=bash : + +# generate wrappers +for _name in "${pkgname[@]}"; do + _short="package_${_name#${MINGW_PACKAGE_PREFIX}-}" + _func="$(declare -f "${_short}")" + eval "${_func/#${_short}/package_${_name}}" +done +# template end;