Recent

Author Topic: may I ship FPC with my app ?  (Read 1163 times)

dragos

  • Newbie
  • Posts: 1
may I ship FPC with my app ?
« on: November 02, 2022, 06:12:46 pm »
Dear Lazarus / FPC Community!
I am new to this community.
I appreciate Lazarus very much, and I must say that, as an old Delphi user, I like Lazarus GUI, the fact that it's cross - platform, its L&F, it's awesome (I use it on my Windows computer, on Linux Mint, also on my Raspberry Pi!). Pascal was my firstly - learnt programming language.
However, my question today would be a fairly simple one, related to the possibility to compile some (small) portions of user-defined Pascal code -> during the program operation. In other words, the application I'm creating (and shipping to the user) assumes, at some point, that the structure is dynamic, or variable (and, therefore, the user needs to define his/her piece of Pascal code, e.g. to define his/her function, or class).
I need to provide a means of compiling (some small piece of) Pascal source code at program runtime, namely the user-defined Pascal code.
As a most-probable use-case, this user code will not contain LCL components, but just "plain text", having a functionality/behavior that is unknown at design time. Now the question is: may I ship (redistribute) the FPC compiler with my application (app) ? What if it would allow the user to create a GUI item (dialog box) at runtime (thereby using the LCL library) ?
Of course, I can acknowledge the fact that I use Lazarus, FPC compiler, in the Help/About dialog box, in the readme.txt file, documentation etc.
May I use the Free Pascal Compiler, in this situation, as a redistributable object (e.g., in a subfolder), or I may not ? I am not very accustomed to reading licenses, but one important thing is that the enclosed application (.exe) would contain, potentially, some IP, therefore I would tend not to make it an open - source. However, as  I mentioned, I shall make clear that the application is built / created with Lazarus & FPC.
Therefore, in short, my questions would be:
- may I use the FPC compiler as redistributable only for text-like (console) app by the user ?
- may I use/ship the FPC as redistributable also for LCL-containing objects (e.g., an user-defined dialog box for his/her component) ?
- if I may not, then the only way that the app will ever work would be to ask the user to have the FPC installed on his/her computer, prior to using my app -> as a prerequisite. It would be rather complicated, in this case. What would be the limitation, in this case ?

Thank you for your support! Sorry for my long question(s)!
Dragos
P.S. I apologize if the topic is wrongly placed. I'm totally new to the forum.

Laksen

  • Hero Member
  • *****
  • Posts: 745
    • J-Software
Re: may I ship FPC with my app ?
« Reply #1 on: November 02, 2022, 06:45:44 pm »
What (IMO) it comes down to is the distribution clause of the GPL license. You can ship FPC and Lazarus with your program but that would mean your program would become GPL as well.

So in that case a user would legally be in their right to request the source code for the entire codebase that you distribute, and you would have to oblige them.

The only way to do it properly if you will not provide the source code is to use the third option that you list. Instruct the user in how to install it on their own and not ship anything under GPL license together with your program.

Another option that you could consider could be to use uPascalScript

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: may I ship FPC with my app ?
« Reply #2 on: November 02, 2022, 07:21:19 pm »
What (IMO) it comes down to is the distribution clause of the GPL license. You can ship FPC and Lazarus with your program but that would mean your program would become GPL as well.

I'm afraid I disagree.

If OP's program linked into modified FPC/PPC binaries, which are GPLed, then his program would become GPLed.

If OP's program invoked the FPC/PPC binaries, then it would be like any other nested program execution.

To expand on the second point slightly, if somebody had a proprietary IDE or make-like tool, and invoked the FPC wrapper or the actual PPC compiler from it, it would not force that tool or IDE to be GPLed. And as a specific example, at one time Borland used the FPC compiler for ARM code and I don't believe that anybody pounced on them insisting that they open-source the Delphi IDE.

If in doubt, simply tell the customers that they need to download the tools themselves, and provide copious documentation explaining how to do so.

I see no reason why the same principles should not extend to the Lazarus IDE: if it is merely invoked rather than modified and linked into a product, then the licenses remain distinct.

*HOWEVER*, it remains OP's responsibility to get suitable legal advice, since if he strays from the spirit of the licence agreement and thereby incurs the wrath of the core team he is likely to have to explain himself to his employers and backers.

And "can't be arsed to read and understand the license" is not, and has never been, a valid defence.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: may I ship FPC with my app ?
« Reply #3 on: November 02, 2022, 07:37:00 pm »
What (IMO) it comes down to is the distribution clause of the GPL license. You can ship FPC and Lazarus with your program but that would mean your program would become GPL as well.

I'm afraid I disagree.
I am afraid you are - very - wrong regarding GPL2. Laksen is correct. Not opinion but fact.
« Last Edit: November 02, 2022, 07:39:03 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: may I ship FPC with my app ?
« Reply #4 on: November 02, 2022, 07:46:06 pm »
I am afraid you are - very - wrong regarding GPL2. Laksen is correct. Not opinion but fact.

https://www.gnu.org/licenses/gpl-faq.html#GPLPlugins

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: may I ship FPC with my app ?
« Reply #5 on: November 02, 2022, 07:49:10 pm »
 ;) Only applies to GNU1...
Anyway you can distribute a program - that includes fpc itself- under some GNU license, provided you make sure that code changes are given back and provide that GNU licensed software is properly represented. Note GNU3 is even more restrictive, caused by miss-use.
« Last Edit: November 02, 2022, 07:56:55 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: may I ship FPC with my app ?
« Reply #6 on: November 02, 2022, 08:03:04 pm »
It says licenses- plural- and specifically mentions v2 and v3 where relevant. And I don't believe OP's proposing any form of modification, or even to recompile the binaries himself.

I've not gone looking for older versions of that commentary, but I believe that the stricture against piping data structures backwards and forwards has been added comparatively recently.

However the bottom line is that he needs to consult a lawyer in his own jurisdiction, preferably one competent in interaction with jurisdictions where GPL-related precedent has been established.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: may I ship FPC with my app ?
« Reply #7 on: November 02, 2022, 08:09:33 pm »
What is the difference between an “aggregate” and other kinds of “modified versions”?
https://www.gnu.org/licenses/gpl-faq.html#MereAggregation

If a modified FPC distribution is provided, then all the changes for that modification would need to be provided as well.

Ability to provide mere aggregate distributions have not somehow vanished with the advent of the GPLv3.

If that were the case, many Linux distributions that provided CD/DVD images would all of a sudden have been in violation when they started to provide GPLv3'ed packages.


Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: may I ship FPC with my app ?
« Reply #8 on: November 02, 2022, 08:14:41 pm »
It would seem that this https://wiki.freepascal.org/licensing should answer most of the questions here.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2069
  • Fifty shades of code.
    • Delphi & FreePascal
Re: may I ship FPC with my app ?
« Reply #9 on: November 02, 2022, 10:04:56 pm »
I would do it simple to not need to deal with license things....
Having a Button/Menu/Whatever that jumps to FPC WebPage for letting user download in his WebBrowser his required Version.
Inside your app you need a config with a TEdit and/or a Button with a TOpen(File)Dialog to let user point to the binary after he installed it outside of your app on his machine.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: may I ship FPC with my app ?
« Reply #10 on: November 02, 2022, 10:22:04 pm »
The GPL means that if you distribute a compiled version of FPC/Lazarus or of a derivative work (~modified version), you need to also make available their source code at a nominal fee (or provide a download link), and offer them under the conditions of the same GPL.

Shipping FPC and/or Lazarus together with another application, or having another application invoke the compiler, does not make this other application a part of FPC/Lazarus or a derivative work of FPC/Lazarus. Similar to how Linux distributions shipping gcc and compiling most of their software with gcc are not derivative works of gcc. Or similar to how Apple initially shipped GCC (back then a GPLv2 project) with its closed source Project Builder/Xcode IDEs. The kind of code your user compiles is also irrelevant, because the (L)GPL only applies when distributing something. Only if your user would distribute the resulting compiled exe, they (and not you) would be bound by the licensing conditions of the FPC RTL/packages and the Lazarus LCL (not of the compiler/ide, since they would not be distributing the compiler/ide, nor a derivative work thereof). And even then the FPC RTL and Lazarus LCL are explicitly under licenses that allow closed source distribution of derivative works (LGPL + static linking exception).

So in short: there is absolutely no problem with shipping FPC and Lazarus with your application, allowing users to invoke it from your application and linking the resulting object files, and keeping your application closed source.

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: may I ship FPC with my app ?
« Reply #11 on: November 02, 2022, 10:31:14 pm »
So in short: there is absolutely no problem with shipping FPC and Lazarus with your application, allowing users to invoke it from your application and linking the resulting object files, and keeping your application closed source.

Agreed. And from what I see here https://www.gnu.org/licenses/gpl-faq.html#MereAggregation and here https://wiki.freepascal.org/licensing that is the case.

And the above two pages cover the needed actions if the the included GPL packages have been modified.

Like I mentioned earlier, this is the norm for Linux distributions when the install media is DVD/CD-ROM images, and is not a network install.

So in this case, it is an application distribution, not an operating system distribution, but same licensing allowances and restrictions apply.
« Last Edit: November 02, 2022, 10:49:36 pm by Bogen85 »

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: may I ship FPC with my app ?
« Reply #12 on: November 04, 2022, 10:56:45 am »
If you want to let users write pascal code I suggest you to look at pascalscript components. They integrate in your app and you expose to the engine what you want user to work on, from inside your application.

pascalscript precompiles the user's pascal code into reusable PCode which is pretty fast and smart.

Integrating pascalscript in your app is easy. Interfacing and exposing classes, procedures, functions, is not so hard

Enjoy
« Last Edit: November 04, 2022, 11:02:48 am by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

Bogen85

  • Hero Member
  • *****
  • Posts: 595
Re: may I ship FPC with my app ?
« Reply #13 on: November 04, 2022, 12:15:19 pm »
Therefore, in short, my questions would be:
- may I use the FPC compiler as redistributable only for text-like (console) app by the user ?
- may I use/ship the FPC as redistributable also for LCL-containing objects (e.g., an user-defined dialog box for his/her component) ?
- if I may not, then the only way that the app will ever work would be to ask the user to have the FPC installed on his/her computer, prior to using my app -> as a prerequisite. It would be rather complicated, in this case. What would be the limitation, in this case ?

Not sure why so many are trying to over-complicate what dragos is asking. And dragos can correct me if I'm wrong.

The first two points just seem to be about apps written with FPC. Does not appear to be any licensing conflicts there.

But the final point seems to say it all, FPC needs to be installed on the user's computer, which would appear to satisfy the first two requirements.

And if dragos is asking if FPC could be bundled with another application, which if how that is being done falls under mere-aggregation as I already pointed out, is not an issue.

And the subject also seems to make it clear: "May I ship FPC with my app?"

The answer is yes, and Jonas Maebe indicated that as well.

Dragos, can you explain how you intend to bundle FPC with your application?
This might alleviate some of the concerns others are having.
« Last Edit: November 04, 2022, 12:54:49 pm by Bogen85 »

 

TinyPortal © 2005-2018