DelphiDabbler Wiki



CodeSnip Compiling & Source Code FAQ

This FAQ is about compiling and using the source code of the DelphiDabbler CodeSnip Code Snippets Repository Application. If your question was about using CodeSnip itself please see the Using CodeSnip FAQ instead.

If you can't find an answer to your question below you can post a question on the CodeSnip discussion group.

Contents


1: Where can I get the CodeSnip source code?

The best place is the CodeSnip GitHub repository on GitHub.

CodeSnip 4 is now developed using the Git Flow methodology. The latest release of CodeSnip is available from the master branch. Development takes place on branches off develop. Tags in the form version-x.x.x are used to denote each release, where x.x.x is the version number of the release.

At present GitFlow is not used for CodeSnip 5. This is presently developed in the pagoda branch. An earlier attempt at CodeSnip 5 used the parsnip branch, but this now been removed from Git.


2: Which compiler is needed to compile CodeSnip?

CodeSnip is written in Delphi Object Pascal. The current code base is compiled using Delphi XE. Later Delphi compilers may be suitable, but this has not been tested.

Some other utilities are also needed. See the "Build Tools" section of Build.html1 for details.

1 the linked file relates to the current release. Versions for other releases etc. may vary. Look at the file Build.html for the release you are interested in.


3: Is CodeSnip open source?

CodeSnip's original code is open source. The license used for most of the source code changed from v3 to v4.

In both cases third party code uses a variety of open source licenses. Any third party libraries are also open source.

The only exception is the code linked in from the Delphi RTL and VCL libraries. Given that you need Delphi to compile CodeSnip, that's not really an issue providing you don't distribute the Delphi library source code.

1 This license file relates to the current release. Versions for other releases etc. may vary slightly. Look at the file License.html for the release you are interested in.


4: How do I build CodeSnip from source?

This is all covered in detail in the file Build.html1 that can be found in the "root" of each source code release.

1 the linked file relates to the current release. Versions for other releases etc. may vary. Look at the file Build.html for the release you are interested in..
2 v3.0.x releases do not have a Build.html file. Look instead for Docs/ReadMe-Src.txt.


5: Do you have a version of the source code that compiles with Delphi versions earlier than Delphi XE?

No, sorry.

The code base might, with a few changes, compile with Delphi 2009/2010, but that is not guaranteed. But, since the code now assumes that string = UnicodeString it definitely can't be compiled with anything before Delphi 2009.


6: Will you publish the PHP source code for the web services that CodeSnip accesses?

Sorry but no. CodeSnip is open source but the scripts that drive my website are not. To publish all the relevant code would be a security risk.

However, for each web service CodeSnip uses, there's a separate unit in the source code. In those units you'll find documentation about how to access the web services.


7: I want to use some of the CodeSnip source code in my project, what are the rules?

The following assumes that the code is covered by the Mozilla Public License (MPL) v1.1 or v2.0.

This answer is not authoritative - please refer to the relevant license text for that. This is just a brief overview for which I make no warranty of accuracy. If this answer conflicts with the licenses then the relevant license takes precedence.

If your project is for private use (i.e. you will not be distributing the project) then you can use the code as you wish.

If you do intend to distribute your project, then the following rules apply to the original CodeSnip code.

  1. If you just use one or more source files unchanged you must not change the MPL license statement in the file's header comments. You must also advertise1 that your product uses some MPLd code and provide a means by which users can obtain the source code2.
  2. If you modify one or more source files then leave the header comment relating to the license unchanged. You must then advertise1 the use of MPLd code and provide a means to obtain the modified source files3.
  3. If you copy and paste some code from one of the MPLd source files into one of you own source files then that file must also adopt the MPL. You must add a suitable4 MPL license block to the source file. As you will now expect you must advertise1 that the product contains MPLd code and provide a means to obtain the relevant files3.

Using MPLd code from CodeSnip does not mean you have to make your other source files available. But there's no way out of complying with these requirements for MPLd code.

If you want to use any MPLd code in a GPL or LGPL project please read FAQ 10.

Footnotes:

1 "Advertise" means you must mention that your product uses MPLd code in some suitable place in your documentation, help files, about box etc. The documentation must also tell users how to obtain the source code. If you are using any MPL v1.1 files you must also acknowledge the names of their original developers.

2 In the case of unchanged source files you may link to the CodeSnip Git repository on GitHub, providing that you specify the names, paths and commit ids of the files you are using. Alternatively provide your own means of obtaining the files3.

3 Make your own arrangements for making the MPLd source code available to users of your project. You could upload the files to some web space and provide a URL in your documentation or distribute the source files with your product.

4 "Suitable" here means that the version of the license you use should be the same as that covering the source file that the code was copied from. So what about the case of copying code from files covered by different versions of the license? Just don't do it!

If you're in doubt about anything, or want help linking to CodeSnip's Subversion repo, post a message in CodeSnip's discussion group on SourceForge.


8: How do I contribute code / bug fixes to the project?

Contributions are welcome. Just fork the project's Git repository and create a feature branch off the develop branch. Commit your changes to your feature branch then submit a pull request when ready.1

If you are contributing to CodeSnip 5 development please create your feature branch off the pagoda branch instead.

Do not change the license on any code you modify. If you are submitting new source code units please license them using the Mozilla Public License v2.0 without an "Incompatible With Secondary Licenses" Notice. If you don't want to use the MPL v2.0 please discuss it with me first.

1 For info on checking out code from the Git repository, see FAQ 1.


9: How do I use TortoiseSVN to check out the CodeSnip source code?

You can't anymore. CodeSnip source has been moved to a Git repository on GitHub.


10: Can I use CodeSnip source code in my GPL or LGPL licensed project?

This answer covers files using the Mozilla Public License (MPL) v1.1 or v2.0. For other licenses, please read the license concerned and check out what the Free Software Foundation has to say about it.

This answer is not authoritative - please refer to the relevant license text for that. This is just a brief overview for which I make no warranty of accuracy. If this answer conflicts with the licenses then the relevant license takes precedence.

Whether the source code can be used in GPL / LGPL projects depends on the version of the MPL used by the source code files in question. Each file contains a header comment that identifies the license.

MPL v2.0

If the source file is covered by the MPL v2.0 then it can usually be used in your project since the MPL v2.0 is compatible with the GPL and LGPL.

There is an exception though. MPL v2.0 files may carry an "Incompatible With Secondary Licenses" notice which reads:

This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.

If this statement is present the file becomes incompatible with the GPL / LGPL.

If you include MPL 2.0 code in your project you must distribute a full copy of the license with it: see http://www.mozilla.org/MPL/2.0/.

MPL v1.1

The MPL v1.1 and the GPL / LGPL are not considered to be compatible. Therefore you can't use MPL v1.1 code in your project.

There is an exception in the case of source code covered by the MPL / GPL / LGPL tri-license which is GPL / LGPL compatible.

Page last modified on February 21, 2016, at 12:30 AM