about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/fpc
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/fpc')
-rwxr-xr-xnixpkgs/pkgs/development/compilers/fpc/binary-builder.sh14
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/binary.nix24
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/default.nix46
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/default.upstream6
-rw-r--r--nixpkgs/pkgs/development/compilers/fpc/lazarus.nix48
5 files changed, 138 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/fpc/binary-builder.sh b/nixpkgs/pkgs/development/compilers/fpc/binary-builder.sh
new file mode 100755
index 000000000000..4308c1ed211a
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fpc/binary-builder.sh
@@ -0,0 +1,14 @@
+source $stdenv/setup
+
+tar xf $src
+cd */
+tarballdir=$(pwd)
+for i in *.tar; do tar xvf $i; done
+echo "Deploying binaries.."
+mkdir $out
+cd $out
+for i in $tarballdir/*.gz; do tar xvf $i; done
+echo 'Creating ppc* symlink..'
+for i in $out/lib/fpc/*/ppc*; do
+  ln -fs $i $out/bin/$(basename $i)
+done
diff --git a/nixpkgs/pkgs/development/compilers/fpc/binary.nix b/nixpkgs/pkgs/development/compilers/fpc/binary.nix
new file mode 100644
index 000000000000..cf13ab6f5954
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fpc/binary.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "fpc-2.6.0-binary";
+
+  src =
+    if stdenv.hostPlatform.system == "i686-linux" then
+      fetchurl {
+        url = "mirror://sourceforge/project/freepascal/Linux/2.6.0/fpc-2.6.0.i386-linux.tar";
+        sha256 = "08yklvrfxvk59bxsd4rh1i6s3cjn0q06dzjs94h9fbq3n1qd5zdf";
+      }
+    else if stdenv.hostPlatform.system == "x86_64-linux" then
+      fetchurl {
+        url = "mirror://sourceforge/project/freepascal/Linux/2.6.0/fpc-2.6.0.x86_64-linux.tar";
+        sha256 = "0k9vi75k39y735fng4jc2vppdywp82j4qhzn7x4r6qjkad64d8lx";
+      }
+    else throw "Not supported on ${stdenv.hostPlatform.system}.";
+
+  builder = ./binary-builder.sh;
+
+  meta = {
+    description = "Free Pascal Compiler from a binary distribution";
+  };
+} 
diff --git a/nixpkgs/pkgs/development/compilers/fpc/default.nix b/nixpkgs/pkgs/development/compilers/fpc/default.nix
new file mode 100644
index 000000000000..b516019ffc9a
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fpc/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, gawk }:
+
+let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
+
+stdenv.mkDerivation rec {
+  version = "3.0.0";
+  name = "fpc-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/freepascal/fpcbuild-${version}.tar.gz";
+    sha256 = "1v40bjp0kvsi8y0mndqvvhnsqjfssl2w6wpfww51j4rxblfkp4fm";
+  };
+
+  buildInputs = [ startFPC gawk ];
+
+  preConfigure =
+    if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then ''
+      sed -e "s@'/lib/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
+      sed -e "s@'/lib64/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
+    '' else "";
+
+  makeFlags = "NOGDB=1 FPC=${startFPC}/bin/fpc";
+
+  installFlags = "INSTALL_PREFIX=\${out}";
+
+  postInstall = ''
+    for i in $out/lib/fpc/*/ppc*; do
+      ln -fs $i $out/bin/$(basename $i)
+    done
+    mkdir -p $out/lib/fpc/etc/
+    $out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/lib/fpc/etc/
+  '';
+
+  passthru = {
+    bootstrap = startFPC;
+  };
+
+  meta = with stdenv.lib; {
+    description = "Free Pascal Compiler from a source distribution";
+    homepage = https://www.freepascal.org;
+    maintainers = [ maintainers.raskin ];
+    license = with licenses; [ gpl2 lgpl2 ];
+    platforms = platforms.linux;
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/development/compilers/fpc/default.upstream b/nixpkgs/pkgs/development/compilers/fpc/default.upstream
new file mode 100644
index 000000000000..9f16c1b645cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fpc/default.upstream
@@ -0,0 +1,6 @@
+url https://sourceforge.net/projects/freepascal/files/Source/
+SF_version_dir
+version_link 'fpcbuild-[0-9.]+[.]tar[.]gz/download$'
+SF_redirect
+version '.*-([0-9.]+)[.]tar[.]gz' '\1'
+do_overwrite () { do_overwrite_just_version; }
diff --git a/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix b/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix
new file mode 100644
index 000000000000..74ca246deb09
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/fpc/lazarus.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, makeWrapper
+, fpc, gtk2, glib, pango, atk, gdk_pixbuf
+, libXi, xorgproto, libX11, libXext
+}:
+stdenv.mkDerivation rec {
+  name = "lazarus-${version}";
+  version = "1.8.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20${version}/lazarus-${version}.tar.gz";
+    sha256 = "1s8hdip973fc1lynklddl0mvg2jd2lzkfk8hzb8jlchs6jn0362s";
+  };
+
+  buildInputs = [
+    fpc gtk2 glib libXi xorgproto
+    libX11 libXext pango atk
+    stdenv.cc makeWrapper gdk_pixbuf
+  ];
+
+  makeFlags = [
+    "FPC=fpc"
+    "PP=fpc"
+    "REQUIRE_PACKAGES+=tachartlazaruspkg"
+    "bigide"
+  ];
+
+  preBuild = ''
+    export makeFlags="$makeFlags LAZARUS_INSTALL_DIR=$out/share/lazarus/ INSTALL_PREFIX=$out/"
+    export NIX_LDFLAGS="$NIX_LDFLAGS -L${stdenv.cc.cc.lib}/lib -lXi -lX11 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lc -lXext -lpango-1.0 -latk-1.0 -lgdk_pixbuf-2.0 -lcairo -lgcc_s"
+    export LCL_PLATFORM=gtk2
+    mkdir -p $out/share "$out/lazarus"
+    tar xf ${fpc.src} --strip-components=1 -C $out/share -m
+    sed -e 's@/usr/fpcsrc@'"$out/share/fpcsrc@" -i ide/include/unix/lazbaseconf.inc
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' "'$NIX_LDFLAGS'" \
+      --prefix LCL_PLATFORM ' ' "'$LCL_PLATFORM'"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Lazarus graphical IDE for FreePascal language";
+    homepage = http://www.lazarus.freepascal.org;
+    license = licenses.gpl2Plus ;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.raskin ];
+  };
+}