# ***** IF USING QT6 *****

# Download pyside-setup-everywhere-src-6.10.2.tar.xz from 
# https://download.qt.io/official_releases/QtForPython/

# or

# git clone https://github.com/qtproject/pyside-pyside-setup.git
# cd pyside-pyside-setup
# git checkout 6.10.2

# To update from 6.10 to a specific target version (say 6.10 to 6.10.2)
# edit sources/pyside6/.cmake.conf to set version info
# and edit sources/shiboken6/.cmake.conf to do the same

export MACOSX_DEPLOYMENT_TARGET=13.0

export MYDEST=/Users/${USER}/ndevpython314/libraries/Frameworks
export MYQTHOME=~/Qt6102
export PATH=${PATH}:${MYQTHOME}/bin
export PATH=${MYDEST}/Python.framework/Versions/3.14/bin:${PATH}

which qmake
which python3

# Prerequisites

# Your may need to have the packaging module installed on your python3
# and install setuptools module
# pip3 install --upgrade packaging
# pip3 install --upgrade setuptools

# You will need libclang (although macOS has this lib pre-installed, it can *not* 
# be found by Qt's cmake.  Qt has pre-build binaries ready to be used for each platform.
# I recommend storing it someplace *outside* the normal path such as in /opt to help 
# prevent future name clash issues.
# Download  libclang-release_19.1.6-based-macos-universal.7z from:
#       https://download.qt.io/development_releases/prebuilt/libclang/
# cd /opt
# and unpack libclang-release_19.1.6-based-macos-universal.7z in /opt to create /opt/libclang

# Tell the pyside6 build where to find it
export CLANG_INSTALL_DIR=/opt/libclang

# You should now be ready to build pyside6

tar -jxf pyside-setup-everywhere-src-6.10.2.tar.xz
cd pyside-setup-everywhere-src-6.10.2
# or cd pyside-pyside-setup if checked out from git

python3 setup.py install --parallel=6

# Fix dangling rpaths produced by PySide6 inside Python site-packages

cd /Users/kbhend/ndevpython314/libraries/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/PySide6

otool -l ./lupdate | grep LC_RPATH -A2
install_name_tool -delete_rpath /Users/kbhend/Qt6102/lib ./lupdate

otool -l ./lrelease | grep LC_RPATH -A2
install_name_tool -delete_rpath /Users/kbhend/Qt6102/lib ./lrelease

otool -l ./Qt/libexec/rcc | grep LC_RPATH -A2
install_name_tool -delete_rpath /Users/kbhend/Qt6102/lib ./Qt/libexec/rcc

otool -l ./Qt/libexec/uic | grep LC_RPATH -A2
install_name_tool -delete_rpath /Users/kbhend/Qt6102/lib ./Qt/libexec/uic


