-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qgis, qgis-ltr: fix dependencies on darwin #157862
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,5 @@ | ||||||
{ lib | ||||||
, stdenv | ||||||
, mkDerivation | ||||||
, fetchFromGitHub | ||||||
, cmake | ||||||
|
@@ -18,6 +19,8 @@ | |||||
, txt2tags | ||||||
, openssl | ||||||
, libzip | ||||||
, libtasn1 | ||||||
, utmp | ||||||
, hdf5 | ||||||
, netcdf | ||||||
, exiv2 | ||||||
|
@@ -103,6 +106,7 @@ in mkDerivation rec { | |||||
postgresql | ||||||
txt2tags | ||||||
libzip | ||||||
libtasn1 | ||||||
hdf5 | ||||||
netcdf | ||||||
qtbase | ||||||
|
@@ -114,13 +118,15 @@ in mkDerivation rec { | |||||
qtserialport | ||||||
qtxmlpatterns | ||||||
qt3d | ||||||
pdal | ||||||
zstd | ||||||
] ++ lib.optional withGrass grass | ||||||
++ lib.optional withWebKit qtwebkit | ||||||
++ lib.optional stdenv.isLinux pdal | ||||||
++ lib.optional stdenv.isDarwin utmp | ||||||
++ pythonBuildInputs; | ||||||
|
||||||
nativeBuildInputs = [ makeWrapper wrapGAppsHook cmake flex bison ninja ]; | ||||||
nativeBuildInputs = [ wrapGAppsHook cmake flex bison ninja ] | ||||||
++ lib.optional stdenv.isLinux [ makeWrapper ]; | ||||||
|
||||||
patches = [ | ||||||
(substituteAll { | ||||||
|
@@ -132,31 +138,76 @@ in mkDerivation rec { | |||||
|
||||||
cmakeFlags = [ | ||||||
"-DWITH_3D=True" | ||||||
"-DWITH_PDAL=TRUE" | ||||||
] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF" | ||||||
++ lib.optional stdenv.isLinux "-DWITH_PDAL=TRUE" | ||||||
++ lib.optional withGrass (let | ||||||
gmajor = lib.versions.major grass.version; | ||||||
gminor = lib.versions.minor grass.version; | ||||||
in "-DGRASS_PREFIX${gmajor}=${grass}/grass${gmajor}${gminor}" | ||||||
); | ||||||
|
||||||
dontWrapGApps = true; # wrapper params passed below | ||||||
dontWrapQtApps = stdenv.isDarwin; | ||||||
|
||||||
postFixup = lib.optionalString withGrass '' | ||||||
postFixup = lib.optionalString (withGrass && stdenv.isLinux) '' | ||||||
# grass has to be availble on the command line even though we baked in | ||||||
# the path at build time using GRASS_PREFIX. | ||||||
# using wrapGAppsHook also prevents file dialogs from crashing the program | ||||||
# on non-NixOS | ||||||
wrapProgram $out/bin/qgis \ | ||||||
"''${gappsWrapperArgs[@]}" \ | ||||||
--prefix PATH : ${lib.makeBinPath [ grass ]} | ||||||
'' + lib.optionalString stdenv.isDarwin '' | ||||||
mkdir -p $out/Applications | ||||||
mkdir -p $out/bin | ||||||
mv $out/QGIS.app $out/Applications/ | ||||||
ln -s $out/Applications/QGIS.app/Contents/MacOS/QGIS $out/bin/qgis | ||||||
export SHORT_VERSION=$(echo "${version}" | awk 'BEGIN{FS=OFS="."} NF--') | ||||||
echo "Short version: $SHORT_VERSION" | ||||||
for f in $out/Applications/QGIS.app/Contents/MacOS/lib/libqgis_app.${version}.dylib \ | ||||||
$out/Applications/QGIS.app/Contents/MacOS/lib/libqgispython.${version}.dylib \ | ||||||
$out/Applications/QGIS.app/Contents/MacOS/QGIS \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_3d.framework/Versions/$SHORT_VERSION/qgis_3d \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_analysis.framework/Versions/$SHORT_VERSION/qgis_analysis \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_core.framework/Versions/$SHORT_VERSION/qgis_core \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_gui.framework/Versions/$SHORT_VERSION/qgis_gui \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_native.framework/Versions/$SHORT_VERSION/qgis_native \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgisgrass8.framework/Versions/$SHORT_VERSION/qgisgrass8 \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_3d.framework/qgis_3d \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_analysis.framework/qgis_analysis \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_core.framework/qgis_core \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_gui.framework/qgis_gui \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgis_native.framework/qgis_native \ | ||||||
$out/Applications/QGIS.app/Contents/Frameworks/qgisgrass8.framework/qgisgrass8 | ||||||
do | ||||||
echo "Manually running install_name_tool on $f" | ||||||
install_name_tool -change "@loader_path/../lib/libqscintilla2_qt5.dylib" "${qscintilla}/lib/libqscintilla2_qt5.dylib" $f | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how did you get this list ? can it be parsed and looped over ? it should be more resistant to future upgrade There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was, unfortunately, done by me repeatedly building and running the .app, having it crash due to a linking error, and repeating over and over. I did at least simplify it so it can loop over the dylibs I know about. It seems like the original build script does it with a little less targeting, but it's true that this is moderately fragile. I'm open to suggestions for how to improve it -- fixDarwinDylib names was too blunt an instrument and tried to operate on lots of files in $out, and wasn't able to deal with the Frameworks, so I ended up just doing this manually. |
||||||
install_name_tool -change "@loader_path/../lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" $f | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same for all other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch -- will revise. |
||||||
install_name_tool -change "@loader_path/../lib/libqwt.dylib" "${qwt}/lib/libqwt.dylib" $f | ||||||
install_name_tool -change "@loader_path/../../Frameworks/qca-qt5.framework/qca-qt5" "${qca-qt5}/lib/qca-qt5.framework/qca-qt5" $f | ||||||
install_name_tool -change "@loader_path/../../../qca-qt5.framework/qca-qt5" "${qca-qt5}/lib/qca-qt5.framework/qca-qt5" $f | ||||||
install_name_tool -change "@loader_path/../../../../MacOS/lib/libqscintilla2_qt5.dylib" "${qscintilla}/lib/libqscintilla2_qt5.dylib" $f | ||||||
install_name_tool -change "@loader_path/../../../../MacOS/lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" $f | ||||||
install_name_tool -change "@loader_path/../../../../MacOS/lib/libqwt.dylib" "${qwt}/lib/libqwt.dylib" $f | ||||||
install_name_tool -change "@loader_path/../../../qgis_3d.framework/qgis_core" "$out/Applications/QGIS.app/Contents/Frameworks/qgis_core.framework/Versions/$SHORT_VERSION/qgis_core" $f | ||||||
install_name_tool -change "@loader_path/../../../qgis_analysis.framework/qgis_analysis" "$out/Applications/QGIS.app/Contents/Frameworks/qgis_analysis.framework/Versions/$SHORT_VERSION/qgis_analysis" $f | ||||||
install_name_tool -change "@loader_path/../../../qgis_core.framework/qgis_core" "$out/Applications/QGIS.app/Contents/Frameworks/qgis_core.framework/Versions/$SHORT_VERSION/qgis_core" $f | ||||||
install_name_tool -change "@loader_path/../../../qgis_gui.framework/qgis_gui" "$out/Applications/QGIS.app/Contents/Frameworks/qgis_gui.framework/Versions/$SHORT_VERSION/qgis_gui" $f | ||||||
install_name_tool -change "@loader_path/../../../qgis_native.framework/qgis_native" "$out/Applications/QGIS.app/Contents/Frameworks/qgis_native.framework/Versions/$SHORT_VERSION/qgis_native" $f | ||||||
install_name_tool -change "@loader_path/../../../qgisgrass8.framework/qgisgrass8" "$out/Applications/QGIS.app/Contents/Frameworks/qgisgrass8.framework/Versions/$SHORT_VERSION/qgisgrass8" $f | ||||||
install_name_tool -change "@executable_path/lib/libqwt.dylib" "${qwt}/lib/libqwt.dylib" $f | ||||||
install_name_tool -change "@executable_path/lib/libqscintilla2_qt5.dylib" "${qscintilla}/lib/libqscintilla2_qt5.dylib" $f | ||||||
install_name_tool -change "@executable_path/lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" $f | ||||||
install_name_tool -change "@executable_path/../Frameworks/qca-qt5.framework/qca-qt5" "${qca-qt5}/lib/qca-qt5.framework/qca-qt5" $f | ||||||
done | ||||||
|
||||||
''; | ||||||
|
||||||
meta = { | ||||||
description = "A Free and Open Source Geographic Information System"; | ||||||
homepage = "https://www.qgis.org"; | ||||||
license = lib.licenses.gpl2Plus; | ||||||
platforms = with lib.platforms; linux; | ||||||
platforms = with lib.platforms; unix; | ||||||
maintainers = with lib.maintainers; [ lsix sikmir erictapen willcohen ]; | ||||||
}; | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change ? it seems to build fine on Mac with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call -- it was broken a long time ago and I just assumed that was still true. Fixed since October with #195216. Will revise.