Last active
December 7, 2024 16:38
-
-
Save cocoabox/7731fb4db30615e32e9e8c84eef62b85 to your computer and use it in GitHub Desktop.
prepare fritzing-1.4.0 for build on macOS ventura
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# macos ventura-13.5 | |
# fritzing-1.4.0 | |
# | |
fritzing_app__repo="[email protected]:cocoabox/fritzing-app.git" | |
fritzing_parts__repo="[email protected]:cocoabox/fritzing-parts.git" | |
fritzing_app__commit_id="a8c6ef7cf66f7a42b9b233d6137f1b70a9573a25" | |
fritzing_parts__commit_id="76235099ed556e52003de63522fdd74e61d53a36" | |
SKIP_UNZIP_IF_DIR_EXISTS=0 | |
set -e | |
eecho() { | |
tput rev >&2 | |
echo "$@" >&2 | |
tput sgr0 >&2 | |
} | |
### | |
brew --version | |
eecho "## brew prerequisites" | |
brew list --versions | grep 'quazip 1.4' | |
brew list --versions | grep 'qt 6.7.3' | |
brew install qt | |
brew install quazip | |
brew install --cask qt-creator | |
### | |
eecho "## git clone/checkouts" | |
[[ ! -d fritzing-app ]] && git clone --quiet "$fritzing_app__repo" | |
pushd fritzing-app | |
git checkout "$fritzing_app__commit_id" | |
git restore . | |
popd | |
[[ ! -d fritzing-parts ]] && git clone --quiet "$fritzing_parts__repo" | |
pushd fritzing-parts | |
git checkout "$fritzing_parts__commit_id" | |
git restore . | |
popd | |
### | |
LIBGIT2_VER="1.7.1" | |
for URL in \ | |
'https://archives.boost.io/release/1.85.0/source/boost_1_85_0.zip' \ | |
'https://github.com/libgit2/libgit2/archive/refs/tags/v'${LIBGIT2_VER}'.tar.gz>libgit2-'${LIBGIT2_VER}'.tar.gz' \ | |
'https://github.com/svgpp/svgpp/archive/refs/tags/v1.3.1.tar.gz>svgpp-1.3.1.tar.gz' \ | |
'https://sourceforge.net/projects/ngspice/files/ng-spice-rework/42/ngspice-42.tar.gz/download>ngspice-42.tar.gz' \ | |
; do | |
FN=`basename "$URL"` | |
## download | |
if [[ "$URL" == *'>'* ]]; then | |
FN=$(echo "$URL" | cut -d '>' -f 2) | |
URL=$(echo "$URL" | cut -d '>' -f 1) | |
fi | |
if [[ -f "$FN" ]]; then | |
eecho "## already got $FN (if unzip fails, please delete manually)" | |
else | |
eecho "## download $URL -> $FN" | |
curl -kLo "$FN" "$URL" | |
fi | |
if [[ ! -s "$FN" ]]; then | |
eecho "## file is empty : $FN" | |
exit 1 | |
fi | |
## unzip | |
EXPAND_DIR="${FN%.*}" | |
eecho "## extract to : $EXPAND_DIR" | |
if [[ -d "$EXPAND_DIR" && $SKIP_UNZIP_IF_DIR_EXISTS -eq 1 ]]; then | |
eecho "## skip unzip ; dir exists : $EXPAND_DIR" | |
else | |
[[ -d "$EXPAND_DIR" ]] && rm -R "$EXPAND_DIR" | |
if [[ "$FN" =~ \.zip$ ]]; then | |
eecho "## unzip : $FN" | |
unzip -qo "$FN" | |
elif [[ "$FN" =~ \.tar\.gz$ ]]; then | |
eecho "## unzip/untar : $FN" | |
tar xzf "$FN" | |
else | |
eecho "## unknown : $FN" | |
exit 1 | |
fi | |
fi | |
done | |
# | |
# clipper : make static .a libraries instead of .dylib (also need to patch clipper1detect.pri) | |
# | |
eecho "## download/build Clipper" | |
[[ ! -f 'clipper-6.4.2.zip' ]] && \ | |
curl -kLo 'clipper-6.4.2.zip' 'https://sourceforge.net/projects/polyclipping/files/clipper_ver6.4.2.zip/download' | |
[[ -d "clipper-6.4.2" ]] && rm -R "clipper-6.4.2" | |
unzip -q -o -d 'clipper-6.4.2' 'clipper-6.4.2.zip' | |
[[ -L "Clipper1" ]] && rm Clipper1 | |
ln -s clipper-6.4.2 Clipper1 | |
pushd Clipper1/cpp | |
# ^M at the end of CMakeLists.txt makes it impossible to have inline patch | |
echo 'MTFjMTEKPCBTRVQoQlVJTERfU0hBUkVEX0xJQlMgT04gQ0FDSEUgQk9PTA0KLS0tCj4gU0VUKEJVSUxEX1NIQVJFRF9MSUJTIE9GRiBDQUNIRSBCT09MDQoxM2MxMwo8IEFERF9MSUJSQVJZKHBvbHljbGlwcGluZyBjbGlwcGVyLmNwcCkNCi0tLQo+IEFERF9MSUJSQVJZKHBvbHljbGlwcGluZyBTVEFUSUMgY2xpcHBlci5jcHApDQo=' \ | |
| base64 --decode \ | |
| patch CMakeLists.txt | |
cmake -S . -B build -D CMAKE_INSTALL_PREFIX=../6.4.2 | |
cmake --build ./build --target install | |
popd | |
### | |
eecho "## build libgit2" | |
pushd 'libgit2-'${LIBGIT2_VER} | |
if [[ -f "build/libgit2_clar" ]]; then | |
eecho "## already built ; to force build , delete : libgit/build/libgit2_clar" | |
else | |
mkdir -p -v build | |
pushd build | |
cmake -DBUILD_SHARED_LIBS=OFF .. && cmake --build . | |
popd | |
[[ -L lib ]] && rm lib | |
ln -s -v build lib | |
fi | |
popd | |
### | |
eecho "## patch fritzing-app" | |
[[ -L quazip ]] && rm quazip ; ln -s $(brew --prefix quazip) quazip | |
if brew list --versions | grep 'qt 6.7.'; then | |
PATCH_SETCONTENT="" | |
else | |
PATCH_SETCONTENT=", nullptr" | |
fi | |
pushd fritzing-app | |
git restore . | |
echo 'diff --git a/phoenix.pro b/phoenix.pro | |
index 72755b97..93025edc 100644 | |
--- a/phoenix.pro | |
+++ b/phoenix.pro | |
@@ -19,9 +19,9 @@ | |
# ******************************************************************** | |
QT_LEAST=6.5.3 | |
-QT_MOST=6.5.10 | |
+# QT_MOST=6.5.10 | |
!versionAtLeast(QT_VERSION, $${QT_LEAST}):error("Use at least Qt version $${QT_LEAST}") | |
-!versionAtMost(QT_VERSION, $${QT_MOST}):error("Use at most Qt version $${QT_MOST}") | |
+# !versionAtMost(QT_VERSION, $${QT_MOST}):error("Use at most Qt version $${QT_MOST}") | |
CONFIG += debug_and_release | |
CONFIG += c++17 | |
diff --git a/pri/quazipdetect.pri b/pri/quazipdetect.pri | |
index 07bd5621..48aae225 100644 | |
--- a/pri/quazipdetect.pri | |
+++ b/pri/quazipdetect.pri | |
@@ -3,7 +3,7 @@ | |
message("Using Fritzing quazip detect script.") | |
QUAZIP_VERSION=1.4 | |
-QUAZIP_PATH=$$absolute_path($$PWD/../../quazip-$$QT_VERSION-$$QUAZIP_VERSION) | |
+QUAZIP_PATH=$$absolute_path($$PWD/../../quazip) | |
QUAZIP_INCLUDE_PATH=$$QUAZIP_PATH/include/QuaZip-Qt6-$$QUAZIP_VERSION | |
QUAZIP_LIB_PATH=$$QUAZIP_PATH/lib | |
diff --git a/pri/spicedetect.pri b/pri/spicedetect.pri | |
index 76795bd8..c275a5aa 100644 | |
--- a/pri/spicedetect.pri | |
+++ b/pri/spicedetect.pri | |
@@ -20,7 +20,7 @@ NGSPICEPATH = $$absolute_path($${NGSPICEPATH}) | |
exists($$NGSPICEPATH) { | |
message("found $${NGSPICEPATH}") | |
- INCLUDEPATH += $$NGSPICEPATH/include | |
+ INCLUDEPATH += $$NGSPICEPATH/src/include | |
} else { | |
error("ngspice not found in $${NGSPICEPATH}") | |
} | |
diff --git a/src/model/modelbase.cpp b/src/model/modelbase.cpp | |
index 487360c7..fb7ea2a2 100644 | |
--- a/src/model/modelbase.cpp | |
+++ b/src/model/modelbase.cpp | |
@@ -868,7 +868,7 @@ ModelPart * ModelBase::createOldSchematicPartAux(ModelPart * modelPart, const QS | |
DebugDialog::debug(QString("Unable to open :%1").arg(path)); | |
} | |
QDomDocument oldDoc; | |
- QDomDocument::ParseResult parseResult = oldDoc.setContent(&newFzp); | |
+ QDomDocument::ParseResult parseResult = oldDoc.setContent(&newFzp '${PATCH_SETCONTENT}' ); | |
if (!parseResult.operator bool()) { | |
QString logMessage = QString("Parse Error: %1 at line %2, column %3 in %4") | |
.arg(parseResult.errorMessage) | |
diff --git a/pri/clipper1detect.pri b/pri/clipper1detect.pri | |
index 5c6505d2..18072b96 100644 | |
--- a/pri/clipper1detect.pri | |
+++ b/pri/clipper1detect.pri | |
@@ -23,5 +23,8 @@ win32 { | |
message("including $$absolute_path($${CLIPPER1}/include)") | |
INCLUDEPATH += $$absolute_path($${CLIPPER1}/include/polyclipping) | |
-LIBS += -L$$absolute_path($${CLIPPER1}/lib) -lpolyclipping | |
-QMAKE_RPATHDIR += $$absolute_path($${CLIPPER1}/lib) | |
+LIBS += $$absolute_path($${CLIPPER1}/lib/libpolyclipping.a) | |
+ | |
+!macx { | |
+ QMAKE_RPATHDIR += $$absolute_path($${CLIPPER1}/lib) | |
+} | |
diff --git a/tools/deploy_fritzing_mac.sh b/tools/deploy_fritzing_mac.sh | |
index 8323077e..c108ac82 100755 | |
--- a/tools/deploy_fritzing_mac.sh | |
+++ b/tools/deploy_fritzing_mac.sh | |
@@ -1,11 +1,16 @@ | |
#!/bin/bash -e | |
-QTBIN=/usr/local/opt/qt5/bin | |
+QTBIN=/usr/local/opt/qt6/bin | |
# Go to this scripts directory and then one up | |
toolsdir=$(dirname "${BASH_SOURCE[0]}") | |
cd "$toolsdir"/.. | |
workingdir=$(pwd) | |
+if [[ ! -f "phoenix.pro" ]]; then | |
+ echo "run this script in the GIT ROOT directory" >&2 | |
+ exit 1 | |
+fi | |
+ | |
echo ">> working directory" | |
echo "$workingdir" | |
@@ -37,8 +42,14 @@ cd "$supportdir" | |
rm -f ./translations/*.ts # remove translation xml files, since we only need the binaries in the release | |
find ./translations -name "*.qm" -size -128c -delete # delete empty translation binaries | |
-echo ">> clone parts repository" | |
-git clone --branch master --single-branch https://github.com/fritzing/fritzing-parts.git | |
+if [[ -d ../fritzing-parts ]]; then | |
+ echo ">> symlink parts repository" | |
+ [[ -L "./fritzing-parts" ]] && rm ./fritzing-parts | |
+ ln -s ../fritzing-parts ./fritzing-parts | |
+else | |
+ echo ">> clone parts repository" | |
+ git clone --branch master --single-branch https://github.com/fritzing/fritzing-parts.git | |
+fi | |
echo ">> build parts database" | |
./Fritzing -db "fritzing-parts/parts.db" # -pp "fritzing-parts" -f "." | |
' | git apply | |
popd | |
eecho "## You can now open using QT-Creator the main Project File : phoenix.pro" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment