Differences between revisions 4 and 8 (spanning 4 versions)
Revision 4 as of 2017-05-29 00:05:54
Size: 1926
Editor: PaulWise
Comment: correct namespace
Revision 8 as of 2017-05-31 18:34:37
Size: 10773
Editor: ?AdrianGlaubitz
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
== On the bootstrapping machine == == Without pre-compiled binaries ==

=
== On the bootstrapping machine ===
Line 66: Line 68:
== On the target machine == === On the target machine ===
Line 83: Line 85:
   $ make FPC=/path/to/ppcbinary OVERRIDEVERSIONCHECK=1 all    $ make FPC=/path/to/ppcbinary FPCDIR=/path/to/fpc/root OVERRIDEVERSIONCHECK=1 all
Line 85: Line 87:

FPC usually being /usr/local/lib/fpc/x.y.z/ppc$CPU and FPCDIR /usr/local/lib/fpc/x.y.z/ when the tarball generated on the bootstrapping host was extracted into /usr/local.

Then skip to '''Creating the Debian package'''

=== With pre-compiled binaries ===

1. Download the binaries for your architecture from [[ftp://ftp.freepascal.org/pub/fpc/dist/]] (chose the latest version, then your target).

{{{
   $ wget --no-check-certificate https://downloads.sourceforge.net/project/freepascal/Linux/3.0.2/fpc-3.0.2.mipsel-linux.tar
}}}

2. Extract the tarball

{{{
   $ tar xf fpc-3.0.2.mipsel-linux.tar
}}}

3. Run ''install.sh'' to install fpc into your home directory or /usr/local (the latter requires root privileges)

{{{
   $ cd fpc-3.0.2.mipsel-linux
   $ ./install.sh
}}}

== Creating the Debian package ==

{{{

# export PATH=$PATH:/home/glaubitz/fpc-3.0.2/bin/:/home/glaubitz/fpc-3.0.2/lib/fpc/3.0.2/
# apt-get install devscripts dh-exec
                                                                                                                                                                                                                                                                                                                                                                                           
diff -Nru old/fpc-3.0.2+dfsg/debian/rules new/fpc-3.0.2+dfsg/debian/rules
--- old/fpc-3.0.2+dfsg/debian/rules 2017-04-09 11:44:58.000000000 +0200
+++ new/fpc-3.0.2+dfsg/debian/rules 2017-05-30 23:52:09.875391597 +0200
@@ -57,6 +57,9 @@
 ifeq ($(CPU_TARGET),sparc)
 PPSUF=sparc
 endif
+ifeq ($(CPU_TARGET),mipsel)
+PPSUF=mipsel
+endif
                                                                                                                                                                                                                                                                                                                                                                                           
 ifneq ($(CPU_SOURCE),$(CPU_TARGET))
 PPPRE=ppcross

diff -Nru old/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in new/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in
--- old/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in 2017-04-09 11:44:58.000000000 +0200
+++ new/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in 2017-05-30 23:44:24.519488161 +0200
@@ -1,11 +1,11 @@
 #! /usr/bin/dh-exec
 usr/lib/fpc/*/*/*/ggi*
-usr/lib/fpc/*/*/*/graph* [!linux-arm64 !linux-armel !linux-armhf !linux-ppc64]
+usr/lib/fpc/*/*/*/graph* [!linux-arm64 !linux-armel !linux-armhf !linux-mipsel !linux-ppc64]
 usr/lib/fpc/*/*/*/hermes*
 usr/lib/fpc/*/*/*/imagemagick*
 usr/lib/fpc/*/*/*/libgd*
 usr/lib/fpc/*/*/*/libpng*
-usr/lib/fpc/*/*/*/opencl* [!freebsd-any !linux-arm64 !linux-armel !linux-armhf !linux-powerpc !linux-ppc64]
+usr/lib/fpc/*/*/*/opencl* [!freebsd-any !linux-arm64 !linux-armel !linux-armhf !linux-mipsel !linux-powerpc !linux-ppc64]
 usr/lib/fpc/*/*/*/opengl*
 usr/lib/fpc/*/*/*/opengles*
 usr/lib/fpc/*/*/*/ptc* [!freebsd-any]

Description: In order to add support for arm64, we need a man-page
Source: upstream

Index: fpc/install/man/man1/ppcmipsel.1
===================================================================
--- /dev/null
+++ fpc/install/man/man1/ppcmipsel.1
@@ -0,0 +1,33 @@
+.TH ppcmipsel 1 "30 may 1999" "Free Pascal" "Free Pascal Compiler"
+.SH NAME
+ppcmipsel \- Free Pascal Compiler (FPC) binary, name derived
+from Portable Pascal Compiler
+
+.SH SYNOPSIS
+
+.B "ppcmipsel [options] [sourcefile]"
+.BR
+
+.SH DESCRIPTION
+This binary is the back-end binary of the
+.I Free Pascal Compiler (FPC)
+which is a
+.I Turbo Pascal
+and
+.I Delphi (7.0)
+compatible standalone (non GCC frontend) multitarget Pascal compiler.
+
+This binary should not be called directly, instead the
+.B fpc
+program should be used instead.
+It will choose the right back-end for compiling units for the requested platforms.
+
+.SH OPTIONS
+
+For a complete list of all supported command-line options, see the
+.BR fpc (1)
+manual page.
+
+.SH SEE ALSO
+.BR fpc (1)
+

# dpkg-buildpackage -d -nc -B
# debsign <changes file>
# dput ftp-master *changes
}}}

Bootstrapping FPC for a new architecture

Without pre-compiled binaries

On the bootstrapping machine

1. Check out FPC from SVN:

   $ svn co http://svn.freepascal.org/svn/fpc/trunk/

2. Install the gcc cross toolchain for the target architecture:

   $ apt install gcc-m68k-linux-gnu g++-m68k-linux-gnu cpp-m68k-linux-gnu

4. Enter FPC source directory and build a cross-compiler:

   $ BINUTILSPREFIX=m68k-linux-gnu- make crossall crossinstall CPU_TARGET=m68k CROSSOPT="-Cp68020 -Cf68881 -CaDEFAULT" OS_TARGET=linux FPC=/usr/lib/fpc/3.0.0/ppcx64 INSTALL_PREFIX=/home/glaubitz/fpc-m68k/

5. Build the native compiler:

   $ BINUTILSPREFIX=m68k-linux-gnu- make compiler CPU_TARGET=m68k OS_TARGET=linux FPC=/root/fpc-m68k/lib/fpc/3.1.1/ppcross68k CROSSOPT="-Cp68020 -Cf68881 -CaDEFAULT -Fu/root/fpc-m68k/lib/fpc/3.1.1/units/*

Note: The options for CROSSOPT can be obtained by running "ppcross$CPU" after the initial build without parameters:

   ~/trunk# ./compiler/ppcross68k -ic
   68000
   68020
   68040
   68060
   ISAA
   ISAA+
   ISAB
   ISAC
   CFV4E
   ~/trunk# ./compiler/ppcross68k -if 
   SOFT
   LIBGCC
   68881
   COLDFIRE
   ~/trunk# ./compiler/ppcross68k -ia
   DEFAULT
   ~/trunk#

6. Copy target compiler into directory of cross-compiler:

   $ cp -av compiler/ppc68k /home/glaubitz/fpc-m68k/lib/fpc/3.1.1/

7. Tar the target compiler up to transport it to the target machine:

   $ tar czf fpc-m68k.tgz /home/glaubitz/fpc-m68k

On the target machine

1. Check out FPC from SVN:

   $ svn co http://svn.freepascal.org/svn/fpc/trunk/

2. Untar cross-compiled target compiler:

   $ tar xf fpc-m68k.tgz

3. Build FPC with the bootstrapped FPC:

   $ make FPC=/path/to/ppcbinary FPCDIR=/path/to/fpc/root OVERRIDEVERSIONCHECK=1 all

FPC usually being /usr/local/lib/fpc/x.y.z/ppc$CPU and FPCDIR /usr/local/lib/fpc/x.y.z/ when the tarball generated on the bootstrapping host was extracted into /usr/local.

Then skip to Creating the Debian package

With pre-compiled binaries

1. Download the binaries for your architecture from ftp://ftp.freepascal.org/pub/fpc/dist/ (chose the latest version, then your target).

   $ wget --no-check-certificate https://downloads.sourceforge.net/project/freepascal/Linux/3.0.2/fpc-3.0.2.mipsel-linux.tar

2. Extract the tarball

   $ tar xf fpc-3.0.2.mipsel-linux.tar

3. Run install.sh to install fpc into your home directory or /usr/local (the latter requires root privileges)

   $ cd fpc-3.0.2.mipsel-linux
   $ ./install.sh

Creating the Debian package

# export PATH=$PATH:/home/glaubitz/fpc-3.0.2/bin/:/home/glaubitz/fpc-3.0.2/lib/fpc/3.0.2/                                                                                                                                                                                                                                                                                                  
# apt-get install devscripts dh-exec                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                           
diff -Nru old/fpc-3.0.2+dfsg/debian/rules new/fpc-3.0.2+dfsg/debian/rules                                                                                                                                                                                                                                                                                                                  
--- old/fpc-3.0.2+dfsg/debian/rules     2017-04-09 11:44:58.000000000 +0200                                                                                                                                                                                                                                                                                                                
+++ new/fpc-3.0.2+dfsg/debian/rules     2017-05-30 23:52:09.875391597 +0200                                                                                                                                                                                                                                                                                                                
@@ -57,6 +57,9 @@                                                                                                                                                                                                                                                                                                                                                                          
 ifeq ($(CPU_TARGET),sparc)                                                                                                                                                                                                                                                                                                                                                                
 PPSUF=sparc                                                                                                                                                                                                                                                                                                                                                                               
 endif                                                                                                                                                                                                                                                                                                                                                                                     
+ifeq ($(CPU_TARGET),mipsel)                                                                                                                                                                                                                                                                                                                                                               
+PPSUF=mipsel                                                                                                                                                                                                                                                                                                                                                                              
+endif                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                           
 ifneq ($(CPU_SOURCE),$(CPU_TARGET))                                                                                                                                                                                                                                                                                                                                                       
 PPPRE=ppcross

diff -Nru old/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in new/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in
--- old/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in   2017-04-09 11:44:58.000000000 +0200
+++ new/fpc-3.0.2+dfsg/debian/fp-units-gfx.install.in   2017-05-30 23:44:24.519488161 +0200
@@ -1,11 +1,11 @@
 #! /usr/bin/dh-exec
 usr/lib/fpc/*/*/*/ggi*
-usr/lib/fpc/*/*/*/graph*        [!linux-arm64 !linux-armel !linux-armhf !linux-ppc64]
+usr/lib/fpc/*/*/*/graph*        [!linux-arm64 !linux-armel !linux-armhf !linux-mipsel !linux-ppc64]
 usr/lib/fpc/*/*/*/hermes*
 usr/lib/fpc/*/*/*/imagemagick*
 usr/lib/fpc/*/*/*/libgd*
 usr/lib/fpc/*/*/*/libpng*
-usr/lib/fpc/*/*/*/opencl*       [!freebsd-any !linux-arm64 !linux-armel !linux-armhf !linux-powerpc !linux-ppc64]
+usr/lib/fpc/*/*/*/opencl*       [!freebsd-any !linux-arm64 !linux-armel !linux-armhf !linux-mipsel !linux-powerpc !linux-ppc64]
 usr/lib/fpc/*/*/*/opengl*
 usr/lib/fpc/*/*/*/opengles*
 usr/lib/fpc/*/*/*/ptc*          [!freebsd-any]

Description: In order to add support for arm64, we need a man-page
Source: upstream

Index: fpc/install/man/man1/ppcmipsel.1
===================================================================
--- /dev/null
+++ fpc/install/man/man1/ppcmipsel.1
@@ -0,0 +1,33 @@
+.TH ppcmipsel 1 "30 may 1999" "Free Pascal" "Free Pascal Compiler"
+.SH NAME
+ppcmipsel \- Free Pascal Compiler (FPC) binary, name derived 
+from Portable Pascal Compiler
+
+.SH SYNOPSIS
+
+.B "ppcmipsel [options] [sourcefile]"
+.BR
+
+.SH DESCRIPTION
+This binary is the back-end binary of the
+.I Free Pascal Compiler (FPC)
+which is a
+.I Turbo Pascal
+and
+.I Delphi (7.0) 
+compatible standalone (non GCC frontend) multitarget Pascal compiler.
+
+This binary should not be called directly, instead the 
+.B fpc
+program should be used instead. 
+It will choose the right back-end for compiling units for the requested platforms.
+
+.SH OPTIONS
+
+For a complete list of all supported command-line options, see the
+.BR fpc (1)
+manual page.
+
+.SH SEE ALSO
+.BR  fpc (1)
+

# dpkg-buildpackage -d -nc -B
# debsign <changes file>
# dput ftp-master *changes