From: Kei Kebreau <kei@openmailbox.org>
To: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: Add fpc. (version 2)
Date: Fri, 27 Jan 2017 01:00:11 -0500 [thread overview]
Message-ID: <87a8adxct0.fsf@openmailbox.org> (raw)
In-Reply-To: <87efzpxfxh.fsf@openmailbox.org> (Kei Kebreau's message of "Thu, 26 Jan 2017 23:52:42 -0500")
[-- Attachment #1.1: Type: text/plain, Size: 611 bytes --]
Kei Kebreau <kei@openmailbox.org> writes:
> Kei Kebreau <kei@openmailbox.org> writes:
>
>> Kei Kebreau <kei@openmailbox.org> writes:
>>
>>> This is a patch that adds a package for the Free Pascal Compiler.
>>> Can someone verify that this builds reproducibly on an i386 machine?
>>
>> This update allows the compiler to find its configuration file.
>
> My apologies, the former upload was missing the crucial changes in the
> configure phase. Please use this patch instead.
Third time's a charm! Forgot a slash in one of the regex substitutions.
I can confirm that this compiles Pascal programs successfully.
[-- Attachment #1.2: 0001-gnu-Add-fpc.patch --]
[-- Type: text/plain, Size: 13528 bytes --]
From e5f92d59faecf2be251375f01df0a1601f4990d4 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Fri, 27 Jan 2017 00:18:45 -0500
Subject: [PATCH] gnu: Add fpc.
* gnu/packages/pascal.scm: New file.
* gnu/packages/patches/fpc-reproducibility.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add pascal.scm.
(dist_patch_DATA): Register patch.
---
gnu/local.mk | 4 +-
gnu/packages/pascal.scm | 176 +++++++++++++++++++++++++
gnu/packages/patches/fpc-reproducibility.patch | 39 ++++++
3 files changed, 218 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/pascal.scm
create mode 100644 gnu/packages/patches/fpc-reproducibility.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 59fc1a82c..fb24f32fb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -4,7 +4,7 @@
# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
# Copyright © 2013, 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
# Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
-# Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
+# Copyright © 2016, 2017 Kei Kebreau <kei@openmailbox.org>
# Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>
# Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
# Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
@@ -290,6 +290,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/ots.scm \
%D%/packages/package-management.scm \
%D%/packages/parallel.scm \
+ %D%/packages/pascal.scm \
%D%/packages/password-utils.scm \
%D%/packages/patchutils.scm \
%D%/packages/pciutils.scm \
@@ -554,6 +555,7 @@ dist_patch_DATA = \
%D%/packages/patches/fltk-shared-lib-defines.patch \
%D%/packages/patches/fltk-xfont-on-demand.patch \
%D%/packages/patches/fontforge-svg-modtime.patch \
+ %D%/packages/patches/fpc-reproducibility.patch \
%D%/packages/patches/freeimage-CVE-2015-0852.patch \
%D%/packages/patches/freeimage-CVE-2016-5684.patch \
%D%/packages/patches/gawk-shell.patch \
diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
new file mode 100644
index 000000000..0e7b9f3ab
--- /dev/null
+++ b/gnu/packages/pascal.scm
@@ -0,0 +1,176 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Kei Kebreau <kei@openmailbox.org>
+;;;
+;;; 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
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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 bootstrap)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages xml))
+
+(define fpc-bootstrap-x86_64-3.0.0
+ (origin
+ (method url-fetch)
+ (uri
+ "mirror://sourceforge/freepascal/Linux/3.0.0/fpc-3.0.0.x86_64-linux.tar")
+ (sha256
+ (base32
+ "1m2xx3nda45cb3zidbjgdr8kddd19zk0khvp7xxdlclszkqscln9"))))
+
+(define fpc-bootstrap-i386-3.0.0
+ (origin
+ (method url-fetch)
+ (uri
+ "mirror://sourceforge/freepascal/Linux/3.0.0/fpc-3.0.0.i386-linux.tar")
+ (sha256
+ (base32
+ "0h3f1dgs1zsx7vvk9kg67anjvgw5sslfbmjblif7ishbcp3k3g5k"))))
+
+(define-public fpc
+ (let ((arch (if (string-prefix? "x86_64" (or (%current-target-system)
+ (%current-system)))
+ "x86_64"
+ "i386")))
+ (package
+ (name "fpc")
+ (version "3.0.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/freepascal/Source/"
+ version "/fpcbuild-" version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1v40bjp0kvsi8y0mndqvvhnsqjfssl2w6wpfww51j4rxblfkp4fm"))
+ (patches (search-patches "fpc-reproducibility.patch"))))
+ (build-system gnu-build-system)
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (inputs
+ `(("expat" ,expat)
+ ("ncurses" ,ncurses)
+ ("zlib" ,zlib)))
+ (native-inputs
+ ;; FPC is built with FPC, so we need bootstrap binaries.
+ `(("fpc-binary"
+ ,(if (string= arch "x86_64")
+ fpc-bootstrap-x86_64-3.0.0
+ fpc-bootstrap-i386-3.0.0))))
+ (arguments
+ `(#:tests? #f ; no tests available
+ #:phases
+ (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")
+ "fpc-bin.tar")
+ (zero? (system* "tar" "xvf" "fpc-bin.tar")))))
+ (add-after 'unpack-bin 'install-bin
+ (lambda* (#:key inputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append fpc-bootstrap-path "/fpc-" ,version "."
+ ,arch "-linux")
+ (let ((binary-tarball
+ (string-append "binary." ,arch "-linux.tar"))
+ (compiler-tarball
+ (string-append "base." ,arch "-linux.tar.gz"))
+ (fpcmake-tarball
+ (string-append "utils-fpcm." ,arch "-linux.tar.gz")))
+ (and
+ ;; Only the base compiler and fpcmake are needed.
+ (zero? (system* "tar" "xvf" binary-tarball
+ compiler-tarball
+ fpcmake-tarball))
+ (zero? (system* "tar" "xvf" compiler-tarball "-C.."))
+ (zero? (system* "tar" "xvf" fpcmake-tarball "-C..")))))))
+ (replace 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* "fpcsrc/compiler/systems/t_linux.pas"
+ ;; Point to the current glibc dynamic linker.
+ (("/lib/ld-linux.so.2")
+ (string-append (assoc-ref inputs "libc")
+ ,(glibc-dynamic-linker)))
+ (("/lib64/ld-linux-x86-64.so.2")
+ (string-append (assoc-ref inputs "libc")
+ ,(glibc-dynamic-linker)))
+ ;; Add glibc to ld's search path.
+ (("if \\(isdll\\) then")
+ (string-append
+ "Add('SEARCH_DIR(\""
+ (assoc-ref inputs "libc") "/lib"
+ "\")');\n"
+ "if (isdll) then")))
+ (substitute* "fpcsrc/compiler/options.pas"
+ (("exepath\\+'../etc/'")
+ (string-append "'" (assoc-ref outputs "out") "/etc'")))
+ #t))
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (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") ":"
+ fpc-bootstrap-path
+ "/lib/fpc/" ,version))
+ (setenv "FPC" fpc)
+ (and
+ ;; Specify target operating system using "-T" option
+ (zero? (system* fpcmake
+ (string-append "-T" ,arch "-linux")))
+ (zero? (system* "make" "build" "NOGDB=1"))))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ ;; This is the suffix of the ppc[arch] binary.
+ (suffix (if (string= ,arch "x86_64")
+ "x64"
+ "386"))
+ (ppc (string-append "ppc" suffix)))
+ (system* "make" "install" "NOGDB=1"
+ (string-append "INSTALL_PREFIX=" out))
+ ;; Add a symlink to the ppc[arch] binary so fpc works.
+ (symlink (string-append out "/lib/fpc/" ,version "/" ppc)
+ (string-append out "/bin/" ppc))
+ ;; Install the example configuration file.
+ (mkdir (string-append out "/etc"))
+ (zero?
+ (system*
+ (string-append out "/lib/fpc/" ,version "/samplecfg")
+ (string-append out "/lib/fpc/" ,version)
+ (string-append out "/etc"))))))))))
+ (home-page "http://www.freepascal.org")
+ (synopsis "The Free Pascal Compiler")
+ (description
+ "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+))))
diff --git a/gnu/packages/patches/fpc-reproducibility.patch b/gnu/packages/patches/fpc-reproducibility.patch
new file mode 100644
index 000000000..133c1d7e8
--- /dev/null
+++ b/gnu/packages/patches/fpc-reproducibility.patch
@@ -0,0 +1,39 @@
+Remove/patch metadata timestamps for reproducibility.
+
+diff -ur fpcbuild-3.0.0.old/fpcsrc/packages/fpmkunit/src/fpmkunit.pp fpcbuild-3.0.0/fpcsrc/packages/fpmkunit/src/fpmkunit.pp
+--- fpcbuild-3.0.0.old/fpcsrc/packages/fpmkunit/src/fpmkunit.pp 2015-11-04 16:17:00.000000000 -0500
++++ fpcbuild-3.0.0/fpcsrc/packages/fpmkunit/src/fpmkunit.pp 2017-01-26 16:25:29.327339282 -0500
+@@ -3779,7 +3779,7 @@
+ Values[KeyName]:=Name;
+ Values[KeyVersion]:=Version;
+ // TODO Generate checksum based on PPUs
+- InstalledChecksum:=DateTimeToFileDate(Now);
++ InstalledChecksum:=0;
+ Values[KeyChecksum]:=IntToStr(InstalledChecksum);
+ Values[KeyCPU]:=CPUToString(ACPU);
+ Values[KeyOS]:=OSToString(AOS);
+diff -ur fpcbuild-3.0.0.old/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp fpcbuild-3.0.0/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp
+--- fpcbuild-3.0.0.old/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp 2013-06-01 18:27:16.000000000 -0400
++++ fpcbuild-3.0.0/fpcsrc/utils/fpcmkcfg/fpcmkcfg.pp 2017-01-26 16:24:22.949044903 -0500
+@@ -234,8 +234,8 @@
+ TemplateParser.Values['FPCTARGETOS'] := BuildOSTarget;
+ TemplateParser.Values['FPCBIN'] := 'fpc';
+ TemplateParser.Values['PWD'] := GetCurrentDir;
+- TemplateParser.Values['BUILDDATE'] := DateToStr(Date);
+- TemplateParser.Values['BUILDTIME'] := TimeToStr(Time);
++ TemplateParser.Values['BUILDDATE'] := '';
++ TemplateParser.Values['BUILDTIME'] := '';
+
+ TemplateParser.Values['LOCALREPOSITORY'] := GetDefaultLocalRepository;
+ TemplateParser.Values['LOCALBASEPATH'] := GetDefaultLocalBasepath;
+diff -ur fpcbuild-3.0.0.old/install/man/Makefile fpcbuild-3.0.0/install/man/Makefile
+--- fpcbuild-3.0.0.old/install/man/Makefile 2011-06-19 14:40:37.000000000 -0400
++++ fpcbuild-3.0.0/install/man/Makefile 2017-01-26 16:25:55.024227566 -0500
+@@ -31,5 +31,5 @@
+ $(GINSTALL) -d -m 755 $(INSTALL_MANDIR)/man5
+ $(GINSTALL) -c -m 644 man1/*.1 $(INSTALL_MANDIR)/man1
+ $(GINSTALL) -c -m 644 man5/*.5 $(INSTALL_MANDIR)/man5
+- find man1/*.1 -exec gzip -9f $(INSTALL_MANDIR)/'{}' \;
+- find man5/*.5 -exec gzip -9f $(INSTALL_MANDIR)/'{}' \;
++ find man1/*.1 -exec gzip -9fn $(INSTALL_MANDIR)/'{}' \;
++ find man5/*.5 -exec gzip -9fn $(INSTALL_MANDIR)/'{}' \;
--
2.11.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-01-27 6:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 22:44 [PATCH] gnu: Add fpc Kei Kebreau
2017-01-27 4:01 ` [PATCH] gnu: Add fpc. (version 2) Kei Kebreau
2017-01-27 4:52 ` Kei Kebreau
2017-01-27 6:00 ` Kei Kebreau [this message]
2017-03-12 12:47 ` Danny Milosavljevic
2017-03-13 21:22 ` Kei Kebreau
2017-03-14 21:45 ` Danny Milosavljevic
2017-03-20 15:02 ` Kei Kebreau
2017-03-20 19:59 ` Ricardo Wurmus
2017-03-20 22:54 ` Kei Kebreau
2017-06-05 13:20 ` Danny Milosavljevic
2017-06-05 13:33 ` Marius Bakke
2017-06-05 13:42 ` Marius Bakke
2017-06-09 1:30 ` Kei Kebreau
2017-06-05 19:55 ` Ricardo Wurmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8adxct0.fsf@openmailbox.org \
--to=kei@openmailbox.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.