Paste number 337262: Free Pascal Compiler for Guix

Paste number 337262: Free Pascal Compiler for Guix
Pasted by: kei
When:5 years, 6 months ago
Share:Tweet this! |
Paste contents:
Raw Source | XML | Display As
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Kei Kebreau <>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <>.

(define-module (gnu packages pascal)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages xml))

(define fpc-bootstrap-x86_64-3.0.0
    (method url-fetch)

(define fpc-bootstrap-i386-3.0.0
    (method url-fetch)

(define-public fpc
  (let ((arch (if (string-prefix? "x86_64" (or (%current-target-system)
      (name "fpc")
      (version "3.0.0")
      (source (origin
                (method url-fetch)
                (uri (string-append "mirror://sourceforge/freepascal/Source/"
                                    version "fpcbuild-" version ".tar.gz"))
      (build-system gnu-build-system)
      (supported-systems '("i686-linux" "x86_64-linux"))
       `(("expat" ,expat)
         ("glibc" ,glibc)
         ("ncurses" ,ncurses)
         ("zlib" ,zlib)))
       ;; FPC is built with FPC, so we need bootstrap binaries.
          ,(if (string= arch "x86_64")
       `(#:tests? #f ; no tests available
         (let ((fpc-bootstrap-path
                (string-append (getcwd) "/" ,name "-" ,version "/fpc-bin")))
           (modify-phases %standard-phases
             (add-after 'unpack 'unpack-bin
               (lambda* (#:key inputs #:allow-other-keys)
                 (mkdir-p fpc-bootstrap-path)
                 (with-directory-excursion fpc-bootstrap-path
                   (copy-file (assoc-ref inputs "fpc-binary")
                   (zero? (system* "tar" "xvf" "fpc-bin.tar")))))
             (add-after 'unpack-bin 'install-bin
               (lambda* (#:key inputs #:allow-other-keys)
                     (string-append fpc-bootstrap-path "/fpc-3.0.0."
                                    ,arch "-linux")
                   (let ((binary-tarball
                          (string-append "binary." ,arch "-linux.tar"))
                          (string-append "base." ,arch "-linux.tar.gz"))
                          (string-append "utils-fpcm." ,arch "-linux.tar.gz")))
                      ;; Only the base compiler, fpcmake, and runtime library
                      ;; are needed.
                      (zero? (system* "tar" "xvf" binary-tarball
                      (zero? (system* "tar" "xvf" compiler-tarball "-C.."))
                      (zero? (system* "tar" "xvf" fpcmake-tarball "-C..")))))))
             (delete 'configure)
             (replace 'build
               (lambda _
                 (let* ((fpc-bin (string-append fpc-bootstrap-path "/bin"))
                        (fpc (string-append fpc-bin "/fpc"))
                        (fpcmake (string-append fpc-bin "/fpcmake")))
                   ;; The fpc binary needs to run the ppc[arch] binary (which
                   ;; does the actual compiling) in this directory.
                   (setenv "PATH"
                          (string-append (getenv "PATH") ":"
                                         "/lib/fpc/" ,version))
                    ;; -T[target operating system]
                    (zero? (system* fpcmake
                                    (string-append "-T" ,arch "-linux")))
                    (zero? (system* "make" "build" "NOGDB=1"
                                    (string-append "FPC=" fpc)))))))))))
      (home-page "")
      (synopsis "The Free Pascal Compiler")
       "Free Pascal is a professional Object Pascal compiler.  It supports the
Turbo Pascal 7.0, Delphi, and Mac Pascal dialects.  Free Pascal also supports
many useful extensions to the Pascal programming language.")
      ;; The majority of the software included is licensed under the GPLv2
      ;; or later.  For more licensing details, see the appropriate files in
      ;; the install/doc directory of the source distribution.
      (license license:gpl2+))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.