SWI-Prolog / packages-xpce

The graphics toolkit for SWI-Prolog
16 stars 14 forks source link

avoid breaking build without GUI #23

Closed crackleware closed 3 years ago

crackleware commented 3 years ago

When building master branch of https://github.com/SWI-Prolog/swipl-devel without GUI (no X11 libs) I'm getting this error:

make[2]: *** No rule to make target 'man/pl2xpce', needed by 'man/lib/main.tex'.  Stop.

I'm not sure if this dummy cmake target is the best way to fix it.

crackleware commented 3 years ago

To reproduce build problem without GUI (nixpkgs 21.05, SWI-Prolog 8.3.28):

$ nix-build -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz -E '
with import <nixpkgs> { };
((swiProlog.override {
  extraLibraries = [
    gperftools # use tcmalloc
  ];
}).overrideAttrs (old: rec {
  version = "8.3.28";
  src = fetchFromGitHub {
    owner = "SWI-Prolog";
    repo = "swipl-devel";
    rev = "V${version}";
    sha256 = "180j2ih9g5ns65x133zrw3nzq2gbld46y0qvslbm25b35slmq75i";
    fetchSubmodules = true;
  };
}))
'
...
make[2]: *** No rule to make target 'man/pl2xpce', needed by 'man/lib/main.tex'.  Stop.

With GUI builds fine:

$ nix-build -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz -E '
with import <nixpkgs> { };
((swiProlog.override {
  extraLibraries = [
    gperftools # use tcmalloc
    xorg.libSM xorg.libXt xorg.libICE
  ];
  withGui = true;
}).overrideAttrs (old: rec {
  version = "8.3.28";
  src = fetchFromGitHub {
    owner = "SWI-Prolog";
    repo = "swipl-devel";
    rev = "V${version}";
    sha256 = "180j2ih9g5ns65x133zrw3nzq2gbld46y0qvslbm25b35slmq75i";
    fetchSubmodules = true;
  };
}))
'

And finally with patch from this PR applied, without GUI builds okay too:

$ nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz -E '
with import <nixpkgs> { };
((swiProlog.override {
  extraLibraries = [
    gperftools # use tcmalloc
  ];
}).overrideAttrs (old: rec {
  version = "8.3.28";
  src = fetchFromGitHub {
    owner = "SWI-Prolog";
    repo = "swipl-devel";
    rev = "V${version}";
    sha256 = "180j2ih9g5ns65x133zrw3nzq2gbld46y0qvslbm25b35slmq75i";
    fetchSubmodules = true;
  };
  patches = [
    (writeText "patch-xpce" '"''"'
--- a/packages/xpce/CMakeLists.txt
+++ b/packages/xpce/CMakeLists.txt
@@ -193,4 +193,6 @@ foreach(rc '"''"'${XPCE_LINK_RC})
          RENAME ${rc}.rc)
 endforeach()

+else(HAVE_GUI)
+add_custom_target(pl2xpce COMMENT "dummy target to avoid breaking build without GUI")
 endif(HAVE_GUI)
'"''"')
  ];
}))
'
JanWielemaker commented 3 years ago

Thanks. Is a bit of a hack. Eventually the documentation dependencies require some more careful consideration :cry: