Difference between revisions of "Build current FPC and Lazarus for Raspbian/zh CN"
Line 18: | Line 18: | ||
# Test if all ok: <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. | # Test if all ok: <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. | ||
# Non-step note: the following steps are mostly based on [https://wiki.lazarus.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository#Creating_the_deb_files_yourself this] | # Non-step note: the following steps are mostly based on [https://wiki.lazarus.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository#Creating_the_deb_files_yourself this] | ||
− | # | + | # 安装开发库: <code>sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev</code> |
# <code>mkdir ~/pascal</code> | # <code>mkdir ~/pascal</code> | ||
# <code>cd ~/pascal</code> | # <code>cd ~/pascal</code> | ||
Line 24: | Line 24: | ||
# <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>, (currently line 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>. Now save the changes and exit. |
− | # | + | # 运行脚本: <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构建。重启树莓派来摆脱临时路径。 |
− | # | + | # 卸载bootstrap FPC: <code>rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp</code>. Check what you just did: <code>fpc abcd</code> should say command is not found. |
# Install the just created FPC Debian package: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb</code>. Check if it works: <code>fpc abcd</code> should show the newly installed FPC compiler. | # Install the just created FPC Debian package: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb</code>. Check if it works: <code>fpc abcd</code> should show the newly installed FPC compiler. | ||
# <code>cd ~/pascal/lazarus/tools/install</code> | # <code>cd ~/pascal/lazarus/tools/install</code> | ||
# <code>./create_fpc_deb.sh fpc-src ~/pascal/fpc/</code>. This builds the FPC source package in about 3 minutes: <code>fpc-src_3.0.4-yymmdd_armhf.deb</code>. Rename with: mv <code>fpc-src_3.0.4-yymmdd_armhf.deb</code> <code>fpc-src_3.0.4_armhf.deb</code> | # <code>./create_fpc_deb.sh fpc-src ~/pascal/fpc/</code>. This builds the FPC source package in about 3 minutes: <code>fpc-src_3.0.4-yymmdd_armhf.deb</code>. Rename with: mv <code>fpc-src_3.0.4-yymmdd_armhf.deb</code> <code>fpc-src_3.0.4_armhf.deb</code> | ||
− | # | + | # 编辑<code>create_lazarus_deb.sh</code>, look for line with the following content: <code>echo "$Arch is not supported."</code>, (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), replace <code>sparc</code> with <code>armhf</code>, and <code>ppcsparc</code> with <code>ppcarm</code>. Look for the first <code>fi</code> 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 another <code>if</code> to a nested <code>if</code>, with its corresponding <code>fi</code>。现在保存并退出。 |
− | # <code>./create_lazarus_deb.sh</code> | + | # <code>./create_lazarus_deb.sh</code>。这将构建Lazarus IDE Debian软件包 <code>lazarus-project_2.0.6-0_armhf.deb</code>。它将花费大约需要15分钟。 |
− | # | + | # 安装FPC源文件和Lazarus软件包: <code>sudo dpkg -i fpc-src_3.0.4_armhf.deb lazarus-project_2.0.6-0_armhf.deb</code> |
− | # | + | # 保存<code>*.deb</code>到另一个位置,如果以后需要可重新安装或与朋友共享:请记住这是自由软件。 |
# <code>cd</code>, <code>rm -rf ~/pascal ~/tmp</code> | # <code>cd</code>, <code>rm -rf ~/pascal ~/tmp</code> | ||
− | 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. | + | 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.现在尝试安装一个软件包,例如:<code>lazreport</code>;它将工作! |
− | + | 想帮助FPC/Lazarus社区?在互联网上的某个地方托管生产的 <code>.deb</code>软件包,并在论坛上留言来让每个人都知道; 为每个发布版本都重做软件包。 | |
[[Category:Install]] | [[Category:Install]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Raspberry Pi]] | [[Category:Raspberry Pi]] |
Revision as of 06:38, 8 April 2020
│
English (en) │
中文(中国大陆) (zh_CN) │
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.
要求:
- Raspberry Pi 4 Model 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 compiler. The latest compiler is compiled with the previous version of itself.
- 提取编译器。这将创建一个
fpc-3.0.2.arm-linux
目录。(NOTE: this folder must be on a linux FS [like Documents folder] as FAT doesn't allow the next step to work). - 在这个目录中, as pi user, 运行
./install.sh
- At the four prompts, answer
Enter, n, n, n
: this is, accept suggested directory/home/pi/fpc-3.0.2
, no Textmode IDE, no documentation, no demos. Ignoretar
warnings. Note the additional files written to/home/pi
:.fpc.cfg
,.config/fppkg.cfg
,.fppkg/config/default
. When the build is done, to delete this temporary bootstrap compiler these files and the/home/pi/fpc-3.0.2
install directory need to be deleted. - Temporarily add FPC install directory to PATH:
export PATH=$PATH:$HOME/fpc-3.0.2/bin
. If you have to reboot for any reason before completing the FPC build, you have to do this step again. - Test if all ok:
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. - Non-step note: the following steps are mostly based on this
- 安装开发库:
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;;
, (currently line 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;;
. Now save the changes and exit. - 运行脚本:
./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
软件包,并在论坛上留言来让每个人都知道; 为每个发布版本都重做软件包。