about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/codeblocks
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/codeblocks')
-rw-r--r--nixpkgs/pkgs/applications/editors/codeblocks/default.nix40
-rw-r--r--nixpkgs/pkgs/applications/editors/codeblocks/writable-projects.patch18
2 files changed, 58 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/codeblocks/default.nix b/nixpkgs/pkgs/applications/editors/codeblocks/default.nix
new file mode 100644
index 000000000000..cbed08f317fa
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/codeblocks/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, autoreconfHook, libtool, pkgconfig, file, zip, wxGTK, gtk2
+, contribPlugins ? false, hunspell, gamin, boost
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}";
+  version = "17.12";
+  pname = "codeblocks";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/codeblocks/Sources/${version}/codeblocks_${version}.tar.xz";
+    sha256 = "1q2pph7md1p10i83rir2l4gvy7ym2iw8w6sk5vl995knf851m20k";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig libtool file zip ];
+  buildInputs = [ wxGTK gtk2 ]
+    ++ optionals contribPlugins [ hunspell gamin boost ];
+  enableParallelBuilding = true;
+  patches = [ ./writable-projects.patch ];
+  preConfigure = "substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file";
+  postConfigure = optionalString stdenv.isLinux "substituteInPlace libtool --replace ldconfig ${stdenv.cc.libc.bin}/bin/ldconfig";
+  configureFlags = [ "--enable-pch=no" ]
+    ++ optionals contribPlugins [ "--with-contrib-plugins" "--with-boost-libdir=${boost}/lib" ];
+
+  meta = {
+    maintainers = [ maintainers.linquize ];
+    platforms = platforms.all;
+    description = "The open source, cross platform, free C, C++ and Fortran IDE";
+    longDescription =
+      ''
+        Code::Blocks is a free C, C++ and Fortran IDE built to meet the most demanding needs of its users.
+        It is designed to be very extensible and fully configurable.
+        Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
+      '';
+    homepage = http://www.codeblocks.org;
+    license = licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/editors/codeblocks/writable-projects.patch b/nixpkgs/pkgs/applications/editors/codeblocks/writable-projects.patch
new file mode 100644
index 000000000000..3b6364a52a1c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/codeblocks/writable-projects.patch
@@ -0,0 +1,18 @@
+diff --git a/src/plugins/scriptedwizard/wiz.cpp b/src/plugins/scriptedwizard/wiz.cpp
+index 0eb4b27..7d469fe 100644
+--- a/src/plugins/scriptedwizard/wiz.cpp
++++ b/src/plugins/scriptedwizard/wiz.cpp
+@@ -785,6 +785,13 @@ void Wiz::CopyFiles(cbProject* theproject, const wxString&  prjdir, const wxStri
+             }
+         }
+         if (do_copy) wxCopyFile(srcfile, dstfile, true);
++        // Noticed! Files in Nix Store are readonly, so make the copied file writable
++        if (do_copy)
++        {
++            struct stat statbuf;
++            if (!::stat(dstfile.mb_str(), &statbuf))
++                ::chmod(dstfile.mb_str(), statbuf.st_mode | 0200);
++        }
+ 
+         // and add it to the project
+         fname.MakeRelativeTo(prjdir);