While libstdc++ (and GCC) is licensed under GPLv3 + GCC Runtime Library Exception, and glibc is under LGPLv2.1, the header files (see, for example,
<vector> for libstdc++-v3) contain additional licenses - for example from Hewlett Packard and SGI and some others.
I need to distribute binaries (compiled for linux; and some object files) dynamically linked with libstdc++ and glibc. I'm not distributing copies of libstdc++ and glibc. Since the code is in C++ and header files contain a lot of templates (and because C's macros exist), I've chose to also add those additional licenses to the mix (in case the templated/macro code is covered by them and inlines).
So, to comply with the terms of the licenses, I've "grepped" all copyright notices from preprocessor output (gcc -C -E) and after a few scripts and a lot of manual checking I ended up with a file like this:
Third party copyright notices and licenses: <Library name: libstdc++, GCC (build-ins and etc.), glibc> (notice the difference in spelling and years) Copyright (c) 1000-1100 Company name Copyright (c) 1000-1100 Company name, Inc Copyright (c) 1000 - 1100 Company name, Inc Copyright (C) 1001-1102 Company name, Inc Copyright (C) 1208 Company name, Inc. Copyright (C) 1208 Company name, Inc. <firstname.lastname@example.org> Copyright (C) 1208, 1209-1300 Company name, Inc. Copyright (c) 1208, 1209, 1300 Company name Inc. This library is available under the license GPLv3 with GCC Runtime Exception (see below). In addition, some code is available under different licenses: Copyright (c) Invividual Copyright (c) Invividual <email@example.com> Copyright (C) Invividual Full Name <firstname.lastname@example.org> <Text of the license> (repeated several times for different libraries, licenses and notices) <GPLv3 license text> <GCC Runtime Exception license text> <LGPLv2 license text> <other named licenses>
Keep in mind that some licenses demand to put them in documentation separatedly, so I couldn't just grab the source code and distribute them with my binary.
The process was rather cubersome and unintuitive, as I couldn't find any lists of "add those copyright notices and licenses for this release of GCC/libstdc++/glibc and you are good to go" in the manual or on the internet and had to write regular expressions and scripts myself. I'm still not sure if I've included everything, since I haven't checked the respective non-header source code (I assume that dynamic linking makes my life easier in this regard) and checked only the included files - not to mention that some copyright notices, theoretically, might have had a weird format. Come to think of it, I'm not sure if GCC's built-ins are linked statically (which means that I have to check libgcc's sources) or are separated in libgcc dynamic library.
The binary distribution is a very common task, but to manually re-check every included standard header every time before release doesn't seem right. There has to be a better way and I'm not sure that my process is even correct.
Homework: by googling I've found ScanCode toolkit, which seems to automate the process for arbitrary third-party libraries. As for the license notice format, I'm staring at the "Open Source Software Notice" by Huawei (PDF of several megabytes, no link), which has the similar format of "Software name -> Copyright notices -> License". Mozilla Firefox's "about" section also demonstrates something similar. It's just the lack of specific instructions on automating this common process for standard libraries makes me concerned.
Surely there has to be an automated tool (that can come with the compiler itself) for such a common task as compiling all used in the binary standard library's licenses? How do open-source projects that distribute binaries do this? I'm not experienced in open source - do they just use tools like ScanCode and simply don't talk about it, as it actually something obvious?