File: default.nix

package info (click to toggle)
openclonk 8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 169,656 kB
  • sloc: cpp: 180,484; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 148; sh: 101; javascript: 34
file content (65 lines) | stat: -rw-r--r-- 2,034 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ pkgs ? import <nixpkgs> {} , withEditor ? false }:

pkgs.stdenv.mkDerivation rec {
  name = "openclonk";

  gitRef = pkgs.lib.commitIdFromGitRepo ../.git;

  src = builtins.filterSource (path: type: ! builtins.elem (baseNameOf path) [
    ".git" # leave out .git as it changes often in ways that do not affect the build
    "default.nix" # default.nix might change, but the only thing that matters is what it evaluates to, and nix takes care of that
    "result" # build result is irrelevant
    "build"
  ]) ./..;

  enableParallelBuilding = true;

  hardeningDisable = [ "format" ];

  nativeBuildInputs = with pkgs; [ cmake pkgconfig ];

  dontStrip = true;

  buildInputs = with pkgs; [
    SDL2 libvorbis libogg libjpeg libpng freetype glew tinyxml
    openal freealut readline
  ] ++ stdenv.lib.optional withEditor qt5.full;

  cmakeFlags = [ "-DCMAKE_AR=${pkgs.gcc-unwrapped}/bin/gcc-ar" "-DCMAKE_RANLIB=${pkgs.gcc-unwrapped}/bin/gcc-ranlib" ];

  preConfigure = ''
    sed s/REVGOESHERE/''${gitRef:0:12}/ > cmake/GitGetChangesetID.cmake <<EOF
    function(git_get_changeset_id VAR)
      set(\''${VAR} "REVGOESHERE" PARENT_SCOPE)
    endfunction()
    EOF
  '';

  # Temporary measure until 28154f45a6 is in a release of nixpkgs
  # Once this is the case, replace this with cmakeBuildType = "RelWithDebInfo"
  configurePhase = ''
    runHook preConfigure
    fixCmakeFiles .
    mkdir build
    cd build
    cmakeDir=..
    cmakeFlagsArray+=("-DCMAKE_INSTALL_PREFIX=$prefix" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_SKIP_BUILD_RPATH=ON")
    cmake ''${cmakeDir:-.} $cmakeFlags "''${cmakeFlagsArray[@]}"
    runHook postConfigure
  '';

  postInstall = ''
    mkdir -p $out/bin
    ln -s $out/games/openclonk $out/bin/
  '';


  meta = with pkgs.stdenv.lib; {
    description = "A free multiplayer action game about mining, settling and fast-paced melees";
    homepage = "http://www.openclonk.org/";
    license = with licenses; [
      isc cc-by-30
    ];
    maintainers = with lib.maintainers; [ lheckemann ];
  };
}