I am trying to understand when and where the copyleft of GPL v2|v3 applies, similar to this OS question. The way I understand it, is that if a derivative work is created AND distributed, copyleft applies, eg. the code needs to have a GPL v2|v3 license as well.
But I am having trouble understanding the definition of derivative work and distribution.
Let's use a couple of examples:
1. Code in a GPL licensed scripting language without additional libraries
Let's say I create some code in R, which is a scripting language licensed under GPL v2 or v3 (see also Licenses), which solely uses R and no additional GPL-licensed library (R allows to install and use further libraries with separate licenses).
Note that the program would be called from the command line like this Rscript myfile.R
, where Rscript is the executable of R and myfile.R is the code in text form that I have written.
Would I have to use a copyleft license (GPL v2|v3) for the code that I have written because my code is derivative work of R? Or could I license it under closed source licenses, as it neither extends nor modifies R and is being called from the command line with my code as an argument?
Example
# code.R
my_calculation <- function(...) {
print("Hello World")
# ...
}
my_calculation(...)
2. Same as above but with an additional GPL dependency
Let's say that the code from above uses another package that also has a GPL v2|v3 license (for example the RestRserve library which is GPL >= v2 licensed). The package is not extended but used as intended, in this case to create and drive the functionality of a REST API.
Does including a GPL R library change the result of the first example?
Example
# code_with_dependencies.R
library(RestRserve)
app <- Application$new()
# ...
app$add_get(path = "/calc", FUN = my_calculation)
# ...
3. Same as 2. but with other packages that do not use GPL
Lets say I use 2. but do not use RestRserve (GPL) but plumber (same functionality in principal but MIT licensed) as my sole dependency. Would that mean that my code does not have to be copyleft licensed?
4. Distributing the code
Now I have a (hypothetical) customer "A" that wants to use my code but neither them nor me want to open source the code. When I send them only the code and instructions to download and install the R dependencies (such as via a Dockerfile, or a simple bash build script), can I license my code using a closed source license?
Example
# Dockerfile
FROM rhub/r-minimal
RUN installr RestRserve
COPY code_with_dependencies.R code_with_dependencies.R
CMD ["Rscript", "code_with_dependencies.R"]
I have looked at the GNU FAQ page but I couldn't find the right FAQs for these cases.
Any answer/links to further understand this are greatly appreciated!