The standard way to apply a license to a software is to put the full license text in a file called LICENSE or COPYING included with the source code and then put a short notice in a comment at the top of each source file (naming the copyright date, holder, license and saying where to find the full text of the license).
GPLv3 requires that if the program does terminal interaction, it also has to output a short notice like this when it starts in an interactive mode:
Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'show c' for details.
If the license you want to apply doesn't have specific instructions (e.g. zlib) OSI suggests to follow the Apache License / GPLv3 instructions.
According to Github a LICENSE file in the root of the repository is enough (see Where does the license live on my repository? and I already have a project with a license file, do I need to do anything?).
- Applying the Apache License, Version 2.0
To apply the ALv2 to a new software distribution, include one copy of the license text by copying the file:
into a file called LICENSE in the top directory of your distribution.
Each original source document (code and documentation, but excluding the LICENSE and NOTICE files) SHOULD include a short license header at the top.
- How to Apply GPL v3 Terms to Your New Programs
- I want to use the Mozilla Public License for software that I have written. What do I have to do?
To apply the Mozilla Public License to software that you have written, add the header from Exhibit A of the license to each source code file in your project. Sample headers for various commenting styles are available here. You may also add additional accurate notices of copyright ownership, such as the name of the copyright holder, but this is not necessary.
This answer is for reference purposes only and it is not intended as nor does it constitute legal advice. The author is not an attorney and makes absolutely no claim to have any knowledge about legal matters beyond that of an informed layman.