Last active
October 11, 2023 15:39
-
-
Save chertov/4074b711aa8450479c888dfb69bb3ae7 to your computer and use it in GitHub Desktop.
Building pgmodeler on macos ARM
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 | |
set -e | |
script_path="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/" | |
echo script_path: ${script_path} | |
brew install [email protected] libxml2 qt@6 postgresql@15 libpq | |
# export QT_ROOT=/opt/homebrew/Cellar/qt/6.5.2 | |
export QT_ROOT=/Users/user/Qt/6.5.3/macos/ | |
export INSTALLATION_ROOT=/Applications/pgmodeler.app | |
export PGSQL_ROOT=/opt/homebrew/opt/postgresql@14 | |
export OPENSSL_ROOT=/opt/homebrew/Cellar/[email protected]/1.1.1w | |
export PGMODELER_SRC=${script_path:?}/pgmodeler | |
rm -rf ${PGMODELER_SRC:?} | |
git clone https://github.com/pgmodeler/pgmodeler.git ${PGMODELER_SRC:?} | |
cd ${PGMODELER_SRC:?} | |
git checkout v1.0.5 | |
rm -rf ${INSTALLATION_ROOT:?} | |
cp pgmodeler.pri pgmodeler.pri.bak | |
sed -e 's!/Library/PostgreSQL/14/lib/libpq.dylib!/opt/homebrew/opt/postgresql@14/lib/postgresql@14/libpq.dylib!' \ | |
-e 's!/Library/PostgreSQL/14/include!/opt/homebrew/opt/postgresql@14/include/postgresql@14!' \ | |
pgmodeler.pri.bak > pgmodeler.pri | |
rm pgmodeler.pri.bak | |
${QT_ROOT:?}/bin/qmake -r pgmodeler.pro | |
make -j8 && make install | |
${QT_ROOT:?}/bin/macdeployqt $INSTALLATION_ROOT \ | |
$INSTALLATION_ROOT/Contents/MacOS/pgmodeler-ch \ | |
$INSTALLATION_ROOT/Contents/MacOS/pgmodeler-cli | |
cp \ | |
$PGSQL_ROOT/lib/postgresql@14/libpq.5.dylib \ | |
$OPENSSL_ROOT/lib/libssl.1.* \ | |
$OPENSSL_ROOT/lib/libcrypto.1.* \ | |
\ | |
$INSTALLATION_ROOT/Contents/Frameworks | |
install_name_tool -change "@loader_path/../lib/libcrypto.1.1.dylib" "@loader_path/../Frameworks/libcrypto.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libssl.1.1.dylib | |
install_name_tool -change "@loader_path/../lib/libcrypto.1.1.dylib" "@loader_path/../Frameworks/libcrypto.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libpq.5.dylib | |
install_name_tool -change "@loader_path/../lib/libssl.1.1.dylib" "@loader_path/../Frameworks/libssl.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libpq.5.dylib | |
install_name_tool -change libpq.5.dylib "@loader_path/../Frameworks/libpq.5.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libconnector.dylib | |
codesign --force --deep -s - ${INSTALLATION_ROOT} |
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 | |
set -e | |
# arch -x86_64 zsh # crosscompile x64 on Apple Arm | |
script_path="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/" | |
echo script_path: ${script_path} | |
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install openssl libxml2 qt@6 postgresql@15 libpq | |
export INSTALLATION_ROOT=/Applications/pgModeler.app | |
# macos Intel x64 | |
export HOMEBREW_PREFIX=/usr/local | |
export HOMEBREW_CELLAR=${HOMEBREW_PREFIX:?}/Cellar | |
export OPENSSL_ROOT=${HOMEBREW_CELLAR:?}/openssl@3/3.1.3 | |
export PGSQL_ROOT=${HOMEBREW_PREFIX:?}/opt/postgresql@15 | |
export QT_ROOT=${HOMEBREW_CELLAR:?}/qt/6.5.2 | |
# macos Apple M1 | |
# export QT_ROOT=/opt/homebrew/Cellar/qt/6.5.2 # export QT_ROOT=/Users/user/Qt/6.5.3/macos/ | |
# export PGSQL_ROOT=/opt/homebrew/opt/postgresql@14 | |
# export OPENSSL_ROOT=/opt/homebrew/Cellar/[email protected]/1.1.1w | |
export PGMODELER_SRC=${script_path:?}/pgmodeler | |
rm -rf ${PGMODELER_SRC:?} | |
git clone https://github.com/pgmodeler/pgmodeler.git ${PGMODELER_SRC:?} | |
cd ${PGMODELER_SRC:?} | |
git checkout v1.0.5 | |
rm -rf ${INSTALLATION_ROOT:?} | |
cp pgmodeler.pri pgmodeler.pri.bak | |
sed -e "s!/Library/PostgreSQL/14/lib/libpq.dylib!${PGSQL_ROOT:?}/lib/libpq.dylib!" \ | |
-e "s!/Library/PostgreSQL/14/include!${PGSQL_ROOT:?}/include!" \ | |
pgmodeler.pri.bak > pgmodeler.pri | |
rm pgmodeler.pri.bak | |
${QT_ROOT:?}/bin/qmake -r pgmodeler.pro | |
make -j8 | |
make install | |
rm -rf ./pgModeler.app | |
cp -r ${INSTALLATION_ROOT:?} pgModeler_backup.app | |
cp -r ${INSTALLATION_ROOT:?} pgModeler.app | |
${QT_ROOT:?}/bin/macdeployqt pgModeler.app \ | |
pgModeler.app/Contents/MacOS/pgmodeler-ch \ | |
pgModeler.app/Contents/MacOS/pgmodeler-cli \ | |
-always-overwrite -dmg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment