Packaging/Binaries: Difference between revisions

imported>Makefu
No edit summary
imported>Makefu
Line 137: Line 137:


   src = fetchurl {
   src = fetchurl {
      url = "http://get.code-industry.net/public/${name}_qt5.amd64.deb";
    url = "http://get.code-industry.net/public/${name}_qt5.amd64.deb";
      sha256 = "1z26qjhbiyz33rm7mp8ycgl5ka0v3v5lv5i5v0b5mx35arvx2zzy";
    sha256 = "1z26qjhbiyz33rm7mp8ycgl5ka0v3v5lv5i5v0b5mx35arvx2zzy";
   };
   };
   sourceRoot = ".";
   sourceRoot = ".";
   unpackCmd = ''
   unpackCmd = ''
      ar p "$src" data.tar.xz | tar xJ
    ar p "$src" data.tar.xz | tar xJ
   '';
   '';


   buildPhase = ":";  # nothing to build
   buildPhase = ":";  # nothing to build
  libPath = lib.makeLibraryPath [
 
    qt5.qtbase        # libQt5PrintSupport.so.5
    qt5.qtsvg        # libQt5Svg.so.5
    stdenv.cc.cc.lib  # libstdc++.so.6
    saneBackends    # libsane.so.1
  ];
   installPhase = ''
   installPhase = ''
     mkdir -p $out/bin
     mkdir -p $out/bin
Line 157: Line 152:
     # fix the path in the desktop file
     # fix the path in the desktop file
     substituteInPlace \
     substituteInPlace \
        $out/share/applications/masterpdfeditor4.desktop \
      $out/share/applications/masterpdfeditor4.desktop \
        --replace /opt/ $out/opt/
      --replace /opt/ $out/opt/
     # symlink the binary to bin/
     # symlink the binary to bin/
     ln -s $out/opt/master-pdf-editor-4/masterpdfeditor4 $out/bin/masterpdfeditor4
     ln -s $out/opt/master-pdf-editor-4/masterpdfeditor4 $out/bin/masterpdfeditor4
   '';
   '';
   postFixup = ''
   preFixup = let
    # we prepare our library path in the let clause to avoid it become part of the input of mkDerivation
    libPath = lib.makeLibraryPath [
      qt5.qtbase        # libQt5PrintSupport.so.5
      qt5.qtsvg        # libQt5Svg.so.5
      stdenv.cc.cc.lib  # libstdc++.so.6
      saneBackends      # libsane.so.1
    ];
  in ''
     patchelf \
     patchelf \
        --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath "${libPath}" \
      --set-rpath "${libPath}" \
        $out/opt/master-pdf-editor-4/masterpdfeditor4
      $out/opt/master-pdf-editor-4/masterpdfeditor4
   '';
   '';


Line 181: Line 184:
Because we created a derivation which is meant to be called by callPackage we can build the package now only via:
Because we created a derivation which is meant to be called by callPackage we can build the package now only via:
<code>nix-build -E '((import <nixpkgs> {}).callPackage (import ./default.nix) { })' --keep-failed --no-out-link</code>
<code>nix-build -E '((import <nixpkgs> {}).callPackage (import ./default.nix) { })' --keep-failed --no-out-link</code>


== Add the package to nixpkgs ==
== Add the package to nixpkgs ==