l...@gnu.org (Ludovic Courtès) writes: > Mark H Weaver <m...@netris.org> skribis: > >> Ricardo Wurmus <ricardo.wur...@mdc-berlin.de> writes: > > [...] > >>> There are functions in src/shogun/kernel/Kernel.{cpp,h} that are also >>> released under non-free terms, but they are enclosed in #ifdef >>> statements and the make flags we pass disable these functions at build >>> time. >> >> This is not sufficient. We will need to completely remove the non-free >> functions from the source code using a snippet. We cannot use a patch >> because the patch would contain the non-free code. > > Indeed (I thought Kernel.{cpp,h} were the files being removed.) > > I guess there are two ways to address this: have a snippet that reads > these two files line by line (with ‘read-line’ from (ice-9 rdelim)) and > dismisses files within the #ifdef. > > If that turns out to be impractical, for instance because there are > nested #ifdefs or computed conditionals, then we’ll have to host a > cleaned up source tarball or repo somewhere.
There's another option that might be better: instead of reading the file line-by-line, read the entire file into a single string, and then use regexps to find the relevant section and remove it. It might even be possible to do it with a single regexp substitution. Mark