Difference between revisions of "Build current FPC and Lazarus for Raspbian/zh CN"
Line 15: | Line 15: | ||
# 提取编译器。这将创建一个<code>fpc-3.0.2.arm-linux</code>目录。(注意:这个文件夹必需存在于一个 linux 文件系统上 [像文档文件夹] ,像 FAT 之类不允许接下来步骤的工作)。 | # 提取编译器。这将创建一个<code>fpc-3.0.2.arm-linux</code>目录。(注意:这个文件夹必需存在于一个 linux 文件系统上 [像文档文件夹] ,像 FAT 之类不允许接下来步骤的工作)。 | ||
# 在这个目录中,以 pi 用户,运行<code>./install.sh</code> | # 在这个目录中,以 pi 用户,运行<code>./install.sh</code> | ||
− | # 在四个提示处,回答<code>Enter, n, n, n</code>: 这是,接受建议的目录<code>/home/pi/fpc-3.0.2</code> | + | # 在四个提示处,回答<code>Enter, n, n, n</code>: 这是,接受建议的目录<code>/home/pi/fpc-3.0.2</code>,没有文本模式IDE,没有文档,没有示例。忽略<code>tar</code>警告。注意额外文件将被写入到<code>/home/pi</code>: <code>.fpc.cfg</code>, <code>.config/fppkg.cfg</code>, <code>.fppkg/config/default</code>中。当构建完成后,删除临时的bootstrap编译器,这些文件和 <code>/home/pi/fpc-3.0.2</code>安装目录需要被删除。 |
− | #临时添加FPC安装目录到PATH: <code>export PATH=$PATH:$HOME/fpc-3.0.2/bin</code> | + | #临时添加FPC安装目录到PATH: <code>export PATH=$PATH:$HOME/fpc-3.0.2/bin</code>。如果你在完成FPC构建之前由于任何原因必须重新启动,那么你必需再次执行此步骤。 |
− | # | + | # 测试是否一切正常: <code>fpc abcd</code>。This invokes the just installed compiler trying to compile a non-existent file (abcd). A multiline message will be shown including the compiler version. |
− | # | + | # 非步骤注释:下面步骤主要基于 [https://wiki.lazarus.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository#Creating_the_deb_files_yourself 这个] |
# 安装开发库: <code>sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev</code> | # 安装开发库: <code>sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev</code> | ||
# <code>mkdir ~/pascal</code> | # <code>mkdir ~/pascal</code> | ||
Line 25: | Line 25: | ||
# <code>svn co <nowiki>https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6</nowiki> lazarus</code> | # <code>svn co <nowiki>https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6</nowiki> lazarus</code> | ||
# <code>cd lazarus/tools/install</code> | # <code>cd lazarus/tools/install</code> | ||
− | # 编辑<code>create_fpc_deb.sh</code>, look for line with the following content: <code>arm) ppcbin=arm; FPCArch=arm;;</code>, ( | + | # 编辑<code>create_fpc_deb.sh</code>, look for line with the following content: <code>arm) ppcbin=arm; FPCArch=arm;;</code>, (当前行109). Copy and paste this line below itself, so it will appear twice. Edit this copy to read like this: <code>armhf) ppcbin=arm; FPCArch=arm;;</code>. 现在保存更改和退出。 |
# 运行脚本: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>. This will compile the latest compiler with the bootstrap compiler. It takes about 11 minutes. A <code>.deb</code> file will be created: <code>fpc-laz_3.0.4-yymmdd_armhf.deb</code>; the exact name will be shown at the end of the compilation. Rename the file with (NOTE: do not type the brackets): mv [file name shown at end of compilation] <code>fpc-laz_3.0.4_armhf.deb</code> | # 运行脚本: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>. This will compile the latest compiler with the bootstrap compiler. It takes about 11 minutes. A <code>.deb</code> file will be created: <code>fpc-laz_3.0.4-yymmdd_armhf.deb</code>; the exact name will be shown at the end of the compilation. Rename the file with (NOTE: do not type the brackets): mv [file name shown at end of compilation] <code>fpc-laz_3.0.4_armhf.deb</code> | ||
# 你已经完成FPC构建。重启树莓派来摆脱临时路径。 | # 你已经完成FPC构建。重启树莓派来摆脱临时路径。 |
Revision as of 01:05, 16 April 2020
│
English (en) │
中文(中国大陆) (zh_CN) │
为树莓派构建最新的FPC和Lazarus
Raspbian Buster (基于Debian 10 Buster),在存储库中有开用FPC和Lazarus, but they suffer from the same "design decisions" that don't allow for a nice experience, namely the smooth IDE rebuilding capability based on source packages that is possible with FPC/Lazarus official .deb packages vs the crippled experience with the official Debian/Raspbian packages. One wishes there were official FPC/Lazarus packages for Raspbian as there are for Intel Debian/Ubuntu, which are also frequently updated; not being that the case (at least for now), this page shows the steps for building your own FPC, FPC-source and Lazarus packages for Raspbian. Example shows steps for Lazarus 2.0.6 which includes FPC 3.0.4, most recent at the time of writing. Adjust accordingly.
要求:
- 树莓派4版本B, 4 GB (更少的内存将需要swap), with appropriate cooling (author uses aluminum case that doubles as heatsink) to avoid throttling due to excessive heat
- Latest Raspbian Buster fully updated
步骤:
- 安装 Subversion:
sudo apt install subversion
- 获取bootstrap FPC 编译器。最新版本的编译器是使用其先前版本的编译器来编译。
- 提取编译器。这将创建一个
fpc-3.0.2.arm-linux
目录。(注意:这个文件夹必需存在于一个 linux 文件系统上 [像文档文件夹] ,像 FAT 之类不允许接下来步骤的工作)。 - 在这个目录中,以 pi 用户,运行
./install.sh
- 在四个提示处,回答
Enter, n, n, n
: 这是,接受建议的目录/home/pi/fpc-3.0.2
,没有文本模式IDE,没有文档,没有示例。忽略tar
警告。注意额外文件将被写入到/home/pi
:.fpc.cfg
,.config/fppkg.cfg
,.fppkg/config/default
中。当构建完成后,删除临时的bootstrap编译器,这些文件和/home/pi/fpc-3.0.2
安装目录需要被删除。 - 临时添加FPC安装目录到PATH:
export PATH=$PATH:$HOME/fpc-3.0.2/bin
。如果你在完成FPC构建之前由于任何原因必须重新启动,那么你必需再次执行此步骤。 - 测试是否一切正常:
fpc abcd
。This invokes the just installed compiler trying to compile a non-existent file (abcd). A multiline message will be shown including the compiler version. - 非步骤注释:下面步骤主要基于 这个
- 安装开发库:
sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev
mkdir ~/pascal
cd ~/pascal
svn co https://svn.freepascal.org/svn/fpc/tags/release_3_0_4 fpc
, you have to be online for this and the next step to work.svn co https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6 lazarus
cd lazarus/tools/install
- 编辑
create_fpc_deb.sh
, look for line with the following content:arm) ppcbin=arm; FPCArch=arm;;
, (当前行109). Copy and paste this line below itself, so it will appear twice. Edit this copy to read like this:armhf) ppcbin=arm; FPCArch=arm;;
. 现在保存更改和退出。 - 运行脚本:
./create_fpc_deb.sh fpc ~/pascal/fpc/
. This will compile the latest compiler with the bootstrap compiler. It takes about 11 minutes. A.deb
file will be created:fpc-laz_3.0.4-yymmdd_armhf.deb
; the exact name will be shown at the end of the compilation. Rename the file with (NOTE: do not type the brackets): mv [file name shown at end of compilation]fpc-laz_3.0.4_armhf.deb
- 你已经完成FPC构建。重启树莓派来摆脱临时路径。
- 卸载bootstrap FPC:
rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp
. Check what you just did:fpc abcd
should say command is not found. - Install the just created FPC Debian package:
sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb
. Check if it works:fpc abcd
should show the newly installed FPC compiler. cd ~/pascal/lazarus/tools/install
./create_fpc_deb.sh fpc-src ~/pascal/fpc/
. This builds the FPC source package in about 3 minutes:fpc-src_3.0.4-yymmdd_armhf.deb
. Rename with: mvfpc-src_3.0.4-yymmdd_armhf.deb
fpc-src_3.0.4_armhf.deb
- 编辑
create_lazarus_deb.sh
, look for line with the following content:echo "$Arch is not supported."
, (currently line 86). Copy the 3 lines above it and paste them just below themselves: at this time it is copy lines 83 to 85 and paste them between lines 85 and 86. In the just pasted lines (lines 86-88), replacesparc
witharmhf
, andppcsparc
withppcarm
. Look for the firstfi
just below; copy and paste it below itself (copy line 91 below itself, so line 91 and 92 read the same). For you coders out there, you are adding anotherif
to a nestedif
, with its correspondingfi
。现在保存并退出。 ./create_lazarus_deb.sh
。这将构建Lazarus IDE Debian软件包lazarus-project_2.0.6-0_armhf.deb
。它将花费大约需要15分钟。- 安装FPC源文件和Lazarus软件包:
sudo dpkg -i fpc-src_3.0.4_armhf.deb lazarus-project_2.0.6-0_armhf.deb
- 保存
*.deb
到另一个位置,如果以后需要可重新安装或与朋友共享:请记住这是自由软件。 cd
,rm -rf ~/pascal ~/tmp
You can now finally enjoy your fully working, fully up to date Lazarus. Find it in the Programming section of the Raspberry menu. A message titled "Error in EditorMacroScript" will be shown on first run; this also appears in the Raspbian Lazarus, reason still unknown to the original author of this page.现在尝试安装一个软件包,例如:lazreport
;它将工作!
想帮助FPC/Lazarus社区?在互联网上的某个地方托管生产的 .deb
软件包,并在论坛上留言来让每个人都知道; 为每个发布版本都重做软件包。
贡献者和更改
- 简体中文版本由 robsean 于 2020-04-08 创建。