summary refs log tree commit diff
path: root/pkgs/development/tools/misc/astyle/default.nix
blob: 770162c237e41296296e07585d5a666b46722d80 (plain) (blame)
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
{ stdenv, fetchurl }:

let
  name = "astyle";
  version = "2.05.1";
in
stdenv.mkDerivation {
  name = "${name}-${version}";

  src = fetchurl {
    url = "mirror://sourceforge/${name}/${name}_${version}_linux.tar.gz";
    sha256 = "1b0f4wm1qmgcswmixv9mwbp86hbdqxk754hml8cjv5vajvqwdpzv";
  };

  sourceRoot = if (stdenv.cc.cc.isClang or false)
    then "astyle/build/clang"
    else "astyle/build/gcc";

  # -s option is obsolete on Darwin and breaks build
  postPatch = if stdenv.isDarwin then ''
    substituteInPlace Makefile --replace "LDFLAGSr   = -s" "LDFLAGSr ="
  '' else null;

  installFlags = "INSTALL=install prefix=$$out";

  meta = {
    homepage = "http://astyle.sourceforge.net/";
    description = "Source code indenter, formatter, and beautifier for C, C++, C# and Java";
    license = stdenv.lib.licenses.lgpl3;
    platforms = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.simons ];
  };
}