秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在 bootstrapping 计算机上

1. 从 Gitlab下载FPC:

$ git https://gitlab.com/freepascal.org/fpc/source.git fpc-src

2. 为目标架构安装 fpc 和 gcc cross 工具链:

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

4. 进入 FPC 源码目录,搭建一个交叉编译器:

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

5. 构建原生编译器:

   ~/fpc-src $ BINUTILSPREFIX=m68k-linux-gnu- make compiler CPU_TARGET=m68k OS_TARGET=linux FPC=/home/glaubitz/fpc-m68k/lib/fpc/3.3.1/ppcross68k CROSSOPT="-Cp68020 -Cf68881 -CaDEFAULT -Fu/home/fpc-m68k/lib/fpc/3.3.1//units/*"

注意:CROSSOPT 的选项可以通过在初始构建后运行“ppcross$CPU”来获得,不带参数: 

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

6. 将目标编译器复制到交叉编译器的目录下:

  ~/fpc-src $ cp -av compiler/ppc68k /home/glaubitz/fpc-m68k/lib/fpc/3.3.1/

7. 对目标编译器进行 tar 运算,以将其传输到目标计算机: 

   ~/fpc-src $ cd
   $ tar czf fpc-m68k.tgz /home/glaubitz/fpc-m68k

在目标计算机上

1. 从 Gitlab下载FPC:

 $ git https://gitlab.com/freepascal.org/fpc/source.git fpc-src

2. 解压交叉编译的目标编译器:

$ tar xf fpc-m68k.tgz

3. 使用自举的 FPC 构建 FPC:

   $ make FPC=/home/glaubitz/fpc-m68k/lib/fpc/3.3.1/ppcm68k FPCDIR=/home/glaubitz/fpc-m68k/lib/fpc/3.3.1/ OVERRIDEVERSIONCHECK=1 all

4. 安装新建的 FPC:

$ make FPC=/home/glaubitz/fpc-m68k/lib/fpc/3.3.1/ppcm68k FPCDIR=/home/glaubitz/fpc-m68k/lib/fpc/3.3.1/ OVERRIDEVERSIONCHECK=1 install INSTALL_PREFIX=/home/glaubitz/fpc CPU_TARGET=m68k

然后跳到创建 Debian 软件包

 

使用预编译的二进制文件

1. 从 ftp://ftp.freepascal.org/pub/fpc/dist/ 下载适用于您的架构的二进制文件(选择最新版本,然后选择您的目标)。

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

2. 提取 tarball

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

3. 运行 install.sh 将 fpc 安装到您的主目录或 /usr/local 中(后者需要 root 权限)

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

创建 Debian 软件包

# 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

 

posted on 2025-03-28 09:24  秋·风  阅读(303)  评论(0)    收藏  举报