diff options
author | Kissaki <kissaki@gmx.de> | 2013-07-14 15:23:25 +0400 |
---|---|---|
committer | Kissaki <kissaki@gmx.de> | 2013-07-14 15:23:25 +0400 |
commit | 8021c66170ee4a9f27140b904f01b92d5d368824 (patch) | |
tree | 8e14161b3326687936aa23c70587689e7b74d1d1 /scripts/mklic.pl | |
parent | 82fa0e60e7b3b3ca45110db68d3d7e7449ae241d (diff) |
Refac mklic.pl. Generate new licenses.h file.
* Adjust the mklic.pl so it generates and uses the newly introduced ThirdPartyLicense struct
* Misc improvements (newline cleanups, varnaming)
* Generate new licenses.h file via mklic.pl
Diffstat (limited to 'scripts/mklic.pl')
-rwxr-xr-x | scripts/mklic.pl | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/scripts/mklic.pl b/scripts/mklic.pl index 0f047f091..c61cbcabb 100755 --- a/scripts/mklic.pl +++ b/scripts/mklic.pl @@ -18,7 +18,7 @@ sub licenseFileToVar($$) { $l = join("\\n\"\n\t\"",split(/\n/, $l)); - return qq!static const char *${var} = \n\t\"! . $l . "\";\n\n\n"; + return qq!static const char *${var} = \n\t\"! . $l . "\";\n"; } sub printGuarded($$$) { @@ -45,9 +45,23 @@ print $F " */\n"; print $F "#ifndef MUMBLE_MUMBLE_LICENSES_H_\n"; print $F "#define MUMBLE_MUMBLE_LICENSES_H_\n"; print $F "\n"; -print $F "#include <QtGlobal>\n\n"; +print $F "#include <QtGlobal>\n"; +print $F "\n"; +print $F "struct ThirdPartyLicense {\n"; +print $F " const char* name;\n"; +print $F " const char* url;\n"; +print $F " const char* license;\n"; +print $F "\n"; +print $F " ThirdPartyLicense() : name(0), url(0), license(0) {}\n"; +print $F " ThirdPartyLicense(const char* name, const char* url, const char* license)\n"; +print $F " : name(name), url(url), license(license) {}\n"; +print $F " bool isEmpty() const { return (name == 0 && url == 0 && license == 0); }\n"; +print $F "};\n"; +print $F "\n"; + print $F licenseFileToVar("licenseMumble", "../LICENSE"); +print $F "\n\n"; # List of 3rd party licenses [<variableName>, <pathToLicenseFile>, <DisplayName>, <URL>] my @thirdPartyLicenses = ( @@ -61,42 +75,26 @@ my @thirdPartyLicenses = ( ["licenseFLAC", "../3rdPartyLicenses/libflac_license.txt", "libFLAC", "http://flac.sourceforge.net/"], ["licenseMachOverride", "../3rdPartyLicenses/mach_override_license.txt", "mach_override", "https://github.com/rentzsch/mach_star", "Q_OS_MAC"], ["licenseQtTranslations", "../src/mumble/qttranslations/LICENSE", - "Additional Qt translations", "https://www.virtualbox.org/ticket/2018", "USING_BUNDLED_QT_TRANSLATIONS"], + "Additional Qt translations", "https://www.virtualbox.org/ticket/2018", "USING_BUNDLED_QT_TRANSLATIONS"], ["licenseFilterSvg", "../icons/Filter.txt", "Filter.svg icon", "https://commons.wikimedia.org/wiki/File:Filter.svg"], - ); +); # Print 3rd party licenses foreach (@thirdPartyLicenses) { printGuarded($F, licenseFileToVar(@$_[0], @$_[1]), @$_[4]); + print $F "\n\n"; } -# Print list of 3rd party license references -print $F "static const char *licenses3rdParty[] = {\n"; -foreach (@thirdPartyLicenses) { - printGuarded($F, "\t" . @$_[0] . ", \n", @$_[4]); -} -print $F "\t0\n"; -print $F "};\n\n\n"; - -# Print list of 3rd party names -print $F "static const char *licenses3rdPartyNames[] = {\n"; +# Print list of 3rd party licenses +print $F "static const ThirdPartyLicense licenses3rdParties[] = {\n"; foreach (@thirdPartyLicenses) { - printGuarded($F, "\t\"" . @$_[2] . "\",\n", @$_[4]); + printGuarded($F, "\tThirdPartyLicense(\"" . @$_[2] . "\", \"" . @$_[3] . "\", " . @$_[0] . "),\n", @$_[4]); } - -print $F "\t0\n"; +# Empty entry that marks the end of the array +printGuarded($F, "\tThirdPartyLicense(),\n", @$_[4]); print $F "};\n\n\n"; -# Print list of 3rd party urls -print $F "static const char *licenses3rdPartyURLs[] = {\n"; -foreach (@thirdPartyLicenses) { - printGuarded($F, "\t\"" . @$_[3] . "\",\n", @$_[4]); -} - -print $F "\t0\n"; -print $F "};\n"; -print $F "\n"; print $F "#endif\n"; close($F); |