summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo Bargen2022-04-18 21:29:27 +0200
committerDanilo Bargen2022-04-18 21:29:27 +0200
commit367cc0a2fb2980a5af12c0a0bdb4a7428dcd40cf (patch)
tree9e4df742e6853b3c3f7e606f6a480891b23673df
parentd87f35f390e24ebb84292df098d75ebab349c75f (diff)
downloadaur-367cc0a2fb2980a5af12c0a0bdb4a7428dcd40cf.tar.gz
Fix CMake linking against muparser
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD17
-rw-r--r--cmake-muparser-fix.patch32
3 files changed, 48 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index da1c71ff0229..66cae92b2e4e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = librepcb
pkgdesc = A free EDA software to develop printed circuit boards
pkgver = 0.1.6
- pkgrel = 2
+ pkgrel = 3
url = https://librepcb.org/
arch = x86_64
arch = i686
@@ -17,8 +17,10 @@ pkgbase = librepcb
depends = quazip
source = https://download.librepcb.org/releases/0.1.6/librepcb-0.1.6-source.zip
source = https://download.librepcb.org/releases/0.1.6/librepcb-0.1.6-source.zip.asc
+ source = cmake-muparser-fix.patch
validpgpkeys = D6F9AF572228C5BCD6B538407EF3061F5C8D5E25
sha256sums = 8c7bf475ed59eb5b5e4b13073b96b9468ee01fb6980ef2b3471b1fbb39c46721
sha256sums = SKIP
+ sha256sums = a59a830a77f7401c5dea02172eaee54ba40953b04404a393cf2314e4002410eb
pkgname = librepcb
diff --git a/PKGBUILD b/PKGBUILD
index 950926979538..8842206c79e5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,7 @@
pkgname=librepcb
pkgver=0.1.6
_pkgver=${pkgver/_/-}
-pkgrel=2
+pkgrel=3
pkgdesc="A free EDA software to develop printed circuit boards"
arch=('x86_64' 'i686')
url="https://librepcb.org/"
@@ -30,13 +30,25 @@ makedepends=(
source=(
"https://download.librepcb.org/releases/${_pkgver}/librepcb-${_pkgver}-source.zip"
"https://download.librepcb.org/releases/${_pkgver}/librepcb-${_pkgver}-source.zip.asc"
+ "cmake-muparser-fix.patch"
)
sha256sums=(
'8c7bf475ed59eb5b5e4b13073b96b9468ee01fb6980ef2b3471b1fbb39c46721'
'SKIP'
+ 'a59a830a77f7401c5dea02172eaee54ba40953b04404a393cf2314e4002410eb'
)
validpgpkeys=('D6F9AF572228C5BCD6B538407EF3061F5C8D5E25')
+prepare() {
+ cd "${srcdir}/librepcb-${_pkgver}/"
+
+ # Patch muparser include path
+ sed -i 's/muparser\/include\/muParser.h/muParser.h/' libs/librepcb/common/utils/mathparser.cpp
+
+ # Apply CMake fix (https://github.com/LibrePCB/LibrePCB/pull/970)
+ patch -p1 < "${srcdir}/cmake-muparser-fix.patch"
+}
+
build() {
cd "${srcdir}/librepcb-${_pkgver}/"
@@ -49,9 +61,6 @@ build() {
# Remove bundled hoedown, it is not needed on Qt >=5.14
rm -rf libs/hoedown/
- # Patch muparser include path
- sed -i 's/muparser\/include\/muParser.h/muParser.h/' libs/librepcb/common/utils/mathparser.cpp
-
# Build
mkdir -p build && cd build
cmake .. \
diff --git a/cmake-muparser-fix.patch b/cmake-muparser-fix.patch
new file mode 100644
index 000000000000..5299878ac824
--- /dev/null
+++ b/cmake-muparser-fix.patch
@@ -0,0 +1,32 @@
+From b65dc1b766fc54da3117d44f612f6a93d5caa602 Mon Sep 17 00:00:00 2001
+From: Danilo Bargen <mail@dbrgn.ch>
+Date: Mon, 18 Apr 2022 21:05:43 +0200
+Subject: [PATCH] CMake: Add alias for muparser target
+
+Building LibrePCB with unbundled MuParser on Arch Linux currently fails,
+because the target `MuParser::MuParser` is not defined. Because this
+used to work before, I assume the target was renamed from
+`MuParser::MuParser` to `muparser::muparser` some time ago.
+
+To fix this, add an alias if the CMake package was found, but the pascal
+case alias isn't defined yet.
+---
+ cmake/FindMuParser.cmake | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/cmake/FindMuParser.cmake b/cmake/FindMuParser.cmake
+index 193898d8c..2e113d084 100644
+--- a/cmake/FindMuParser.cmake
++++ b/cmake/FindMuParser.cmake
+@@ -37,6 +37,11 @@ find_package(muparser 2.0 QUIET)
+ if(muparser_FOUND)
+ message(STATUS "Using system MuParser")
+
++ # Add uppercase alias if only the lowercase target is defined
++ if(NOT TARGET MuParser::MuParser)
++ add_library(MuParser::MuParser ALIAS muparser::muparser)
++ endif()
++
+ # Stop here, we're done
+ return()
+ endif()