Merge pull request #139764 from veprbl/pr/qtwrap_ismacho

qt: use isELF and isMachO in wrapQtAppsHook
This commit is contained in:
Thomas Tuegel 2021-09-28 20:37:15 -05:00 committed by GitHub
commit 0e87e81ee5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1 additions and 61 deletions

View file

@ -30,13 +30,9 @@ mkDerivation rec {
postConfigure = "make qmake_all";
# 1. installs app bundle on darwin, move to app bundle dir & link binary to bin
# 2. wrapQtAppsHook fails to wrap mach-o binaries automatically, manually call wrapper
# (see https://github.com/NixOS/nixpkgs/issues/102044)
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
mv $out/{bin,Applications}/BambooTracker.app
wrapQtApp $out/Applications/BambooTracker.app/Contents/MacOS/BambooTracker
ln -s $out/{Applications/BambooTracker.app/Contents/MacOS,bin}/BambooTracker
'';

View file

@ -36,7 +36,6 @@ mkDerivation rec {
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir $out/Applications
mv $out/bin/${mainProgram}.app $out/Applications/
wrapQtApp $out/Applications/${mainProgram}.app/Contents/MacOS/${mainProgram}
ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram}
'';

View file

@ -52,7 +52,6 @@ stdenv.mkDerivation rec {
postInstall = lib.optionalString stdenv.isDarwin ''
mkdir "$out"/Applications
mv app/mindforger.app "$out"/Applications/
wrapQtApp "$out"/Applications/mindforger.app/Contents/MacOS/mindforger
'';
meta = with lib; {

View file

@ -76,9 +76,6 @@ mkDerivation rec {
postInstall = with stdenv; lib.optionalString isDarwin ''
mkdir -p $out/Applications
mv $out/Mapper.app $out/Applications
# Fixes "This application failed to start because it could not find or load the Qt
# platform plugin "cocoa"."
wrapQtApp $out/Applications/Mapper.app/Contents/MacOS/Mapper
mkdir -p $out/bin
ln -s $out/Applications/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
'';

View file

@ -65,8 +65,6 @@ mkDerivation rec {
mv $out/bin/*.app $out/Applications
rmdir $out/bin || true
wrapQtApp "$out"/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
mv --target-directory=$out/Applications/OpenSCAD.app/Contents/Resources \
$out/share/openscad/{examples,color-schemes,locale,libraries,fonts,templates}

View file

@ -56,7 +56,6 @@ mkDerivation rec {
postInstall = lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
mv GoldenDict.app $out/Applications
wrapQtApp $out/Applications/GoldenDict.app/Contents/MacOS/GoldenDict
'';
meta = with lib; {

View file

@ -28,7 +28,6 @@ mkDerivation rec {
postInstall = lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
mv GPXLab/GPXLab.app $out/Applications
wrapQtApp $out/Applications/GPXLab.app/Contents/MacOS/GPXLab
'';
meta = with lib; {

View file

@ -26,7 +26,6 @@ mkDerivation rec {
postInstall = with stdenv; lib.optionalString isDarwin ''
mkdir -p $out/Applications
mv GPXSee.app $out/Applications
wrapQtApp $out/Applications/GPXSee.app/Contents/MacOS/GPXSee
'';
meta = with lib; {

View file

@ -115,11 +115,6 @@ stdenv.mkDerivation rec {
++ optional (stdenv.isDarwin && withKeePassTouchID)
darwin.apple_sdk.frameworks.LocalAuthentication;
preFixup = optionalString stdenv.isDarwin ''
# Make it work without Qt in PATH.
wrapQtApp $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC
'';
passthru.tests = nixosTests.keepassxc;
meta = {

View file

@ -30,9 +30,6 @@ mkDerivation rec {
installPhase = ''
install -Dm755 console/lsd2dsl gui/lsd2dsl-qtgui -t $out/bin
'' + lib.optionalString stdenv.isDarwin ''
wrapQtApp $out/bin/lsd2dsl
wrapQtApp $out/bin/lsd2dsl-qtgui
'';
meta = with lib; {

View file

@ -50,7 +50,6 @@ mkDerivation rec {
mkdir -p $out/Applications
mv binaries/bin/merkaartor.app $out/Applications
mv binaries/bin/plugins $out/Applications/merkaartor.app/Contents
wrapQtApp $out/Applications/merkaartor.app/Contents/MacOS/merkaartor
'';
meta = with lib; {

View file

@ -33,10 +33,6 @@ in mkDerivation {
cp sleepyhead/SleepyHead $out/bin
'';
postFixup = lib.optionalString stdenv.isDarwin ''
wrapQtApp "$out/Applications/SleepyHead.app/Contents/MacOS/SleepyHead"
'';
meta = with lib; {
homepage = "https://sleepyhead.jedimark.net/";
description = "Review and explore data produced by CPAP and related machines";

View file

@ -51,11 +51,6 @@ stdenv.mkDerivation rec {
install -Dm644 $src/xpdf-qt/xpdf-icon.svg $out/share/pixmaps/xpdf.svg
'';
# wrapQtAppsHook broken on macOS (https://github.com/NixOS/nixpkgs/issues/102044)
postFixup = lib.optionalString stdenv.isDarwin ''
wrapQtApp $out/bin/xpdf
'';
meta = with lib; {
homepage = "https://www.xpdfreader.com";
description = "Viewer for Portable Document Format (PDF) files";

View file

@ -16,9 +16,6 @@ mkDerivation rec {
mkdir -p "$out/Applications"
mv bin/chatterino.app "$out/Applications/"
'';
postFixup = lib.optionalString stdenv.isDarwin ''
wrapQtApp "$out/Applications/chatterino.app/Contents/MacOS/chatterino"
'';
meta = with lib; {
description = "A chat client for Twitch chat";
longDescription = ''

View file

@ -34,7 +34,6 @@ mkDerivation rec {
mkdir -p $out/Applications
cp -r tensor.app $out/Applications/tensor.app
wrapQtApp $out/Applications/tensor.app/Contents/MacOS/tensor
runHook postInstall
'' else ''

View file

@ -38,8 +38,6 @@ stdenv.mkDerivation rec {
install_name_tool \
-add_rpath @executable_path/../Frameworks \
$out/Applications/Communi.app/Contents/MacOS/Communi
wrapQtApp $out/Applications/Communi.app/Contents/MacOS/Communi
'' else ''
substituteInPlace "$out/share/applications/communi.desktop" \
--replace "/usr/bin" "$out/bin"

View file

@ -66,8 +66,6 @@ in stdenv.mkDerivation {
install_name_tool -change "$dylib" "$out/lib/$dylib" "$f"
done
done
wrapQtApp $out/Applications/Wireshark.app/Contents/MacOS/Wireshark
'' else optionalString withQt ''
install -Dm644 -t $out/share/applications ../wireshark.desktop

View file

@ -37,10 +37,6 @@ stdenv.mkDerivation rec {
done
'';
postInstall = lib.optionalString stdenv.isDarwin ''
wrapQtApp "$out"/bin/beamerpresenter.app/Contents/MacOS/beamerpresenter
'';
meta = with lib; {
description = "Modular multi screen pdf presentation software respecting your window manager";
homepage = "https://github.com/stiglers-eponym/BeamerPresenter";

View file

@ -28,10 +28,6 @@ mkDerivation rec {
'SET(CMAKE_INSTALL_PREFIX "${placeholder "out"}/Stellarium.app/Contents")'
'';
postFixup = lib.optionalString stdenv.isDarwin ''
wrapQtApp "$out"/Stellarium.app/Contents/MacOS/stellarium
'';
meta = with lib; {
description = "Free open-source planetarium";
homepage = "http://stellarium.org/";

View file

@ -94,9 +94,6 @@ mkDerivation rec {
mv $out/Resources/* "$out/Applications/Jellyfin Media Player.app/Contents/Resources/"
rmdir $out/Resources
# fix 'Could not find the Qt platform plugin "cocoa" in ""' error
wrapQtApp "$out/Applications/Jellyfin Media Player.app/Contents/MacOS/Jellyfin Media Player"
ln -s "$out/Applications/Jellyfin Media Player.app/Contents/MacOS/Jellyfin Media Player" $out/bin/jellyfinmediaplayer
'';

View file

@ -36,8 +36,6 @@ mkDerivation {
-change libfive.dylib $out/lib/libfive.dylib \
-change libfive-guile.dylib $out/lib/libfive-guile.dylib \
$out/Applications/Studio.app/Contents/MacOS/Studio
wrapQtApp $out/Applications/Studio.app/Contents/MacOS/Studio
'' else ''
# Link "Studio" binary to "libfive-studio" to be more obvious:
ln -s "$out/bin/Studio" "$out/bin/libfive-studio"

View file

@ -85,7 +85,7 @@ wrapQtAppsHook() {
find "$targetDir" ! -type d -executable -print0 | while IFS= read -r -d '' file
do
patchelf --print-interpreter "$file" >/dev/null 2>&1 || continue
ifELF "$file" || isMachO "$file" || continue
if [ -f "$file" ]
then

View file

@ -53,7 +53,6 @@ mkDerivation rec {
mv "${binname}.app" $out/Applications/
install_name_tool -change {,${qwt}/lib/}libqwt.6.dylib "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
wrapQtApp "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
ln -s "$out/Applications/${binname}.app/Contents/MacOS/${binname}" $out/bin/${mainProgram}
'';

View file

@ -29,9 +29,6 @@ mkDerivation rec {
postInstall = lib.optionalString stdenv.isDarwin ''
mkdir $out/Applications
mv $out/*.app $out/Applications
for f in $out/Applications/android-file-transfer.app/Contents/MacOS/*; do
wrapQtApp "$f"
done
'';
meta = with lib; {

View file

@ -58,8 +58,6 @@ in
--prefix PATH : '${coreutils}/bin' \
--prefix PATH : '${fontconfig.bin}/bin' \
--run '. ${./set-gdfontpath-from-fontconfig.sh}'
'' + lib.optionalString (stdenv.isDarwin && withQt) ''
wrapQtApp $out/bin/gnuplot
'';
enableParallelBuilding = true;

View file

@ -25,7 +25,6 @@ mkDerivation rec {
mkdir -p $out/Applications
mv $out/bin/glogg.app $out/Applications/glogg.app
rm -fr $out/{bin,share}
wrapQtApp $out/Applications/glogg.app/Contents/MacOS/glogg
'';
meta = with lib; {