Skip to content
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

qcachegrind: init at 16.12.3 #23812

Closed
wants to merge 1 commit into from
Closed

Conversation

periklis
Copy link
Contributor

@periklis periklis commented Mar 12, 2017

Motivation for this change

This is the pure qt-based version of kcachegrind for Non-KDE-users e.g. MacOS. kcachegrind is merged under #23766

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@periklis
Copy link
Contributor Author

@orivej Here is the WIP of my PR. Currently qcachegrind segfaults during qt-plugin-load.

@periklis
Copy link
Contributor Author

Ok now i can fully understand the segfaults. I missed the wrapQtProgram.

@periklis periklis changed the title [WIP] qcachegrind: init at 16.12.2 qcachegrind: init at 16.12.2 Mar 13, 2017
@periklis
Copy link
Contributor Author

  • Fixed missing Qt wrapping
  • Added converters to $out/bin

{ stdenv, fetchurl, bash, cmake, qt57, graphviz, qmakeHook, makeQtWrapper, makeWrapper }:

stdenv.mkDerivation rec {
name = "kcachegrind-${version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the name not be qcachegrind?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is needed for the url and qcachegrind is a subpackage of kcachegrind for non-kde-environments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, then I would suggest changing the name here to qcachegrind and change the source URL to http://download.kde.org/stable/applications/${version}/src/kcachegrind-${version}.tar.xz.

The package name should reflect what you actually get when installing the package and doing nix-env -i kcachegrind and ending up with qcachegrind may be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point :) i've always used the attr through nix-env -iA :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

cp -r converters/memprof2calltree $out/bin/memprof2calltree
cp -r converters/op2calltree $out/bin/op2calltree
cp -r converters/pprof2calltree $out/bin/pprof2calltree
chmod -R +x $out/bin/
Copy link
Contributor

@orivej orivej Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To include converters, you should list their dependencies in build inputs so that fixup phase fixes their shebangs. (Users may disable them with e.g. qcachegrind.override { php = null; }.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies to perl, php, python added.

buildInputs = [ qt57.qtbase graphviz ];
nativeBuildInputs = [ qmakeHook makeQtWrapper makeWrapper ];

postInstall = stdenv.lib.optionalString (stdenv.isDarwin) ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also be available on Linux, at least cgview. I'm going to help with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could separate postInstall to build a .desktop for linux and an .app for macos. Let me known what you think.

version = "16.12.2";

src = fetchurl {
url = "http://download.kde.org/stable/applications/${version}/src/${name}.tar.xz";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if qcachegrind should be a part of kdeApplications since it uses its sources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it is possible at all to provide linux+macos outputs through the kdeWrapper. I think it is best for bost OSes to have the two packages separate, since the CMakelists.txt for linux depend on find_library(kde4) which will never work on MacOS. Thus, a simple separate qcachegrind package for non-linux users will be the alternative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.:

  '' + stdenv.lib.optionalString (stdenv.isLinux) ''
     mkdir -p "$out/share/applications"
     cat > "$out/share/applications/cgview.desktop" << __EOF__
     [Desktop Entry]
     Exec=$out/bin/cgview
     Name=Cachgrind View
     GenericName=Profiling Visualization
     Terminal=true
     Type=Application
     Categories=Qt;Development;Profiling;
     __EOF__
     wrapQtProgram $out/bin/cgview

     cat > "$out/share/applications/qcachegrind.desktop" << __EOF__
     [Desktop Entry]
     Exec=$out/bin/qcachegrind
     Name=QCachgrind
     GenericName=Profiling Visualization
     Terminal=false
     Type=Application
     Categories=Qt;Development;Profiling;
     __EOF__
     wrapQtProgram $out/bin/qcachegrind
  ''

'';

meta = with stdenv.lib; {
description = "QCachegrind is a Qt GUI to visualize profiling data.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates convention.

@periklis
Copy link
Contributor Author

Thx for review, i'll take care in the next couple of hours.

@periklis periklis force-pushed the topic_qcachegrind branch 5 times, most recently from d312332 to ddb11b8 Compare March 16, 2017 21:17
@periklis
Copy link
Contributor Author

@orivej ping

@orivej
Copy link
Contributor

orivej commented Mar 19, 2017

I would suggest to apply these changes: orivej@qcachegrind

  1. Now that qt5 is qt58 which is not yet available for darwin, you can't use pkgs.qmakeHook. You can use libsForQt57.callPackage to bring in qmakeHook compatible with Qt 5.7.
  2. The version might as well be updated to 16.12.3.
  3. Delete unused inputs: makeWrapper and graphviz. Yes, running qcachegrind may invoke graphviz, but simply mentioning graphviz in buildInputs will not help installed qcachegrind find it.
  4. Do not lose permissions with cp -r , use cp -a or cp -p.
  5. There seems to be no reason to install cgview as an app bundle — it is a terminal application that can not be launched from the menu.

@periklis
Copy link
Contributor Author

@orivej: I fixed 2. - 5. and let libsForQt57, since qt58 is not darwin-compatible yet. I have to check and apply the patch 4904df8 to qt-5/5.8, which will have to be a separate PR.

{ stdenv, fetchurl, bash, cmake,
qt, graphviz,
qmakeHook, makeQtWrapper,
perl, python, php
Copy link
Contributor

@orivej orivej Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the style guide (“Function formal arguments”), lines with arguments do not end with commas.

bash and graphviz are unused.

mkdir -p $out/Applications
cp -rp qcachegrind/qcachegrind.app $out/Applications
wrapQtProgram $out/Applications/qcachegrind.app/Contents/MacOS/qcachegrind
chmod -R +x $out/Applications/qcachegrind.app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chmod is not needed.

You did not include installation of Linux desktop files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installation on linux should be let to kcachegrind?!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no cgview in kcachegrind package, and some people who do not use KDE might prefer qcachegrind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, as asked above. What is the preferred way, provide the binary only under $out/bin or a qcachegrind.desktop file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I linked to what I would expect on Linux: an executable in $out/bin/qcachegrind and desktop metadata (for qcachegrind to appear in the launcher) in $out/share/applications.

@periklis periklis changed the title qcachegrind: init at 16.12.2 qcachegrind: init at 16.12.3 Mar 20, 2017
@periklis periklis force-pushed the topic_qcachegrind branch 2 times, most recently from d72ceea to 9a52fe6 Compare March 21, 2017 20:22
@periklis
Copy link
Contributor Author

@orivej any other impediments to merge this?

@orivej
Copy link
Contributor

orivej commented Mar 22, 2017

I approve the merge, but I do not have merge rights.

@rycee
Copy link
Member

rycee commented Mar 22, 2017

I'm doing a build of this now, if everything goes well I'll put it in master.

@rycee
Copy link
Member

rycee commented Mar 22, 2017

Rebased into master in a92dfe7. Many thanks @periklis for the submission and @orivej for the reviewing!

@rycee rycee closed this Mar 22, 2017
@periklis periklis deleted the topic_qcachegrind branch July 25, 2018 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants