Merge pull request #67486 from peterhoeg/f/astyle

astyle: use cmake to avoid having to manually manage the build
This commit is contained in:
Peter Hoeg 2019-08-26 18:47:39 +08:00 committed by GitHub
commit 780e656e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,32 +1,26 @@
{ stdenv, fetchurl }: { stdenv, lib, fetchurl, cmake }:
let stdenv.mkDerivation rec {
name = "astyle"; pname = "astyle";
version = "3.1"; version = "3.1";
in
stdenv.mkDerivation {
name = "${name}-${version}";
src = fetchurl { src = fetchurl {
url = "mirror://sourceforge/${name}/${name}_${version}_linux.tar.gz"; url = "mirror://sourceforge/${pname}/${pname}_${version}_linux.tar.gz";
sha256 = "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b"; sha256 = "1ms54wcs7hg1bsywqwf2lhdfizgbk7qxc9ghasxk8i99jvwlrk6b";
}; };
sourceRoot = if stdenv.cc.isClang # lots of hardcoded references to /usr
then "astyle/build/clang" postPatch = ''
else "astyle/build/gcc"; substituteInPlace CMakeLists.txt \
--replace ' /usr/' " $out/"
'';
# -s option is obsolete on Darwin and breaks build nativeBuildInputs = [ cmake ];
postPatch = if stdenv.isDarwin then ''
substituteInPlace Makefile --replace "LDFLAGSr = -s" "LDFLAGSr ="
'' else null;
installFlags = "INSTALL=install prefix=$$out"; meta = with lib; {
meta = {
homepage = http://astyle.sourceforge.net/;
description = "Source code indenter, formatter, and beautifier for C, C++, C# and Java"; description = "Source code indenter, formatter, and beautifier for C, C++, C# and Java";
license = stdenv.lib.licenses.lgpl3; homepage = "https://astyle.sourceforge.net/";
platforms = stdenv.lib.platforms.unix; license = licenses.lgpl3;
platforms = platforms.unix;
}; };
} }