Lazarus 2.0.8 has been announced today.
Also see:
Release notes
Fixes
Happy coding :-)
Showing posts with label Lazarus. Show all posts
Showing posts with label Lazarus. Show all posts
Thursday, April 16, 2020
Friday, November 01, 2019
Tuesday, January 15, 2019
WebAssembly with Delphi and ChakraCore
chakracore-delphi now contains WasmSample, a new sample project using ChakraCore to load and run a WebAssembly module (in this case, an implementation of Conway's Game of Life).
It's based on Colin Eberhardt's blog post Writing WebAssembly By Hand (you can run the code in your browser here).
It's based on Colin Eberhardt's blog post Writing WebAssembly By Hand (you can run the code in your browser here).
Monday, October 29, 2018
My Lazarus External Tools
Similar to My Delphi Tools blog post (wow, many years ago), here's my Lazarus External Tools configuration.
Linux (Mint)
Title: Explore to Source Directory
Program Filename:
Parameters:
Working Directory:
Title: Explore to Target Directory
Program Filename:
Parameters:
Working Directory:
Title: Console in Source Directory
Program Filename:
Parameters:
Working Directory:
Show console:
Title: Console in Target Directory
Program Filename:
Parameters:
Working Directory:
Show console:
Import link: lazarus-external-tools-linux-mint.xml
Windows
Title: Explore to Source Directory
Program Filename:
Parameters:
Working Directory:
Title: Explore to Target Directory
Program Filename:
Parameters:
Working Directory:
Title: Console in Source Directory
Program Filename:
Parameters:
Working Directory:
Show console:
Title: Console in Target Directory
Program Filename:
Parameters:
Working Directory:
Show console:
Import link: lazarus-external-tools-windows.xml
Linux (Mint)
Title: Explore to Source Directory
Program Filename:
cajaParameters:
$Path($EdFile())Working Directory:
Title: Explore to Target Directory
Program Filename:
cajaParameters:
$Path($TargetFile())Working Directory:
Title: Console in Source Directory
Program Filename:
mate-terminalParameters:
--working-directory=$Path($EdFile())Working Directory:
Show console:
TrueTitle: Console in Target Directory
Program Filename:
mate-terminalParameters:
--working-directory=$Path($TargetFile())Working Directory:
Show console:
TrueImport link: lazarus-external-tools-linux-mint.xml
Windows
Title: Explore to Source Directory
Program Filename:
explorer.exeParameters:
/e,/select, "$EdFile()"Working Directory:
Title: Explore to Target Directory
Program Filename:
explorer.exeParameters:
/e,/select,"$TargetFile()"Working Directory:
Title: Console in Source Directory
Program Filename:
cmd.exeParameters:
/k cd "$Path($EdFile())"Working Directory:
Show console:
TrueTitle: Console in Target Directory
Program Filename:
cmd.exeParameters:
/k cd "$Path($TargetFile())"Working Directory:
Show console:
TrueImport link: lazarus-external-tools-windows.xml
Thursday, August 23, 2018
Thursday, July 19, 2018
Delphi Free for Some - Lazarus Free for Everyone!
Embarcadero has announced the Community Edition releases for Delphi and C++Builder. Sounds like a reason to celebrate. But reading the "fine print" is rather sobering, as the license agreement practically excludes anyone but some students and hobbyists, perhaps:
I think there's no need to be so excited about it. Consider this: you mustn't have more than $5000 a year (or $416.67 a month), regardless of what tools you're using. Mind you, revenue, not profit, and even donations count. That makes the offer unusable even for most start-ups, students or hobbyists. So in case you make a bit more than that ;-) and still don't want to pay the full price for a Professional or Enterprise Edition, you're back to
All free and open, with full source code. Licensed under GPL/LGPL.
OK, Embarcadero still considers Delphi as the Swiss Army Knife of software development and Swiss Army Knives don't come cheap. Maybe not everybody shares that point of view and some may not feel like paying to find out (30 days trial is just not enough for such a complex tool.) For those, Free Pascal and Lazarus are still a working and probably the best solution.
After all, this sounds more permissive than the EULA itself for company employees.
"The Community Edition license applies solely if Licensee cumulative annual revenue (of the for-profit organization, the government entity or the individual developer) or any donations (of the non-profit organization) does not exceed USD $5,000.00 (or the equivalent in other currencies) (the "Threshold"). If Licensee is an individual developer, the revenue of all contract work performed by developer in one calendar year may not exceed the Threshold (whether or not the Community Edition is used for all projects). For example, a developer who receives payment of $5,000.00 for a single project (or more than $5,000.00 for multiple projects) even if such engagements do not anticipate the use of the Community Edition, is not allowed to use the Community Edition. In addition, a developer building solely an app store application would not be allowed to use the Community Edition once the app store revenue reaches a revenue of $5,000.00 or more in a year. If Licensee is a company that has a cumulative annual revenue which exceeds the Threshold, then Licensee is not allowed to use the Community Edition, regardless if the Community Edition is used solely to write applications for the business' internal use or is seen by third parties outside the company or has a direct revenue associated with it."
I think there's no need to be so excited about it. Consider this: you mustn't have more than $5000 a year (or $416.67 a month), regardless of what tools you're using. Mind you, revenue, not profit, and even donations count. That makes the offer unusable even for most start-ups, students or hobbyists. So in case you make a bit more than that ;-) and still don't want to pay the full price for a Professional or Enterprise Edition, you're back to
Free Pascal and Lazarus
- Truly free (both as in beer and as in speech) Object Pascal compilers and tools supporting multiple target platforms, including Windows, Mac OS X and Linux, Intel 32-bit, 64-bit, ARM and more. (I haven't tried the mobile platforms, Android or iOS, yet.)
- A nice, stable and capable IDE, itself a great example of its own multi-platform support (screenshots).
- LCL (Lazarus Component Library) - cross-platform, with many components, extensible with your own. (Just a few days ago, I realised there's an LCL port of Virtual TreeView which I can use in my projects on all the three major operating systems. I'm eager to try it out!)
All free and open, with full source code. Licensed under GPL/LGPL.
OK, Embarcadero still considers Delphi as the Swiss Army Knife of software development and Swiss Army Knives don't come cheap. Maybe not everybody shares that point of view and some may not feel like paying to find out (30 days trial is just not enough for such a complex tool.) For those, Free Pascal and Lazarus are still a working and probably the best solution.
UPDATE:
The Community Edition FAQs suggest it's fine for anyone to use it for "their own personal use":Q: If I work for a company with more than US $5,000 in revenue, can I still download Delphi Community Edition or C++Builder Community Edition for my own personal use?
A: Yes. You can download Delphi Community Edition or C++Builder Community Edition as an individual and use it to develop applications for your personal use and use it to create software for you to sell (up to US $5,000 in revenue, see License Agreement for details).
After all, this sounds more permissive than the EULA itself for company employees.
Monday, April 02, 2018
First steps with Lazarus Qt5 interface
Steps for building and installing Qt5 for Lazarus
Using a quick test project with relevant code shown here: unit1.pas
I'm using Qt 5.6.2 because that's the version with which Lazarus qt5 interface has been tested. You can experiment with later versions, too.
- download: qt-opensource-windows-x86-mingw492-5.6.2.exe
- install
- open command prompt in the bindings directory
- download: qt-opensource-windows-x86-msvc2015_64-5.6.2.exe
- install
- fix the binding sources in the bindings directory
- open command prompt in the bindings directory
- edit the
- download: qt-opensource-mac-x64-clang-5.6.2.dmg
- install
- open terminal in the bindings directory
- make sure OpenGL headers are installed:
- download: qt-opensource-linux-x64-5.6.2.run
- install
Modify the system-wide config in
- open terminal in the bindings directory
Happy Easter!
Using a quick test project with relevant code shown here: unit1.pas
I'm using Qt 5.6.2 because that's the version with which Lazarus qt5 interface has been tested. You can experiment with later versions, too.
Windows 32-bit
Using MinGW
$(LazarusDir): C:\fpcupdeluxe\lazarus
$(QtDir): C:\Qt\Qt5.6.2
- download: qt-opensource-windows-x86-mingw492-5.6.2.exe
- install
- open command prompt in the bindings directory
$(LazarusDir)\lcl\interfaces\qt5\cbindingsset PATH=$(QtDir)\5.6\mingw49_32\bin;$(QtDir)\Tools\mingw492_32\bin;%PATH%
qmake
mingw32-make
mingw32-make install
$(FpcDir)\bin\i386-win32\strip.exe $(QtDir)\5.6\mingw49_32\bin\Qt5Pas1.dll
Windows 64-bit
Using Visual Studio 2015
$(LazarusDir): C:\fpcupdeluxe\lazarus
$(QtDir): C:\Qt\Qt5.6.2
- download: qt-opensource-windows-x86-msvc2015_64-5.6.2.exe
- install
- fix the binding sources in the bindings directory
$(LazarusDir)\lcl\interfaces\qt5\cbindings to be able to compile with Visual Studio: patch- open command prompt in the bindings directory
$(LazarusDir)\lcl\interfaces\qt5\cbindingsset PATH=$(QtDir)\5.6\msvc2015_64\bin;%PATH%
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
qmake- edit the
Makefile to remove -Wfatal-errors from CXXFLAGSnmake
nmake install
OSX 64-bit
$(LazarusDir): ~/fpcupdeluxe/lazarus
$(QtDir): ~/Qt5.6.2
- download: qt-opensource-mac-x64-clang-5.6.2.dmg
- install
- open terminal in the bindings directory
$(LazarusDir)/lcl/interfaces/qt5/cbindingsPATH=$(QtDir)/5.6/clang_64/bin:$PATH
qmake
make
sudo make install
Linux 64-bit (Mint 18.3 Sylvia)
$(LazarusDir): ~/fpcupdeluxe/lazarus
$(QtDir): ~/Qt5.6.2
- make sure OpenGL headers are installed:
sudo apt install mesa-common-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so
sudo ldconfig
- download: qt-opensource-linux-x64-5.6.2.run
- install
Modify the system-wide config in
/usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf to point to your Qt5 directories:$(QtDir)/5.6/gcc_64/bin
$(QtDir)/5.6/gcc_64/lib
- open terminal in the bindings directory
$(LazarusDir)/lcl/interfaces/qt5/cbindingsqmake
make
sudo make install
sudo strip $(QtDir)/5.6/gcc_64/lib/libQt5Pas.so.1.2.6
Happy Easter!
Sunday, February 04, 2018
Updated chakracore-delphi examples
chakracore-delphi has been updated to show some (still rather crude) example implementations of:
- setTimeout
- setInterval
- native Promise
Friday, January 12, 2018
chakracore-delphi initial release
The initial release of chakracore-delphi is out, published under the MIT license.
Short summary:
Comments, ideas and of course pull requests are very welcome. Cheers!
Short summary:
Comments, ideas and of course pull requests are very welcome. Cheers!
Saturday, January 06, 2018
chakracore-delphi
With the initial release coming up soon, here are a few teaser screenshots of chakracore-delphi, a new opensource library with Delphi and Free Pascal bindings and classes for Microsoft's ChakraCore Javascript engine:
and a tiny code snippet showing an example of embedding the Javascript engine and exposing some native methods to it:
and a tiny code snippet showing an example of embedding the Javascript engine and exposing some native methods to it:
Sunday, December 10, 2017
fpcupdeluxe
If you use Free Pascal and/or Lazarus and update them often to follow the development in trunk, or if you just need to use multiple versions side by side, have a look at fpcupdeluxe (GitHub).
It's a GUI front-end which lets you easily select a release and build it, including cross-compilers, with a click of a button. The result is installed into its own directory where it doesn't interfere with any other installations of Free Pascal and Lazarus.
If you haven't yet, check out the latest releases of both Free Pascal (3.0.4) and Lazarus (1.8) published recently.
Update: It seems the latest fpcupdeluxe (1.6.0k) now builds trunk without any problems, no tweaks necessary, so you can ignore the rest of this post.
As a side note, updating trunk today failed for me when it was trying to build the intermediate ("bootstrap") compiler. I haven't thoroughly investigated it but I think it's due to the fact that fpc 3.0.4 is now the required compiler to build trunk and I have found a quick fix which works for me now and comprises the following two steps:
1. Create a patch file with the following content in $(fpcupdeluxe)/patchfpc directory:
and activate it in the fpcupdeluxe's settings (see screenshot below). This should "force" the bootstrap compiler 3.0.4 to be used instead of 3.0.2 as before.
2. Click "Trunk" and let fpcupdeluxe clone the 3.0.4 release into its fpcbootstrap subdirectory. This would still fail for me as for some reason the generated bootstrap compiler was still 3.0.2. Just replace the binary (ppcx64) with the 3.0.4 binary (you can build one yourself from source or copy it from the official release).
On the next click of the "Trunk" button, you should get a successful build of the current trunk fpc (3.1.1) and Lazarus (1.9). Updating the cross-compilers then worked for me again as well. I usually use x86_64-linux and cross-compile to arm-linux, i386-linux, x86_64-win64, i386-win32, x86_64-darwin and i386-darwin.
It's a GUI front-end which lets you easily select a release and build it, including cross-compilers, with a click of a button. The result is installed into its own directory where it doesn't interfere with any other installations of Free Pascal and Lazarus.
If you haven't yet, check out the latest releases of both Free Pascal (3.0.4) and Lazarus (1.8) published recently.
Update: It seems the latest fpcupdeluxe (1.6.0k) now builds trunk without any problems, no tweaks necessary, so you can ignore the rest of this post.
1. Create a patch file with the following content in $(fpcupdeluxe)/patchfpc directory:
Index: Makefile.fpc
===================================================================
--- Makefile.fpc (revision 37707)
+++ Makefile.fpc (working copy)
@@ -21,7 +21,7 @@
[prerules]
REQUIREDVERSION=3.0.4
-REQUIREDVERSION2=3.0.2
+REQUIREDVERSION2=3.0.4
# make versions < 3.77 (OS2 version) are buggy
and activate it in the fpcupdeluxe's settings (see screenshot below). This should "force" the bootstrap compiler 3.0.4 to be used instead of 3.0.2 as before.
2. Click "Trunk" and let fpcupdeluxe clone the 3.0.4 release into its fpcbootstrap subdirectory. This would still fail for me as for some reason the generated bootstrap compiler was still 3.0.2. Just replace the binary (ppcx64) with the 3.0.4 binary (you can build one yourself from source or copy it from the official release).
On the next click of the "Trunk" button, you should get a successful build of the current trunk fpc (3.1.1) and Lazarus (1.9). Updating the cross-compilers then worked for me again as well. I usually use x86_64-linux and cross-compile to arm-linux, i386-linux, x86_64-win64, i386-win32, x86_64-darwin and i386-darwin.
Saturday, July 04, 2015
FPC and Lazarus development environment (follow-up)
I've just done a fresh installation of Linux Mint 17.2 'Rafaela' MATE edition (64-bit) from scratch which went without a hitch. I've followed my previous notes to set up my FreePascal and Lazarus development environment, with success.
Saturday, May 30, 2015
FPC and Lazarus development environment
Notes on how to set up a FreePascal/Lazarus development environment on a Linux system, with cross-compiling for OSX and Windows. Intended as a future reference for myself and anybody else who might find them useful.
I'm using Linux Mint 17.1 'Rebecca' MATE 64-bit.
Create a symlink for the new compiler:
Create a symlink for the new cross-compiler:
I'm using Linux Mint 17.1 'Rebecca' MATE 64-bit.
Initial installation
Install fpc
~ $ sudo apt-get install fpc fp-utilsCheck installed version
The current maintained version is 2.6.2:~ $ which fpc
/usr/bin/fpc
~ $ fpc -?
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
/usr/lib/fpc/2.6.2/ppcx64 [options] <inputfile> [options] Hello, world!
Write a simple program to show the compiler version:~/Development/Hello $ nano hello.pas
{$MACRO ON}
program Hello;
begin
Writeln('Hello, world from FPC ', FPC_FULLVERSION, '!');
end.Compile and run it:~/Development/Hello $ fpc hello.pas
Free Pascal Compiler version 2.6.2-8 [2014/01/2/2] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling hello.pas
Linking hello
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
5 lines compiled, 0.2 sec
~/Development/Hello $ ./hello
Hello, world from FPC 20602!Latest (trunk) installation
Get latest fpc
~/Development $ svn checkout http://svn.freepascal.org/svn/fpc/trunk fpcBuild latest fpc (linux-x86_64)
Use fpc 2.6.2 to build the latest fpc:
~/Development/fpc $ make distclean
~/Development/fpc $ make all install FPC=/usr/bin/fpc OPT=-gl INSTALL_PREFIX=~
Configuration
The original installation creates a symlink in /etc/fpc.cfg pointing to /etc/alternatives/fpc.cfg which itself is a symlink pointing to /etc/fpc-2.6.2.cfg. In the code below, we copy the original config file to ~/Development and fix the symlink to point to it.~/Development $ cp /etc/fpc.cfg ~/Development
~/Development $ sudo rm /etc/fpc.cfg
~/Development $ sudo ln -s ~/Development/fpc.cfg /etc/fpc.cfg
Modify the new configuration file:@@ -124,6 +124,8 @@
-Cppentiumm
-Oppentiumm
#endif
+ -gw
+ -XR/usr/lib/apple/SDKs/MacOSX10.6.sdk
#endif
# -----------------------
@@ -141,17 +143,17 @@
#-Fr/usr/lib/fpc/$fpcversion/msg/errorr.msg
# searchpath for units and other system dependent things
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget/*
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget/rtl
#IFDEF FPCAPACHE_1_3
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget/httpd20
#ELSE
--Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22
+-Fu~/lib/fpc/$fpcversion/units/$fpctarget/httpd22
#ENDIF
#ENDIF
@@ -160,7 +162,7 @@
# path to the gcclib
#ifdef cpui386
--Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
+-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8/32
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
@@ -168,11 +170,16 @@
# searchpath for libraries
#-Fl/usr/lib/fpc/$fpcversion/lib
-#-Fl/lib;/usr/lib
--Fl/usr/lib/fpc/$fpcversion/lib/$FPCTARGET
+#ifdef cpui386
+-Fl/usr/lib/i386-linux-gnu;/lib32;/usr/lib32
+#endif
+#ifdef cpux86_64
+-Fl/lib;/usr/lib
+#endif
+-Fl~/lib/fpc/$fpcversion/lib/$fpctarget
# searchpath for tools
--FD/usr/lib/fpc/$fpcversion/bin/$FPCTARGET
+-FD~/lib/fpc/$fpcversion/bin/$fpctarget
#IFNDEF CPUI386
#IFNDEF CPUAMD64
@@ -241,7 +248,7 @@
# If you don't want so much verbosity use
#-vw
# multiarch library search path
--Fl/usr/lib/$fpctarget-*
+-Fl~/lib/$fpctarget-*
# Third party units should be installe in a, multi-arch compatible location.
# Units should be installed in /usr/lib/$fpctarget-gnu/fp-units-2.6.2/$pkg/.
# Ech fp-units package should install a configuration file called $pkg.cfg inCreate a symlink for the new compiler:
~/Development/fpc $ ln -s ~/lib/fpc/3.1.1/ppcx64 ~/bin/ppcx64Hello, world! (linux-x86_64)
~/Development/Hello $ fpc hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling hello.pas
Linking hello
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
5 lines compiled, 0.3 sec
~/Development/Hello $ ./hello
Hello, world from FPC 30101!Cross-compiling
See useful tips here.Linux
Install prerequisites
For cross-compiling to 32-bit Linux, install gcc-multilib and create a few links.~ $ sudo apt-get install gcc-multilib
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0 /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0 /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0 /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 /usr/lib/i386-linux-gnu/libgobject-2.0.so
~ $ sudo ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /lib/i386-linux-gnu/libglib-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 /usr/lib/i386-linux-gnu/libgthread-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 /usr/lib/i386-linux-gnu/libgmodule-2.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libpango-1.0.so.0 /usr/lib/i386-linux-gnu/libpango-1.0.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libcairo.so.2 /usr/lib/i386-linux-gnu/libcairo.so
~ $ sudo ln -s /usr/lib/i386-linux-gnu/libatk-1.0.so.0 /usr/lib/i386-linux-gnu/libatk-1.0.soCross-compiler for linux-i386
~ $ nano ~/bin/i386-linux-ld
#!/bin/bash
ld -A elf32-i386 $@
~ $ chmod +x ~/bin/i386-linux-ld
~ $ nano ~/bin/i386-linux-as
#!/bin/bash
as --32 $@
~ $ chmod +x ~/bin/i386-linux-as
~/Development/fpc $ make distclean OS_TARGET=linux CPU_TARGET=i386
~/Development/fpc $ make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=linux CPU_TARGET=i386 \
INSTALL_PREFIX=~Create a symlink for the new cross-compiler:
~ $ ln -s ~/lib/fpc/3.1.1/ppcross386 ~/bin/ppcross386Hello, world! (linux-i386)
~/Development/Hello $ fpc -Pi386 hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling hello.pas
Linking hello
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
5 lines compiled, 0.2 sec
~/Development/Hello $ ./hello
Hello, world from FPC 30101!Windows
Cross-compiler for win32-i386
~/Development/fpc $ make distclean OS_TARGET=win32 CPU_TARGET=i386
~/Development/fpc $ make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=~Hello, world! (win32-i386)
~/Development/Hello $ fpc -Twin32 -Pi386 hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling hello.pas
Linking hello.exe
5 lines compiled, 0.0 sec, 26976 bytes code, 1284 bytes dataCross-compiler for win64-x86_64
~/Development/fpc $ make distclean OS_TARGET=win64 CPU_TARGET=x86_64
~/Development/fpc $ make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=win64 CPU_TARGET=x86_64 \
INSTALL_PREFIX=~Hello, world! (win64-x86_64)
~/Development/Hello $ fpc -Twin64 -Px86_64 hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling hello.pas
Linking hello.exe
5 lines compiled, 0.1 sec, 33504 bytes code, 1364 bytes dataOSX
Install odcctools and SDK
Install ppa:flosoft/cross-apple manually (to use maverick):~ $ sudo nano /etc/apt/sources.list
deb http://ppa.launchpad.net/flosoft/cross-apple/ubuntu maverick main
deb-src http://ppa.launchpad.net/flosoft/cross-apple/ubuntu maverick main
~ $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D0611AA0
~ $ sudo apt-get update
~ $ sudo apt-get install apple-x86-odcctools
~ $ sudo apt-get install apple-uni-sdk-10.6
~ $ ln -s /usr/bin/i686-apple-darwin10-ld ~/bin/x86_64-darwin-ld
~ $ ln -s /usr/bin/i686-apple-darwin10-ld ~/bin/i386-darwin-ld
~ $ ln -s /usr/bin/i686-apple-darwin10-as ~/bin/x86_64-darwin-as
~ $ ln -s /usr/bin/i686-apple-darwin10-as ~/bin/i386-darwin-asCross-compiler for darwin-i386
~/Development/fpc make distclean OS_TARGET=darwin CPU_TARGET=i386
~/Development/fpc $ make crossall crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=darwin CPU_TARGET=i386 \
INSTALL_PREFIX=~ BINUTILSPREFIX=i686-apple-darwin10- \
OPT="-gl -gw -godwarfsets -XX -CX -Xd -Fl/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib"Hello, world! (darwin-i386)
~/Development/Hello $ fpc -Tdarwin -Pi386 hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling hello.pas
Assembling (pipe) hello.s
Linking hello
5 lines compiled, 0.1 secCross-compiler for darwin-x86_64
~/Development/fpc $ make distclean OS_TARGET=darwin CPU_TARGET=x86_64
~/Development/fpc $ make crossall crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=darwin CPU_TARGET=x86_64 \
INSTALL_PREFIX=~ BINUTILSPREFIX=i686-apple-darwin10- \
OPT="-gl -gw -godwarfsets -XX -CX -Xd -Fl/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib"Hello, world! (darwin-x86_64)
~/Development/Hello $ fpc -Tdarwin -Px86_64 hello.pas
Free Pascal Compiler version 3.1.1 [2015/05/29] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling hello.pas
Assembling (pipe) hello.s
Linking hello
5 lines compiled, 0.1 secLazarus
Get latest Lazarus
~/Development $ svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarusBuild LCL
Build LCL for Windows native and GTK2, OSX Carbon (32-bit), OSX Cocoa (64-bit), Linux GTK2:~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=win32
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=gtk2
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=win64 CPU_TARGET=x86_64 \
LCL_PLATFORM=win32
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=win64 CPU_TARGET=x86_64 \
LCL_PLATFORM=gtk2
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=darwin CPU_TARGET=i386 \
LCL_PLATFORM=carbon
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=darwin CPU_TARGET=x86_64 \
LCL_PLATFORM=cocoa
~/Development/lazarus $ make distclean registration lazutils lcl OS_TARGET=linux CPU_TARGET=i386 LCL_PLATFORM=gtk2
~/Development/lazarus $ make distclean all OS_TARGET=linux CPU_TARGET=x86_64 LCL_PLATFORM=gtk2
~/Development/lazarus $ ./lazbuild --build-ide=The last two commands above will fully build LCL and the Lazarus IDE.Updating
I'm using the following script to update both fpc and Lazarus to the latest trunk and rebuild everything:#!/bin/bash
rm -rf ~/lib/fpc/3.1.1/~units
mv ~/lib/fpc/3.1.1/units ~/lib/fpc/3.1.1/~units
cd ~/Development/fpc
make distclean > /dev/null
cd ~/Development/lazarus
make distclean > /dev/null
cd ~/Development
svn info fpc
svn update fpc
svn info lazarus
svn update lazarus
cd ~/Development/fpc
echo "**** FreePascal Windows 32-bit begin ****"
make distclean OS_TARGET=win32 CPU_TARGET=i386 > /dev/null
make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=~
echo "**** FreePascal Windows 32-bit end ****"
echo
echo "**** FreePascal Windows 64-bit begin ****"
make distclean OS_TARGET=win64 CPU_TARGET=x86_64 > /dev/null
make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=~
echo "**** FreePascal Windows 64-bit end ****"
echo
echo "**** FreePascal MacOSX 32-bit begin ****"
make distclean OS_TARGET=darwin CPU_TARGET=i386 > /dev/null
make crossall crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=darwin CPU_TARGET=i386 INSTALL_PREFIX=~ \
BINUTILSPREFIX=i686-apple-darwin10- \
OPT="-gl -gw -godwarfsets -XX -CX -Xd -Fl/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib"
echo "**** FreePascal MacOSX 32-bit end ****"
echo
echo "**** FreePascal MacOSX 64-bit begin ****"
make distclean OS_TARGET=darwin CPU_TARGET=x86_64 > /dev/null
make crossall crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=darwin CPU_TARGET=x86_64 INSTALL_PREFIX=~ \
BINUTILSPREFIX=i686-apple-darwin10- \
OPT="-gl -gw -godwarfsets -XX -CX -Xd -Fl/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib"
echo "**** FreePascal MacOSX 64-bit end ****"
echo
echo "**** FreePascal Linux 32-bit begin ****"
make distclean OS_TARGET=linux CPU_TARGET=i386 > /dev/null
make all crossinstall FPC=/usr/bin/fpc NOGDB=1 OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~
echo "**** FreePascal Linux 32-bit end ****"
echo
echo "**** FreePascal Linux 64-bit begin ****"
make distclean OS_TARGET=linux CPU_TARGET=x86_64 > /dev/null
make all install FPC=/usr/bin/fpc OPT=-gl OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=~
echo "**** FreePascal Linux 64-bit end ****"
echo
cd ~/Development/lazarus
echo "**** LCL Windows 32-bit native begin ****"
make distclean registration lazutils lcl OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=win32
echo "**** LCL Windows 32-bit native end ****"
echo
echo "**** LCL Windows 32-bit GTK2 begin ****"
make distclean registration lazutils lcl OS_TARGET=win32 CPU_TARGET=i386 LCL_PLATFORM=gtk2
echo "**** LCL Windows 32-bit GTK2 end ****"
echo
echo "**** LCL Windows 64-bit native begin ****"
make distclean registration lazutils lcl OS_TARGET=win64 CPU_TARGET=x86_64 LCL_PLATFORM=win32
echo "**** LCL Windows 64-bit native end ****"
echo
echo "**** LCL Windows 64-bit GTK2 begin ****"
make distclean registration lazutils lcl OS_TARGET=win64 CPU_TARGET=x86_64 LCL_PLATFORM=gtk2
echo "**** LCL Windows 64-bit GTK2 end ****"
echo
echo "**** LCL MacOSX 32-bit Carbon begin ****"
make distclean registration lazutils lcl OS_TARGET=darwin CPU_TARGET=i386 LCL_PLATFORM=carbon
echo "**** LCL MacOSX 32-bit Carbon end ****"
echo
echo "**** LCL MacOSX 64-bit Cocoa begin ****"
make distclean registration lazutils lcl OS_TARGET=darwin CPU_TARGET=x86_64 LCL_PLATFORM=cocoa
echo "**** LCL MacOSX 64-bit Cocoa end ****"
echo
echo "**** LCL Linux 32-bit GTK2 begin ****"
make distclean registration lazutils lcl OS_TARGET=linux CPU_TARGET=i386 LCL_PLATFORM=gtk2
echo "**** LCL Linux 32-bit GTK2 end ****"
echo
echo "**** Lazarus Linux 64-bit GTK2 begin ****"
make distclean all OS_TARGET=linux CPU_TARGET=x86_64 LCL_PLATFORM=gtk2
./lazbuild --build-ide=
echo "**** Lazarus Linux 64-bit GTK2 end ****"
echo
cd ~/Development/fpc
USEZIP=0 USETAR=bz2 make zipsourceinstall
mv fpc.source.tar.bz2 ..
cd ~/
tar --create --bzip2 --recursion bin > ~/Development/bin.tar.bz2
tar --create --bzip2 --recursion lib > ~/Development/lib.tar.bz2
cd ~/Development/lazarus
tar --create --bzip2 --recursion lcl/units > ~/Development/lcl.tar.bz2
tar --create --bzip2 --recursion components/lazutils/lib > ~/Development/lazutils.tar.bz2
tar --create --bzip2 --recursion packager/units > ~/Development/packager.tar.bz2
cd ~/DevelopmentHello, world! (with UI)
Now you can use the Lazarus IDE to create and cross-compile your projects.
Subscribe to:
Posts (Atom)



















