So today I finished a couple hundreds of lines of code that allow me to do all the nifty album cover and iTunes trickery that you can see in my sidebar and over at itunes.php. I want to release them to the world so that other bloggers using Kung-Tunes can do what they will with Amazon's vast stores of info. But I can't find a license that I like!

Let's start with the GNU GPL or GNU General Public License. From what I understand, this prevents anyone from linking to my code without having to open up their code as well. For this particular project, free software zealot that I may be, that doesn't seem appropriate. I'd like bloggers to be able to fiddle with it without being forced to release all their machinations and templates and whatnot.

Then there's the GNU LGPL, or GNU Lesser General Public License (previously known as the GNU Library General Public License). This is closer to what I want, in that one can link to my libraries without having to release one's own code, but any modifications directly to my code (bug fixes, etc.) do have to be released under the LGPL. The only problem is that anyone can link to it for any purposes, including commercial ones. Under the LGPL, some fool can slap on a frontend and start making tons of cash off my code! I don't want that!

So moving on to the Creative Commons Public License schemes. These guys offer some flexibility in terms of attribution, commercial use, and shareability. The problem is that the shareability distinction is not subtle enough. Under the Attribution-NonCommercial license, your code can be modified and publicly used by anyone, and those modifications are lost to you. So if someone else fixes some bugs or markedly improves my code, the license permits him or her to keep the changes to the source code private, while still using his or her new code on a public site. On the other hand, under the Attribution-NonCommercial-ShareAlike 1.0 license, anyone who uses my code to create "Derivative Works" is obliged, as with the GPL, to open up those Derivative Works through the same licensing scheme.

This is where the problem comes in - the term "Derivative Works." These Creative Commons licenses define a "Derivative Work" thus:

"a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted."

How does this work in terms of code? If File B has a line in it that says include ('File A');, is B then a derivative work of A? Or does the content of A actually have to be placed directly into B?

Common wisdom about the GPL seems to imply that if File B links to Library A and Library A is GPL'd, File B must also be GPL'd, even if these are just executables linking to one another. This is basically why the LGPL was created. It stands to reason then that when code is being literally inserted from one file into another, whether by the PHP interpreter or by human hands, that this would still apply - that File B would be thought of as derivative. Therefore, neither license is acceptable - either I lose out on changes to the source code, or other lose out on using it.

So what is a boy to do? Where do I find a license that will allow me to prevent commercial use and force published modifications to my actual code to be released, while allowing people to link to it without having to release the rest of their code? I know it's not very much code right now, but these criteria seem pretty important to me, and I'll probably want to use them again and again.

And PLEASE don't say I have to write my own license. Cause I just can't deal with all that legal crap....

[Update 1:07 AM: I've been doing some more reading about Java and the LGPL , and I'm beginning to think that, at least in terms of PHP, the license I'm looking for does not exist. It seems to be that if the code is included, as it is in PHP, rather than linked as it might be with compiled code, clause 5 of the LGPL, which is what lends it its special power, does not apply, and clause 6, which makes it basically like the GPL, takes precedence. My guess would be that all existing licenses will take this stance, as anyone using my code is essentially incorporating it into their application, rather than linking to it externally. I will probably have to compromise, but in which direction?]